diff options
Diffstat (limited to 'src/emu/sound.cpp')
-rw-r--r-- | src/emu/sound.cpp | 46 |
1 files changed, 22 insertions, 24 deletions
diff --git a/src/emu/sound.cpp b/src/emu/sound.cpp index 9e970b8fd52..8260762d1f8 100644 --- a/src/emu/sound.cpp +++ b/src/emu/sound.cpp @@ -1090,7 +1090,10 @@ sound_manager::sound_manager(running_machine &machine) : #endif // register callbacks - machine.configuration().config_register("mixer", config_load_delegate(&sound_manager::config_load, this), config_save_delegate(&sound_manager::config_save, this)); + machine.configuration().config_register( + "mixer", + configuration_manager::load_delegate(&sound_manager::config_load, this), + configuration_manager::save_delegate(&sound_manager::config_save, this)); machine.add_notifier(MACHINE_NOTIFY_PAUSE, machine_notify_delegate(&sound_manager::pause, this)); machine.add_notifier(MACHINE_NOTIFY_RESUME, machine_notify_delegate(&sound_manager::resume, this)); machine.add_notifier(MACHINE_NOTIFY_RESET, machine_notify_delegate(&sound_manager::reset, this)); @@ -1356,14 +1359,10 @@ void sound_manager::resume() // configuration file //------------------------------------------------- -void sound_manager::config_load(config_type cfg_type, util::xml::data_node const *parentnode) +void sound_manager::config_load(config_type cfg_type, config_level cfg_level, util::xml::data_node const *parentnode) { - // we only care about game files - if (cfg_type != config_type::GAME) - return; - - // might not have any data - if (parentnode == nullptr) + // we only care system-specific configuration + if ((cfg_type != config_type::SYSTEM) || !parentnode) return; // iterate over channel nodes @@ -1388,29 +1387,28 @@ void sound_manager::config_load(config_type cfg_type, util::xml::data_node const void sound_manager::config_save(config_type cfg_type, util::xml::data_node *parentnode) { - // we only care about game files - if (cfg_type != config_type::GAME) + // we only save system-specific configuration + if (cfg_type != config_type::SYSTEM) return; // iterate over mixer channels - if (parentnode != nullptr) - for (int mixernum = 0; ; mixernum++) - { - mixer_input info; - if (!indexed_mixer_input(mixernum, info)) - break; - float newvol = info.stream->input(info.inputnum).user_gain(); + for (int mixernum = 0; ; mixernum++) + { + mixer_input info; + if (!indexed_mixer_input(mixernum, info)) + break; - if (newvol != 1.0f) + float const newvol = info.stream->input(info.inputnum).user_gain(); + if (newvol != 1.0f) + { + util::xml::data_node *const channelnode = parentnode->add_child("channel", nullptr); + if (channelnode) { - util::xml::data_node *const channelnode = parentnode->add_child("channel", nullptr); - if (channelnode != nullptr) - { - channelnode->set_attribute_int("index", mixernum); - channelnode->set_attribute_float("newvol", newvol); - } + channelnode->set_attribute_int("index", mixernum); + channelnode->set_attribute_float("newvol", newvol); } } + } } |