summaryrefslogtreecommitdiffstatshomepage
path: root/src/frontend/mame/ui/ui.cpp
diff options
context:
space:
mode:
author Aaron Giles <aaronsgiles@users.noreply.github.com>2020-09-13 10:18:44 -0700
committer GitHub <noreply@github.com>2020-09-13 10:18:44 -0700
commitc1bd56f0d318c71faac757d89c910c2682af6651 (patch)
tree9f4bbe78f74401a13603d89b6314c67fbd68a3f5 /src/frontend/mame/ui/ui.cpp
parenta3572727bd862176aa7458a84e2e9664c9d3f918 (diff)
Significant internal changes to sound streams (#7169)
Significant internal changes to sound streams: Abstracted buffers of sound data into an internal stream_buffer class, with helper classes read_stream_view and write_stream_view which offer readable/writable "views" into the buffers Internal sound calculations are all done using stream_buffer::sample_t, which is a 32-bit float; existing callbacks are supported through an adapter that converts to/from signed 32-bit integers Improved behavior of dynamic stream sample rate changes to resample a short runway of data to preserve continuity across transitions Created a new stream update callback which passes a std::vector of read_stream_views for inputs, and a std::vector of write_stream_views for outputs Updated core mixer and speaker devices to the new stream update callback Updated the following sound cores to the new stream update callback: ay8910, dac, k054539, msm5205, namco, netlist, okim6295, pokey, samples, sn76496, sp0250, tms5220, tms57002, upd7759, vgm_visualizer, volt_reg Changed existing stream update callback to make inputs explicitly const and the output pointers const as well, since they are re-used across calls; fixed several engines that violated this rule Sound_manager::stream_alloc can no longer automatically connect to a device's sound_stream_update callback; instead, the stream_alloc() on the sound_device_interface should be called; updated many violators of this rule Streams can be created with SAMPLE_RATE_OUTPUT_ADAPTIVE, which dynamically tracks the sample rate of its first downstream output, or with SAMPLE_RATE_INPUT_ADAPTIVE, which tracks the sample rate of its first input Changed resampling to be a separate sound_stream that is invoked as needed, opening the path for selectable resampling implementations Added a flags parameter to the new stream allocation method that allows you to specify a that input streams should not be resampled Exposed stream_input and stream_output classes directly, simplifying access to user gains and stream names Added a simple dynamic compressor to sound_manager to provide nicer results when overdriven sound happens; compression does not affect speaker_report results Improved verbose speaker_report to print a graph of peaks over time More aggressive debugging enabled for now even in release builds (should be disabled prior to next release) via SOUND_DEBUG define in sound.h; report any assertions for fixing
Diffstat (limited to 'src/frontend/mame/ui/ui.cpp')
-rw-r--r--src/frontend/mame/ui/ui.cpp10
1 files changed, 5 insertions, 5 deletions
diff --git a/src/frontend/mame/ui/ui.cpp b/src/frontend/mame/ui/ui.cpp
index 40a5651430d..ff16d117117 100644
--- a/src/frontend/mame/ui/ui.cpp
+++ b/src/frontend/mame/ui/ui.cpp
@@ -1524,7 +1524,7 @@ std::vector<ui::menu_item> mame_ui_manager::slider_init(running_machine &machine
int32_t maxval = 2000;
int32_t defval = 1000;
- std::string str = string_format(_("%1$s Volume"), info.stream->input_name(info.inputnum));
+ std::string str = string_format(_("%1$s Volume"), info.stream->input(info.inputnum).name());
m_sliders.push_back(slider_alloc(SLIDER_ID_MIXERVOL + item, str.c_str(), 0, defval, maxval, 20, (void *)(uintptr_t)item));
}
@@ -1762,13 +1762,13 @@ int32_t mame_ui_manager::slider_mixervol(running_machine &machine, void *arg, in
return 0;
if (newval != SLIDER_NOCHANGE)
{
- int32_t curval = floor(info.stream->user_gain(info.inputnum) * 1000.0f + 0.5f);
+ int32_t curval = floor(info.stream->input(info.inputnum).user_gain() * 1000.0f + 0.5f);
if (newval > curval && (newval - curval) <= 4) newval += 4; // round up on increment
- info.stream->set_user_gain(info.inputnum, (float)newval * 0.001f);
+ info.stream->input(info.inputnum).set_user_gain((float)newval * 0.001f);
}
if (str)
- *str = string_format("%4.2f", info.stream->user_gain(info.inputnum));
- return floorf(info.stream->user_gain(info.inputnum) * 1000.0f + 0.5f);
+ *str = string_format("%4.2f", info.stream->input(info.inputnum).user_gain());
+ return floorf(info.stream->input(info.inputnum).user_gain() * 1000.0f + 0.5f);
}