Skip to content

Commit 677d7fe

Browse files
committed
The Full Ass Complete Audio Rework
Original Commit Histories are in https://github.com/Cam-VSRG/lime/tree/audio-rework-dummy Squashed to 1 commit because majigsaw told me to
1 parent 3fee36b commit 677d7fe

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

+6750
-1438
lines changed

.gitmodules

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -83,3 +83,13 @@
8383
path = project/lib/hashlink
8484
url = https://github.com/HaxeFoundation/hashlink
8585
shallow = true
86+
[submodule "project/lib/dr_libs"]
87+
path = project/lib/dr_libs
88+
url = https://github.com/mackron/dr_libs
89+
shallow = true
90+
[submodule "project/lib/opusfile"]
91+
path = project/lib/opusfile
92+
url = https://github.com/xiph/opusfile
93+
[submodule "project/lib/opus"]
94+
path = project/lib/opus
95+
url = https://github.com/xiph/opus

include.xml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@
66
<log error="Lime ${lime} requires Haxe 4 to target HashLink (version ${haxe} found)" if="hl ${${haxe} < 4.0}" />
77

88
<set name="lime" />
9+
<define name="lime-funkin" />
910

1011
<define name="native" if="cpp || neko || nodejs || cs || java || hl" />
1112
<define name="howlerjs" if="html5" />
@@ -15,13 +16,15 @@
1516
<define name="lime-cffi" if="native" />
1617
<define name="lime-curl" unless="lime-console || lime-switch || emscripten || flash || html5" />
1718
<define name="lime-dom" if="html5" />
19+
<define name="lime-drlibs" if="native" />
1820
<define name="lime-harfbuzz" if="native" />
1921
<define name="lime-howlerjs" if="html5" />
2022
<define name="lime-html5" if="html5" />
2123
<define name="lime-native" if="native" />
2224
<define name="lime-openal" unless="lime-console || flash || html5" />
2325
<define name="lime-opengl" if="desktop" unless="html5" />
2426
<define name="lime-opengles" if="emscripten || mobile" />
27+
<define name="lime-opus" if="native" />
2528
<define name="lime-vorbis" if="native" />
2629
<define name="lime-webgl" if="html5" />
2730

project/Build.xml

Lines changed: 26 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@
2222
<set name="LIME_LZMA" value="1" />
2323
<set name="LIME_MBEDTLS" value="1" unless="emscripten || winrt" />
2424
<!-- <set name="LIME_NEKO" value="1" if="linux" /> -->
25-
<set name="LIME_OGG" value="1" />
25+
<set name="LIME_OPUS" value="1" />
2626
<set name="LIME_OPENALSOFT" value="1" if="windows || linux || mac || android || iphone" unless="tvos" />
2727
<set name="LIME_OPENAL" value="1" if="webassembly || tvos" />
2828
<set name="LIME_MOJOAL" value="1" if="switch || static_link || winrt || mojoal" unless="LIME_OPENAL || iphone LIME_OPENALSOFT" />
@@ -42,6 +42,7 @@
4242
<!-- <set name="LIME_VPX" value="1" />
4343
<set name="LIME_WEBM" value="1" /> -->
4444
<set name="LIME_ZLIB" value="1" />
45+
<set name="LIME_DRLIBS" value="1" />
4546

4647
<set name="OUTPUT_DIR" value="../ndll" unless="OUTPUT_DIR" />
4748
<set name="NATIVE_TOOLKIT_PATH" value="lib" unless="NATIVE_TOOLKIT_PATH" />
@@ -89,6 +90,18 @@
8990

9091
</section>
9192

93+
<section if="LIME_DRLIBS">
94+
95+
<compilerflag value="-I${NATIVE_TOOLKIT_PATH}/dr_libs/" />
96+
<compilerflag value="-DLIME_DRLIBS" />
97+
98+
<file name="src/media/codecs/flac/DrFlac.cpp" />
99+
<file name="src/media/codecs/mp3/DrMp3.cpp" />
100+
<file name="src/media/codecs/wav/DrWav.cpp" />
101+
<file name="src/media/codecs/DrLibsBindings.cpp" />
102+
103+
</section>
104+
92105
<section if="LIME_EFSW">
93106

94107
<compilerflag value="-I${NATIVE_TOOLKIT_PATH}/efsw/include/" />
@@ -173,14 +186,14 @@
173186

174187
</section>
175188

176-
<section if="LIME_OGG">
189+
<section if="LIME_OPUS">
177190

178-
<compilerflag value="-I${NATIVE_TOOLKIT_PATH}/custom/ogg/include/" />
179-
<compilerflag value="-I${NATIVE_TOOLKIT_PATH}/ogg/include/" />
180-
<compilerflag value="-I${NATIVE_TOOLKIT_PATH}/vorbis/include/" />
181-
<compilerflag value="-DLIME_OGG" />
191+
<compilerflag value="-I${NATIVE_TOOLKIT_PATH}/opus/include/" />
192+
<compilerflag value="-I${NATIVE_TOOLKIT_PATH}/opusfile/include" />
193+
<compilerflag value="-DLIME_OPUS" />
182194

183-
<file name="src/media/containers/OGG.cpp" />
195+
<file name="src/media/codecs/opus/OpusFile.cpp" />
196+
<file name="src/media/codecs/OpusBindings.cpp" />
184197

185198
</section>
186199

@@ -284,12 +297,13 @@
284297

285298
<section if="LIME_VORBIS">
286299

300+
<compilerflag value="-I${NATIVE_TOOLKIT_PATH}/custom/ogg/include/" />
287301
<compilerflag value="-I${NATIVE_TOOLKIT_PATH}/ogg/include/" />
288302
<compilerflag value="-I${NATIVE_TOOLKIT_PATH}/vorbis/include/" />
289303
<compilerflag value="-DLIME_VORBIS" />
290304

291-
<file name="src/media/codecs/vorbis/VorbisBindings.cpp" />
292305
<file name="src/media/codecs/vorbis/VorbisFile.cpp" />
306+
<file name="src/media/codecs/VorbisBindings.cpp" />
293307

294308
</section>
295309

@@ -313,7 +327,6 @@
313327
<file name="src/math/Rectangle.cpp" />
314328
<file name="src/math/Vector2.cpp" />
315329
<file name="src/media/AudioBuffer.cpp" />
316-
<file name="src/media/containers/WAV.cpp" />
317330
<file name="src/system/CFFI.cpp" />
318331
<file name="src/system/CFFIPointer.cpp" />
319332
<file name="src/system/ClipboardEvent.cpp" />
@@ -351,6 +364,7 @@
351364

352365
<include name="lib/cairo-files.xml" />
353366
<include name="lib/curl-files.xml" />
367+
<include name="lib/dr-libs-files.xml" />
354368
<include name="lib/efsw-files.xml" />
355369
<include name="lib/faudio-files.xml" if="LIME_FAUDIO" />
356370
<include name="lib/freetype-files.xml" />
@@ -360,7 +374,7 @@
360374
<include name="lib/mbedtls-files.xml" />
361375
<include name="lib/mojoal-files.xml" />
362376
<include name="lib/neko-files.xml" />
363-
<include name="lib/ogg-files.xml" />
377+
<include name="lib/opus-files.xml" />
364378
<include name="lib/openal-files.xml" />
365379
<include name="lib/pixman-files.xml" />
366380
<include name="lib/png-files.xml" />
@@ -393,7 +407,7 @@
393407
<files id="native-toolkit-mbedtls" if="LIME_MBEDTLS" />
394408
<files id="native-toolkit-mojoal" if="LIME_MOJOAL" />
395409
<files id="native-toolkit-neko" if="LIME_NEKO" />
396-
<files id="native-toolkit-ogg" if="LIME_OGG" />
410+
<files id="native-toolkit-opus" if="LIME_OPUS" />
397411
<files id="native-toolkit-openal" if="LIME_OPENALSOFT" />
398412
<files id="native-toolkit-pixman" if="LIME_PIXMAN" />
399413
<files id="native-toolkit-png" if="LIME_PNG" />
@@ -403,6 +417,7 @@
403417
<files id="native-toolkit-vpx" if="LIME_VPX" />
404418
<files id="native-toolkit-webm" if="LIME_WEBM" />
405419
<files id="native-toolkit-zlib" if="LIME_ZLIB" />
420+
<files id="native-toolkit-dr-libs" if="LIME_DRLIBS" />
406421

407422
<section unless="static_link">
408423

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
#ifndef LIME_MEDIA_CODECS_FLAC_DR_FLAC_H
2+
#define LIME_MEDIA_CODECS_FLAC_DR_FLAC_H
3+
4+
5+
#include <utils/Bytes.h>
6+
#include <dr_flac.h>
7+
8+
9+
namespace lime {
10+
11+
12+
class DrFlac {
13+
14+
15+
public:
16+
17+
static drflac* FromBytes (Bytes* bytes);
18+
static drflac* FromFile (const char* path);
19+
static void Close (drflac* pFlac);
20+
21+
22+
};
23+
24+
25+
}
26+
27+
28+
29+
#endif
Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
#ifndef LIME_MEDIA_CODECS_MP3_DR_MP3_H
2+
#define LIME_MEDIA_CODECS_MP3_DR_MP3_H
3+
4+
5+
#include <utils/Bytes.h>
6+
#include <dr_mp3.h>
7+
8+
9+
namespace lime {
10+
11+
12+
class DrMp3 {
13+
14+
15+
public:
16+
17+
static drmp3* FromBytes (Bytes* bytes);
18+
static drmp3* FromFile (const char* path);
19+
static void Close (drmp3* pMp3);
20+
21+
22+
};
23+
24+
25+
}
26+
27+
28+
29+
#endif
Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
#ifndef LIME_MEDIA_CODECS_OPUS_OPUS_FILE_H
2+
#define LIME_MEDIA_CODECS_OPUS_OPUS_FILE_H
3+
4+
5+
#include <utils/Bytes.h>
6+
#include <opusfile.h>
7+
8+
9+
namespace lime {
10+
11+
12+
class OpusFile {
13+
14+
15+
public:
16+
17+
18+
static OggOpusFile* FromBytes (Bytes* bytes);
19+
static OggOpusFile* FromFile (const char* path);
20+
21+
22+
};
23+
24+
25+
}
26+
27+
28+
#endif

project/include/media/codecs/vorbis/VorbisFile.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33

44

55
#include <utils/Bytes.h>
6+
#include <vorbis/codec.h>
67
#include <vorbis/vorbisfile.h>
78

89

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
#ifndef LIME_MEDIA_CODECS_WAV_DR_WAV_H
2+
#define LIME_MEDIA_CODECS_WAV_DR_WAV_H
3+
4+
5+
#include <utils/Bytes.h>
6+
#include <dr_wav.h>
7+
8+
9+
namespace lime {
10+
11+
12+
class DrWav {
13+
14+
15+
public:
16+
17+
static drwav* FromBytes (Bytes* bytes);
18+
static drwav* FromFile (const char* path);
19+
static void Close (drwav* pWav);
20+
21+
22+
};
23+
24+
25+
}
26+
27+
28+
29+
#endif

project/include/media/containers/OGG.h

Lines changed: 0 additions & 26 deletions
This file was deleted.

project/include/media/containers/WAV.h

Lines changed: 0 additions & 57 deletions
This file was deleted.

0 commit comments

Comments
 (0)