summaryrefslogtreecommitdiffstatshomepage
path: root/src/emu/sound.cpp
Commit message (Collapse)AuthorAgeFilesLines
* Merge branch 'master' into time-experiments Aaron Giles2021-08-131-25/+26
|\
| * API cleanups and miscellaneous fixes. Vas Crabb2021-07-151-24/+22
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | emu/ioport.cpp: Allow controller files to override input sequences for inputs that don't use defaults, and to override the toggle setting for digital inputs. emu/config.cpp: Expose configuration level (mostly matters for controller files), improved verbose diagnostic messages, and moved a few things out of the global and preprocessor namespaces. docs: Added documentation for some controller configuration file features. The device mapping feature documentation will be merged in at some point. util/unicode.cpp, emu/input.cpp: API cleanups.
| * sound: Don't go down to the osd on redundant mute calls (like vgmplay's ↵ Olivier Galibert2021-04-161-1/+4
| | | | | | | | 44100 times per second)
* | Added stricter checks on allocation of device timers. Fixed several places ↵ Aaron Giles2021-03-271-2/+2
| | | | | | | | that were caught by this. Updated all interfaces and core systems to use new timer classes.
* | Small cleanups. Properly differentiate persistent_timer::init for device ↵ Aaron Giles2021-03-261-2/+2
| | | | | | | | timers. Update sound manager to use native callback form. Update screen to use persistent timers.
* | Major timer object reshuffling. timer_expired_delegate wraps the various ↵ Aaron Giles2021-03-261-6/+4
| | | | | | | | callback types. timer_callback is a class containing a timer_expired_delegate plus a user-supplied pointer, and accounting information for registration. timer_instance is a single active timer in the scheduler. persistent_timer is what you get back from timer_alloc() now, and has methods for dynamic changes. transient_timer_factory is what you use to create transient timers. Devices now own a transient_timer_factory for transient device timers. persistent_timers can be emedded and initialized directly.
* | Use the device-provided timer_alloc instead of reaching around to the ↵ Aaron Giles2021-03-251-1/+1
| | | | | | | | scheduler. Also change machine().scheduler().time() calls to just machine().time().
* | Made m_seconds and m_attoseconds private members to allow for future ↵ Aaron Giles2021-03-171-1/+1
|/ | | | abstractions.
* Eliminate ARRAY_LENGTH template in favor of C++17's std::size AJR2021-02-141-4/+4
| | | | | | | | | | * osdcomm.h: Move definition of EQUIVALENT_ARRAY to coretmpl.h * sharc.cpp, gt64xxx.cpp, ym2413.cpp, gb_lcd.cpp, snes_ppu.cpp: Use STRUCT_MEMBER for save state registration * gio/newport.cpp, megadrive/svp.cpp, nes_ctrl/bcbattle.cpp, arm7.cpp, tms9995.cpp, pckeybrd.cpp, sa1110.cpp, sa1111.cpp, jangou_blitter.cpp, vic4567.cpp: Use std::fill(_n) instead of memset * emucore.h: Remove obsolete typedef
* More Lua interface cleanup - it's simpler with cleaner underlyng APIs. Vas Crabb2020-12-271-34/+24
| | | | | | | | | | | Made the sound manager mute controls readable, and got rid of system enable since it just controls system mute anyway. This was causing confusion: phantom2 was trying to use both independentlyt casuing the mute bit to be ignored. THe Lua interface changes are mostly changing methods to properties, some renames to make things clearer, and some additional properties for better control over snapshots.
* Eliminate many unnecessary c_str calls AJR2020-12-211-1/+1
|
* Fairly significant overhaul of Lua engine and some cleanup. Vas Crabb2020-11-251-7/+7
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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.
* sound: Fix bug where gain was doubly-applied in some cases. Aaron Giles2020-10-251-1/+1
|
* 07765: Sample rate now saved as part of the stream Aaron Giles2020-10-191-0/+1
|
* dac/volt_reg: improve performance (#7274) Aaron Giles2020-10-171-0/+1
| | | | | | | | | | | | | * dac/volt_reg: improve performance * modify dac to accept streams of any input rate to avoid resampling * modify dac to assume input voltage streams are constant by only grabbing the first input sample * modify volt_reg to output at the minimum sample rate * dac: Restructure the DAC sound devices a bit * centralize implementation based on lookup tables * add set_constant_vref() method for the common case where references are constant, thus avoiding the need for voltage regulator devices * convert williams.cpp to using this new method as a test
* Complete sound modernization of remaining devices. Legacy callbacks and ↵ Aaron Giles2020-09-281-86/+2
| | | | | | | | | | | | | | | | | | | | | | | | | 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.
* Disable SOUND_DEBUG for non-debug builds, and srcclean Vas Crabb2020-09-271-1/+1
|
* sound: Fix assertion when loading save state from command line. Aaron Giles2020-09-241-2/+2
|
* sound: fix some crackling when upsampling Aaron Giles2020-09-201-1/+1
|
* sound: Fix asserts due to sample-rate ping-pong in esq5505 driver Aaron Giles2020-09-191-1/+8
|
* sound: Some optimizations for common cases Aaron Giles2020-09-171-29/+41
| | | | | * 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-18/+23
| | | | This reverts commit dc0ede3c90717ed25de0695c555b861f06344f18.
* sound: Improved view interfaces to match usage patterns Aaron Giles2020-09-171-23/+18
| | | | | | | | | | * 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
* sound: Fix #7241, crash when restoring save state. Aaron Giles2020-09-151-0/+4
|
* sound: Fix edge case where pending sample rate matches output. Aaron Giles2020-09-141-3/+5
|
* sound: Drive updates more sensibly from the sound manager, fixing some asserts. Aaron Giles2020-09-141-8/+17
|
* Significant internal changes to sound streams (#7169) Aaron Giles2020-09-131-587/+1071
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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
* emu: correct some file headers (nw) hap2020-06-191-1/+1
|
* disound.cpp, sound.cpp, speaker.cpp: Use fill_n and resize to zero memory ↵ AJR2019-11-241-18/+12
| | | | instead of memset (nw)
* callback after sound update has generated new samples feos2019-09-241-0/+3
|
* Expose sound buffer and samplerate to luaengine (#5497) feos2019-08-171-4/+20
| | | | | | | | | | * luaengine: manager:machine():sound():samples() * luaengine: fix natural_keyboard docs * tiny cleanup as requested in #5348 * fix clang build
* -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]
* Fix setting sample rate back to zero & crash for synchronous streams when ↵ smf-2018-07-291-16/+45
| | | | rate is zero. This fixes all reported bugs. (nw)
* Revert part of 20b5f5d0e6f73b9ce6fffa4fc5dbe3f2b83d2a27 Olivier Galibert2018-07-291-31/+8
| | | | | | | This is damn sensitive code, and generates differences all over the place we don't really explain. The changes should be justified by themselves and tested in collaboration with Tafoid to ensure the differences are not a problem.
* vgmplay: start all clocks at zero and reset all sound chips on a song change ↵ smf-2018-07-271-8/+31
| | | | [smf]
* sound.cpp: Turn this check into an assert now that the caller should prevent ↵ AJR2018-05-151-3/+1
| | | | this (nw)
* sound.cpp: Perform the sanity check from ↵ AJR2018-05-151-3/+3
| | | | a0137c10da45fe10e52f9debcf00b266f2234329 in a better place (nw, seems to fix assert error)
* sound: If stream->update() is done going back in time (originating from Olivier Galibert2018-05-151-0/+3
| | | | | | | different devices at a different execution point), don't try to generate a negative number of samples [O. Galibert] Not sure why that never happened before. Oh well.
* This causes huge changes in behaviour that can't be hand-waved away. Vas Crabb2018-01-131-13/+17
| | | | | | | | | | 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-17/+13
| | | | | | | - 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).
* 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.
* XML refactoring: Vas Crabb2016-12-111-7/+7
| | | | | | | * move stuff to namespace util::xml * scope down some enums * split config load/save delegate types * make config load take const so it can't mangle data
* A round of spelling/typographical fixes to source comments (nw) Scott Stone2016-11-241-1/+1
|
* Introduce u8/u16/u32/u64/s8/s16/s32/s64 Vas Crabb2016-11-191-27/+27
| | | | | | | | | | | | * 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
* Turn xmlfile API into something that looks like C++ Vas Crabb2016-11-171-7/+7
| | | | It's still a bit quirky but it's far better encapsulated before, and it plays nice with const (nw)
* Do not use FUNC in delegate where applicable (nw) Miodrag Milanovic2016-11-061-6/+6
|
* Reverting part of changes from previous commits as described in mail on list ↵ Miodrag Milanovic2016-10-231-1/+1
| | | | (nw)
* there you go (nw) Miodrag Milanovic2016-10-221-1/+1
|
* NOTICE (TYPE NAME CONSOLIDATION) Miodrag Milanovic2016-10-221-27/+27
| | | | | 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
* some bool <-> int not needed conversions, also cleaned drivenum.* was using ↵ Miodrag Milanovic2016-10-211-1/+1
| | | | memset for clearing vector (nw)