Commit Graph

14 Commits

Author SHA1 Message Date
hap
014cc81ea6 ui/info: add \n before btanb warning strings,
misc: replace pi constant with M_PI
2023-08-24 21:51:57 +02:00
Vas Crabb
a1d35e5abf Cleaned up bitmap API.
Made const-qualified pixel accessors (pix, pixt, raw_pixptr) return
const-qualified references/pointers to pixesl, and added non-const
versions.  This makes bitmap more like standard library containers where
const protects the content as well as the dimensions.

Made the templated pixt accessor protected - having it public makes it
too easy to inadvertently get a pointer to the wrong location.

Removed the pix(8|16|32|64) accessors from the specific bitmaps.  You
could only use the "correct" one anyway, and having the "incorrect" ones
available prevented explicit instantiations of the class template
because the static assertions would fail.  You can still see the pixel
type in the bitmap class names, and you can't assign the result of
&pix(y, x) to the wrong kind of pointer without a cast.

Added fill member functions to the specific bitmap template, and added
a explicit instantiations.  This allows the bitmap size check to be
skipped on most bitmap fills, although the clipping check is still
there.  Also fixed a couple of places that were trying to fill an
indexed 16-bit bitmap with rgb_t::black() exposed by this (replaced with
zero to get the same net effect).  The explicit template instantiations
in the .cpp file mean the compiler can inline the function if necessary,
but don't need to generate a local out-of-line body if it chooses not
to.

Extended the size of the fill value parameter in the base bitmap class
to 64 bits so it works correctly for 64-bit bitmaps.

Fixed places where IE15 and VGM visualiser weren't accounting for row
bytes potentially being larger than width.

Fixed an off-by-one in an HP-DIO card where it was treating the Topcat
cursor right edge as exclusive.

Updated everything to work with the API changes, reduced the scope of
many variables, added more const, and replaced a few fill/copy loops
with stuff from <algorithm>.
2020-09-27 14:00:42 +10: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
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
8a923f9361 srcclean and manual cleanup (nw) 2020-04-26 12:04:54 +10:00
Ryan Holtz
9c6f0781b0 -vgm_visualizer: Added more spectrogram visualization modes. [Ryan Holtz] 2020-04-08 19:38:18 +02:00
AJR
73c1c3400f vgm_visualizer.cpp: C++14's non-inline constexpr variables are problematic, part 2020 (nw) 2020-03-30 17:27:59 -04:00
mooglyguy
b4a32cf83a -vgmplay: Fixed DC offset issue, and added more visualization modes. [Ryan Holtz] 2020-03-30 14:29:08 +02:00
mooglyguy
b6ce59f77a -vgmplay: Added multiple spectrogram visualization modes. [Ryan Holtz] 2020-03-28 02:25:05 +01:00
Vas Crabb
ddfe149872 (nw) It helps if you're using the same data types in both places (VGM
visualiser device and WDL FFT libarary).

I changed the VGM visualiser to use single-precision float which is the
default for WDL FFT.  GCC's loop vectoriser can make better use of SSE
with single-precision maths, and the extra precision shouldn't be needed
for the visualisation.  If this is a problem, let me know and I'll
revert this and flip the WDL FFT library over the other way.
2020-03-07 07:01:48 +11:00
Vas Crabb
11ac7454db Maintenance:
* Removed empty nl_examples from dist.mak
* Added copyright acknowledgements and full text of licenses to binary distribution
* Fixed up the list of third-party libraries
* Moved WDL fft.c to 3rdparty
2020-03-04 22:41:15 +11:00
AJR
85ed543a01 vgm_visualizer: Build fixes (nw) 2020-03-01 14:22:43 -05:00
MooglyGuy
bcefd95275 -vgmplay: Added a visualizer. [Ryan Holtz, Justin Frankel] 2020-03-01 19:58:07 +01:00