Skip to content

Commit

Permalink
Merge pull request #741 from edge-classic/fp-mixer
Browse files Browse the repository at this point in the history
Migrate to floating point audio mixing; simplify blitting and mono vs. stereo audio processing
  • Loading branch information
dashodanger authored Oct 17, 2024
2 parents 0a43bd5 + d0ed06b commit 3af9bf0
Show file tree
Hide file tree
Showing 52 changed files with 6,124 additions and 27,282 deletions.
5 changes: 1 addition & 4 deletions docs/licenses/License Attribution.txt
Original file line number Diff line number Diff line change
Expand Up @@ -25,9 +25,6 @@ libRAD (patches.cpp/radmidi.cpp) - Copyright (c) 2021-2023 Devin Acker
Mod4Play library - Copyright (c) 2024 dashodanger
Copyright (c) 2022 Olav Sørensen

minivorbis library - Copyright (c) 2020 Eduardo Bart
Copyright (c) 2002-2020 Xiph.org Foundation

ZDoom FName implementation - Copyright (c) 2005-2007 Randy Heit

===========================================================================================
Expand Down Expand Up @@ -139,7 +136,7 @@ prns.h - Marc B. Reynolds

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

stb_image, stb_image_write, stb_rect_pack, stb_sprintf and stb_truetype libraries - Sean Barrett
stb_image, stb_image_write, stb_rect_pack, stb_sprintf, stb_truetype and stb_vorbis libraries - Sean Barrett

===========================================================================================
SIL Open Font License
Expand Down
2 changes: 0 additions & 2 deletions libraries/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
add_subdirectory(almostequals)
add_subdirectory(crsid)
add_subdirectory(dr_libs)
add_subdirectory(fmmidi)
add_subdirectory(fluidlite)
if (NOT EDGE_GL_ES2)
add_subdirectory(glad)
Expand All @@ -13,7 +12,6 @@ add_subdirectory(libRAD)
add_subdirectory(libvwad)
add_subdirectory(lua)
add_subdirectory(m4p)
add_subdirectory(minivorbis)
add_subdirectory(miniz)
add_subdirectory(pl_mpeg)
add_subdirectory(prns)
Expand Down
25 changes: 25 additions & 0 deletions libraries/crsid/host/audio.c
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
#include <stdint.h>

void cRSID_generateSound(cRSID_C64instance *C64, unsigned char *buf, unsigned short len)
{
static unsigned short i;
Expand All @@ -18,6 +20,29 @@ void cRSID_generateSound(cRSID_C64instance *C64, unsigned char *buf, unsigned sh
}
}

void cRSID_generateFloat(cRSID_C64instance *C64, float *buf, unsigned short len)
{
static unsigned short i;
static unsigned char j;
static cRSID_Output Output;
static int16_t OutputL, OutputR;

for (i = 0; i < len; i += 8)
{
for (j = 0; j < C64->PlaybackSpeed; ++j)
Output = cRSID_generateSample(C64);
#if defined _MSC_VER || (defined __SIZEOF_FLOAT__ && __SIZEOF_FLOAT__ == 4)
*(uint32_t *)buf=0x43818000^((uint16_t)Output.L * C64->MainVolume / 256);
*buf++ -= 259.0f;
*(uint32_t *)buf=0x43818000^((uint16_t)Output.R * C64->MainVolume / 256);
*buf++ -= 259.0f;
#else
*buf++ = (float)(Output.L * C64->MainVolume / 256) * 0.000030517578125f;
*buf++ = (float)(Output.R * C64->MainVolume / 256) * 0.000030517578125f;
#endif
}
}

static inline cRSID_Output cRSID_generateSample(cRSID_C64instance *C64)
{ // call this from custom buffer-filler
static cRSID_Output Output;
Expand Down
1 change: 1 addition & 0 deletions libraries/crsid/libcRSID.h
Original file line number Diff line number Diff line change
Expand Up @@ -102,6 +102,7 @@ extern "C"

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

struct cRSID_SIDheader
{ // Offset: default/info:
Expand Down
10 changes: 0 additions & 10 deletions libraries/fmmidi/CHANGES.txt

This file was deleted.

10 changes: 0 additions & 10 deletions libraries/fmmidi/CMakeLists.txt

This file was deleted.

26 changes: 0 additions & 26 deletions libraries/fmmidi/LICENSE.txt

This file was deleted.

Loading

0 comments on commit 3af9bf0

Please sign in to comment.