summaryrefslogtreecommitdiffstatshomepage
path: root/src/emu/disound.cpp
Commit message (Collapse)AuthorAgeFilesLines
* Revert "device_mixer_interface: set samplerate to osd rate, like how it was ↵ hap3 days1-1/+1
| | | | | | before sound rewrite" This reverts commit 99fc7b2c7f45562a10dea68c754015c29173b537.
* device_mixer_interface: set samplerate to osd rate, like how it was before ↵ hap3 days1-1/+1
| | | | sound rewrite
* New sound infrastructure. Olivier Galibert6 days1-303/+155
| | | | | | | | | | | | | | | | | Should be added soon: - mute - speaker/microphone resampling To be added a little later: - compression - reverb Needs to be added by someone else: - coreaudio - direct - portaudio - xaudio2 - js
* Much more core std::string_view modernization AJR2021-01-201-5/+5
| | | | | | | | | | | | | | | - Remove corestr.h from emu.h; update a few source files to not use it at all - Change strtrimspace, strtrimrightspace and core_filename_extract_* to be pure functions taking a std::string_view by value and returning the same type - Change strmakeupper and strmakelower to be pure functions taking a std::string_view and constructing a std::string - Remove the string-modifying version of zippath_parent - Change tag-based lookup functions in device_t to take std::string_view instead of const std::string & or const char * - Remove the subdevice tag cache from device_t (since device finders are now recommended) and replace it with a map covering directly owned subdevices only - Move the working directory setup method out of device_image_interface (only the UI seems to actually use the full version of this) - Change output_manager to use std::string_view for output name arguments - Change core_options to accept std::string_view for most name and value arguments (return values are still C strings for now) - Change miscellaneous other functions to accept std::string_view arguments - Remove a few string accessor macros from romload.h - Remove many unnecessary c_str() calls from logging/error messages
* Fairly significant overhaul of Lua engine and some cleanup. Vas Crabb2020-11-251-3/+3
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The things that were previously called device iterators are not iterators in the C++ sense of the word. This is confusing for newcomers. These have been renamed to be device enumerators. Several Lua methods and properties that previously returned tables now return lightweight wrappers for the underlying objects. This means creating them is a lot faster, but you can't modify them, and the performance characteristics of different operations varies. The render manager's target list uses 1-based indexing to be more like idiomatic Lua. It's now possible to create a device enumerator on any device, and then get subdevices (or sibling devices) using a relative tag. Much more render/layout functionality has been exposed to Lua. Layout scripts now have access to the layout file and can directly set the state of an item with no bindings, or register callbacks to obtain state. Some things that were previously methods are now read-only properties. Layout files are no longer required to supply a "name". This was problematic because the same layout file could be loaded for multiple instances of the same device, and each instance of the layout file should use the correct inputs (and in the future outputs) for the device instance it's associated with. This should also fix video output with MSVC builds by avoiding delegates that return things that don't fit in a register.
* disound: Create m_specified_inputs_mask to track which inputs have been ↵ Aaron Giles2020-10-181-10/+16
| | | | | | | | | | specified. dac: Various improvements: - Default to output range -1..1, by far the most common case - Detect if inputs are specified and use those for output range leland: Update to leverage new DAC capabilities.
* Complete sound modernization of remaining devices. Legacy callbacks and ↵ Aaron Giles2020-09-281-17/+1
| | | | | | | | | | | | | | | | | | | | | | | | | stream_sample_t removed. (#7297) * a2mcms/coco_ssc/gus/cassette/floppy/8364_paula/laserdsc/s2636/spg2xx_audio/arcadia/channelf/cmi01a/cps3/dai_snd: Update to new stream callbacks * dsbz80/elan_eu3a05/exidy/exidy440/flower/geebee/gomoku/gridlee: Update to new stream callbacks * hyprolyb/lynx/micro3d/phoenix/pleiads/polepos: Update to new sound stream callback * redbaron/segag80r/segausb/seibu/snk6502/socrates/special/svis_snd: Update to new stream callbacks. * tiamc1/turrett/tvc/tx1/vboy/vc4000: Update to new stream callbacks * warpwarp/wiping/wswan/xavix/esq1/istrebiteli/milton6805/pv1000/mega32x/gic: Update to new stream callback * sound: Remove legacy stream support and stream_sample_t * * gomoku/wiping: Remove silly mixer tables in favor of math * micro3d: Remove tiny vectors in favor of fixed arrays * phoenix: Went back to std::unique_ptr array for LFSR * wiping: Fixed the scale factor.
* sound: Some optimizations for common cases Aaron Giles2020-09-171-0/+7
| | | | | * Reuse resamplers if routing the same output to multiple targets at the same rate * Avoid copying when there's only one stream going through a mixer
* Revert "sound: Improved view interfaces to match usage patterns" Aaron Giles2020-09-171-3/+3
| | | | This reverts commit dc0ede3c90717ed25de0695c555b861f06344f18.
* sound: Improved view interfaces to match usage patterns Aaron Giles2020-09-171-3/+3
| | | | | | | | | | * read/write_stream_views now have an internal index * get/put/add/fill/copy now implicitly use and advance this index * new method reset() can (re)set the internal index * new method done() checks if index is past the end * new method remaining() indicates how many samples remain * get_indexed/put_indexed/etc available for random access * updated all consumers to new interfaces
* Significant internal changes to sound streams (#7169) Aaron Giles2020-09-131-23/+75
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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
* Revert "Add an overload to input_to_stream_input in disound.cpp, fixes the ↵ Lord-Nightmare2020-08-131-26/+0
| | | | | | input_gain and set_input_gain functions being unusable on device_mixer_interface type. [Lord Nightmare]" This reverts commit 03f3e1ff42f4171d7ef8f484b5b4843183e95a17.
* Add an overload to input_to_stream_input in disound.cpp, fixes the ↵ Lord-Nightmare2020-08-121-0/+26
| | | | input_gain and set_input_gain functions being unusable on device_mixer_interface type. [Lord Nightmare]
* emu: correct some file headers (nw) hap2020-06-191-1/+1
|
* fixed some clang-tidy warnings (nw) (#6197) Oliver Stöneberg2020-01-221-1/+1
| | | | | | | | | | | | | | * fixed some bugprone-throw-keyword-missing clang-tidy warnings (nw) * fixed some modernize-use-nullptr clang-tidy warnings (nw) * fixed some readability-delete-null-pointer clang-tidy warnings (nw) * fixed some performance-faster-string-find clang-tidy warnings (nw) * fixed some performance-for-range-copy clang-tidy warnings (nw) * fixed some readability-redundant-string-cstr clang-tidy warnings (nw)
* disound.cpp, sound.cpp, speaker.cpp: Use fill_n and resize to zero memory ↵ AJR2019-11-241-1/+1
| | | | instead of memset (nw)
* (nw) add doxygen comments for a bunch of core stuff, and convert a bunch of ↵ Vas Crabb2019-10-161-17/+17
| | | | comments to doxygen format
* Make osd_printf_* use util/strformat semantics. Vas Crabb2019-09-261-1/+1
| | | | | | | | | | | | | | | | | (nw) This has been a long time coming but it's here at last. It should be easier now that logerror, popmessage and osd_printf_* behave like string_format and stream_format. Remember the differences from printf: * Any object with a stream out operator works with %s * %d, %i, %o, %x, %X, etc. work out the size by magic * No sign extending promotion to int for short/char * No widening/narrowing conversions for characters/strings * Same rules on all platforms, insulated from C runtime library * No format warnings from compiler * Assert in debug builds if number of arguments doesn't match format (nw) Also removed a pile of redundant c_str and string_format, and some workarounds for not being able to portably format 64-bit integers or long long.
* Start cleaning up palette configuration: Vas Crabb2018-12-291-7/+8
| | | | | | | | | | * Basically, initialisers go in the constructor arguments, and things for setting format go in set_format. * Initialisation patterns can be specified with an enum discriminator or with a FUNC and optionally a tag. * Formats can be specified with an enum discriminator or a size and function pointer. * You must always supply the number of entries when setting the format. * When initislising with a paletter initialisation member, you can specify the entries and indirecte entries together. * The palette_device now has a standard constructor, so use .set_entries if you are specifying entry count with no format/initialisation. * Also killed an overload on delegates that wasn't being useful.
* -keyboard/a1200, changela, goldnpkr, m68705prg, mexico86, pipeline, pitnrun, ↵ mooglyguy2018-12-141-2/+2
| | | | | | | | | | qix, quizpun2, stfight, tigeroad: Removed MACHINE_CONFIG. [Ryan Holtz] -m68705, m68hc05: Removed MCFG. [Ryan Holtz] -qix: First-pass cleanup. [Ryan Holtz] -core: Fixed spelling of "nonexistent". [Ryan Holtz]
* disound: added getters for input/output gain (nw) hap2018-11-041-0/+26
|
* Make MCFG_DEVICE_ADD and callable device types more flexible: Vas Crabb2018-05-041-3/+6
| | | | | | | | | | | | | | | | | | | | | * Allows defaulted clocks (see subtle example with vboy) * Allows additional constructors (see RS232 port in tranz330) * Allows use of device finder in place of tag in MCFG_DEVICE_ADD * Requires out-of-line destructor for devices using incomplete types * Requires XTAL or explicit u32 for clocks for devices with private types Devices must still define the standard constructor. When writing additional constructors, be aware that the constructor runs before device_add_mconfig in the context of the existing device, not the new device. See osborne1, zorba, tranz330, and vboy for examples of this in use. Compilation is a bit slower, but this is temporary while refactoring is in progress. Eliminated the need for MCFG_SOUND_ROUTE_EX. Removed macros from slot option configuration - they just obfuscated code and slowed it down with needless dynamic casts, but didn't actually simplify it.
* Route sound relative to current device. Vas Crabb2018-05-011-56/+62
| | | | | | | | Also, look Ma - no magic prologue! Slot card additions run in the context of the slot itself, which isn't entirely intuitive. Slot configuration needs a bunch of other cleanup anyway.
* Bind devcb relative to current device. This is probably going to break Vas Crabb2018-05-011-1/+1
| | | | | | | plenty of things with late bind errors. Sorry. Remaining things to switch over include sound routes and things with custom delegates.
* destaticify initializations (nw) (#3289) wilbertpol2018-03-041-34/+0
| | | | | | * destaticify initializations (nw) * fix this->set_screen (nw)
* This causes huge changes in behaviour that can't be hand-waved away. Vas Crabb2018-01-131-62/+0
| | | | | | | | | | Revert "Removal of voltage_regulator_device (nw)" This reverts commit 1af133752a05079060c462e372c369ad0b7296ee. Revert "New way to provide DAC reference inputs (nw)" This reverts commit 1c6a7ab40ccd23b753777204c7a289e830b2adcb.
* New way to provide DAC reference inputs (nw) AJR2018-01-101-0/+62
| | | | | | | - Introduce MCFG_SOUND_REFERENCE_INPUT to provide fixed inputs through the resampler, eliminating the need for the "voltage regulator" device - Replace memset use in sound.cpp with std::fill This was my third implementation of this concept. The previous two involved attaching sound streams to the dummy device (which required giving it device_sound_interface and other modifications).
* Minor core cleanups (nw) AJR2017-07-131-2/+2
| | | | | - disound.cpp: Make a few more methods const - machine.cpp: c_str() is no longer needed with emu_file::open since it now takes a std::string
* Self-registering devices prep: Vas Crabb2017-02-271-0/+1
| | | | | | | | | | | | | | * Make device_creator a variable template and get rid of the ampersands * Remove screen.h and speaker.h from emu.h and add where necessary * Centralise instantiations of screen and speaker finder templates * Add/standardise #include guards in many hearers * Remove many redundant #includes * Order #includesr to help catch headers that can't be #included alone (nw) This changes #include order to be prefix, unit header if applicable then other stuff roughly in order from most dependent to least dependent library. This helps catch headers that don't #include things that they use.
* Introduce u8/u16/u32/u64/s8/s16/s32/s64 Vas Crabb2016-11-191-3/+3
| | | | | | | | | | | | * New abbreviated types are in osd and util namespaces, and also in global namespace for things that #include "emu.h" * Get rid of import of cstdint types to global namespace (C99 does this anyway) * Remove the cstdint types from everything in emu * Get rid of U64/S64 macros * Fix a bug in dps16 caused by incorrect use of macro * Fix debugcon not checking for "do " prefix case-insensitively * Fix a lot of messed up tabulation * More constexpr * Fix up many __names
* NOTICE (TYPE NAME CONSOLIDATION) Miodrag Milanovic2016-10-221-3/+3
| | | | | Use standard uint64_t, uint32_t, uint16_t or uint8_t instead of UINT64, UINT32, UINT16 or UINT8 also use standard int64_t, int32_t, int16_t or int8_t instead of INT64, INT32, INT16 or INT8
* simple_list to vector in sound (nw) Miodrag Milanovic2016-06-191-27/+27
|
* simple_list to std::vector (nw) Miodrag Milanovic2016-06-171-28/+27
|
* Iterate over devices C++11 style AJR2016-04-181-19/+17
| | | | | | Replace the old device_iterator and its specialized versions with functionally equivalent classes that use standard operators to yield references to devices/interfaces rather than pointers. With range-based for loops, they no longer have to be stored in named variables, though they can also be reused concurrently since the iteration state is now maintained by a subclass. Add a few more typical getters to device_t::subdevice_list.
* Iterate over core classes C++11 style AJR2016-03-311-50/+50
| | | | | | | | C++11 range-based for loops can now iterate over simple_list, tagged_list, core_options, device_t::subdevice_list, device_t::interface_list, render_primitive_list and all subclasses of the above, and much code has been refactored to use them. Most core classes that have these lists as members now have methods that return the lists themselves, replacing most of the methods that returned the object at an owned list's head. (A few have been retained due to their use in drivers or OSD.) device_t now manages subdevice and interface lists through subclasses, but has given up the work of adding and removing subdevices to machine_config. memory_manager has its tagged lists exposed, though the old rooted tag lookup methods have been removed (they were privatized already).
* disound: Don't crash on state load when the mixer is disabled by lack of ↵ Olivier Galibert2016-02-041-1/+4
| | | | inputs (misconfiguration or missing samples) [O. Galibert]
* reverting: Miodrag Milanovic2016-01-201-4/+4
| | | | | | | SHA-1: 1f90ceab075c4869298e963bf0a14a0aac2f1caa * tags are now strings (nw) fix start project for custom builds in Visual Studio (nw)
* Revert "rest of device parameters to std::string (nw)" Miodrag Milanovic2016-01-201-1/+1
| | | | This reverts commit caba131d844ade3f2b30d6be24ea6cf46b2949d7.
* rest of device parameters to std::string (nw) Miodrag Milanovic2016-01-161-1/+1
|
* tags are now strings (nw) Miodrag Milanovic2016-01-161-4/+4
| | | | fix start project for custom builds in Visual Studio (nw)
* clang-modernize part 1 (nw) Miodrag Milanovic2015-12-031-26/+26
|
* Some cleanups and init fixes with help of ReSharper C++ (nw) Miodrag Milanovic2015-11-111-2/+2
|
* Rename *.c -> *.cpp in our source (nw) Miodrag Milanovic2015-11-081-0/+471