Make all items connected to mixer inputs available in the UI, not just items

connected to speakers.
This commit is contained in:
Aaron Giles 2012-02-28 09:21:05 +00:00
parent da9745a54c
commit 9465d7393d
4 changed files with 29 additions and 27 deletions

View File

@ -176,5 +176,8 @@ protected:
sound_stream * m_mixer_stream; // mixing stream
};
// iterator
typedef device_interface_iterator<device_mixer_interface> mixer_interface_iterator;
#endif /* __DISOUND_H__ */

View File

@ -786,10 +786,10 @@ sound_manager::sound_manager(running_machine &machine)
if (m_nosound_mode && wavfile[0] == 0 && avifile[0] == 0)
machine.m_sample_rate = 11025;
// count the speakers
// count the mixers
#if VERBOSE
speaker_device_iterator iter(machine.root_device());
VPRINTF(("total speakers = %d\n", iter.count()));
mixer_interface_iterator iter(machine.root_device());
VPRINTF(("total mixers = %d\n", iter.count()));
#endif
// allocate memory for mix buffers
@ -856,24 +856,24 @@ void sound_manager::set_attenuation(int attenuation)
//-------------------------------------------------
// indexed_speaker_input - return the speaker
// device and input index of the global speaker
// indexed_mixer_input - return the mixer
// device and input index of the global mixer
// input
//-------------------------------------------------
bool sound_manager::indexed_speaker_input(int index, speaker_input &info) const
bool sound_manager::indexed_mixer_input(int index, mixer_input &info) const
{
// scan through the speakers until we find the indexed input
speaker_device_iterator iter(machine().root_device());
for (info.speaker = iter.first(); info.speaker != NULL; info.speaker = iter.next())
// scan through the mixers until we find the indexed input
mixer_interface_iterator iter(machine().root_device());
for (info.mixer = iter.first(); info.mixer != NULL; info.mixer = iter.next())
{
if (index < info.speaker->inputs())
if (index < info.mixer->inputs())
{
info.stream = info.speaker->input_to_stream_input(index, info.inputnum);
info.stream = info.mixer->input_to_stream_input(index, info.inputnum);
assert(info.stream != NULL);
return true;
}
index -= info.speaker->inputs();
index -= info.mixer->inputs();
}
// didn't locate
@ -946,8 +946,8 @@ void sound_manager::config_load(int config_type, xml_data_node *parentnode)
// iterate over channel nodes
for (xml_data_node *channelnode = xml_get_sibling(parentnode->child, "channel"); channelnode != NULL; channelnode = xml_get_sibling(channelnode->next, "channel"))
{
speaker_input info;
if (indexed_speaker_input(xml_get_attribute_int(channelnode, "index", -1), info))
mixer_input info;
if (indexed_mixer_input(xml_get_attribute_int(channelnode, "index", -1), info))
{
float defvol = xml_get_attribute_float(channelnode, "defvol", -1000.0);
float newvol = xml_get_attribute_float(channelnode, "newvol", -1000.0);
@ -973,8 +973,8 @@ void sound_manager::config_save(int config_type, xml_data_node *parentnode)
if (parentnode != NULL)
for (int mixernum = 0; ; mixernum++)
{
speaker_input info;
if (!indexed_speaker_input(mixernum, info))
mixer_input info;
if (!indexed_mixer_input(mixernum, info))
break;
float defvol = info.stream->initial_input_gain(info.inputnum);
float newvol = info.stream->input_gain(info.inputnum);

View File

@ -60,16 +60,15 @@
//**************************************************************************
// forward references
class speaker_device;
typedef struct _wav_file wav_file;
// structure describing an indexed speaker
struct speaker_input
// structure describing an indexed mixer
struct mixer_input
{
speaker_device * speaker; // owning device
sound_stream * stream; // stream within the device
int inputnum; // input on the stream
device_mixer_interface *mixer; // owning device interface
sound_stream * stream; // stream within the device
int inputnum; // input on the stream
};
@ -237,7 +236,7 @@ public:
void system_enable(bool turn_on = true) { mute(!turn_on, MUTE_REASON_SYSTEM); }
// user gain controls
bool indexed_speaker_input(int index, speaker_input &info) const;
bool indexed_mixer_input(int index, mixer_input &info) const;
private:
// internal helpers

View File

@ -1654,8 +1654,8 @@ static slider_state *slider_init(running_machine &machine)
tailptr = &(*tailptr)->next;
/* add per-channel volume */
speaker_input info;
for (item = 0; machine.sound().indexed_speaker_input(item, info); item++)
mixer_input info;
for (item = 0; machine.sound().indexed_mixer_input(item, info); item++)
{
INT32 maxval = 2000;
INT32 defval = info.stream->initial_input_gain(info.inputnum) * 1000.0f + 0.5f;
@ -1815,8 +1815,8 @@ static INT32 slider_volume(running_machine &machine, void *arg, astring *string,
static INT32 slider_mixervol(running_machine &machine, void *arg, astring *string, INT32 newval)
{
speaker_input info;
if (!machine.sound().indexed_speaker_input((FPTR)arg, info))
mixer_input info;
if (!machine.sound().indexed_mixer_input((FPTR)arg, info))
return 0;
if (newval != SLIDER_NOCHANGE)
{