summaryrefslogtreecommitdiffstatshomepage
path: root/src/mess/audio/dave.c
blob: 023927c358da929dc136b49d518b1ee325c8c727 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
/**********************************************************************

    "Dave" Sound Chip

    DAVE SOUND CHIP FOUND IN ENTERPRISE

     working:

    - pure tone
    - sampled sounds
    - 1 kHz, 50 Hz and 1 Hz ints
    - external ints (int1 and int2) - not correct speed yet

**********************************************************************/

#include "emu.h"
#include "audio/dave.h"


/***************************************************************************
    MACROS / CONSTANTS
***************************************************************************/

#define STEP 0x08000


/***************************************************************************
    TYPE DEFINITIONS
***************************************************************************/

typedef struct _dave_t dave_t;
struct _dave_t
{
	devcb_resolved_read8 reg_r;
	devcb_resolved_write8 reg_w;
	devcb_resolved_write_line int_callback;

	unsigned char Regs[32];

	/* int latches (used by 1Hz, int1 and int2) */
	unsigned long int_latch;
	/* int enables */
	unsigned long int_enable;
	/* int inputs */
	unsigned long int_input;

	unsigned long int_irq;

	/* INTERRUPTS */

	/* internal timer */
	/* bit 2: 1kHz timer irq */
	/* bit 1: 50kHz timer irq */
	int timer_irq;
	/* 1khz timer - divided into 1kHz, 50Hz and 1Hz timer */
	emu_timer	*int_timer;
	/* state of 1kHz timer */
	unsigned long one_khz_state;
	/* state of 50Hz timer */
	unsigned long fifty_hz_state;

	/* counter used to trigger 50Hz from 1kHz timer */
	unsigned long fifty_hz_count;
	/* counter used to trigger 1Hz from 1kHz timer */
	unsigned long one_hz_count;


	/* SOUND SYNTHESIS */
	int Period[4];
	int Count[4];
	int	level[4];

	/* these are used to force channels on/off */
	/* if one of the or values is 0x0ff, this means
    the volume will be forced on,else it is dependant on
    the state of the wave */
	int level_or[8];
	/* if one of the values is 0x00, this means the
    volume is forced off, else it is dependant on the wave */
	int level_and[8];

	/* these are the current channel volumes in MAME form */
	int mame_volumes[8];

	/* update step */
	int UpdateStep;

	sound_stream *sound_stream_var;

	/* temp here */
	int nick_virq;
};


/***************************************************************************
    INLINE FUNCTIONS
***************************************************************************/

INLINE dave_t *get_token(device_t *device)
{
	assert(device != NULL);
	assert(device->type() == DAVE);
	return (dave_t *) downcast<legacy_device_base *>(device)->token();
}



INLINE const dave_interface *get_interface(device_t *device)
{
	assert(device != NULL);
	assert(device->type() == DAVE);
	return (const dave_interface *) device->static_config();
}


/***************************************************************************
    PROTOTYPES
***************************************************************************/

static void dave_set_external_int_state(device_t *device, int IntID, int State);
static TIMER_CALLBACK(dave_1khz_callback);
static STREAM_UPDATE(dave_update_sound);


/***************************************************************************
    IMPLEMENTATION
***************************************************************************/

/*-------------------------------------------------
    DEVICE_START( dave_sound )
-------------------------------------------------*/

static DEVICE_START( dave_sound )
{
	int i;
	dave_t *dave = get_token(device);
	const dave_interface *intf = get_interface(device);

	memset(dave, 0, sizeof(*dave));

	/* resolve callbacks */
	dave->reg_r.resolve(intf->reg_r, *device);
	dave->reg_w.resolve(intf->reg_w, *device);
	dave->int_callback.resolve(intf->int_callback, *device);

	/* temp! */
	dave->nick_virq = 0;

	/* initialise 1kHz timer */
	dave->int_latch = 0;
	dave->int_input = 0;
	dave->int_enable = 0;
	dave->timer_irq = 0;
	dave->fifty_hz_state = 0;
	dave->one_khz_state = 0;
	dave->fifty_hz_count = DAVE_FIFTY_HZ_COUNTER_RELOAD;
	dave->one_hz_count = DAVE_ONE_HZ_COUNTER_RELOAD;
	device->machine().scheduler().timer_pulse(attotime::from_hz(1000), FUNC(dave_1khz_callback), 0, (void *) device);

	for (i=0; i<3; i++)
	{
		dave->Period[i] = (STEP * device->machine().sample_rate()) / 125000;
		dave->Count[i] = (STEP * device->machine().sample_rate()) / 125000;
		dave->level[i] = 0;
	}

	/* dave has 3 tone channels and 1 noise channel.
    the volumes are mixed internally and output as left and right volume */

	/* 3 tone channels + 1 noise channel */
	dave->sound_stream_var = device->machine().sound().stream_alloc(*device, 0, 2, device->machine().sample_rate(), NULL, dave_update_sound);
}


/*-------------------------------------------------
    DEVICE_RESET( dave_sound )
-------------------------------------------------*/

static DEVICE_RESET( dave_sound )
{
	dave_t *dave = get_token(device);
	int i;

	for (i = 0; i < 32; i++)
		dave->Regs[i] = 0;

	dave_reg_w(device, 0x10, 0);
	dave_reg_w(device, 0x11, 0);
	dave_reg_w(device, 0x12, 0);
	dave_reg_w(device, 0x13, 0);

}


/*-------------------------------------------------
    dave_refresh_ints
-------------------------------------------------*/

static void dave_refresh_ints(device_t *device)
{
	dave_t *dave = get_token(device);
	int int_wanted;

	logerror("int latch: %02x enable: %02x input: %02x\n", (int) dave->int_latch, (int) dave->int_enable, (int) dave->int_input);

	int_wanted = ((dave->int_enable<<1) & dave->int_latch) != 0;
	dave->int_callback(int_wanted);
}


/*-------------------------------------------------
    dave_refresh_selectable_int
-------------------------------------------------*/

static void dave_refresh_selectable_int(device_t *device)
{
	dave_t *dave = get_token(device);

	/* update 1kHz/50Hz/tg latch and int input */
	switch ((dave->Regs[7]>>5) & 0x03)
	{
		/* 1kHz */
		case 0:
		{
			dave->int_latch &=~(1<<1);
			dave->int_latch |= (dave->int_irq>>1) & 0x02;

			/* set int input state */
			dave->int_input &= ~(1<<0);
			dave->int_input |= (dave->one_khz_state & 0x01)<<0;
		}
		break;

		/* 50Hz */
		case 1:
		{
			dave->int_latch &=~(1<<1);
			dave->int_latch |= dave->int_irq & 0x02;

			/* set int input state */
			dave->int_input &= ~(1<<0);
			dave->int_input |= (dave->fifty_hz_state & 0x01)<<0;
		}
		break;


		default:
			break;
	}

	dave_refresh_ints(device);
}


/*-------------------------------------------------
    dave_1khz_callback
-------------------------------------------------*/

static TIMER_CALLBACK(dave_1khz_callback)
{
	device_t *device = (device_t *)ptr;
	dave_t *dave = get_token(device);

	/* time over - want int */
	dave->one_khz_state ^= 0x0ffffffff;

	/* lo-high transition causes int */
	if (dave->one_khz_state!=0)
	{
		dave->int_irq |=(1<<2);
	}


	/* update fifty Hz counter */
	dave->fifty_hz_count--;

	if (dave->fifty_hz_count==0)
	{
		/* these two lines are temp here */
		dave->nick_virq ^= 0x0ffffffff;
		dave_set_external_int_state(device, DAVE_INT1_ID, dave->nick_virq);


		dave->fifty_hz_count = DAVE_FIFTY_HZ_COUNTER_RELOAD;
		dave->fifty_hz_state^=0x0ffffffff;

		if (dave->fifty_hz_state!=0)
		{
			dave->int_irq |= (1<<1);
		}
	}

	dave->one_hz_count--;

	if (dave->one_hz_count==0)
	{
		/* reload counter */
		dave->one_hz_count = DAVE_ONE_HZ_COUNTER_RELOAD;

		/* change state */
		dave->int_input ^= (1<<2);

		if (dave->int_input & (1<<2))
		{
			/* transition from 0->1 */
			/* int requested */
			dave->int_latch |=(1<<3);
		}
	}

	dave_refresh_selectable_int(device);
}


/*-------------------------------------------------
    dave_update_sound
-------------------------------------------------*/

static STREAM_UPDATE( dave_update_sound )
{
	dave_t *dave = get_token(device);
	stream_sample_t *buffer1, *buffer2;
	/* 0 = channel 0 left volume, 1 = channel 0 right volume,
    2 = channel 1 left volume, 3 = channel 1 right volume,
    4 = channel 2 left volume, 5 = channel 2 right volume
    6 = noise channel left volume, 7 = noise channel right volume */
	int output_volumes[8];
	int left_volume;
	int right_volume;

	//logerror("sound update!\n");

	buffer1 = outputs[0];
	buffer2 = outputs[1];

	while (samples)
	{
		int vol[4];
		int i;

		/* vol[] keeps track of how long each square wave stays */
		/* in the 1 position during the sample period. */
		vol[0] = vol[1] = vol[2] = vol[3] = 0;

		for (i = 0;i < 3;i++)
		{
			if ((dave->Regs[7] & (1<<i))==0)
			{

				if (dave->level[i]) vol[i] += dave->Count[i];
				dave->Count[i] -= STEP;
				/* Period[i] is the half period of the square wave. Here, in each */
				/* loop I add Period[i] twice, so that at the end of the loop the */
				/* square wave is in the same status (0 or 1) it was at the start. */
				/* vol[i] is also incremented by Period[i], since the wave has been 1 */
				/* exactly half of the time, regardless of the initial position. */
				/* If we exit the loop in the middle, Output[i] has to be inverted */
				/* and vol[i] incremented only if the exit status of the square */
				/* wave is 1. */
				while (dave->Count[i] <= 0)
				{
					dave->Count[i] += dave->Period[i];
					if (dave->Count[i] > 0)
					{
						dave->level[i] ^= 0x0ffffffff;
						if (dave->level[i]) vol[i] += dave->Period[i];
							break;
					}
					dave->Count[i] += dave->Period[i];
					vol[i] += dave->Period[i];
				}
				if (dave->level[i])
					vol[i] -= dave->Count[i];
			}
		}

		/* update volume outputs */

		/* setup output volumes for each channel */
		/* channel 0 */
		output_volumes[0] = ((dave->level[0] & dave->level_and[0]) | dave->level_or[0]) & dave->mame_volumes[0];
		output_volumes[1] = ((dave->level[0] & dave->level_and[1]) | dave->level_or[1]) & dave->mame_volumes[4];
		/* channel 1 */
		output_volumes[2] = ((dave->level[1] & dave->level_and[2]) | dave->level_or[2]) & dave->mame_volumes[1];
		output_volumes[3] = ((dave->level[1] & dave->level_and[3]) | dave->level_or[3]) & dave->mame_volumes[5];
		/* channel 2 */
		output_volumes[4] = ((dave->level[2] & dave->level_and[4]) | dave->level_or[4]) & dave->mame_volumes[2];
		output_volumes[5] = ((dave->level[2] & dave->level_and[5]) | dave->level_or[5]) & dave->mame_volumes[6];
		/* channel 3 */
		output_volumes[6] = ((dave->level[3] & dave->level_and[6]) | dave->level_or[6]) & dave->mame_volumes[3];
		output_volumes[7] = ((dave->level[3] & dave->level_and[7]) | dave->level_or[7]) & dave->mame_volumes[7];

		left_volume = (output_volumes[0] + output_volumes[2] + output_volumes[4] + output_volumes[6])>>2;
		right_volume = (output_volumes[1] + output_volumes[3] + output_volumes[5] + output_volumes[7])>>2;

		*(buffer1++) = left_volume;
		*(buffer2++) = right_volume;

		samples--;
	}
}


/*-------------------------------------------------
    dave_sound_w - used to update sound output
    based on data writes
-------------------------------------------------*/

static WRITE8_DEVICE_HANDLER(dave_sound_w)
{
	dave_t *dave = get_token(device);

	/* update stream */
	dave->sound_stream_var->update();

	/* new write */
	switch (offset)
	{
		/* channel 0 down-counter */
		case 0:
		case 1:
		/* channel 1 down-counter */
		case 2:
		case 3:
		/* channel 2 down-counter */
		case 4:
		case 5:
		{
			int count = 0;
			int channel_index = offset>>1;

			/* Fout = 125,000 / (n+1) Hz */

			/* sample rate/clock */


			/* get down-count */
			switch (offset & 0x01)
			{
				case 0:
				{
					count = (data & 0x0ff) | ((dave->Regs[offset+1] & 0x0f)<<8);
				}
				break;

				case 1:
				{
					count = (dave->Regs[offset-1] & 0x0ff) | ((data & 0x0f)<<8);

				}
				break;
			}

			count++;


			dave->Period[channel_index] = ((STEP  * device->machine().sample_rate())/125000) * count;

		}
		break;

		/* channel 0 left volume */
		case 8:
		/* channel 1 left volume */
		case 9:
		/* channel 2 left volume */
		case 10:
		/* noise channel left volume */
		case 11:
		/* channel 0 right volume */
		case 12:
		/* channel 1 right volume */
		case 13:
		/* channel 2 right volume */
		case 14:
		/* noise channel right volume */
		case 15:
		{
			/* update mame version of volume from data written */
			/* 0x03f->0x07e00. Max is 0x07fff */
			/* I believe the volume is linear - to be checked! */
			dave->mame_volumes[offset-8] = (data & 0x03f)<<9;
		}
		break;

		case 7:
		{
			/*  force => the value of this register is forced regardless of the wave
                    state,
                remove => this value is force to zero so that it has no influence over
                    the final volume calculation, regardless of wave state
                use => the volume value is dependant on the wave state and is included
                    in the final volume calculation */

			logerror("selectable int ");
			switch ((data>>5) & 0x03)
			{
				case 0:
				{
					logerror("1kHz\n");
				}
				break;

				case 1:
				{
					logerror("50Hz\n");
				}
				break;

				case 2:
				{
					logerror("tone channel 0\n");
				}
				break;

				case 3:
				{
					logerror("tone channel 1\n");
				}
				break;
			}



			/* turn L.H audio output into D/A, outputting value in R8 */
			if (data & (1<<3))
			{
				/* force r8 value */
				dave->level_or[0] = 0x0ffff;
				dave->level_and[0] = 0x00;

				/* remove r9 value */
				dave->level_or[2] = 0x000;
				dave->level_and[2] = 0x00;

				/* remove r10 value */
				dave->level_or[4] = 0x000;
				dave->level_and[4] = 0x00;

				/* remove r11 value */
				dave->level_or[6] = 0x000;
				dave->level_and[6] = 0x00;
			}
			else
			{
				/* use r8 value */
				dave->level_or[0] = 0x000;
				dave->level_and[0] = 0xffff;

				/* use r9 value */
				dave->level_or[2] = 0x000;
				dave->level_and[2] = 0xffff;

				/* use r10 value */
				dave->level_or[4] = 0x000;
				dave->level_and[4] = 0xffff;

				/* use r11 value */
				dave->level_or[6] = 0x000;
				dave->level_and[6] = 0xffff;
			}

			/* turn L.H audio output into D/A, outputting value in R12 */
			if (data & (1<<4))
			{
				/* force r12 value */
				dave->level_or[1] = 0x0ffff;
				dave->level_and[1] = 0x00;

				/* remove r13 value */
				dave->level_or[3] = 0x000;
				dave->level_and[3] = 0x00;

				/* remove r14 value */
				dave->level_or[5] = 0x000;
				dave->level_and[5] = 0x00;

				/* remove r15 value */
				dave->level_or[7] = 0x000;
				dave->level_and[7] = 0x00;
			}
			else
			{
				/* use r12 value */
				dave->level_or[1] = 0x000;
				dave->level_and[1] = 0xffff;

				/* use r13 value */
				dave->level_or[3] = 0x000;
				dave->level_and[3] = 0xffff;

				/* use r14 value */
				dave->level_or[5] = 0x000;
				dave->level_and[5] = 0xffff;

				/* use r15 value */
				dave->level_or[7] = 0x000;
				dave->level_and[7] = 0xffff;
			}
		}
		break;

		default:
			break;
	}
}


/*-------------------------------------------------
    dave_reg_w
-------------------------------------------------*/

WRITE8_DEVICE_HANDLER ( dave_reg_w )
{
	dave_t *dave = get_token(device);

	logerror("dave w: %04x %02x\n",offset,data);

	dave_sound_w(device, offset, data);

	dave->Regs[offset & 0x01f] = data;

	switch (offset)
	{
		case 0x07:
		{
			dave_refresh_selectable_int(device);
		}
		break;

		case 0x014:
		{
			/* enabled ints */
			dave->int_enable = data & 0x055;
			/* clear latches */
			dave->int_latch &=~(data & 0x0aa);

			/* reset 1kHz, 50Hz latch */
			if (data & (1<<1))
			{
				dave->int_irq = 0;
			}

			/* refresh ints */
			dave_refresh_ints(device);
		}
		break;

		default:
			break;
	}

	dave->reg_w(offset, data);
}


/*-------------------------------------------------
    dave_set_reg
-------------------------------------------------*/

void dave_set_reg(device_t *device, offs_t offset, UINT8 data)
{
	dave_t *dave = get_token(device);
	dave->Regs[offset & 0x01f] = data;
}


/*-------------------------------------------------
    dave_reg_r
-------------------------------------------------*/

READ8_DEVICE_HANDLER( dave_reg_r )
{
	dave_t *dave = get_token(device);

	logerror("dave r: %04x\n",offset);

	dave->reg_r(offset);

	switch (offset)
	{
		case 0x000:
		case 0x001:
		case 0x002:
		case 0x003:
		case 0x004:
		case 0x005:
		case 0x006:
		case 0x007:
		case 0x008:
		case 0x009:
		case 0x00a:
		case 0x00b:
		case 0x00c:
		case 0x00d:
		case 0x00e:
		case 0x00f:
		case 0x018:
		case 0x019:
		case 0x01a:
		case 0x01b:
		case 0x01c:
		case 0x01d:
		case 0x01e:
		case 0x01f:
			return 0x0ff;

		case 0x014:
			return (dave->int_latch & 0x0aa) | (dave->int_input & 0x055);


		default:
			break;
	}

	return dave->Regs[offset & 0x01f];
}


/*-------------------------------------------------
    dave_set_external_int_state - negative edge
    triggered
-------------------------------------------------*/

static void dave_set_external_int_state(device_t *device, int IntID, int State)
{
	dave_t *dave = get_token(device);

	switch (IntID)
	{
		/* connected to Nick virq */
		case DAVE_INT1_ID:
		{
			int previous_state;

			previous_state = dave->int_input;

			dave->int_input &=~(1<<4);

			if (State)
			{
				dave->int_input |=(1<<4);
			}

			if ((previous_state ^ dave->int_input) & (1<<4))
			{
				/* changed state */

				if (dave->int_input & (1<<4))
				{
					/* int request */
					dave->int_latch |= (1<<5);

					dave_refresh_ints(device);
				}
			}

		}
		break;

		case DAVE_INT2_ID:
		{
			int previous_state;

			previous_state = dave->int_input;

			dave->int_input &= ~(1<<6);

			if (State)
			{
				dave->int_input |=(1<<6);
			}

			if ((previous_state ^ dave->int_input) & (1<<6))
			{
				/* changed state */

				if (dave->int_input & (1<<6))
				{
					/* int request */
					dave->int_latch|=(1<<7);

					dave_refresh_ints(device);
				}
			}
		}
		break;

		default:
			break;
	}
}

/*
Reg 4 READ:

b7 = 1: INT2 latch set
b6 = INT2 input pin
b5 = 1: INT1 latch set
b4 = INT1 input pin
b3 = 1: 1Hz latch set
b2 = 1Hz input pin
b1 = 1: 1kHz/50Hz/TG latch set
b0 = 1kHz/50Hz/TG input

Reg 4 WRITE:

b7 = 1: Reset INT2 latch
b6 = 1: Enable INT2
b5 = 1: Reset INT1 latch
b4 = 1: Enable INT1
b3 = 1: Reset 1Hz interrupt latch
b2 = 1: Enable 1Hz interrupt
b1 = 1: Reset 1kHz/50Hz/TG latch
b0 = 1: Enable 1kHz/50Hz/TG latch
*/



DEVICE_GET_INFO( dave_sound )
{
	switch (state)
	{
		/* --- the following bits of info are returned as 64-bit signed integers --- */
		case DEVINFO_INT_TOKEN_BYTES:					info->i = sizeof(dave_t);				break;

		/* --- the following bits of info are returned as pointers to data or functions --- */
		case DEVINFO_FCT_START:							info->start = DEVICE_START_NAME(dave_sound);	break;
		case DEVINFO_FCT_RESET:							info->reset = DEVICE_RESET_NAME(dave_sound);	break;

		/* --- the following bits of info are returned as NULL-terminated strings --- */
		case DEVINFO_STR_NAME:							strcpy(info->s, "Dave");				break;
		case DEVINFO_STR_SOURCE_FILE:					strcpy(info->s, __FILE__);						break;
	}
}

DEFINE_LEGACY_SOUND_DEVICE(DAVE, dave_sound);