Commit Graph

43 Commits

Author SHA1 Message Date
Vas Crabb
687dd20aeb sound/discrete.cpp: Fix more crashes, and modernise a little.
Reserve some space in another vector that it takes addresses to members
of (fixes lack of sound in dkong and dkongjr).

Removed dependence on auto_alloc and friends.  There's one more
problematic make_unique_clear now, but there are several fewer
auto_alloc family calls.
2020-09-30 23:40:06 +10:00
Vas Crabb
cc8cd6c33b sound/discrete: Reserve space before taking addresses of new vector items.
This code is still unsafe, 16 just happens to be enough for the systems
in MAME.  (The old vector_t implicitly reserved space for 16 items on
construction.)
2020-09-30 22:12:44 +10:00
Vas Crabb
3b59cb8860 -Got rid of most of the remaining problematic uses of make_unique_clear.
-sound/discrete.cpp: Use C++ std::vector and range-based for.
2020-09-30 14:10:43 +10:00
Aaron Giles
7b8913fefa
Complete sound modernization of remaining devices. Legacy callbacks and 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.
2020-09-28 13:46:58 +10:00
Aaron Giles
ecd3333757 t6721a/t6w28/tc8830f/tia/tms36xx/tms5110/upd1771/upd7752/upd934g/vlm5030/vrc6/vrender0/wave/x1_010: update to new stream callbacks 2020-09-21 18:59:41 -07:00
Aaron Giles
70743c6fb2 s_dsp/saa1099/scsp/segapcm/sn76477/snkwave/sp0256/spkrdev/spu/st0016/swp*: Update to new stream callbacks 2020-09-21 12:47:00 -07:00
Aaron Giles
8d7d01caef Revert "sound: Improved view interfaces to match usage patterns"
This reverts commit dc0ede3c90.
2020-09-17 01:24:17 -07:00
Aaron Giles
dc0ede3c90 sound: Improved view interfaces to match usage patterns
* 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
2020-09-17 00:46:06 -07:00
Aaron Giles
937bb188b2 dac76/dave/digitalk/discrete: update to new stream callbacks 2020-09-16 18:11:30 -07:00
Aaron Giles
c1bd56f0d3
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
2020-09-13 10:18:44 -07:00
Vas Crabb
dac7094f34 (nw) misc cleanup:
* get rid of most assert_always
* get rid of a few MCFG_*_OVERRIDE
2019-09-20 00:28:19 +10:00
AJR
c188d54965 discrete: Eliminate unnecessary address space argument from handlers (nw)
audio/galaxian: Move configuration to driver files (nw)
2018-11-12 16:13:48 -05:00
Wilbert Pol
86f6ad0b5c de-staticify initializations for src/devices/sound (nw) 2018-02-25 17:40:06 +01:00
Vas Crabb
0f0d39ef81 Move static data out of devices into the device types. This is a significant change, so please pay attention.
The core changes are:
* Short name, full name and source file are no longer members of device_t, they are part of the device type
* MACHINE_COFIG_START no longer needs a driver class
* MACHINE_CONFIG_DERIVED_CLASS is no longer necessary
* Specify the state class you want in the GAME/COMP/CONS line
* The compiler will work out the base class where the driver init member is declared
* There is one static device type object per driver rather than one per machine configuration

Use DECLARE_DEVICE_TYPE or DECLARE_DEVICE_TYPE_NS to declare device type.
* DECLARE_DEVICE_TYPE forward-declares teh device type and class, and declares extern object finders.
* DECLARE_DEVICE_TYPE_NS is for devices classes in namespaces - it doesn't forward-declare the device type.

Use  DEFINE_DEVICE_TYPE or DEFINE_DEVICE_TYPE_NS to define device types.
* These macros declare storage for the static data, and instantiate the device type and device finder templates.

The rest of the changes are mostly just moving stuff out of headers that shouldn't be there, renaming stuff for consistency, and scoping stuff down where appropriate.

Things I've actually messed with substantially:
* More descriptive names for a lot of devices
* Untangled the fantasy sound from the driver state, which necessitates breaking up sound/flip writes
* Changed DECO BSMT2000 ready callback into a device delegate
* Untangled Microprose 3D noise from driver state
* Used object finders for CoCo multipak, KC85 D002, and Irem sound subdevices
* Started to get TI-99 stuff out of the TI-990 directory and arrange bus devices properly
* Started to break out common parts of Samsung ARM SoC devices
* Turned some of FM, SID, SCSP DSP, EPIC12 and Voodoo cores into something resmbling C++
* Tried to make Z180 table allocation/setup a bit safer
* Converted generic keyboard/terminal to not use WRITE8 - space/offset aren't relevant
* Dynamically allocate generic terminal buffer so derived devices (e.g. teleprinter) can specify size
* Imporved encapsulation of Z80DART channels
* Refactored the SPC7110 bit table generator loop to make it more readable
* Added wrappers for SNES PPU operations so members can be made protected
* Factored out some boilerplate for YM chips with PSG
* toaplan2 gfx
* stic/intv resolution
* Video System video
* Out Run/Y-board sprite alignment
* GIC video hookup
* Amstrad CPC ROM box members
* IQ151 ROM cart region
* MSX cart IRQ callback resolution time
* SMS passthrough control devices starting subslots

I've smoke-tested several drivers, but I've probably missed something.  Things I've missed will likely blow up spectacularly with failure to bind errors and the like.  Let me know if there's more subtle breakage (could have happened in FM or Voodoo).

And can everyone please, please try to keep stuff clean.  In particular, please stop polluting the global namespace.  Keep things out of headers that don't need to be there, and use things that can be scoped down rather than macros.
It feels like an uphill battle trying to get this stuff under control while more of it's added.
2017-05-14 21:44:11 +10:00
Vas Crabb
6c23897483 Self-registering devices prep:
* 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.
2017-02-27 22:57:14 +11:00
Miodrag Milanovic
68bd81d11a Use osd_getenv instead of getenv (nw) 2016-11-02 15:25:36 +01:00
Miodrag Milanovic
ddb290d5f6 NOTICE (TYPE NAME CONSOLIDATION)
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
2016-10-22 13:13:17 +02:00
Miodrag Milanovic
9667c6a8cc std::min and std:max instead of MIN and MAX, also some more macros converted to inline functions (nw) 2016-07-31 14:41:02 +02:00
Miodrag Milanovic
be67262fc2 INC -> HXX makes editors and code analyzers see it as C++ (nw) 2016-05-01 20:27:50 +02:00
Miodrag Milanovic
96d123b42c NULL->nullptr, instead of DEVCB_NULL use always DEVCB_NOOP to prevent confusion (nw) 2016-04-24 15:38:49 +02:00
AJR
fb08fefaee Move a few odds and ends out of the emu core 2016-04-23 15:27:59 -04:00
Vas Crabb
5aea0893a0 Use type-safe printf for core_file and emu_file, surprisingly few knock-on effects
Properly fix up a couple of places I64FMT was being used, still more to deal with
2016-03-09 23:04:12 +11:00
Miodrag Milanovic
e76d30243e Removed I64FMT and SIZETFMT, one usage left in chdman.cpp (nw) 2016-03-07 19:34:44 +01:00
Miodrag Milanovic
91c910e73c Use std::atomic and std::mutex where applicable (nw) 2016-03-01 13:09:50 +01:00
Miodrag Milanovic
4e8e3066f8 reverting:
SHA-1: 1f90ceab07

* tags are now strings (nw)
fix start project for custom builds in Visual Studio (nw)
2016-01-20 21:42:13 +01:00
Miodrag Milanovic
7c9cd3feea Revert "rest of device parameters to std::string (nw)"
This reverts commit caba131d84.
2016-01-20 21:35:11 +01:00
Miodrag Milanovic
caba131d84 rest of device parameters to std::string (nw) 2016-01-16 20:05:32 +01:00
Miodrag Milanovic
1f90ceab07 tags are now strings (nw)
fix start project for custom builds in Visual Studio (nw)
2016-01-16 14:54:42 +01:00
Miodrag Milanovic
ce75a5d682 removed memory tracking (nw) 2016-01-08 12:41:13 +01:00
Miodrag Milanovic
e0d0a314e5 Revert "vector_t to std::vector in discrete (nw)"
This reverts commit ccf38aa73c.
2016-01-07 16:39:22 +01:00
Miodrag Milanovic
cd97db866b Revert "fixed discrete.cpp (nw)"
This reverts commit fc7dd39eb7.
2016-01-07 16:39:22 +01:00
Miodrag Milanovic
237945d2ce Revert "missed one place (nw)"
This reverts commit dc89e92390.
2016-01-07 16:39:22 +01:00
Miodrag Milanovic
dc89e92390 missed one place (nw) 2016-01-06 12:05:46 +01:00
Miodrag Milanovic
fc7dd39eb7 fixed discrete.cpp (nw) 2016-01-06 12:02:05 +01:00
Miodrag Milanovic
ccf38aa73c vector_t to std::vector in discrete (nw) 2016-01-06 10:53:29 +01:00
Miodrag Milanovic
1fefd835ce update by request (nw) 2015-12-21 12:47:41 +01:00
Miodrag Milanovic
2d09179902 Added license for Derrick Renaud, extended K.Wilkins and F.Palazzolo to full names, (nw)
Added license for Paul Forgey
2015-12-21 09:57:22 +01:00
Miodrag Milanovic
234c5deb82 update license based on what actually is done by each person (nw) 2015-12-12 11:21:32 +01:00
Miodrag Milanovic
0c56ac848d clang-modernize part 3 2015-12-04 07:02:45 +01:00
Miodrag Milanovic
0825ce4f3b Cleanups and version bump 2015-11-25 08:22:24 +01:00
Miodrag Milanovic
6ba2d36e1d Some more cleanup (nw) 2015-11-11 17:47:41 +01:00
Miodrag Milanovic
4046c861ba These are not needed with official tools (nw) 2015-11-10 14:39:09 +01:00
Miodrag Milanovic
7c19aac60e Rename *.c -> *.cpp in our source (nw) 2015-11-08 12:56:12 +01:00