Beispiel #1
0
static void route_sound(running_machine *machine)
{
	/* iterate again over all the sound chips */
	device_sound_interface *sound = NULL;
	for (bool gotone = machine->m_devicelist.first(sound); gotone; gotone = sound->next(sound))
	{
		int numoutputs = stream_get_device_outputs(*sound);

		/* iterate over all routes */
		for (const device_config_sound_interface::sound_route *route = sound->sound_config().m_route_list; route != NULL; route = route->m_next)
		{
			device_t *target_device = machine->device(route->m_target);
			if (target_device->type() == SPEAKER)
				continue;

			int inputnum = route->m_input;

			/* iterate over all outputs, matching any that apply */
			for (int outputnum = 0; outputnum < numoutputs; outputnum++)
				if (route->m_output == outputnum || route->m_output == ALL_OUTPUTS)
				{
					sound_stream *inputstream, *stream;
					int streaminput, streamoutput;

					if (stream_device_input_to_stream_input(target_device, inputnum++, &inputstream, &streaminput))
						if (stream_device_output_to_stream_output(*sound, outputnum, &stream, &streamoutput))
							stream_set_input(inputstream, streaminput, stream, streamoutput, route->m_gain);
				}
		}
	}
}
Beispiel #2
0
void device_sound_interface::interface_post_start()
{
	// count the outputs
	for (int outputnum = 0; outputnum < MAX_OUTPUTS; outputnum++)
	{
		// stop when we run out of streams
		sound_stream *stream = stream_find_by_device(&m_device, outputnum);
		if (stream == NULL)
			break;

		// accumulate the number of outputs from this stream
		int numoutputs = stream_get_outputs(stream);
		assert(m_outputs + numoutputs < MAX_OUTPUTS);

		// fill in the array
		for (int curoutput = 0; curoutput < numoutputs; curoutput++)
		{
			sound_output *output = &m_output[m_outputs++];
			output->stream = stream;
			output->output = curoutput;
		}
	}

	// iterate over all the sound devices
	device_sound_interface *sound = NULL;
	for (bool gotone = m_device.machine->m_devicelist.first(sound); gotone; gotone = sound->next(sound))
	{
		// scan each route on the device
		for (const device_config_sound_interface::sound_route *route = sound->sound_config().m_route_list; route != NULL; route = route->m_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 = stream_get_device_outputs(*sound);
				for (int outputnum = 0; outputnum < numoutputs; outputnum++)
					if (route->m_output == outputnum || route->m_output == ALL_OUTPUTS)
					{
						sound_stream *inputstream, *stream;
						int streaminput, streamoutput;

						// get the input and output streams and wire them together
						if (stream_device_input_to_stream_input(target_device, inputnum++, &inputstream, &streaminput))
							if (stream_device_output_to_stream_output(*sound, outputnum, &stream, &streamoutput))
								stream_set_input(inputstream, streaminput, stream, streamoutput, route->m_gain);
					}
			}
		}
	}
}