OpenCores
URL https://opencores.org/ocsvn/sqmusic/sqmusic/trunk

Subversion Repositories sqmusic

[/] [sqmusic/] [trunk/] [mame/] [okim6295.h] - Blame information for rev 10

Go to most recent revision | Details | Compare with Previous | View Log

Line No. Rev Author Line
1 8 gryzor
/***************************************************************************
2
 
3
    okim6295.h
4
 
5
    OKIM 6295 ADCPM sound chip.
6
 
7
***************************************************************************/
8
 
9
#pragma once
10
 
11
#ifndef __OKIM6295_H__
12
#define __OKIM6295_H__
13
 
14
#include "sound/okiadpcm.h"
15
 
16
 
17
 
18
//**************************************************************************
19
//  CONSTANTS
20
//**************************************************************************
21
 
22
enum
23
{
24
        OKIM6295_PIN7_LOW = 0,
25
        OKIM6295_PIN7_HIGH = 1
26
};
27
 
28
 
29
 
30
//**************************************************************************
31
//  INTERFACE CONFIGURATION MACROS
32
//**************************************************************************
33
 
34
#define MCFG_OKIM6295_ADD(_tag, _clock, _pin7) \
35
        MCFG_DEVICE_ADD(_tag, OKIM6295, _clock) \
36
        MCFG_OKIM6295_PIN7(_pin7)
37
 
38
#define MCFG_OKIM6295_REPLACE(_tag, _clock, _pin7) \
39
        MCFG_DEVICE_REPLACE(_tag, OKIM6295, _clock) \
40
        MCFG_OKIM6295_PIN7(_pin7)
41
 
42
#define MCFG_OKIM6295_PIN7(_pin7) \
43
        okim6295_device::static_set_pin7(*device, _pin7); \
44
 
45
 
46
 
47
//**************************************************************************
48
//  TYPE DEFINITIONS
49
//**************************************************************************
50
 
51
 
52
// ======================> okim6295_device
53
 
54
class okim6295_device : public device_t,
55
                                                public device_sound_interface,
56
                                                public device_memory_interface
57
{
58
public:
59
        // construction/destruction
60
        okim6295_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock);
61
 
62
        // inline configuration helpers
63
        static void static_set_pin7(device_t &device, int pin7);
64
 
65
        // runtime configuration
66
        void set_bank_base(offs_t base, bool bDontUpdateStream = false);
67
        void set_pin7(int pin7);
68
 
69
        UINT8 read_status();
70
        void write_command(UINT8 command);
71
 
72
        DECLARE_READ8_MEMBER( read );
73
        DECLARE_WRITE8_MEMBER( write );
74
 
75
protected:
76
        // device-level overrides
77
        virtual void device_start();
78
        virtual void device_reset();
79
        virtual void device_post_load();
80
        virtual void device_clock_changed();
81
 
82
        // device_memory_interface overrides
83
        virtual const address_space_config *memory_space_config(address_spacenum spacenum = AS_0) const;
84
 
85
        // device_sound_interface overrides
86
        virtual void sound_stream_update(sound_stream &stream, stream_sample_t **inputs, stream_sample_t **outputs, int samples);
87
 
88
        // a single voice
89
        class okim_voice
90
        {
91
        public:
92
                okim_voice();
93
                void generate_adpcm(direct_read_data &direct, stream_sample_t *buffer, int samples);
94
 
95
                oki_adpcm_state m_adpcm;        // current ADPCM state
96
                bool            m_playing;
97
                offs_t          m_base_offset;  // pointer to the base memory location
98
                UINT32          m_sample;       // current sample number
99
                UINT32          m_count;        // total samples to play
100
                INT8            m_volume;       // output volume
101
        };
102
 
103
        // configuration state
104
        const address_space_config  m_space_config;
105
 
106
        // internal state
107
        static const int OKIM6295_VOICES = 4;
108
 
109
        okim_voice          m_voice[OKIM6295_VOICES];
110
        INT32               m_command;
111
        bool                m_bank_installed;
112
        offs_t              m_bank_offs;
113
        sound_stream *      m_stream;
114
        UINT8               m_pin7_state;
115
        direct_read_data *  m_direct;
116
 
117
        static const UINT8 s_volume_table[16];
118
};
119
 
120
 
121
// device type definition
122
extern const device_type OKIM6295;
123
 
124
 
125
#endif /* __OKIM6295_H__ */

powered by: WebSVN 2.1.0

© copyright 1999-2024 OpenCores.org, equivalent to Oliscience, all rights reserved. OpenCores®, registered trademark.