Commit graph

30 commits

Author SHA1 Message Date
Clownacy
b57ccd7ed5 Shut up errors on Windows 2020-03-31 20:22:54 +01:00
Clownacy
d91c1e9bdc Update the SDL2 audio backend
Now uses the shared software mixer
2020-03-31 12:19:44 +01:00
Clownacy
f82a53d336 Prevent errors encountered by MSVC 2020-02-09 18:47:50 +00:00
Clownacy
2e5e1994c2 Enable debug console prints in non-debug builds 2020-02-03 16:44:52 +00:00
Clownacy
e3db7749ba Add verbose error-reporting to backends
Should fix #98
2020-02-01 12:22:44 +00:00
Clownacy
788697dc5d Fix a possible hang in the audio mixer
It was likely a race condition between the game thread writing to
'organya_timer', and the audio thread reading it.

...I really need to rethink the API for this Organya-synchronisation
thing.
2020-01-29 23:21:27 +00:00
Clownacy
e4394aea1f Whoops, forgot to remove this #include 2020-01-29 22:16:21 +00:00
Clownacy
d0defa4a7b This cast shouldn't be necessary 2020-01-29 22:15:53 +00:00
Clownacy
638e96be11 Move and rename attrHot
Like the MIN and MAX macros, I'd rather keep this in the source file
than a common header.
2020-01-29 22:14:35 +00:00
Gabriel Ravier
5e6658847c Re-add missing "(double)"
Signed-off-by: Gabriel Ravier <gabravier@gmail.com>
2020-01-29 23:04:17 +01:00
Gabriel Ravier
88a8362f23 Reverted fmodf stuff and tried to make it so C++ compilers would go for the float version in appropriate circumstances (fmodf directly is unavailable due to not being in C89)
Signed-off-by: Gabriel Ravier <gabravier@gmail.com>
2020-01-29 23:01:31 +01:00
Gabriel Ravier
1442299924 Made MixSounds be marked as hot
Signed-off-by: Gabriel Ravier <gabrielravier@gabrielAncientIBMv2>
2020-01-29 23:01:31 +01:00
Gabriel Ravier
c15ecbf728 Used fmodf instead of fmod for a 0.5% performance increase in MixSounds
Signed-off-by: Gabriel Ravier <gabrielravier@gabrielAncientIBMv2>
2020-01-29 23:01:31 +01:00
Clownacy
79886f5ae4 Add debug prints for listing SDL2 drivers
These list what video/render/audio backends are available, and which
are currently being used.

SDL2 allows you to choose a specific video/audio driver with the
SDL_VIDEODRIVER and SDL_AUDIODRIVER environment variables,
respectively, but there's no such option for the render driver.
2020-01-20 15:27:05 +00:00
Clownacy
449a09b09e Fix an occational invalid memory read
Stupid floating-point rounding errors. Had to undo a fancy
optimisation to avoid it.
2020-01-09 09:10:24 +00:00
Clownacy
bbf77f9cfd Capitalise a macro 2020-01-04 20:57:36 +00:00
Clownacy
01c5fb3a37 Shut up another warning 2019-10-29 12:25:03 +00:00
Clownacy
b6f8bf68ec Minor audio backend cleanup 2019-09-16 23:08:05 +00:00
Clownacy
949bfd129b Allow SDL2 to change the audio frequency
The mixer can handle arbitrary frequencies, so there's no point in
forcing SDL2 to use 44100Hz.
2019-09-10 22:11:31 +00:00
Clownacy
aede7b6069 Restore the FREQUENCY constant
Cave Story at 2000Hz is fun
2019-09-10 14:04:06 +00:00
Clownacy
657b586cd1 Add missing #include to audio backend
Another GabrielRavier fix.
2019-09-10 12:36:55 +00:00
Clownacy
355b303635 Shut up some warnings 2019-09-10 01:53:19 +01:00
Clownacy
3eb346ce10 Synchronise the audio callback with Organya
This is the 'perfect' Organya playback I mentioned in the commit
message for 5ea356a3bd
2019-09-09 21:43:33 +00:00
Clownacy
a076274864 Make a clamp macro safer 2019-09-09 20:24:09 +00:00
Clownacy
a220732aac Shut up some warnings 2019-09-06 20:03:35 +01:00
Clownacy
0dc9bb6b1b Change the audio backend API again 2019-09-06 14:46:31 +00:00
Clownacy
ce055c12cb Remove a now-unused function 2019-09-05 03:17:20 +00:00
Clownacy
a3bb651194 Change the audio backend API a little
AudioBackend_SetSoundPosition was very loosely-defined.
2019-09-04 03:16:33 +01:00
Clownacy
5ea356a3bd Weed out a lot of the Windows dependency
Storytime: Cucky's original SDL2 port work involved using SDL2's
threading API to emulate the original WinAPI threading.

I can't be assed with that stuff, so I used the same trick Cucky did
for the Wii port, and hooked Organya up to the SDL2 audio callback.
This actually opens up the possibility for perfectly-synchronised
Organya playback. By that I mean, instead of needing a super
low-latency audio callback, I can have the callback synchronise its
audio mixing with Organya itself. I haven't done it yet, I plan to
soon.
2019-09-04 00:28:23 +01:00
Clownacy
5a9492166d Restored the new SDL2 audio system
While I was at it, I overhauled the thing and found a bunch of
optimisations,
2019-09-03 22:29:57 +01:00