~ubuntu-branches/ubuntu/precise/mame/precise-proposed

« back to all changes in this revision

Viewing changes to src/emu/sound/es5503.c

  • Committer: Package Import Robot
  • Author(s): Cesare Falco
  • Date: 2011-11-30 18:50:10 UTC
  • mfrom: (1.1.4)
  • Revision ID: package-import@ubuntu.com-20111130185010-02hcxybht1mn082w
Tags: 0.144-0ubuntu1
* New upstream release (LP: #913550)
* mame.install:
  - Added artwork/ images to be used with -effect switch
  - Be more selective with hash/ contents
* contrib/mame.ini: added /usr/share/games/mame/artwork/ to artpath

Show diffs side-by-side

added added

removed removed

Lines of Context:
31
31
  0.4 (RB) - major fixes to IRQ semantics and end-of-sample handling.
32
32
  0.5 (RB) - more flexible wave memory hookup (incl. banking) and save state support.
33
33
  1.0 (RB) - properly respects the input clock
 
34
  2.0 (RB) - C++ conversion, more accurate oscillator IRQ timing
34
35
*/
35
36
 
36
37
#include "emu.h"
37
38
#include "es5503.h"
38
39
 
39
 
typedef struct
40
 
{
41
 
        void *chip;
42
 
 
43
 
        UINT16 freq;
44
 
        UINT16 wtsize;
45
 
        UINT8  control;
46
 
        UINT8  vol;
47
 
        UINT8  data;
48
 
        UINT32 wavetblpointer;
49
 
        UINT8  wavetblsize;
50
 
        UINT8  resolution;
51
 
 
52
 
        UINT32 accumulator;
53
 
        UINT8  irqpend;
54
 
        emu_timer *timer;
55
 
} ES5503Osc;
56
 
 
57
 
typedef struct
58
 
{
59
 
        ES5503Osc oscillators[32];
60
 
 
61
 
        UINT8 *docram;
62
 
 
63
 
        sound_stream * stream;
64
 
 
65
 
        void (*irq_callback)(device_t *, int);  // IRQ callback
66
 
 
67
 
        read8_device_func adc_read;             // callback for the 5503's built-in analog to digital converter
68
 
 
69
 
        INT8  oscsenabled;              // # of oscillators enabled
70
 
 
71
 
        int   rege0;                    // contents of register 0xe0
72
 
 
73
 
        UINT32 clock;
74
 
        UINT32 output_rate;
75
 
        device_t *device;
76
 
} ES5503Chip;
77
 
 
78
 
INLINE ES5503Chip *get_safe_token(device_t *device)
79
 
{
80
 
        assert(device != NULL);
81
 
        assert(device->type() == ES5503);
82
 
        return (ES5503Chip *)downcast<legacy_device_base *>(device)->token();
83
 
}
84
 
 
 
40
// device type definition
 
41
const device_type ES5503 = &device_creator<es5503_device>;
 
42
 
 
43
// useful constants
85
44
static const UINT16 wavesizes[8] = { 256, 512, 1024, 2048, 4096, 8192, 16384, 32768 };
86
45
static const UINT32 wavemasks[8] = { 0x1ff00, 0x1fe00, 0x1fc00, 0x1f800, 0x1f000, 0x1e000, 0x1c000, 0x18000 };
87
46
static const UINT32 accmasks[8]  = { 0xff, 0x1ff, 0x3ff, 0x7ff, 0xfff, 0x1fff, 0x3fff, 0x7fff };
88
47
static const int    resshifts[8] = { 9, 10, 11, 12, 13, 14, 15, 16 };
89
48
 
90
 
enum
91
 
{
92
 
        MODE_FREE = 0,
93
 
        MODE_ONESHOT = 1,
94
 
        MODE_SYNCAM = 2,
95
 
        MODE_SWAP = 3
96
 
};
 
49
// default address map
 
50
static ADDRESS_MAP_START( es5503, AS_0, 8 )
 
51
        AM_RANGE(0x000000, 0x1ffff) AM_ROM
 
52
ADDRESS_MAP_END
 
53
 
 
54
//**************************************************************************
 
55
//  LIVE DEVICE
 
56
//**************************************************************************
 
57
 
 
58
//-------------------------------------------------
 
59
//  es5503_device - constructor
 
60
//-------------------------------------------------
 
61
 
 
62
es5503_device::es5503_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock)
 
63
        : device_t(mconfig, ES5503, "Ensoniq ES5503", tag, owner, clock),
 
64
          device_sound_interface(mconfig, *this),
 
65
          device_memory_interface(mconfig, *this),
 
66
          m_space_config("es5503_samples", ENDIANNESS_LITTLE, 8, 17, 0, NULL, *ADDRESS_MAP_NAME(es5503)),
 
67
          m_irq_func(NULL),
 
68
          m_adc_func(NULL)
 
69
{
 
70
}
 
71
 
 
72
//-------------------------------------------------
 
73
//  memory_space_config - return a description of
 
74
//  any address spaces owned by this device
 
75
//-------------------------------------------------
 
76
 
 
77
const address_space_config *es5503_device::memory_space_config(address_spacenum spacenum) const
 
78
{
 
79
        return (spacenum == 0) ? &m_space_config : NULL;
 
80
}
 
81
 
 
82
//-------------------------------------------------
 
83
//  static_set_type - configuration helper to set
 
84
//  the IRQ callback
 
85
//-------------------------------------------------
 
86
 
 
87
void es5503_device::static_set_irqf(device_t &device, void (*irqf)(device_t *device, int state))
 
88
{
 
89
        es5503_device &es5503 = downcast<es5503_device &>(device);
 
90
        es5503.m_irq_func = irqf;
 
91
}
 
92
 
 
93
void es5503_device::static_set_adcf(device_t &device, UINT8 (*adcf)(device_t *device))
 
94
{
 
95
        es5503_device &es5503 = downcast<es5503_device &>(device);
 
96
        es5503.m_adc_func = adcf;
 
97
}
 
98
 
 
99
//-------------------------------------------------
 
100
//  device_timer - called when our device timer expires
 
101
//-------------------------------------------------
 
102
 
 
103
void es5503_device::device_timer(emu_timer &timer, device_timer_id tid, int param, void *ptr)
 
104
{
 
105
        m_stream->update();
 
106
}
97
107
 
98
108
// halt_osc: handle halting an oscillator
99
109
// chip = chip ptr
100
110
// onum = oscillator #
101
111
// type = 1 for 0 found in sample data, 0 for hit end of table size
102
 
static void es5503_halt_osc(ES5503Chip *chip, int onum, int type, UINT32 *accumulator)
 
112
void es5503_device::halt_osc(int onum, int type, UINT32 *accumulator)
103
113
{
104
 
        ES5503Osc *pOsc = &chip->oscillators[onum];
105
 
        ES5503Osc *pPartner = &chip->oscillators[onum^1];
 
114
        ES5503Osc *pOsc = &oscillators[onum];
 
115
        ES5503Osc *pPartner = &oscillators[onum^1];
106
116
        int mode = (pOsc->control>>1) & 3;
107
117
 
108
118
        // if 0 found in sample data or mode is not free-run, halt this oscillator
128
138
        {
129
139
                pOsc->irqpend = 1;
130
140
 
131
 
                if (chip->irq_callback)
 
141
                if (m_irq_func)
132
142
                {
133
 
                        chip->irq_callback(chip->device, 1);
 
143
                        m_irq_func(this, 1);
134
144
                }
135
145
        }
136
146
}
137
147
 
138
 
static TIMER_CALLBACK( es5503_timer_cb )
139
 
{
140
 
        ES5503Osc *osc = (ES5503Osc *)ptr;
141
 
        ES5503Chip *chip = (ES5503Chip *)osc->chip;
142
 
 
143
 
        chip->stream->update();
144
 
}
145
 
 
146
 
static STREAM_UPDATE( es5503_pcm_update )
147
 
{
148
 
        INT32 mix[48000*2];
 
148
void es5503_device::sound_stream_update(sound_stream &stream, stream_sample_t **inputs, stream_sample_t **outputs, int samples)
 
149
{
 
150
        static INT32 mix[(44100/60)*4];
149
151
        INT32 *mixp;
150
152
        int osc, snum, i;
151
153
        UINT32 ramptr;
152
 
        ES5503Chip *chip = (ES5503Chip *)param;
153
154
 
 
155
        assert(samples < (44100/60)*2);
154
156
        memset(mix, 0, sizeof(mix));
155
157
 
156
 
        for (osc = 0; osc < (chip->oscsenabled+1); osc++)
 
158
        for (osc = 0; osc < (oscsenabled+1); osc++)
157
159
        {
158
 
                ES5503Osc *pOsc = &chip->oscillators[osc];
 
160
                ES5503Osc *pOsc = &oscillators[osc];
159
161
 
160
162
                mixp = &mix[0];
161
163
 
178
180
 
179
181
                                acc += freq;
180
182
 
181
 
                                data = (INT32)chip->docram[ramptr + wtptr] ^ 0x80;
 
183
                                // channel strobe is always valid when reading; this allows potentially banking per voice
 
184
                                m_channel_strobe = (ctrl>>4) & 0xf;
 
185
                                data = (INT32)m_direct->read_raw_byte(ramptr + wtptr) ^ 0x80;
182
186
 
183
 
                                if (chip->docram[ramptr + wtptr] == 0x00)
 
187
                                if (m_direct->read_raw_byte(ramptr + wtptr) == 0x00)
184
188
                                {
185
 
                                        es5503_halt_osc(chip, osc, 1, &acc);
 
189
                                        halt_osc(osc, 1, &acc);
186
190
                                }
187
191
                                else
188
192
                                {
199
203
 
200
204
                                        if (altram >= wtsize)
201
205
                                        {
202
 
                                                es5503_halt_osc(chip, osc, 0, &acc);
 
206
                                                halt_osc(osc, 0, &acc);
203
207
                                        }
204
208
                                }
205
209
 
226
230
}
227
231
 
228
232
 
229
 
static DEVICE_START( es5503 )
 
233
void es5503_device::device_start()
230
234
{
231
 
        const es5503_interface *intf;
232
235
        int osc;
233
 
        ES5503Chip *chip = get_safe_token(device);
234
 
 
235
 
        intf = (const es5503_interface *)device->static_config();
236
 
 
237
 
        chip->irq_callback = intf->irq_callback;
238
 
        chip->adc_read = intf->adc_read;
239
 
        chip->docram = intf->wave_memory;
240
 
        chip->clock = device->clock();
241
 
        chip->device = device;
242
 
 
243
 
        chip->rege0 = 0x80;
 
236
 
 
237
        // find our direct access
 
238
        m_direct = &space()->direct();
 
239
 
 
240
        rege0 = 0x80;
244
241
 
245
242
        for (osc = 0; osc < 32; osc++)
246
243
        {
247
 
                device->save_item(NAME(chip->oscillators[osc].freq), osc);
248
 
                device->save_item(NAME(chip->oscillators[osc].wtsize), osc);
249
 
                device->save_item(NAME(chip->oscillators[osc].control), osc);
250
 
                device->save_item(NAME(chip->oscillators[osc].vol), osc);
251
 
                device->save_item(NAME(chip->oscillators[osc].data), osc);
252
 
                device->save_item(NAME(chip->oscillators[osc].wavetblpointer), osc);
253
 
                device->save_item(NAME(chip->oscillators[osc].wavetblsize), osc);
254
 
                device->save_item(NAME(chip->oscillators[osc].resolution), osc);
255
 
                device->save_item(NAME(chip->oscillators[osc].accumulator), osc);
256
 
                device->save_item(NAME(chip->oscillators[osc].irqpend), osc);
257
 
 
258
 
                chip->oscillators[osc].data = 0x80;
259
 
                chip->oscillators[osc].irqpend = 0;
260
 
                chip->oscillators[osc].accumulator = 0;
261
 
 
262
 
                chip->oscillators[osc].timer = device->machine().scheduler().timer_alloc(FUNC(es5503_timer_cb), &chip->oscillators[osc]);
263
 
                chip->oscillators[osc].chip = (void *)chip;
264
 
        }
265
 
 
266
 
        chip->oscsenabled = 1;
267
 
 
268
 
        chip->output_rate = (device->clock()/8)/34;     // (input clock / 8) / # of oscs. enabled + 2
269
 
        chip->stream = device->machine().sound().stream_alloc(*device, 0, 2, chip->output_rate, chip, es5503_pcm_update);
270
 
}
271
 
 
272
 
READ8_DEVICE_HANDLER( es5503_r )
 
244
                save_item(NAME(oscillators[osc].freq), osc);
 
245
                save_item(NAME(oscillators[osc].wtsize), osc);
 
246
                save_item(NAME(oscillators[osc].control), osc);
 
247
                save_item(NAME(oscillators[osc].vol), osc);
 
248
                save_item(NAME(oscillators[osc].data), osc);
 
249
                save_item(NAME(oscillators[osc].wavetblpointer), osc);
 
250
                save_item(NAME(oscillators[osc].wavetblsize), osc);
 
251
                save_item(NAME(oscillators[osc].resolution), osc);
 
252
                save_item(NAME(oscillators[osc].accumulator), osc);
 
253
                save_item(NAME(oscillators[osc].irqpend), osc);
 
254
        }
 
255
 
 
256
        output_rate = (clock()/8)/34;   // (input clock / 8) / # of oscs. enabled + 2
 
257
        m_stream = machine().sound().stream_alloc(*this, 0, 2, output_rate, this);
 
258
 
 
259
        m_timer = timer_alloc(0, NULL);
 
260
        m_timer->adjust(attotime::from_hz(output_rate));
 
261
}
 
262
 
 
263
void es5503_device::device_reset()
 
264
{
 
265
        rege0 = 0x80;
 
266
 
 
267
        for (int osc = 0; osc < 32; osc++)
 
268
        {
 
269
                oscillators[osc].data = 0x80;
 
270
                oscillators[osc].irqpend = 0;
 
271
                oscillators[osc].accumulator = 0;
 
272
        }
 
273
 
 
274
        oscsenabled = 1;
 
275
 
 
276
        m_channel_strobe = 0;
 
277
 
 
278
        output_rate = (clock()/8)/34;   // (input clock / 8) / # of oscs. enabled + 2
 
279
}
 
280
 
 
281
READ8_MEMBER( es5503_device::read )
273
282
{
274
283
        UINT8 retval;
275
284
        int i;
276
 
        ES5503Chip *chip = get_safe_token(device);
277
285
 
278
 
        chip->stream->update();
 
286
        m_stream->update();
279
287
 
280
288
        if (offset < 0xe0)
281
289
        {
284
292
                switch(offset & 0xe0)
285
293
                {
286
294
                        case 0:         // freq lo
287
 
                                return (chip->oscillators[osc].freq & 0xff);
 
295
                                return (oscillators[osc].freq & 0xff);
288
296
 
289
297
                        case 0x20:      // freq hi
290
 
                                return (chip->oscillators[osc].freq >> 8);
 
298
                                return (oscillators[osc].freq >> 8);
291
299
 
292
300
                        case 0x40:      // volume
293
 
                                return chip->oscillators[osc].vol;
 
301
                                return oscillators[osc].vol;
294
302
 
295
303
                        case 0x60:      // data
296
 
                                return chip->oscillators[osc].data;
 
304
                                return oscillators[osc].data;
297
305
 
298
306
                        case 0x80:      // wavetable pointer
299
 
                                return (chip->oscillators[osc].wavetblpointer>>8) & 0xff;
 
307
                                return (oscillators[osc].wavetblpointer>>8) & 0xff;
300
308
 
301
309
                        case 0xa0:      // oscillator control
302
 
                                return chip->oscillators[osc].control;
 
310
                                return oscillators[osc].control;
303
311
 
304
312
                        case 0xc0:      // bank select / wavetable size / resolution
305
313
                                retval = 0;
306
 
                                if (chip->oscillators[osc].wavetblpointer & 0x10000)
 
314
                                if (oscillators[osc].wavetblpointer & 0x10000)
307
315
                                {
308
316
                                        retval |= 0x40;
309
317
                                }
310
318
 
311
 
                                retval |= (chip->oscillators[osc].wavetblsize<<3);
312
 
                                retval |= chip->oscillators[osc].resolution;
 
319
                                retval |= (oscillators[osc].wavetblsize<<3);
 
320
                                retval |= oscillators[osc].resolution;
313
321
                                return retval;
314
322
                }
315
323
        }
318
326
                switch (offset)
319
327
                {
320
328
                        case 0xe0:      // interrupt status
321
 
                                retval = chip->rege0;
 
329
                                retval = rege0;
322
330
 
323
331
                                // scan all oscillators
324
 
                                for (i = 0; i < chip->oscsenabled+1; i++)
 
332
                                for (i = 0; i < oscsenabled+1; i++)
325
333
                                {
326
 
                                        if (chip->oscillators[i].irqpend)
 
334
                                        if (oscillators[i].irqpend)
327
335
                                        {
328
336
                                                // signal this oscillator has an interrupt
329
337
                                                retval = i<<1;
330
338
 
331
 
                                                chip->rege0 = retval | 0x80;
 
339
                                                rege0 = retval | 0x80;
332
340
 
333
341
                                                // and clear its flag
334
 
                                                chip->oscillators[i].irqpend--;
 
342
                                                oscillators[i].irqpend--;
335
343
 
336
 
                                                if (chip->irq_callback)
 
344
                                                if (m_irq_func)
337
345
                                                {
338
 
                                                        chip->irq_callback(chip->device, 0);
 
346
                                                        m_irq_func(this, 0);
339
347
                                                }
340
348
                                                break;
341
349
                                        }
342
350
                                }
343
351
 
344
352
                                // if any oscillators still need to be serviced, assert IRQ again immediately
345
 
                                for (i = 0; i < chip->oscsenabled+1; i++)
 
353
                                for (i = 0; i < oscsenabled+1; i++)
346
354
                                {
347
 
                                        if (chip->oscillators[i].irqpend)
 
355
                                        if (oscillators[i].irqpend)
348
356
                                        {
349
 
                                                if (chip->irq_callback)
 
357
                                                if (m_irq_func)
350
358
                                                {
351
 
                                                        chip->irq_callback(chip->device, 1);
 
359
                                                        m_irq_func(this, 1);
352
360
                                                }
353
361
                                                break;
354
362
                                        }
357
365
                                return retval;
358
366
 
359
367
                        case 0xe1:      // oscillator enable
360
 
                                return chip->oscsenabled<<1;
 
368
                                return oscsenabled<<1;
361
369
 
362
370
                        case 0xe2:      // A/D converter
363
 
                                if (chip->adc_read)
 
371
                                if (m_adc_func)
364
372
                                {
365
 
                                        return chip->adc_read(chip->device, 0);
 
373
                                        return m_adc_func(this);
366
374
                                }
367
375
                                break;
368
376
                }
371
379
        return 0;
372
380
}
373
381
 
374
 
WRITE8_DEVICE_HANDLER( es5503_w )
 
382
WRITE8_MEMBER( es5503_device::write )
375
383
{
376
 
        ES5503Chip *chip = get_safe_token(device);
377
 
 
378
 
        chip->stream->update();
 
384
        m_stream->update();
379
385
 
380
386
        if (offset < 0xe0)
381
387
        {
384
390
                switch(offset & 0xe0)
385
391
                {
386
392
                        case 0:         // freq lo
387
 
                                chip->oscillators[osc].freq &= 0xff00;
388
 
                                chip->oscillators[osc].freq |= data;
 
393
                                oscillators[osc].freq &= 0xff00;
 
394
                                oscillators[osc].freq |= data;
389
395
                                break;
390
396
 
391
397
                        case 0x20:      // freq hi
392
 
                                chip->oscillators[osc].freq &= 0x00ff;
393
 
                                chip->oscillators[osc].freq |= (data<<8);
 
398
                                oscillators[osc].freq &= 0x00ff;
 
399
                                oscillators[osc].freq |= (data<<8);
394
400
                                break;
395
401
 
396
402
                        case 0x40:      // volume
397
 
                                chip->oscillators[osc].vol = data;
 
403
                                oscillators[osc].vol = data;
398
404
                                break;
399
405
 
400
406
                        case 0x60:      // data - ignore writes
401
407
                                break;
402
408
 
403
409
                        case 0x80:      // wavetable pointer
404
 
                                chip->oscillators[osc].wavetblpointer = (data<<8);
 
410
                                oscillators[osc].wavetblpointer = (data<<8);
405
411
                                break;
406
412
 
407
413
                        case 0xa0:      // oscillator control
408
414
                                // if a fresh key-on, reset the ccumulator
409
 
                                if ((chip->oscillators[osc].control & 1) && (!(data&1)))
410
 
                                {
411
 
                                        chip->oscillators[osc].accumulator = 0;
412
 
 
413
 
                                        // if this voice generates interrupts, set a timer to make sure we service it on time
414
 
                                        if (((data & 0x09) == 0x08) && (chip->oscillators[osc].freq > 0))
415
 
                                        {
416
 
                                                UINT32 length, run;
417
 
                                                UINT32 wtptr = chip->oscillators[osc].wavetblpointer & wavemasks[chip->oscillators[osc].wavetblsize];
418
 
                                                UINT32 acc = 0;
419
 
                                                UINT16 wtsize = chip->oscillators[osc].wtsize-1;
420
 
                                                UINT16 freq = chip->oscillators[osc].freq;
421
 
                                                INT8 data = -128;
422
 
                                                int resshift = resshifts[chip->oscillators[osc].resolution] - chip->oscillators[osc].wavetblsize;
423
 
                                                UINT32 sizemask = accmasks[chip->oscillators[osc].wavetblsize];
424
 
                                                UINT32 ramptr, altram;
425
 
                                                attotime period;
426
 
 
427
 
                                                run = 1;
428
 
                                                length = 0;
429
 
                                                while (run)
430
 
                                                {
431
 
                                                        ramptr = (acc >> resshift) & sizemask;
432
 
                                                        altram = (acc >> resshift);
433
 
                                                        acc += freq;
434
 
                                                        data = (INT32)chip->docram[ramptr + wtptr];
435
 
 
436
 
                                                        if ((data == 0) || (altram >= wtsize))
437
 
                                                        {
438
 
                                                                run = 0;
439
 
                                                        }
440
 
                                                        else
441
 
                                                        {
442
 
                                                                length++;
443
 
                                                        }
444
 
                                                }
445
 
 
446
 
                                                // ok, we run for this long
447
 
                                                period = attotime::from_hz(chip->output_rate) * length;
448
 
 
449
 
                                                chip->oscillators[osc].timer->adjust(period, 0, period);
450
 
                                        }
451
 
                                }
452
 
                                else if (!(chip->oscillators[osc].control & 1) && (data&1))
453
 
                                {
454
 
                                        // key off
455
 
                                        chip->oscillators[osc].timer->adjust(attotime::never);
456
 
                                }
457
 
 
458
 
                                chip->oscillators[osc].control = data;
 
415
                                if ((oscillators[osc].control & 1) && (!(data&1)))
 
416
                                {
 
417
                                        oscillators[osc].accumulator = 0;
 
418
                                }
 
419
 
 
420
                                oscillators[osc].control = data;
459
421
                                break;
460
422
 
461
423
                        case 0xc0:      // bank select / wavetable size / resolution
462
424
                                if (data & 0x40)        // bank select - not used on the Apple IIgs
463
425
                                {
464
 
                                        chip->oscillators[osc].wavetblpointer |= 0x10000;
 
426
                                        oscillators[osc].wavetblpointer |= 0x10000;
465
427
                                }
466
428
                                else
467
429
                                {
468
 
                                        chip->oscillators[osc].wavetblpointer &= 0xffff;
 
430
                                        oscillators[osc].wavetblpointer &= 0xffff;
469
431
                                }
470
432
 
471
 
                                chip->oscillators[osc].wavetblsize = ((data>>3) & 7);
472
 
                                chip->oscillators[osc].wtsize = wavesizes[chip->oscillators[osc].wavetblsize];
473
 
                                chip->oscillators[osc].resolution = (data & 7);
 
433
                                oscillators[osc].wavetblsize = ((data>>3) & 7);
 
434
                                oscillators[osc].wtsize = wavesizes[oscillators[osc].wavetblsize];
 
435
                                oscillators[osc].resolution = (data & 7);
474
436
                                break;
475
437
                }
476
438
        }
482
444
                                break;
483
445
 
484
446
                        case 0xe1:      // oscillator enable
485
 
                                chip->oscsenabled = (data>>1) & 0x1f;
 
447
                                oscsenabled = (data>>1) & 0x1f;
486
448
 
487
 
                                chip->output_rate = (chip->clock/8)/(2+chip->oscsenabled);
488
 
                                chip->stream->set_sample_rate(chip->output_rate);
 
449
                                output_rate = (clock()/8)/(2+oscsenabled);
 
450
                                m_stream->set_sample_rate(output_rate);
 
451
                                m_timer->adjust(attotime::from_hz(output_rate));
489
452
                                break;
490
453
 
491
454
                        case 0xe2:      // A/D converter
494
457
        }
495
458
}
496
459
 
497
 
void es5503_set_base(device_t *device, UINT8 *wavemem)
498
 
{
499
 
        ES5503Chip *chip = get_safe_token(device);
500
 
 
501
 
        chip->docram = wavemem;
502
 
}
503
 
 
504
 
/**************************************************************************
505
 
 * Generic get_info
506
 
 **************************************************************************/
507
 
 
508
 
DEVICE_GET_INFO( es5503 )
509
 
{
510
 
        switch (state)
511
 
        {
512
 
                /* --- the following bits of info are returned as 64-bit signed integers --- */
513
 
                case DEVINFO_INT_TOKEN_BYTES:                                   info->i = sizeof(ES5503Chip);                                   break;
514
 
 
515
 
                /* --- the following bits of info are returned as pointers to data or functions --- */
516
 
                case DEVINFO_FCT_START:                                                 info->start = DEVICE_START_NAME( es5503 );                      break;
517
 
                case DEVINFO_FCT_STOP:                                                  /* Nothing */                                                                   break;
518
 
                case DEVINFO_FCT_RESET:                                                 /* Nothing */                                                                   break;
519
 
 
520
 
                /* --- the following bits of info are returned as NULL-terminated strings --- */
521
 
                case DEVINFO_STR_NAME:                                                  strcpy(info->s, "ES5503");                                              break;
522
 
                case DEVINFO_STR_FAMILY:                                        strcpy(info->s, "Ensoniq ES550x");                              break;
523
 
                case DEVINFO_STR_VERSION:                                       strcpy(info->s, "1.0");                                                 break;
524
 
                case DEVINFO_STR_SOURCE_FILE:                                           strcpy(info->s, __FILE__);                                              break;
525
 
                case DEVINFO_STR_CREDITS:                                       strcpy(info->s, "Copyright R. Belmont");                break;
526
 
        }
527
 
}
528
 
 
529
 
 
530
 
DEFINE_LEGACY_SOUND_DEVICE(ES5503, es5503);