static DEVICE_START( exidy440_sound ) { running_machine *machine = device->machine; int i, length; /* reset the system */ exidy440_sound_command = 0; exidy440_sound_command_ack = 1; state_save_register_global(machine, exidy440_sound_command); state_save_register_global(machine, exidy440_sound_command_ack); /* reset the 6844 */ for (i = 0; i < 4; i++) { m6844_channel[i].active = 0; m6844_channel[i].control = 0x00; } m6844_priority = 0x00; m6844_interrupt = 0x00; m6844_chain = 0x00; state_save_register_global(machine, m6844_priority); state_save_register_global(machine, m6844_interrupt); state_save_register_global(machine, m6844_chain); channel_frequency[0] = device->clock; /* channels 0 and 1 are run by FCLK */ channel_frequency[1] = device->clock; channel_frequency[2] = device->clock/2; /* channels 2 and 3 are run by SCLK */ channel_frequency[3] = device->clock/2; /* get stream channels */ stream = stream_create(device, 0, 2, device->clock, NULL, channel_update); /* allocate the sample cache */ length = memory_region_length(machine, "cvsd") * 16 + MAX_CACHE_ENTRIES * sizeof(sound_cache_entry); sound_cache = (sound_cache_entry *)auto_alloc_array(machine, UINT8, length); /* determine the hard end of the cache and reset */ sound_cache_max = (sound_cache_entry *)((UINT8 *)sound_cache + length); reset_sound_cache(); /* allocate the mixer buffer */ mixer_buffer_left = auto_alloc_array(machine, INT32, 2 * device->clock); mixer_buffer_right = mixer_buffer_left + device->clock; if (SOUND_LOG) debuglog = fopen("sound.log", "w"); }
void exidy440_sound_device::device_start() { int i, length; /* reset the system */ m_sound_command = 0; m_sound_command_ack = 1; save_item(NAME(m_sound_command)); save_item(NAME(m_sound_command_ack)); /* reset the 6844 */ for (i = 0; i < 4; i++) { m_m6844_channel[i].active = 0; m_m6844_channel[i].control = 0x00; } m_m6844_priority = 0x00; m_m6844_interrupt = 0x00; m_m6844_chain = 0x00; save_item(NAME(m_m6844_priority)); save_item(NAME(m_m6844_interrupt)); save_item(NAME(m_m6844_chain)); m_channel_frequency[0] = clock(); /* channels 0 and 1 are run by FCLK */ m_channel_frequency[1] = clock(); m_channel_frequency[2] = clock()/2; /* channels 2 and 3 are run by SCLK */ m_channel_frequency[3] = clock()/2; /* get stream channels */ m_stream = machine().sound().stream_alloc(*this, 0, 2, clock()); /* allocate the sample cache */ length = machine().root_device().memregion("cvsd")->bytes() * 16 + MAX_CACHE_ENTRIES * sizeof(sound_cache_entry); m_sound_cache = (sound_cache_entry *)auto_alloc_array_clear(machine(), UINT8, length); /* determine the hard end of the cache and reset */ m_sound_cache_max = (sound_cache_entry *)((UINT8 *)m_sound_cache + length); reset_sound_cache(); /* allocate the mixer buffer */ m_mixer_buffer_left = make_unique_clear<INT32[]>(clock()); m_mixer_buffer_right = make_unique_clear<INT32[]>(clock()); if (SOUND_LOG) m_debuglog = fopen("sound.log", "w"); }