summaryrefslogtreecommitdiffstatshomepage
path: root/src/osd/modules/lib/osdobj_common.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/osd/modules/lib/osdobj_common.cpp')
-rw-r--r--src/osd/modules/lib/osdobj_common.cpp175
1 files changed, 137 insertions, 38 deletions
diff --git a/src/osd/modules/lib/osdobj_common.cpp b/src/osd/modules/lib/osdobj_common.cpp
index 90bb63bf7f5..24148889570 100644
--- a/src/osd/modules/lib/osdobj_common.cpp
+++ b/src/osd/modules/lib/osdobj_common.cpp
@@ -15,12 +15,12 @@
#include "modules/font/font_module.h"
#include "modules/input/input_module.h"
#include "modules/midi/midi_module.h"
+#include "modules/netdev/netdev_module.h"
#include "modules/monitor/monitor_module.h"
#include "modules/netdev/netdev_module.h"
#include "modules/render/render_module.h"
#include "modules/sound/sound_module.h"
-#include "osdnet.h"
#include "watchdog.h"
#include "emu.h"
@@ -58,6 +58,7 @@ const options_entry osd_options::s_option_entries[] =
{ nullptr, nullptr, core_options::option_type::HEADER, "OSD DEBUGGING OPTIONS" },
{ OSDOPTION_DEBUGGER, OSDOPTVAL_AUTO, core_options::option_type::STRING, "debugger used: " },
+ { OSDOPTION_DEBUGGER_HOST, "localhost", core_options::option_type::STRING, "address to bind to for gdbstub debugger" },
{ OSDOPTION_DEBUGGER_PORT, "23946", core_options::option_type::INTEGER, "port to use for gdbstub debugger" },
{ OSDOPTION_DEBUGGER_FONT ";dfont", OSDOPTVAL_AUTO, core_options::option_type::STRING, "font to use for debugger views" },
{ OSDOPTION_DEBUGGER_FONT_SIZE ";dfontsize", "0", core_options::option_type::FLOAT, "font size to use for debugger views" },
@@ -207,6 +208,7 @@ osd_common_t::osd_common_t(osd_options &options)
, m_sound(nullptr)
, m_debugger(nullptr)
, m_midi(nullptr)
+ , m_network(nullptr)
, m_keyboard_input(nullptr)
, m_mouse_input(nullptr)
, m_lightgun_input(nullptr)
@@ -269,6 +271,9 @@ void osd_common_t::register_options()
#ifndef NO_USE_PULSEAUDIO
REGISTER_MODULE(m_mod_man, SOUND_PULSEAUDIO);
#endif
+#ifndef NO_USE_PIPEWIRE
+ REGISTER_MODULE(m_mod_man, SOUND_PIPEWIRE);
+#endif
REGISTER_MODULE(m_mod_man, SOUND_NONE);
REGISTER_MODULE(m_mod_man, MONITOR_SDL);
@@ -308,6 +313,7 @@ void osd_common_t::register_options()
REGISTER_MODULE(m_mod_man, MOUSEINPUT_WIN32);
REGISTER_MODULE(m_mod_man, MOUSE_NONE);
+ REGISTER_MODULE(m_mod_man, LIGHTGUNINPUT_SDL);
REGISTER_MODULE(m_mod_man, LIGHTGUN_X11);
REGISTER_MODULE(m_mod_man, LIGHTGUNINPUT_RAWINPUT);
REGISTER_MODULE(m_mod_man, LIGHTGUNINPUT_WIN32);
@@ -462,9 +468,6 @@ void osd_common_t::update(bool skip_redraw)
//
if (m_watchdog != nullptr)
m_watchdog->reset();
-
- update_slider_list();
-
}
@@ -506,39 +509,58 @@ void osd_common_t::debugger_update()
}
-//-------------------------------------------------
-// update_audio_stream - update the stereo audio
-// stream
-//-------------------------------------------------
+bool osd_common_t::sound_external_per_channel_volume()
+{
+ return m_sound->external_per_channel_volume();
+}
-void osd_common_t::update_audio_stream(const int16_t *buffer, int samples_this_frame)
+bool osd_common_t::sound_split_streams_per_source()
{
- //
- // This method is called whenever the system has new audio data to stream.
- // It provides an array of stereo samples in L-R order which should be
- // output at the configured sample_rate.
- //
- m_sound->update_audio_stream(m_machine->video().throttled(), buffer,samples_this_frame);
+ return m_sound->split_streams_per_source();
}
+uint32_t osd_common_t::sound_get_generation()
+{
+ return m_sound->get_generation();
+}
-//-------------------------------------------------
-// set_mastervolume - set the system volume
-//-------------------------------------------------
+osd::audio_info osd_common_t::sound_get_information()
+{
+ return m_sound->get_information();
+}
-void osd_common_t::set_mastervolume(int attenuation)
+uint32_t osd_common_t::sound_stream_sink_open(uint32_t node, std::string name, uint32_t rate)
{
- //
- // Attenuation is the attenuation in dB (a negative number).
- // To convert from dB to a linear volume scale do the following:
- // volume = MAX_VOLUME;
- // while (attenuation++ < 0)
- // volume /= 1.122018454; // = (10 ^ (1/20)) = 1dB
- //
- if (m_sound != nullptr)
- m_sound->set_mastervolume(attenuation);
+ return m_sound->stream_sink_open(node, name, rate);
}
+uint32_t osd_common_t::sound_stream_source_open(uint32_t node, std::string name, uint32_t rate)
+{
+ return m_sound->stream_source_open(node, name, rate);
+}
+
+void osd_common_t::sound_stream_set_volumes(uint32_t id, const std::vector<float> &db)
+{
+ m_sound->stream_set_volumes(id, db);
+}
+
+void osd_common_t::sound_stream_close(uint32_t id)
+{
+ m_sound->stream_close(id);
+}
+
+void osd_common_t::sound_stream_sink_update(uint32_t id, const int16_t *buffer, int samples_this_frame)
+{
+ m_sound->stream_sink_update(id, buffer, samples_this_frame);
+}
+
+void osd_common_t::sound_stream_source_update(uint32_t id, int16_t *buffer, int samples_this_frame)
+{
+ m_sound->stream_source_update(id, buffer, samples_this_frame);
+}
+
+
+
//-------------------------------------------------
// customize_input_type_list - provide OSD
@@ -567,6 +589,31 @@ void osd_common_t::customize_input_type_list(std::vector<input_type_entry> &type
std::vector<ui::menu_item> osd_common_t::get_slider_list()
{
+ // check if any window has dirty sliders
+ bool dirty = false;
+ for (const auto &window : window_list())
+ {
+ if (window->has_renderer() && window->renderer().sliders_dirty())
+ {
+ dirty = true;
+ break;
+ }
+ }
+
+ if (dirty)
+ {
+ m_sliders.clear();
+
+ for (const auto &window : osd_common_t::window_list())
+ {
+ if (window->has_renderer())
+ {
+ std::vector<ui::menu_item> window_sliders = window->renderer().get_slider_list();
+ m_sliders.insert(m_sliders.end(), window_sliders.begin(), window_sliders.end());
+ }
+ }
+ }
+
return m_sliders;
}
@@ -591,17 +638,49 @@ bool osd_common_t::execute_command(const char *command)
{
if (strcmp(command, OSDCOMMAND_LIST_NETWORK_ADAPTERS) == 0)
{
- osd_module &om = select_module_options<osd_module>(OSD_NETDEV_PROVIDER);
- osd_list_network_adapters();
- om.exit();
+ auto &om = select_module_options<netdev_module>(OSD_NETDEV_PROVIDER);
+ auto const interfaces = om.list_devices();
+ if (interfaces.empty())
+ {
+ printf("No supported network interfaces were found\n");
+ }
+ else
+ {
+ printf("Available network interfaces:\n");
+ for (auto &entry : interfaces)
+ {
+ printf(" %.*s\n", int(entry.description.length()), entry.description.data());
+ }
+ }
+ dynamic_cast<osd_module &>(om).exit();
return true;
}
else if (strcmp(command, OSDCOMMAND_LIST_MIDI_DEVICES) == 0)
{
- osd_module &om = select_module_options<osd_module>(OSD_MIDI_PROVIDER);
- dynamic_cast<midi_module &>(om).list_midi_devices();
- om.exit();
+ auto &om = select_module_options<midi_module>(OSD_MIDI_PROVIDER);
+ auto const ports = om.list_midi_ports();
+ if (ports.empty())
+ {
+ printf("No MIDI ports were found\n");
+ }
+ else
+ {
+ printf("MIDI input ports:\n");
+ for (auto const &port : ports)
+ {
+ if (port.input)
+ printf(port.default_input ? "%s (default)\n" : "%s\n", port.name.c_str());
+ }
+
+ printf("\nMIDI output ports:\n");
+ for (auto const &port : ports)
+ {
+ if (port.output)
+ printf(port.default_output ? "%s (default)\n" : "%s\n", port.name.c_str());
+ }
+ }
+ dynamic_cast<osd_module &>(om).exit();
return true;
}
@@ -641,10 +720,10 @@ void osd_common_t::init_subsystems()
m_debugger = &select_module_options<debug_module>(OSD_DEBUG_PROVIDER);
- select_module_options<netdev_module>(OSD_NETDEV_PROVIDER);
-
m_midi = &select_module_options<midi_module>(OSD_MIDI_PROVIDER);
+ m_network = &select_module_options<netdev_module>(OSD_NETDEV_PROVIDER);
+
m_output = &select_module_options<output_module>(OSD_OUTPUT_PROVIDER);
machine().output().set_global_notifier(output_notifier_callback, this);
@@ -717,7 +796,27 @@ bool osd_common_t::get_font_families(std::string const &font_path, std::vector<s
return m_font_module->get_font_families(font_path, result);
}
-std::unique_ptr<osd_midi_device> osd_common_t::create_midi_device()
+std::unique_ptr<osd::midi_input_port> osd_common_t::create_midi_input(std::string_view name)
+{
+ return m_midi->create_input(name);
+}
+
+std::unique_ptr<osd::midi_output_port> osd_common_t::create_midi_output(std::string_view name)
+{
+ return m_midi->create_output(name);
+}
+
+std::vector<osd::midi_port_info> osd_common_t::list_midi_ports()
+{
+ return m_midi->list_midi_ports();
+}
+
+std::unique_ptr<osd::network_device> osd_common_t::open_network_device(int id, osd::network_handler &handler)
+{
+ return m_network->open_device(id, handler);
+}
+
+std::vector<osd::network_device_info> osd_common_t::list_network_devices()
{
- return m_midi->create_midi_device();
+ return m_network->list_devices();
}