void device_sound_interface::set_input_gain(int inputnum, float gain) { int stream_inputnum; sound_stream *stream = input_to_stream_input(inputnum, stream_inputnum); if (stream != nullptr) stream->set_input_gain(stream_inputnum, gain); }
void device_sound_interface::interface_post_start() { // iterate over all the sound devices device_sound_interface *sound = NULL; for (bool gotone = m_device.machine().devicelist().first(sound); gotone; gotone = sound->next(sound)) { // scan each route on the device for (const sound_route *route = sound->first_route(); route != NULL; route = route->next()) { // if we are the target of this route, hook it up device_t *target_device = m_device.machine().device(route->m_target); if (target_device == &m_device) { // iterate over all outputs, matching any that apply int inputnum = route->m_input; int numoutputs = sound->outputs(); for (int outputnum = 0; outputnum < numoutputs; outputnum++) if (route->m_output == outputnum || route->m_output == ALL_OUTPUTS) { // find the output stream to connect from int streamoutputnum; sound_stream *outputstream = sound->output_to_stream_output(outputnum, streamoutputnum); if (outputstream == NULL) fatalerror("Sound device '%s' specifies route for non-existant output #%d", route->m_target, outputnum); // find the input stream to connect to int streaminputnum; sound_stream *inputstream = input_to_stream_input(inputnum++, streaminputnum); if (inputstream == NULL) fatalerror("Sound device '%s' targeted output #%d to non-existant device '%s' input %d", route->m_target, outputnum, m_device.tag(), inputnum - 1); // set the input inputstream->set_input(streaminputnum, outputstream, streamoutputnum, route->m_gain); } } } } }
void device_sound_interface::interface_post_start() { // iterate over all the sound devices for (device_sound_interface &sound : sound_interface_iterator(m_device.machine().root_device())) { // scan each route on the device for (sound_route const &route : sound.routes()) { // if we are the target of this route, hook it up device_t *const target_device = route.m_base.get().subdevice(route.m_target.c_str()); if (target_device == &m_device) { // iterate over all outputs, matching any that apply int inputnum = route.m_input; int const numoutputs = sound.outputs(); for (int outputnum = 0; outputnum < numoutputs; outputnum++) if ((route.m_output == outputnum) || (route.m_output == ALL_OUTPUTS)) { // find the output stream to connect from int streamoutputnum; sound_stream *const outputstream = sound.output_to_stream_output(outputnum, streamoutputnum); if (!outputstream) fatalerror("Sound device '%s' specifies route for nonexistent output #%d\n", sound.device().tag(), outputnum); // find the input stream to connect to int streaminputnum; sound_stream *const inputstream = input_to_stream_input(inputnum++, streaminputnum); if (!inputstream) fatalerror("Sound device '%s' targeted output #%d to nonexistent device '%s' input %d\n", sound.device().tag(), outputnum, m_device.tag(), inputnum - 1); // set the input inputstream->set_input(streaminputnum, outputstream, streamoutputnum, route.m_gain); } } } } }
float device_sound_interface::input_gain(int inputnum) const { int stream_inputnum; sound_stream *stream = input_to_stream_input(inputnum, stream_inputnum); return (stream != nullptr) ? stream->input_gain(stream_inputnum) : 0.0f; }