SDL_sound. An abstract soundfile decoder. SDL_sound is a library that handles the decoding of several popular sound file formats, such as .WAV and .MP3. It is meant to make the programmer's sound playback tasks simpler. The programmer gives SDL_sound a filename, or feeds it data directly from one of many sources, and then reads the decoded waveform data back at her leisure. If resource constraints are a concern, SDL_sound can process sound data in programmer-specified blocks. Alternately, SDL_sound can decode a whole sound file and hand back a single pointer to the whole waveform. SDL_sound can also handle sample rate, audio format, and channel conversion on-the-fly and behind-the-scenes, if the programmer desires. Please check the website for the most up-to-date information about SDL_sound: https://icculus.org/SDL_sound/ SDL_sound _REQUIRES_ Simple Directmedia Layer (SDL) 2.x to function, and cannot be built without it. You can get SDL from https://www.libsdl.org/. Reports of success or failure are welcome. Current versions of SDL_sound do not use any external libraries for decoding various file formats. All needed decoder source code is included with the library. Unless explicitly disabled during initial build configuration, SDL_sound always supports the following file formats internally: - Wave (.WAV) files - MPEG-1 layers I-III (.MP3, .MP2, .MP1) - Ogg Vorbis (.OGG) files - Free Lossless Audio Codec (.FLAC) files - Audio Interchange format (.AIFF) files - Sun/NeXT Audio (.AU) files - Shorten (.SHN) files - Creative Labs Voice (.VOC) files - Various "module" formats (.MOD, .669, .AMF, .XM, .IT, .S3M, .STM, etc) - MIDI (.mid) files - Raw PCM data - (macOS/iOS only) anything that CoreAudio can decode. Building/Installing: Please read docs/INSTALL.txt. Reporting bugs/commenting: There is a mailing list available. Subscription and mailing list archives can be found here: https://icculus.org/mailman/listinfo/sdlsound The mailing list is the best way to get in touch with SDL_sound developers. --ryan. ([email protected])
An abstract soundfile decoder.
Overview
Comments
-
"release" tag
hi there, since the last release goes back several years, and the commit hashes changed since the switch from hg, would you mind doing an occasional tag so distros have something specific they can point to to get a tarball ? it doesn't really matter whether it's a proper release, for example it'd be perfectly fine if current master is tagged as e.g. "v1.0.4-beta1".
-
build: stb_vorbis.h requires -lm
There is no
-lm
on the link command for libSDL2_sound.so.2, so the build fails on some systems where-Wl,--as-needed
is also used, as the linker no longer scans -lSDL2 > libSDL2.so > libasound.so.2 > libm.so.6.[ 42s] [ 91%] Linking C shared library libSDL2_sound.so [ 42s] /usr/bin/cmake -E cmake_link_script CMakeFiles/SDL2_sound.dir/link.txt --verbose=1 [ 42s] /usr/bin/cc -fPIC -fmessage-length=0 -grecord-gcc-switches -O2 -Wall -D_FORTIFY_SOURCE=2 -fstack-protector-strong -fun wind-tables -fasynchronous-unwind-tables -fstack-clash-protection -DNDEBUG -O2 -g -DNDEBUG -Wl,--as-needed -Wl,--no-undefined -Wl,-z,now -shared -Wl,-soname,libSDL2_sound.so.2 -o libSDL2_sound.so.2.0.1 CMakeFiles/SDL2_sound.dir/src/SDL_sound.c.o CMakeFi les/SDL2_sound.dir/src/SDL_sound_aiff.c.o CMakeFiles/SDL2_sound.dir/src/SDL_sound_au.c.o CMakeFiles/SDL2_sound.dir/src/SDL_soun d_coreaudio.c.o CMakeFiles/SDL2_sound.dir/src/SDL_sound_flac.c.o CMakeFiles/SDL2_sound.dir/src/SDL_sound_midi.c.o CMakeFiles/SD L2_sound.dir/src/SDL_sound_modplug.c.o CMakeFiles/SDL2_sound.dir/src/SDL_sound_mp3.c.o CMakeFiles/SDL2_sound.dir/src/SDL_sound_ raw.c.o CMakeFiles/SDL2_sound.dir/src/SDL_sound_shn.c.o CMakeFiles/SDL2_sound.dir/src/SDL_sound_voc.c.o CMakeFiles/SDL2_sound.d ir/src/SDL_sound_vorbis.c.o CMakeFiles/SDL2_sound.dir/src/SDL_sound_wav.c.o CMakeFiles/SDL2_sound.dir/src/libmodplug/fastmix.c. o CMakeFiles/SDL2_sound.dir/src/libmodplug/load_669.c.o CMakeFiles/SDL2_sound.dir/src/libmodplug/load_amf.c.o CMakeFiles/SDL2_s ound.dir/src/libmodplug/load_ams.c.o CMakeFiles/SDL2_sound.dir/src/libmodplug/load_dbm.c.o CMakeFiles/SDL2_sound.dir/src/libmod plug/load_dmf.c.o CMakeFiles/SDL2_sound.dir/src/libmodplug/load_dsm.c.o CMakeFiles/SDL2_sound.dir/src/libmodplug/load_far.c.o C MakeFiles/SDL2_sound.dir/src/libmodplug/load_it.c.o CMakeFiles/SDL2_sound.dir/src/libmodplug/load_mdl.c.o CMakeFiles/SDL2_sound .dir/src/libmodplug/load_med.c.o CMakeFiles/SDL2_sound.dir/src/libmodplug/load_mod.c.o CMakeFiles/SDL2_sound.dir/src/libmodplug /load_mt2.c.o CMakeFiles/SDL2_sound.dir/src/libmodplug/load_mtm.c.o CMakeFiles/SDL2_sound.dir/src/libmodplug/load_okt.c.o CMakeFiles/SDL2_sound.dir/src/libmodplug/load_gdm.c.o CMakeFiles/SDL2_sound.dir/src/libmodplug/load_psm.c.o CMakeFiles/SDL2_sound.dir/src/libmodplug/load_ptm.c.o CMakeFiles/SDL2_sound.dir/src/libmodplug/load_s3m.c.o CMakeFiles/SDL2_sound.dir/src/libmodplug/load_stm.c.o CMakeFiles/SDL2_sound.dir/src/libmodplug/load_ult.c.o CMakeFiles/SDL2_sound.dir/src/libmodplug/load_umx.c.o CMakeFiles/SDL2_sound.dir/src/libmodplug/load_xm.c.o CMakeFiles/SDL2_sound.dir/src/libmodplug/mmcmp.c.o CMakeFiles/SDL2_sound.dir/src/libmodplug/modplug.c.o CMakeFiles/SDL2_sound.dir/src/libmodplug/snd_dsp.c.o CMakeFiles/SDL2_sound.dir/src/libmodplug/snd_flt.c.o CMakeFiles/SDL2_sound.dir/src/libmodplug/snd_fx.c.o CMakeFiles/SDL2_sound.dir/src/libmodplug/sndfile.c.o CMakeFiles/SDL2_sound.dir/src/libmodplug/sndmix.c.o -L/usr/lib64 -lSDL2 [ 42s] /usr/lib64/gcc/x86_64-suse-linux/7/../../../../x86_64-suse-linux/bin/ld: CMakeFiles/SDL2_sound.dir/src/SDL_sound_vorbis.c.o: in function `lookup1_values': [ 42s] /home/abuild/rpmbuild/BUILD/SDL_sound-2.0.1/src/stb_vorbis.h:1283: undefined reference to `exp' (openSUSE Leap 15.3)
-
cmake: libraries cannot link to SDL2::SDL2main (through SDL2_LIBRARIES)
With MinGW when linking to
SDL2::SDL2main
,-Wl,-u,main
is passed to the linker. This was done to avoid the requriement of adding-lmingw32 -lSDL2
+ it also allows normal CMake targets.Fixes #75 Fixes #72
CI: https://github.com/madebr/SDL_sound/actions/runs/3078892981
-
SDL_sound unable to decode Ogg Vorbis file
This bug report was migrated from our old Bugzilla tracker.
These attachments are available in the static archive:
- Ogg Vorbis file that cannot be decoded (test.ogg, video/ogg, 2012-04-21 14:01:30 +0000, 75527 bytes)
Reported in version: unspecified Reported for operating system, platform: Linux, x86_64
Comments on the original bug report:
On 2012-04-21 14:01:30 +0000, Nikos Chantziaras wrote:
Created attachment 847 Ogg Vorbis file that cannot be decoded
SDL_sound (current hg stable-1.0) cannot decode the attached file in whole. A part of it is decoded, but at the wrong samplerate. The SOUND_SAMPLEFLAG_ERROR is set in the sample, but Sound_GetError() doesn't return anything.
SDL_mixer has no problems decoding the file with Mix_LoadWAV_RW, so it's not a problem with the file. SDL_mixer is unsuitable though, because it doesn't support partial decoding; it decodes the whole file in one go.
libvorbis 1.3.2 libogg 1.3.0
This is a test program that demonstrates the bug:
#include <stdio.h> #include <SDL_sound.h> int main(void) { if (SDL_Init(SDL_INIT_AUDIO) != 0) { printf("SDL_Init() failed: %s\n", SDL_GetError()); return 1; } if (Sound_Init() == 0) { printf("Sound_Init() failed: %s\n", Sound_GetError()); return 1; } SDL_RWops* rw = SDL_RWFromFile("test.ogg", "rb"); if (rw == 0) { printf("ERROR: %s\n", SDL_GetError()); return 1; } Sound_AudioInfo wantedFormat; wantedFormat.channels = 2; wantedFormat.rate = 44100; wantedFormat.format = AUDIO_S16LSB; Sound_Sample* sample = Sound_NewSample(rw, "OGG", &wantedFormat, 4096); if (sample == 0) { printf("ERROR: %s\n", Sound_GetError()); return 1; } Sound_DecodeAll(sample); if (sample->flags & SOUND_SAMPLEFLAG_ERROR) { printf("ERROR: %s\n", Sound_GetError()); } Sound_Quit(); SDL_Quit(); return 0; }
-
Fix underlinking with lld (missing -lm)
We need to explicitly search for and link with -lm if needed by libc for math libraries like
log
andsin
:ld.lld: error: undefined reference due to --no-allow-shlib-undefined: sin >>> referenced by ../.libs/libSDL_sound.so ld.lld: error: undefined reference due to --no-allow-shlib-undefined: log >>> referenced by ../.libs/libSDL_sound.so
It turns out Gentoo has actually had a patch for this since 2012 (mea culpa!) but it never made its way upstream.
We're already using libtool, so just use the macro it provides for this purpose.
Signed-off-by: Sam James [email protected]
-
Error building with macOS Monterey and CMake 3.24
I tried to build on macOS Monterey 12.6 using the following:
SDL2_SOUND_VERSION=8d96d4cc0e1df35835a222ee51a7c32f273ec63e cd /tmp curl -fLsS "https://github.com/icculus/SDL_sound/archive/$SDL2_SOUND_VERSION.tar.gz" --output SDL_sound.tar.gz tar -xvzf SDL_sound.tar.gz mv SDL_sound-$SDL2_SOUND_VERSION SDL_sound cd /tmp/SDL_sound mkdir /tmp/SDL_sound/build cd /tmp/SDL_sound/build cmake -DSDL2_DIR=/usr/local/lib/cmake/SDL2 -DSDLSOUND_DECODER_MIDI=1 .. && make make install
but I got an error at link time that looked like I was missing
-framework AudioToolbox
, but I use it in other projects, not sure what I am doing wrong here... I have cmake version 3.24.2-- The C compiler identification is AppleClang 13.1.6.13160021 -- Detecting C compiler ABI info -- Detecting C compiler ABI info - done -- Check for working C compiler: /Library/Developer/CommandLineTools/usr/bin/cc - skipped -- Detecting C compile features -- Detecting C compile features - done -- Could NOT find Doxygen (missing: DOXYGEN_EXECUTABLE) -- Doxygen not found. You won't be able to build documentation. -- SDL_sound will build with the following options: -- WAV support: enabled -- AIFF support: enabled -- AU support: enabled -- VOC support: enabled -- FLAC support: enabled -- VORBIS support: enabled -- RAW support: enabled -- SHN support: enabled -- MODPLUG support: enabled -- MP3 support: enabled -- TiMidity support: enabled -- COREAUDIO support: enabled -- Build static library: enabled -- Build shared library: enabled -- Build stdio test program: enabled -- Configuring done CMake Warning (dev): Policy CMP0068 is not set: RPATH settings on macOS do not affect install_name. Run "cmake --help-policy CMP0068" for policy details. Use the cmake_policy command to set the policy and suppress this warning. For compatibility with older versions of CMake, the install_name fields for the following targets are still affected by RPATH settings: SDL2_sound This warning is for project developers. Use -Wno-dev to suppress it. -- Generating done -- Build files have been written to: /tmp/SDL_sound/build [ 0%] Building C object CMakeFiles/SDL2_sound.dir/src/SDL_sound.c.o [ 1%] Building C object CMakeFiles/SDL2_sound-static.dir/src/SDL_sound.c.o [ 3%] Building C object CMakeFiles/SDL2_sound-static.dir/src/SDL_sound_aiff.c.o [ 3%] Building C object CMakeFiles/SDL2_sound.dir/src/SDL_sound_aiff.c.o [ 4%] Building C object CMakeFiles/SDL2_sound.dir/src/SDL_sound_au.c.o [ 5%] Building C object CMakeFiles/SDL2_sound.dir/src/SDL_sound_coreaudio.c.o [ 7%] Building C object CMakeFiles/SDL2_sound.dir/src/SDL_sound_flac.c.o [ 7%] Building C object CMakeFiles/SDL2_sound-static.dir/src/SDL_sound_au.c.o [ 8%] Building C object CMakeFiles/SDL2_sound-static.dir/src/SDL_sound_coreaudio.c.o [ 9%] Building C object CMakeFiles/SDL2_sound-static.dir/src/SDL_sound_flac.c.o /tmp/SDL_sound/src/SDL_sound_coreaudio.c:487:9: warning: variable 'total_frames_read' set but not used [-Wunused-but-set-variable] UInt32 total_frames_read = 0; ^ 1 warning generated. [ 10%] Building C object CMakeFiles/SDL2_sound-static.dir/src/SDL_sound_midi.c.o /tmp/SDL_sound/src/SDL_sound_coreaudio.c:487:9: warning: variable 'total_frames_read' set but not used [-Wunused-but-set-variable] UInt32 total_frames_read = 0; ^ [ 11%] Building C object CMakeFiles/SDL2_sound.dir/src/SDL_sound_midi.c.o 1 warning generated. [ 12%] Building C object CMakeFiles/SDL2_sound-static.dir/src/SDL_sound_modplug.c.o [ 13%] Building C object CMakeFiles/SDL2_sound.dir/src/SDL_sound_modplug.c.o [ 14%] Building C object CMakeFiles/SDL2_sound.dir/src/SDL_sound_mp3.c.o [ 14%] Building C object CMakeFiles/SDL2_sound-static.dir/src/SDL_sound_mp3.c.o [ 15%] Building C object CMakeFiles/SDL2_sound.dir/src/SDL_sound_raw.c.o [ 16%] Building C object CMakeFiles/SDL2_sound-static.dir/src/SDL_sound_raw.c.o [ 17%] Building C object CMakeFiles/SDL2_sound-static.dir/src/SDL_sound_shn.c.o [ 18%] Building C object CMakeFiles/SDL2_sound.dir/src/SDL_sound_shn.c.o [ 19%] Building C object CMakeFiles/SDL2_sound-static.dir/src/SDL_sound_voc.c.o [ 20%] Building C object CMakeFiles/SDL2_sound-static.dir/src/SDL_sound_vorbis.c.o [ 20%] Building C object CMakeFiles/SDL2_sound.dir/src/SDL_sound_voc.c.o [ 21%] Building C object CMakeFiles/SDL2_sound-static.dir/src/SDL_sound_wav.c.o [ 22%] Building C object CMakeFiles/SDL2_sound.dir/src/SDL_sound_vorbis.c.o [ 23%] Building C object CMakeFiles/SDL2_sound.dir/src/SDL_sound_wav.c.o [ 24%] Building C object CMakeFiles/SDL2_sound-static.dir/src/timidity/common.c.o [ 25%] Building C object CMakeFiles/SDL2_sound.dir/src/timidity/common.c.o [ 26%] Building C object CMakeFiles/SDL2_sound-static.dir/src/timidity/instrum.c.o [ 27%] Building C object CMakeFiles/SDL2_sound-static.dir/src/timidity/mix.c.o [ 28%] Building C object CMakeFiles/SDL2_sound-static.dir/src/timidity/output.c.o [ 29%] Building C object CMakeFiles/SDL2_sound.dir/src/timidity/instrum.c.o [ 30%] Building C object CMakeFiles/SDL2_sound.dir/src/timidity/mix.c.o [ 31%] Building C object CMakeFiles/SDL2_sound.dir/src/timidity/output.c.o [ 31%] Building C object CMakeFiles/SDL2_sound-static.dir/src/timidity/playmidi.c.o [ 32%] Building C object CMakeFiles/SDL2_sound-static.dir/src/timidity/readmidi.c.o [ 33%] Building C object CMakeFiles/SDL2_sound-static.dir/src/timidity/resample.c.o [ 34%] Building C object CMakeFiles/SDL2_sound.dir/src/timidity/playmidi.c.o [ 35%] Building C object CMakeFiles/SDL2_sound-static.dir/src/timidity/tables.c.o [ 36%] Building C object CMakeFiles/SDL2_sound-static.dir/src/timidity/timidity.c.o [ 37%] Building C object CMakeFiles/SDL2_sound.dir/src/timidity/readmidi.c.o [ 38%] Building C object CMakeFiles/SDL2_sound.dir/src/timidity/resample.c.o [ 38%] Building C object CMakeFiles/SDL2_sound.dir/src/timidity/tables.c.o [ 39%] Building C object CMakeFiles/SDL2_sound-static.dir/src/libmodplug/fastmix.c.o [ 40%] Building C object CMakeFiles/SDL2_sound-static.dir/src/libmodplug/load_669.c.o [ 41%] Building C object CMakeFiles/SDL2_sound-static.dir/src/libmodplug/load_amf.c.o [ 42%] Building C object CMakeFiles/SDL2_sound.dir/src/timidity/timidity.c.o [ 43%] Building C object CMakeFiles/SDL2_sound.dir/src/libmodplug/fastmix.c.o [ 44%] Building C object CMakeFiles/SDL2_sound.dir/src/libmodplug/load_669.c.o [ 45%] Building C object CMakeFiles/SDL2_sound-static.dir/src/libmodplug/load_ams.c.o [ 46%] Building C object CMakeFiles/SDL2_sound-static.dir/src/libmodplug/load_dbm.c.o [ 46%] Building C object CMakeFiles/SDL2_sound-static.dir/src/libmodplug/load_dmf.c.o [ 47%] Building C object CMakeFiles/SDL2_sound.dir/src/libmodplug/load_amf.c.o [ 48%] Building C object CMakeFiles/SDL2_sound.dir/src/libmodplug/load_ams.c.o [ 49%] Building C object CMakeFiles/SDL2_sound-static.dir/src/libmodplug/load_dsm.c.o [ 50%] Building C object CMakeFiles/SDL2_sound.dir/src/libmodplug/load_dbm.c.o [ 51%] Building C object CMakeFiles/SDL2_sound.dir/src/libmodplug/load_dmf.c.o [ 52%] Building C object CMakeFiles/SDL2_sound-static.dir/src/libmodplug/load_far.c.o [ 53%] Building C object CMakeFiles/SDL2_sound-static.dir/src/libmodplug/load_it.c.o [ 54%] Building C object CMakeFiles/SDL2_sound.dir/src/libmodplug/load_dsm.c.o [ 55%] Building C object CMakeFiles/SDL2_sound.dir/src/libmodplug/load_far.c.o [ 56%] Building C object CMakeFiles/SDL2_sound-static.dir/src/libmodplug/load_mdl.c.o [ 56%] Building C object CMakeFiles/SDL2_sound.dir/src/libmodplug/load_it.c.o [ 57%] Building C object CMakeFiles/SDL2_sound-static.dir/src/libmodplug/load_med.c.o [ 58%] Building C object CMakeFiles/SDL2_sound.dir/src/libmodplug/load_mdl.c.o [ 59%] Building C object CMakeFiles/SDL2_sound-static.dir/src/libmodplug/load_mod.c.o [ 60%] Building C object CMakeFiles/SDL2_sound-static.dir/src/libmodplug/load_mt2.c.o [ 61%] Building C object CMakeFiles/SDL2_sound-static.dir/src/libmodplug/load_mtm.c.o [ 62%] Building C object CMakeFiles/SDL2_sound.dir/src/libmodplug/load_med.c.o [ 63%] Building C object CMakeFiles/SDL2_sound-static.dir/src/libmodplug/load_okt.c.o [ 64%] Building C object CMakeFiles/SDL2_sound.dir/src/libmodplug/load_mod.c.o [ 64%] Building C object CMakeFiles/SDL2_sound-static.dir/src/libmodplug/load_gdm.c.o [ 65%] Building C object CMakeFiles/SDL2_sound.dir/src/libmodplug/load_mt2.c.o [ 66%] Building C object CMakeFiles/SDL2_sound.dir/src/libmodplug/load_mtm.c.o [ 67%] Building C object CMakeFiles/SDL2_sound.dir/src/libmodplug/load_okt.c.o [ 68%] Building C object CMakeFiles/SDL2_sound-static.dir/src/libmodplug/load_psm.c.o [ 69%] Building C object CMakeFiles/SDL2_sound-static.dir/src/libmodplug/load_ptm.c.o [ 70%] Building C object CMakeFiles/SDL2_sound.dir/src/libmodplug/load_gdm.c.o [ 71%] Building C object CMakeFiles/SDL2_sound-static.dir/src/libmodplug/load_s3m.c.o [ 72%] Building C object CMakeFiles/SDL2_sound-static.dir/src/libmodplug/load_stm.c.o [ 73%] Building C object CMakeFiles/SDL2_sound.dir/src/libmodplug/load_psm.c.o [ 74%] Building C object CMakeFiles/SDL2_sound-static.dir/src/libmodplug/load_ult.c.o [ 75%] Building C object CMakeFiles/SDL2_sound.dir/src/libmodplug/load_ptm.c.o [ 75%] Building C object CMakeFiles/SDL2_sound.dir/src/libmodplug/load_s3m.c.o [ 76%] Building C object CMakeFiles/SDL2_sound-static.dir/src/libmodplug/load_umx.c.o [ 77%] Building C object CMakeFiles/SDL2_sound-static.dir/src/libmodplug/load_xm.c.o [ 78%] Building C object CMakeFiles/SDL2_sound-static.dir/src/libmodplug/mmcmp.c.o [ 79%] Building C object CMakeFiles/SDL2_sound-static.dir/src/libmodplug/modplug.c.o [ 80%] Building C object CMakeFiles/SDL2_sound.dir/src/libmodplug/load_stm.c.o [ 80%] Building C object CMakeFiles/SDL2_sound-static.dir/src/libmodplug/snd_dsp.c.o [ 81%] Building C object CMakeFiles/SDL2_sound.dir/src/libmodplug/load_ult.c.o [ 82%] Building C object CMakeFiles/SDL2_sound-static.dir/src/libmodplug/snd_flt.c.o [ 83%] Building C object CMakeFiles/SDL2_sound-static.dir/src/libmodplug/snd_fx.c.o [ 84%] Building C object CMakeFiles/SDL2_sound-static.dir/src/libmodplug/sndfile.c.o [ 85%] Building C object CMakeFiles/SDL2_sound.dir/src/libmodplug/load_umx.c.o [ 86%] Building C object CMakeFiles/SDL2_sound.dir/src/libmodplug/load_xm.c.o /tmp/SDL_sound/src/libmodplug/snd_fx.c:1837:9: warning: variable 'dwMidiCode' set but not used [-Wunused-but-set-variable] DWORD dwMidiCode = 0, dwByteCode = 0; ^ 1 warning generated. [ 87%] Building C object CMakeFiles/SDL2_sound-static.dir/src/libmodplug/sndmix.c.o [ 88%] Building C object CMakeFiles/SDL2_sound.dir/src/libmodplug/mmcmp.c.o [ 89%] Building C object CMakeFiles/SDL2_sound.dir/src/libmodplug/modplug.c.o [ 90%] Building C object CMakeFiles/SDL2_sound.dir/src/libmodplug/snd_dsp.c.o [ 92%] Linking C static library libSDL2_sound.a [ 92%] Building C object CMakeFiles/SDL2_sound.dir/src/libmodplug/snd_flt.c.o [ 93%] Building C object CMakeFiles/SDL2_sound.dir/src/libmodplug/snd_fx.c.o [ 93%] Built target SDL2_sound-static [ 93%] Building C object CMakeFiles/SDL2_sound.dir/src/libmodplug/sndfile.c.o [ 94%] Building C object CMakeFiles/SDL2_sound.dir/src/libmodplug/sndmix.c.o /tmp/SDL_sound/src/libmodplug/snd_fx.c:1837:9: warning: variable 'dwMidiCode' set but not used [-Wunused-but-set-variable] DWORD dwMidiCode = 0, dwByteCode = 0; ^ 1 warning generated. [ 95%] Linking C shared library libSDL2_sound.dylib Undefined symbols for architecture x86_64: "_AudioFileClose", referenced from: _CoreAudio_open in SDL_sound_coreaudio.c.o _CoreAudio_close in SDL_sound_coreaudio.c.o "_AudioFileGetProperty", referenced from: _CoreAudio_open in SDL_sound_coreaudio.c.o "_AudioFileOpenWithCallbacks", referenced from: _CoreAudio_open in SDL_sound_coreaudio.c.o "_ExtAudioFileDispose", referenced from: _CoreAudio_open in SDL_sound_coreaudio.c.o _CoreAudio_close in SDL_sound_coreaudio.c.o "_ExtAudioFileRead", referenced from: _CoreAudio_read in SDL_sound_coreaudio.c.o "_ExtAudioFileSeek", referenced from: _CoreAudio_rewind in SDL_sound_coreaudio.c.o _CoreAudio_seek in SDL_sound_coreaudio.c.o "_ExtAudioFileSetProperty", referenced from: _CoreAudio_open in SDL_sound_coreaudio.c.o "_ExtAudioFileWrapAudioFileID", referenced from: _CoreAudio_open in SDL_sound_coreaudio.c.o ld: symbol(s) not found for architecture x86_64 clang: error: linker command failed with exit code 1 (use -v to see invocation) make[2]: *** [libSDL2_sound.2.0.1.dylib] Error 1 make[1]: *** [CMakeFiles/SDL2_sound.dir/all] Error 2 make: *** [all] Error 2
Would it be possible for a new SDL sound release? I noticed in brew they are relying on releases, and a new release would make it easier to build apps that use SDL_sound from source by just running
brew install sdl2_sound
for dependencies. -
using add_subdirectory for SDL2 and SDL_sound is broken
broken after: https://github.com/icculus/SDL_sound/commit/42c4f200c867cc7681b2e9b96057bb9e90355738
the problem:
cmake_push_check_state() set(CMAKE_REQUIRED_LIBRARIES ${SDL2_LIBRARIES}) check_function_exists(SDL_exp HAVE_SDL_EXP) cmake_pop_check_state()
once we are in check state we require SDL2_LIBRARIES, but they haven't been built yet - if both SDL2 and SDL_sound have been added using add_subdirectory, CMake will configure everything and then build everything.
If you are in a system with SDL2 libraries installed, this can be overlooked, as the check will happen with your system SDL2 and then following your project will build with the SDL2 you used add_subdirectory.
I think add_subdirectory through CMake is a valid config (and it's used by a lot of SDL projects for adding their own dependencies, like SDL_image), and it's really useful for working in platforms that don't have package managers for C libraries like Android and consoles, and also for shipping games with SDL2 configured in a more sane way.
The error I get:
-- Looking for SDL_exp CMake Error at build_13.2_debug/CMakeFiles/CMakeTmp/CMakeLists.txt:16 (add_executable): Target "cmTC_3bc0e" links to target "SDL2::SDL2" but the target was not found. Perhaps a find_package() call is missing for an IMPORTED target, or an ALIAS target is missing?
Alternative approaches:
- leverage pkgconfig to check old sdl2 version, and only act on knowing it's needed
- figure a check for the symbol in
"SDL_stdinc.h"
, these could happen at config time. (maybecheck_prototype_definition
?) - use a cmake option that skips this check (quick workaround, also very flexible!)
if(NOT SDLSOUND_HAVE_SDL_EXP) cmake_push_check_state() set(CMAKE_REQUIRED_LIBRARIES ${SDL2_LIBRARIES}) check_function_exists(SDL_exp SDLSOUND_HAVE_SDL_EXP) cmake_pop_check_state() endif()
-
mp3 misses a bit of sound at the end
I am attaching
playsound_simple.exe
built with the current SDL_sound and SDL2, and a really shorttest.mp3
file.When playing this mp3 file on VLC there's a small bit more of sound you can listen, and when using
playsound_simple.exe
like$> playsound_simple.exe test.mp3 Now playing [test.mp3]...
I can hear there's a small bit at the end that doesn't play.
-
timidity: Sync with SDL_mixer
This is split out from PR #47.
It was mentioned there that the values of
DEFAULT_VOICES
andMAX_VOICES
are potentially higher than they need to be. Should these be lowered in SDL_mixer as well? -
support linking external libmodplug
Please add an option to link against external libmodplug. Most Linux distributions include a libmodplug package that can be detected using pkg-config:
find_package(PkgConfig) pkg_check_modules(MODPLUG libmodplug)
Bundled libmodlug copy could be used if external one is not found.
-
Fix CMake compatibility with older SDL2 config files + improve install tree
- Fixes #77
- Installs CMake configuration files such that people can use SDL2_sound in their CMake project as follows:
find_package(SDL2_sound REQUIRED CONFIG) target_link_libraries(mygame PRIVATE SDL2_sound::SDL2_sound)
This is also tested on CI
A Linux install tree looks like follows:
prefix ├── bin │ └── playsound ├── include │ └── SDL2 │ └── SDL_sound.h └── lib64 ├── cmake │ └── SDL2_sound │ ├── SDL2_soundConfig.cmake │ ├── SDL2_soundConfigVersion.cmake │ ├── SDL2_sound-shared-targets.cmake │ ├── SDL2_sound-shared-targets-debug.cmake │ ├── SDL2_sound-static-targets.cmake │ └── SDL2_sound-static-targets-debug.cmake ├── libSDL2_sound.a ├── libSDL2_sound.so -> libSDL2_sound.so.2 ├── libSDL2_sound.so.2 -> libSDL2_sound.so.2.0.1 ├── libSDL2_sound.so.2.0.1 └── pkgconfig └── SDL2_sound.pc
A MinGW install tree looks like follows:
prefix ├── bin │ ├── playsound.exe │ └── SDL2_sound.dll ├── include │ └── SDL2 │ └── SDL_sound.h └── lib ├── cmake │ └── SDL2_sound │ ├── SDL2_soundConfig.cmake │ ├── SDL2_soundConfigVersion.cmake │ ├── SDL2_sound-shared-targets.cmake │ ├── SDL2_sound-shared-targets-release.cmake │ ├── SDL2_sound-static-targets.cmake │ └── SDL2_sound-static-targets-release.cmake ├── libSDL2_sound.a ├── libSDL2_sound.dll.a └── pkgconfig └── SDL2_sound.pc
-
Reading timidity soundfont from SDL_rwops
Hey, I understand we can pass a soundfont path through an environment variable or SDL_setenv, but is it possible to pass a stream so I could find a soundfont inside a game package - using SDL_rwops or some way to pass the location in memory. Is something like this possible?
-
WAV: support "extensible" format tag.
I put in a quick hack, but here are the details on proper support.
https://docs.microsoft.com/en-us/windows/win32/api/mmreg/ns-mmreg-waveformatextensible
SDL_LoadWAV already has this--at least enough for reasonable use--and I'm aiming for something similar here.
-
Sound_NewSample*'s `desired` field should be a const pointer.
Right now it looks like this:
SNDDECLSPEC Sound_Sample * SDLCALL Sound_NewSample(SDL_RWops *rw, const char *ext, Sound_AudioInfo *desired, Uint32 bufferSize);
...but that
desired
argument isn't modified (the desired and obtained values are both available in the returned Sound_Sample, not set in thedesired
struct), so this should be const.I have to double-check this is actually true, but this is likely a mistake from the year 2000. :)
-
Let decoders claim a sound file
We need to let decoders signal that they own a given sound file.
For example, the .WAV decoder might hit this legitimate failure case (if given a 24-bit audio file, which we don't yet support)...
BAIL_MACRO("WAV: Unsupported sample size.", 0);
But then SDL_sound will try other decoders, which appropriately fail because the file isn't .mp3/.voc/whatever, eventually setting the error message to "Sound format unsupported."
So what we need is a way for decoders to say "this is definitely a .WAV (or whatever) file, but I can't open it (i/o issue, corrupted, some unsupported thing)," so that SDL_sound can report a more meaningful error and also know to stop trying other decoders.
-
Add support for UWP Compilation target
If you understand how to do that, I would appreciate if you could add that support, I'm developing a Xbox game using SDL_Sound.
I'll try my best at compiling it for UWP too, if I succeed before you, I may PR, but I know that should be a kid's play for you
Releases(v2.0.1)
-
v2.0.1(Mar 25, 2022)
It's been 5087 days since the last SDL_sound release, so I thought it might be time for a new one. :)
A lot has changed in the last 13.93 years, including my understanding of how to build useful open source middleware. As such, you're going to find that the internals of SDL_sound 2 are dramatically different than the guts of SDL_sound 1.
The most notable changes:
- SDL_sound 2.0 is now licensed under the zlib license. The 1.x releases are (and continue to be) LGPL2. This matches the license change between SDL 1.2 and SDL 2.0.
- SDL_sound 2.0 now uses SDL 2. SDL 1.2 is no longer supported.
- SDL_sound 2.0 has no external dependencies. All the code you need to build it is included. You do not have to hunt down and figure out how to build third party libraries to enable support for various audio decoders.
- Several decoders have been replaced with so-called "single header libraries" to simplify matters. You no longer need to install libogg and libvorbis to support .ogg files--SDL_sound just includes stb_vorbis as part of the source tree.
- We have moved to CMake, because of course we have. :)
- But also, it's now pretty simple to just drop SDL_sound's sources into your project and compile it directly.
- QuickTime support is gone (because it's obsolete in modern OSes; macOS and iOS can still use our CoreAudio decoder for roughly the same effect).
- Speex support is gone (no easy public domain code available to decode it).
- MikMod support is gone (but modplug is built in and handles approximately the same files).
Please note that SDL_sound 2's public API has not changed at all from SDL_sound 1, so you can just upgrade in place and, in theory, just keep on as before.
I wrote about the motivations for the 2.0 changes here.
Note that this is release 2.0.1; there was no 2.0.0 release, but since that's the version that revision control has listed for the last year, we wanted to make sure that there was a differentiator in case someone had shipped the prerelease code.
Thanks for everyone's patience; hopefully the next release won't take another decade!
Source code(tar.gz)
Source code(zip)
MPEG-H 3D Audio Low Complexity Profile Decoder
Introduction of the MPEG-H 3D Audio Low Complexity Profile Decoder The advent of object-based audio and scene-based audio has revolutionized the 3D so
Static analyzer for C/C++ based on the theory of Abstract Interpretation.
IKOS IKOS (Inference Kernel for Open Static Analyzers) is a static analyzer for C/C++ based on the theory of Abstract Interpretation. Introduction IKO
BSAL(Bluetooth Stack Abstract Layer)软件包是由 RT-Thread 针对不同 蓝牙协议栈接口实现的,目前支持的 协议栈有:nimble,realtek 等协议栈
BSAL (Bluetooth Stack Abstract Layer)软件包是由 RT-Thread 针对不同 蓝牙协议栈接口实现的,目前支持的 协议栈有:nimble,realtek 等协议栈。
C++ intrusive container templates. Abstract node links, no use of new/delete.
C-plus-plus-intrusive-container-templates C++ intrusive container templates. Abstract node links, no use of new/delete (AVL tree, singly-linked list,
Static analyzer for C/C++ based on the theory of Abstract Interpretation.
IKOS IKOS (Inference Kernel for Open Static Analyzers) is a static analyzer for C/C++ based on the theory of Abstract Interpretation. Introduction IKO
Step-by-step guide through the abstract and complex universe of Fragment Shaders.
The Book of Shaders by Patricio Gonzalez Vivo and Jen Lowe This is a gentle step-by-step guide through the abstract and complex universe of Fragment S
This is a helper library to abstract away interfacing with floppy disk drives in a cross-platform and open source library.
Adafruit Floppy This is a helper library to abstract away interfacing with floppy disk drives in a cross-platform and open source library. Adafruit Fl
A Graphical Engine written in C++ for abstract OpenGL
Lukeda Graphical Engine (LGE) It's a simple graphical library, written in C++ with OpenGL(GLEW) and GLFW Start as a fork from my other project named "
Minimalistic MP3 decoder single header library
minimp3 Minimalistic, single-header library for decoding MP3. minimp3 is designed to be small, fast (with SSE and NEON support), and accurate (ISO con
Minimal Huffman coder/decoder
huffandpuff This is an extremely minimal huffman encoder/decoder. It uses no calls at all, not even stdlib/stdio, making it suitable for embedded appl
Minimalistic MP3 decoder single header library
minimp3 Minimalistic, single-header library for decoding MP3. minimp3 is designed to be small, fast (with SSE and NEON support), and accurate (ISO con
MPack - A C encoder/decoder for the MessagePack serialization format / msgpack.org[C]
Introduction MPack is a C implementation of an encoder and decoder for the MessagePack serialization format. It is: Simple and easy to use Secure agai
SleighCraft is a decoder based on ghidra's decompiler implementation.
SleighCraft is a decoder (or, linear disassembler) based on ghidra's decompiler implementation. Sleighcraft can be used in Rust or Python, with both high-level and low-level API.
Arduino PNG image decoder library
An 'embedded-friendly' (aka Arduino) PNG image decoding library
White-Stuff - a simple xor encoder/decoder for your shellcode
White-Stuff - a simple xor encoder/decoder for your shellcode
A lean, efficient, accurate geohash encoder and decoder library implemented in C
Geohash encoder/decoder in C A lean, efficient, accurate geohash encoder and decoder library implemented in C. It does not depend on the C standard li
SPDIF decoder for Kingst VIS
SPDIF Logic Analyzer This plugin is for use in the Kingst VIS program to decode captured data from any SPDIF Interface. It's a modified version of [ht
Software MBE decoder for codecserver / digiham / openwebrx
Introduction openwebrx is a web-based SDR receiver. That software used to be capable of decoding digital voice modes such as DMR, YSF, NXDN and D-STAR
combined decoder for DAB and FM
DUORECEIVER 1.0 COMBINED FM AND DAB MINI RECEIVER I got questions from family members why there was no combined FM and DAB receiver available, since t
BCJR-based decoder for CCSDS turbo codes (according to CCSDS 131.0-B-3)
ccsds-tc ccsds-tc is a small project that attempts to systematize the decoding of space packets as received by ground stations of the Amateur DSN. Thi