summaryrefslogtreecommitdiffstatshomepage
diff options
context:
space:
mode:
author hap <happppp@users.noreply.github.com>2025-07-10 20:39:06 +0200
committer hap <happppp@users.noreply.github.com>2025-07-10 20:39:16 +0200
commit56c6e0079810e839c2e32e61e1a7db04564094d6 (patch)
tree9b64676d9e0b27c466fedf93d6d44937463448da
parent20050d94189286d8dc9c3b02eb99468808c98b0a (diff)
(emu.h) sound: use emplace instead of emplace_back when reconfiguring mapping
-rw-r--r--src/emu/sound.cpp36
-rw-r--r--src/emu/sound.h17
-rw-r--r--src/frontend/mame/ui/audiomix.cpp82
-rw-r--r--src/frontend/mame/ui/audiomix.h15
4 files changed, 90 insertions, 60 deletions
diff --git a/src/emu/sound.cpp b/src/emu/sound.cpp
index b291fffbcd5..bebfa1e10a8 100644
--- a/src/emu/sound.cpp
+++ b/src/emu/sound.cpp
@@ -1482,36 +1482,38 @@ sound_manager::config_mapping &sound_manager::config_get_sound_io(sound_io_devic
return m_configs.back();
}
-void sound_manager::config_add_sound_io_connection_node(sound_io_device *dev, std::string_view name, float db)
+void sound_manager::config_add_sound_io_connection_node(sound_io_device *dev, std::string_view name, float db, int index)
{
- internal_config_add_sound_io_connection_node(dev, name, db);
+ internal_config_add_sound_io_connection_node(dev, name, db, index);
m_osd_info.m_generation --;
mapping_update();
}
-void sound_manager::internal_config_add_sound_io_connection_node(sound_io_device *dev, std::string_view name, float db)
+void sound_manager::internal_config_add_sound_io_connection_node(sound_io_device *dev, std::string_view name, float db, int index)
{
auto &config = config_get_sound_io(dev);
for(auto &nmap : config.m_node_mappings)
if(nmap.first == name)
return;
- config.m_node_mappings.emplace_back(name, db);
+ auto it = config.m_node_mappings.begin() + ((index < 0 || index > config.m_node_mappings.size()) ? config.m_node_mappings.size() : index);
+ config.m_node_mappings.emplace(it, name, db);
}
-void sound_manager::config_add_sound_io_connection_default(sound_io_device *dev, float db)
+void sound_manager::config_add_sound_io_connection_default(sound_io_device *dev, float db, int index)
{
- internal_config_add_sound_io_connection_default(dev, db);
+ internal_config_add_sound_io_connection_default(dev, db, index);
m_osd_info.m_generation --;
mapping_update();
}
-void sound_manager::internal_config_add_sound_io_connection_default(sound_io_device *dev, float db)
+void sound_manager::internal_config_add_sound_io_connection_default(sound_io_device *dev, float db, int index)
{
auto &config = config_get_sound_io(dev);
for(auto &nmap : config.m_node_mappings)
if(nmap.first == "")
return;
- config.m_node_mappings.emplace_back("", db);
+ auto it = config.m_node_mappings.begin() + ((index < 0 || index > config.m_node_mappings.size()) ? config.m_node_mappings.size() : index);
+ config.m_node_mappings.emplace(it, "", db);
}
void sound_manager::config_remove_sound_io_connection_node(sound_io_device *dev, std::string_view name)
@@ -1583,36 +1585,38 @@ void sound_manager::internal_config_set_volume_sound_io_connection_default(sound
}
-void sound_manager::config_add_sound_io_channel_connection_node(sound_io_device *dev, u32 guest_channel, std::string_view name, u32 node_channel, float db)
+void sound_manager::config_add_sound_io_channel_connection_node(sound_io_device *dev, u32 guest_channel, std::string_view name, u32 node_channel, float db, int index)
{
- internal_config_add_sound_io_channel_connection_node(dev, guest_channel, name, node_channel, db);
+ internal_config_add_sound_io_channel_connection_node(dev, guest_channel, name, node_channel, db, index);
m_osd_info.m_generation --;
mapping_update();
}
-void sound_manager::internal_config_add_sound_io_channel_connection_node(sound_io_device *dev, u32 guest_channel, std::string_view name, u32 node_channel, float db)
+void sound_manager::internal_config_add_sound_io_channel_connection_node(sound_io_device *dev, u32 guest_channel, std::string_view name, u32 node_channel, float db, int index)
{
auto &config = config_get_sound_io(dev);
for(auto &cmap : config.m_channel_mappings)
if(std::get<0>(cmap) == guest_channel && std::get<1>(cmap) == name && std::get<2>(cmap) == node_channel)
return;
- config.m_channel_mappings.emplace_back(guest_channel, name, node_channel, db);
+ auto it = config.m_channel_mappings.begin() + ((index < 0 || index > config.m_channel_mappings.size()) ? config.m_channel_mappings.size() : index);
+ config.m_channel_mappings.emplace(it, guest_channel, name, node_channel, db);
}
-void sound_manager::config_add_sound_io_channel_connection_default(sound_io_device *dev, u32 guest_channel, u32 node_channel, float db)
+void sound_manager::config_add_sound_io_channel_connection_default(sound_io_device *dev, u32 guest_channel, u32 node_channel, float db, int index)
{
- internal_config_add_sound_io_channel_connection_default(dev, guest_channel, node_channel, db);
+ internal_config_add_sound_io_channel_connection_default(dev, guest_channel, node_channel, db, index);
m_osd_info.m_generation --;
mapping_update();
}
-void sound_manager::internal_config_add_sound_io_channel_connection_default(sound_io_device *dev, u32 guest_channel, u32 node_channel, float db)
+void sound_manager::internal_config_add_sound_io_channel_connection_default(sound_io_device *dev, u32 guest_channel, u32 node_channel, float db, int index)
{
auto &config = config_get_sound_io(dev);
for(auto &cmap : config.m_channel_mappings)
if(std::get<0>(cmap) == guest_channel && std::get<1>(cmap) == "" && std::get<2>(cmap) == node_channel)
return;
- config.m_channel_mappings.emplace_back(guest_channel, "", node_channel, db);
+ auto it = config.m_channel_mappings.begin() + ((index < 0 || index > config.m_channel_mappings.size()) ? config.m_channel_mappings.size() : index);
+ config.m_channel_mappings.emplace(it, guest_channel, "", node_channel, db);
}
void sound_manager::config_remove_sound_io_channel_connection_node(sound_io_device *dev, u32 guest_channel, std::string_view name, u32 node_channel)
diff --git a/src/emu/sound.h b/src/emu/sound.h
index 6c7bac5ea4b..51865272ba7 100644
--- a/src/emu/sound.h
+++ b/src/emu/sound.h
@@ -423,14 +423,14 @@ public:
u32 outputs_count() const { return m_outputs_count; }
// manage the sound_io mapping and volume configuration
- void config_add_sound_io_connection_node(sound_io_device *dev, std::string_view name, float db);
- void config_add_sound_io_connection_default(sound_io_device *dev, float db);
+ void config_add_sound_io_connection_node(sound_io_device *dev, std::string_view name, float db, int index = -1);
+ void config_add_sound_io_connection_default(sound_io_device *dev, float db, int index = -1);
void config_remove_sound_io_connection_node(sound_io_device *dev, std::string_view name);
void config_remove_sound_io_connection_default(sound_io_device *dev);
void config_set_volume_sound_io_connection_node(sound_io_device *dev, std::string_view name, float db);
void config_set_volume_sound_io_connection_default(sound_io_device *dev, float db);
- void config_add_sound_io_channel_connection_node(sound_io_device *dev, u32 guest_channel, std::string_view name, u32 node_channel, float db);
- void config_add_sound_io_channel_connection_default(sound_io_device *dev, u32 guest_channel, u32 node_channel, float db);
+ void config_add_sound_io_channel_connection_node(sound_io_device *dev, u32 guest_channel, std::string_view name, u32 node_channel, float db, int index = -1);
+ void config_add_sound_io_channel_connection_default(sound_io_device *dev, u32 guest_channel, u32 node_channel, float db, int index = -1);
void config_remove_sound_io_channel_connection_node(sound_io_device *dev, u32 guest_channel, std::string_view name, u32 node_channel);
void config_remove_sound_io_channel_connection_default(sound_io_device *dev, u32 guest_channel, u32 node_channel);
void config_set_volume_sound_io_channel_connection_node(sound_io_device *dev, u32 guest_channel, std::string_view name, u32 node_channel, float db);
@@ -611,16 +611,15 @@ private:
// manage the sound_io mapping and volume configuration,
// but don't change generation because we're in the update process
-
config_mapping &config_get_sound_io(sound_io_device *dev);
- void internal_config_add_sound_io_connection_node(sound_io_device *dev, std::string_view name, float db);
- void internal_config_add_sound_io_connection_default(sound_io_device *dev, float db);
+ void internal_config_add_sound_io_connection_node(sound_io_device *dev, std::string_view name, float db, int index = -1);
+ void internal_config_add_sound_io_connection_default(sound_io_device *dev, float db, int index = -1);
void internal_config_remove_sound_io_connection_node(sound_io_device *dev, std::string_view name);
void internal_config_remove_sound_io_connection_default(sound_io_device *dev);
void internal_config_set_volume_sound_io_connection_node(sound_io_device *dev, std::string_view name, float db);
void internal_config_set_volume_sound_io_connection_default(sound_io_device *dev, float db);
- void internal_config_add_sound_io_channel_connection_node(sound_io_device *dev, u32 guest_channel, std::string_view name, u32 node_channel, float db);
- void internal_config_add_sound_io_channel_connection_default(sound_io_device *dev, u32 guest_channel, u32 node_channel, float db);
+ void internal_config_add_sound_io_channel_connection_node(sound_io_device *dev, u32 guest_channel, std::string_view name, u32 node_channel, float db, int index = -1);
+ void internal_config_add_sound_io_channel_connection_default(sound_io_device *dev, u32 guest_channel, u32 node_channel, float db, int index = -1);
void internal_config_remove_sound_io_channel_connection_node(sound_io_device *dev, u32 guest_channel, std::string_view name, u32 node_channel);
void internal_config_remove_sound_io_channel_connection_default(sound_io_device *dev, u32 guest_channel, u32 node_channel);
void internal_config_set_volume_sound_io_channel_connection_node(sound_io_device *dev, u32 guest_channel, std::string_view name, u32 node_channel, float db);
diff --git a/src/frontend/mame/ui/audiomix.cpp b/src/frontend/mame/ui/audiomix.cpp
index 421398b0751..f019a30e7b7 100644
--- a/src/frontend/mame/ui/audiomix.cpp
+++ b/src/frontend/mame/ui/audiomix.cpp
@@ -138,7 +138,7 @@ bool menu_audio_mixer::handle(event const *ev)
switch(current_item) {
case ITM_REMOVE:
- return remove_route(current_item - 1, *current_selection);
+ return remove_route(item_num - 1, *current_selection);
case ITM_ADD_FULL:
return add_full(*current_selection);
@@ -165,13 +165,13 @@ bool menu_audio_mixer::handle(event const *ev)
switch(current_item) {
case ITM_GUEST_CHANNEL:
- return set_prev_guest_channel(*current_selection);
+ return set_prev_guest_channel(item_num - 1, *current_selection);
case ITM_NODE:
- return set_prev_node(*current_selection);
+ return set_prev_node(item_num - 1, *current_selection);
case ITM_NODE_CHANNEL:
- return set_prev_node_channel(*current_selection);
+ return set_prev_node_channel(item_num - 1, *current_selection);
case ITM_DB:
if(shift_pressed) {
@@ -197,13 +197,13 @@ bool menu_audio_mixer::handle(event const *ev)
switch(current_item) {
case ITM_GUEST_CHANNEL:
- return set_next_guest_channel(*current_selection);
+ return set_next_guest_channel(item_num - 1, *current_selection);
case ITM_NODE:
- return set_next_node(*current_selection);
+ return set_next_node(item_num - 1, *current_selection);
case ITM_NODE_CHANNEL:
- return set_next_node_channel(*current_selection);
+ return set_next_node_channel(item_num - 1, *current_selection);
case ITM_DB:
if(shift_pressed) {
@@ -350,7 +350,7 @@ bool menu_audio_mixer::remove_route(uint32_t cursel_index, select_entry &current
}
-bool menu_audio_mixer::set_prev_guest_channel(select_entry &current_selection)
+bool menu_audio_mixer::set_prev_guest_channel(uint32_t cursel_index, select_entry &current_selection)
{
if(current_selection.m_maptype != MT_CHANNEL)
return false;
@@ -368,13 +368,14 @@ bool menu_audio_mixer::set_prev_guest_channel(select_entry &current_selection)
if(guest_channel == current_selection.m_guest_channel)
return false;
if(channel_mapping_available(current_selection.m_dev, guest_channel, current_selection.m_node, current_selection.m_node_channel)) {
+ cursel_index -= find_first_channel_mapping_selection(current_selection.m_dev);
if(current_selection.m_node) {
const auto node = find_node_name(current_selection.m_node);
machine().sound().config_remove_sound_io_channel_connection_node(current_selection.m_dev, current_selection.m_guest_channel, node, current_selection.m_node_channel);
- machine().sound().config_add_sound_io_channel_connection_node(current_selection.m_dev, guest_channel, node, current_selection.m_node_channel, current_selection.m_db);
+ machine().sound().config_add_sound_io_channel_connection_node(current_selection.m_dev, guest_channel, node, current_selection.m_node_channel, current_selection.m_db, cursel_index);
} else {
machine().sound().config_remove_sound_io_channel_connection_default(current_selection.m_dev, current_selection.m_guest_channel, current_selection.m_node_channel);
- machine().sound().config_add_sound_io_channel_connection_default(current_selection.m_dev, guest_channel, current_selection.m_node_channel, current_selection.m_db);
+ machine().sound().config_add_sound_io_channel_connection_default(current_selection.m_dev, guest_channel, current_selection.m_node_channel, current_selection.m_db, cursel_index);
}
m_reset_selection.m_maptype = MT_INTERNAL;
reset(reset_options::REMEMBER_POSITION);
@@ -386,7 +387,7 @@ bool menu_audio_mixer::set_prev_guest_channel(select_entry &current_selection)
}
-bool menu_audio_mixer::set_next_guest_channel(select_entry &current_selection)
+bool menu_audio_mixer::set_next_guest_channel(uint32_t cursel_index, select_entry &current_selection)
{
if(current_selection.m_maptype != MT_CHANNEL)
return false;
@@ -403,13 +404,14 @@ bool menu_audio_mixer::set_next_guest_channel(select_entry &current_selection)
if(guest_channel == current_selection.m_guest_channel)
return false;
if(channel_mapping_available(current_selection.m_dev, guest_channel, current_selection.m_node, current_selection.m_node_channel)) {
+ cursel_index -= find_first_channel_mapping_selection(current_selection.m_dev);
if(current_selection.m_node) {
const auto node = find_node_name(current_selection.m_node);
machine().sound().config_remove_sound_io_channel_connection_node(current_selection.m_dev, current_selection.m_guest_channel, node, current_selection.m_node_channel);
- machine().sound().config_add_sound_io_channel_connection_node(current_selection.m_dev, guest_channel, node, current_selection.m_node_channel, current_selection.m_db);
+ machine().sound().config_add_sound_io_channel_connection_node(current_selection.m_dev, guest_channel, node, current_selection.m_node_channel, current_selection.m_db, cursel_index);
} else {
machine().sound().config_remove_sound_io_channel_connection_default(current_selection.m_dev, current_selection.m_guest_channel, current_selection.m_node_channel);
- machine().sound().config_add_sound_io_channel_connection_default(current_selection.m_dev, guest_channel, current_selection.m_node_channel, current_selection.m_db);
+ machine().sound().config_add_sound_io_channel_connection_default(current_selection.m_dev, guest_channel, current_selection.m_node_channel, current_selection.m_db, cursel_index);
}
m_reset_selection.m_maptype = MT_INTERNAL;
reset(reset_options::REMEMBER_POSITION);
@@ -421,20 +423,21 @@ bool menu_audio_mixer::set_next_guest_channel(select_entry &current_selection)
}
-bool menu_audio_mixer::set_prev_node(select_entry &current_selection)
+bool menu_audio_mixer::set_prev_node(uint32_t cursel_index, select_entry &current_selection)
{
if(current_selection.m_maptype == MT_FULL) {
const uint32_t prev_node = current_selection.m_node;
const uint32_t next_node = find_previous_available_node(current_selection.m_dev, prev_node);
if(next_node != 0xffffffff) {
+ cursel_index -= find_first_full_mapping_selection(current_selection.m_dev);
if(prev_node)
machine().sound().config_remove_sound_io_connection_node(current_selection.m_dev, find_node_name(prev_node));
else
machine().sound().config_remove_sound_io_connection_default(current_selection.m_dev);
if(next_node)
- machine().sound().config_add_sound_io_connection_node(current_selection.m_dev, find_node_name(next_node), current_selection.m_db);
+ machine().sound().config_add_sound_io_connection_node(current_selection.m_dev, find_node_name(next_node), current_selection.m_db, cursel_index);
else
- machine().sound().config_add_sound_io_connection_default(current_selection.m_dev, current_selection.m_db);
+ machine().sound().config_add_sound_io_connection_default(current_selection.m_dev, current_selection.m_db, cursel_index);
m_reset_selection.m_maptype = MT_INTERNAL;
reset(reset_options::REMEMBER_POSITION);
return true;
@@ -443,14 +446,15 @@ bool menu_audio_mixer::set_prev_node(select_entry &current_selection)
const uint32_t prev_node = current_selection.m_node;
const uint32_t next_node = find_previous_available_channel_node(current_selection.m_dev, current_selection.m_guest_channel, prev_node, current_selection.m_node_channel);
if(next_node != 0xffffffff) {
+ cursel_index -= find_first_channel_mapping_selection(current_selection.m_dev);
if(prev_node)
machine().sound().config_remove_sound_io_channel_connection_node(current_selection.m_dev, current_selection.m_guest_channel, find_node_name(prev_node), current_selection.m_node_channel);
else
machine().sound().config_remove_sound_io_channel_connection_default(current_selection.m_dev, current_selection.m_guest_channel, current_selection.m_node_channel);
if(next_node)
- machine().sound().config_add_sound_io_channel_connection_node(current_selection.m_dev, current_selection.m_guest_channel, find_node_name(next_node), current_selection.m_node_channel, current_selection.m_db);
+ machine().sound().config_add_sound_io_channel_connection_node(current_selection.m_dev, current_selection.m_guest_channel, find_node_name(next_node), current_selection.m_node_channel, current_selection.m_db, cursel_index);
else
- machine().sound().config_add_sound_io_channel_connection_default(current_selection.m_dev, current_selection.m_guest_channel, current_selection.m_node_channel, current_selection.m_db);
+ machine().sound().config_add_sound_io_channel_connection_default(current_selection.m_dev, current_selection.m_guest_channel, current_selection.m_node_channel, current_selection.m_db, cursel_index);
m_reset_selection.m_maptype = MT_INTERNAL;
reset(reset_options::REMEMBER_POSITION);
return true;
@@ -461,21 +465,22 @@ bool menu_audio_mixer::set_prev_node(select_entry &current_selection)
}
-bool menu_audio_mixer::set_next_node(select_entry &current_selection)
+bool menu_audio_mixer::set_next_node(uint32_t cursel_index, select_entry &current_selection)
{
if(current_selection.m_maptype == MT_FULL) {
const uint32_t prev_node = current_selection.m_node;
const uint32_t next_node = find_next_available_node(current_selection.m_dev, prev_node);
if(next_node != 0xffffffff) {
+ cursel_index -= find_first_full_mapping_selection(current_selection.m_dev);
current_selection.m_node = next_node;
if(prev_node)
machine().sound().config_remove_sound_io_connection_node(current_selection.m_dev, find_node_name(prev_node));
else
machine().sound().config_remove_sound_io_connection_default(current_selection.m_dev);
if(next_node)
- machine().sound().config_add_sound_io_connection_node(current_selection.m_dev, find_node_name(next_node), current_selection.m_db);
+ machine().sound().config_add_sound_io_connection_node(current_selection.m_dev, find_node_name(next_node), current_selection.m_db, cursel_index);
else
- machine().sound().config_add_sound_io_connection_default(current_selection.m_dev, current_selection.m_db);
+ machine().sound().config_add_sound_io_connection_default(current_selection.m_dev, current_selection.m_db, cursel_index);
m_reset_selection.m_maptype = MT_INTERNAL;
reset(reset_options::REMEMBER_POSITION);
return true;
@@ -484,15 +489,16 @@ bool menu_audio_mixer::set_next_node(select_entry &current_selection)
const uint32_t prev_node = current_selection.m_node;
const uint32_t next_node = find_next_available_channel_node(current_selection.m_dev, current_selection.m_guest_channel, prev_node, current_selection.m_node_channel);
if(next_node != 0xffffffff) {
+ cursel_index -= find_first_channel_mapping_selection(current_selection.m_dev);
current_selection.m_node = next_node;
if(prev_node)
machine().sound().config_remove_sound_io_channel_connection_node(current_selection.m_dev, current_selection.m_guest_channel, find_node_name(prev_node), current_selection.m_node_channel);
else
machine().sound().config_remove_sound_io_channel_connection_default(current_selection.m_dev, current_selection.m_guest_channel, current_selection.m_node_channel);
if(next_node)
- machine().sound().config_add_sound_io_channel_connection_node(current_selection.m_dev, current_selection.m_guest_channel, find_node_name(next_node), current_selection.m_node_channel, current_selection.m_db);
+ machine().sound().config_add_sound_io_channel_connection_node(current_selection.m_dev, current_selection.m_guest_channel, find_node_name(next_node), current_selection.m_node_channel, current_selection.m_db, cursel_index);
else
- machine().sound().config_add_sound_io_channel_connection_default(current_selection.m_dev, current_selection.m_guest_channel, current_selection.m_node_channel, current_selection.m_db);
+ machine().sound().config_add_sound_io_channel_connection_default(current_selection.m_dev, current_selection.m_guest_channel, current_selection.m_node_channel, current_selection.m_db, cursel_index);
m_reset_selection.m_maptype = MT_INTERNAL;
reset(reset_options::REMEMBER_POSITION);
return true;
@@ -503,7 +509,7 @@ bool menu_audio_mixer::set_next_node(select_entry &current_selection)
}
-bool menu_audio_mixer::set_prev_node_channel(select_entry &current_selection)
+bool menu_audio_mixer::set_prev_node_channel(uint32_t cursel_index, select_entry &current_selection)
{
if(current_selection.m_maptype != MT_CHANNEL)
return false;
@@ -521,13 +527,14 @@ bool menu_audio_mixer::set_prev_node_channel(select_entry &current_selection)
if(node_channel == current_selection.m_node_channel)
return false;
if(channel_mapping_available(current_selection.m_dev, current_selection.m_guest_channel, current_selection.m_node, node_channel)) {
+ cursel_index -= find_first_channel_mapping_selection(current_selection.m_dev);
if(current_selection.m_node) {
const auto node = find_node_name(current_selection.m_node);
machine().sound().config_remove_sound_io_channel_connection_node(current_selection.m_dev, current_selection.m_guest_channel, node, current_selection.m_node_channel);
- machine().sound().config_add_sound_io_channel_connection_node(current_selection.m_dev, current_selection.m_guest_channel, node, node_channel, current_selection.m_db);
+ machine().sound().config_add_sound_io_channel_connection_node(current_selection.m_dev, current_selection.m_guest_channel, node, node_channel, current_selection.m_db, cursel_index);
} else {
machine().sound().config_remove_sound_io_channel_connection_default(current_selection.m_dev, current_selection.m_guest_channel, current_selection.m_node_channel);
- machine().sound().config_add_sound_io_channel_connection_default(current_selection.m_dev, current_selection.m_guest_channel, node_channel, current_selection.m_db);
+ machine().sound().config_add_sound_io_channel_connection_default(current_selection.m_dev, current_selection.m_guest_channel, node_channel, current_selection.m_db, cursel_index);
}
m_reset_selection.m_maptype = MT_INTERNAL;
reset(reset_options::REMEMBER_POSITION);
@@ -539,7 +546,7 @@ bool menu_audio_mixer::set_prev_node_channel(select_entry &current_selection)
}
-bool menu_audio_mixer::set_next_node_channel(select_entry &current_selection)
+bool menu_audio_mixer::set_next_node_channel(uint32_t cursel_index, select_entry &current_selection)
{
if(current_selection.m_maptype != MT_CHANNEL)
return false;
@@ -556,13 +563,14 @@ bool menu_audio_mixer::set_next_node_channel(select_entry &current_selection)
if(node_channel == current_selection.m_node_channel)
return false;
if(channel_mapping_available(current_selection.m_dev, current_selection.m_guest_channel, current_selection.m_node, node_channel)) {
+ cursel_index -= find_first_channel_mapping_selection(current_selection.m_dev);
if(current_selection.m_node) {
const auto node = find_node_name(current_selection.m_node);
machine().sound().config_remove_sound_io_channel_connection_node(current_selection.m_dev, current_selection.m_guest_channel, node, current_selection.m_node_channel);
- machine().sound().config_add_sound_io_channel_connection_node(current_selection.m_dev, current_selection.m_guest_channel, node, node_channel, current_selection.m_db);
+ machine().sound().config_add_sound_io_channel_connection_node(current_selection.m_dev, current_selection.m_guest_channel, node, node_channel, current_selection.m_db, cursel_index);
} else {
machine().sound().config_remove_sound_io_channel_connection_default(current_selection.m_dev, current_selection.m_guest_channel, current_selection.m_node_channel);
- machine().sound().config_add_sound_io_channel_connection_default(current_selection.m_dev, current_selection.m_guest_channel, node_channel, current_selection.m_db);
+ machine().sound().config_add_sound_io_channel_connection_default(current_selection.m_dev, current_selection.m_guest_channel, node_channel, current_selection.m_db, cursel_index);
}
m_reset_selection.m_maptype = MT_INTERNAL;
reset(reset_options::REMEMBER_POSITION);
@@ -1178,5 +1186,21 @@ uint32_t menu_audio_mixer::find_previous_available_channel_node(sound_io_device
}
}
+uint32_t menu_audio_mixer::find_first_full_mapping_selection(sound_io_device *dev) const
+{
+ for(uint32_t i = 0; i != m_selections.size(); i++)
+ if(m_selections[i].m_dev == dev && m_selections[i].m_maptype == MT_FULL)
+ return i;
+ return 0xffffffff;
+}
+
+uint32_t menu_audio_mixer::find_first_channel_mapping_selection(sound_io_device *dev) const
+{
+ for(uint32_t i = 0; i != m_selections.size(); i++)
+ if(m_selections[i].m_dev == dev && m_selections[i].m_maptype == MT_CHANNEL)
+ return i;
+ return 0xffffffff;
+}
+
} // namespace ui
diff --git a/src/frontend/mame/ui/audiomix.h b/src/frontend/mame/ui/audiomix.h
index 3159a1df1b3..54ed657ee17 100644
--- a/src/frontend/mame/ui/audiomix.h
+++ b/src/frontend/mame/ui/audiomix.h
@@ -61,12 +61,12 @@ private:
bool add_full(select_entry &current_selection);
bool add_channel(select_entry &current_selection);
bool remove_route(uint32_t cursel_index, select_entry &current_selection);
- bool set_prev_guest_channel(select_entry &current_selection);
- bool set_next_guest_channel(select_entry &current_selection);
- bool set_prev_node(select_entry &current_selection);
- bool set_next_node(select_entry &current_selection);
- bool set_prev_node_channel(select_entry &current_selection);
- bool set_next_node_channel(select_entry &current_selection);
+ bool set_prev_guest_channel(uint32_t cursel_index, select_entry &current_selection);
+ bool set_next_guest_channel(uint32_t cursel_index, select_entry &current_selection);
+ bool set_prev_node(uint32_t cursel_index, select_entry &current_selection);
+ bool set_next_node(uint32_t cursel_index, select_entry &current_selection);
+ bool set_prev_node_channel(uint32_t cursel_index, select_entry &current_selection);
+ bool set_next_node_channel(uint32_t cursel_index, select_entry &current_selection);
bool set_route_volume(menu_item &item, select_entry &current_selection);
uint32_t find_node_index(uint32_t node) const;
@@ -90,6 +90,9 @@ private:
uint32_t find_previous_available_node(sound_io_device *dev, uint32_t node) const;
uint32_t find_next_available_channel_node(sound_io_device *dev, uint32_t guest_channel, uint32_t node, uint32_t node_channel) const;
uint32_t find_previous_available_channel_node(sound_io_device *dev, uint32_t guest_channel, uint32_t node, uint32_t node_channel) const;
+
+ uint32_t find_first_full_mapping_selection(sound_io_device *dev) const;
+ uint32_t find_first_channel_mapping_selection(sound_io_device *dev) const;
};
} // namespace ui