Skip to content

Commit 3af9bf0

Browse files
authored
Merge pull request #741 from edge-classic/fp-mixer
Migrate to floating point audio mixing; simplify blitting and mono vs. stereo audio processing
2 parents 0a43bd5 + d0ed06b commit 3af9bf0

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

52 files changed

+6124
-27282
lines changed

docs/licenses/License Attribution.txt

+1-4
Original file line numberDiff line numberDiff line change
@@ -25,9 +25,6 @@ libRAD (patches.cpp/radmidi.cpp) - Copyright (c) 2021-2023 Devin Acker
2525
Mod4Play library - Copyright (c) 2024 dashodanger
2626
Copyright (c) 2022 Olav Sørensen
2727

28-
minivorbis library - Copyright (c) 2020 Eduardo Bart
29-
Copyright (c) 2002-2020 Xiph.org Foundation
30-
3128
ZDoom FName implementation - Copyright (c) 2005-2007 Randy Heit
3229

3330
===========================================================================================
@@ -139,7 +136,7 @@ prns.h - Marc B. Reynolds
139136

140137
"sf_GMbank" soundfont (renamed to Default.sf2) - The Csound Developers
141138

142-
stb_image, stb_image_write, stb_rect_pack, stb_sprintf and stb_truetype libraries - Sean Barrett
139+
stb_image, stb_image_write, stb_rect_pack, stb_sprintf, stb_truetype and stb_vorbis libraries - Sean Barrett
143140

144141
===========================================================================================
145142
SIL Open Font License

libraries/CMakeLists.txt

-2
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
add_subdirectory(almostequals)
22
add_subdirectory(crsid)
33
add_subdirectory(dr_libs)
4-
add_subdirectory(fmmidi)
54
add_subdirectory(fluidlite)
65
if (NOT EDGE_GL_ES2)
76
add_subdirectory(glad)
@@ -13,7 +12,6 @@ add_subdirectory(libRAD)
1312
add_subdirectory(libvwad)
1413
add_subdirectory(lua)
1514
add_subdirectory(m4p)
16-
add_subdirectory(minivorbis)
1715
add_subdirectory(miniz)
1816
add_subdirectory(pl_mpeg)
1917
add_subdirectory(prns)

libraries/crsid/host/audio.c

+25
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
#include <stdint.h>
2+
13
void cRSID_generateSound(cRSID_C64instance *C64, unsigned char *buf, unsigned short len)
24
{
35
static unsigned short i;
@@ -18,6 +20,29 @@ void cRSID_generateSound(cRSID_C64instance *C64, unsigned char *buf, unsigned sh
1820
}
1921
}
2022

23+
void cRSID_generateFloat(cRSID_C64instance *C64, float *buf, unsigned short len)
24+
{
25+
static unsigned short i;
26+
static unsigned char j;
27+
static cRSID_Output Output;
28+
static int16_t OutputL, OutputR;
29+
30+
for (i = 0; i < len; i += 8)
31+
{
32+
for (j = 0; j < C64->PlaybackSpeed; ++j)
33+
Output = cRSID_generateSample(C64);
34+
#if defined _MSC_VER || (defined __SIZEOF_FLOAT__ && __SIZEOF_FLOAT__ == 4)
35+
*(uint32_t *)buf=0x43818000^((uint16_t)Output.L * C64->MainVolume / 256);
36+
*buf++ -= 259.0f;
37+
*(uint32_t *)buf=0x43818000^((uint16_t)Output.R * C64->MainVolume / 256);
38+
*buf++ -= 259.0f;
39+
#else
40+
*buf++ = (float)(Output.L * C64->MainVolume / 256) * 0.000030517578125f;
41+
*buf++ = (float)(Output.R * C64->MainVolume / 256) * 0.000030517578125f;
42+
#endif
43+
}
44+
}
45+
2146
static inline cRSID_Output cRSID_generateSample(cRSID_C64instance *C64)
2247
{ // call this from custom buffer-filler
2348
static cRSID_Output Output;

libraries/crsid/libcRSID.h

+1
Original file line numberDiff line numberDiff line change
@@ -102,6 +102,7 @@ extern "C"
102102

103103
// host/audio.c
104104
void cRSID_generateSound(cRSID_C64instance *C64, unsigned char *buf, unsigned short len);
105+
void cRSID_generateFloat(cRSID_C64instance *C64, float *buf, unsigned short len);
105106

106107
struct cRSID_SIDheader
107108
{ // Offset: default/info:

libraries/fmmidi/CHANGES.txt

-10
This file was deleted.

libraries/fmmidi/CMakeLists.txt

-10
This file was deleted.

libraries/fmmidi/LICENSE.txt

-26
This file was deleted.

0 commit comments

Comments
 (0)