public namco_device(machine_config mconfig, string tag, device_t owner, u32 clock) : base(mconfig, NAMCO, tag, owner, clock) { m_class_interfaces.Add(new device_sound_interface_namco(mconfig, this)); m_disound = GetClassInterface <device_sound_interface_namco>(); }
// device-level overrides //------------------------------------------------- // device_start - handle device startup //------------------------------------------------- protected override void device_start() { m_disound = GetClassInterface <device_sound_interface_namco>(); // read audio samples load_samples(); // allocate channels m_channel.resize(m_channels); for (int channel = 0; channel < m_channels; channel++) { // initialize channel channel_t chan = m_channel[channel]; chan.stream = m_disound.stream_alloc(0, 1, machine().sample_rate()); chan.source = null; chan.source_num = -1; chan.step = 0; chan.loop = false; chan.paused = false; // register with the save state system save_item(chan.source_length, "chan.source_length", channel); save_item(chan.source_num, "chan.source_num", channel); save_item(chan.pos, "chan.pos", channel); save_item(chan.frac, "chan.frac", channel); save_item(chan.step, "chan.step", channel); save_item(chan.loop, "chan.loop", channel); save_item(chan.paused, "chan.paused", channel); } // initialize any custom handlers //m_samples_start_cb.bind_relative_to(owner()); if (m_samples_start_cb != null) { m_samples_start_cb(); } }