Actually use the speaker interface if provided.

This commit is contained in:
Curt Coder 2009-11-27 13:11:19 +00:00
parent a2e82426fe
commit abb8ad1fb6

View File

@ -139,12 +139,25 @@ INLINE speaker_state *get_safe_token(const device_config *device)
static DEVICE_START( speaker ) static DEVICE_START( speaker )
{ {
speaker_state *sp = get_safe_token(device); speaker_state *sp = get_safe_token(device);
const speaker_interface *intf = (const speaker_interface *) device->static_config;
int i; int i;
double x; double x;
sp->channel = stream_create(device, 0, 1, device->machine->sample_rate, sp, speaker_sound_update); sp->channel = stream_create(device, 0, 1, device->machine->sample_rate, sp, speaker_sound_update);
if (intf != NULL)
{
assert(intf->num_level > 1);
assert(intf->levels != NULL);
sp->num_levels = intf->num_level;
sp->levels = intf->levels;
}
else
{
sp->num_levels = 2; sp->num_levels = 2;
sp->levels = default_levels; sp->levels = default_levels;
}
sp->level = 0; sp->level = 0;
for (i = 0; i < FILTER_LENGTH; i++) for (i = 0; i < FILTER_LENGTH; i++)
sp->composed_volume[i] = 0; sp->composed_volume[i] = 0;