Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions AUTHORS
Original file line number Diff line number Diff line change
Expand Up @@ -40,3 +40,4 @@ lexander Yashin https://github.com/yashin-alexander
Nils Duval https://github.com/nlsdvl
JackRedstonia [email protected]
David Bullock https://github.com/dwbullock
Sam Gubernick https://github.com/samgubernick
83 changes: 83 additions & 0 deletions build/genie.lua
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
local WITH_SDL = 0
local WITH_SDL2 = 0
local WITH_SDL3 = 0
local WITH_SDL_STATIC = 0
local WITH_SDL2_STATIC = 0
local WITH_PORTAUDIO = 0
Expand Down Expand Up @@ -30,6 +31,7 @@ end

local sdl_root = "/libraries/sdl"
local sdl2_root = "/libraries/sdl2"
local sdl3_root = "/libraries/sdl3"
local dxsdk_root = os.getenv("DXSDK_DIR") and os.getenv("DXSDK_DIR") or "C:/Program Files (x86)/Microsoft DirectX SDK (June 2010)"
local portaudio_root = "/libraries/portaudio"
local openal_root = "/libraries/openal"
Expand All @@ -40,6 +42,9 @@ local sdl_include = sdl_root .. "/include"
local sdl2_include = sdl2_root .. "/include"
local sdl2_lib_x86 = sdl2_root .. "/lib/x86"
local sdl2_lib_x64 = sdl2_root .. "/lib/x64"
local sdl3_include = sdl3_root .. "/include"
local sdl3_lib_x86 = sdl3_root .. "/lib/x86"
local sdl3_lib_x64 = sdl3_root .. "/lib/x64"
local dxsdk_include = dxsdk_root .. "/include"
local portaudio_include = portaudio_root .. "/include"
local openal_include = openal_root .. "/include"
Expand Down Expand Up @@ -69,6 +74,11 @@ newoption {
description = "Include SDL2 backend in build"
}

newoption {
trigger = "with-sdl3",
description = "Include SDL3 backend in build"
}

newoption {
trigger = "with-portaudio",
description = "Include PortAudio backend in build"
Expand Down Expand Up @@ -109,6 +119,11 @@ newoption {
description = "Only include sdl2 that doesn't use dyndll in build"
}

newoption {
trigger = "with-sdl3-only",
description = "Only include sdl3 in build"
}

newoption {
trigger = "with-coreaudio",
description = "Include OS X CoreAudio backend in build"
Expand Down Expand Up @@ -157,6 +172,7 @@ newoption {
if _OPTIONS["soloud-devel"] then
WITH_SDL = 0
WITH_SDL2 = 1
WITH_SDL3 = 0
WITH_SDL_STATIC = 0
WITH_SDL2_STATIC = 0
WITH_PORTAUDIO = 1
Expand All @@ -178,6 +194,7 @@ end

if _OPTIONS["with-common-backends"] then
WITH_SDL = 1
WITH_SDL3 = 0
WITH_SDL_STATIC = 0
WITH_SDL2_STATIC = 0
WITH_PORTAUDIO = 1
Expand Down Expand Up @@ -221,6 +238,10 @@ if _OPTIONS["with-sdl2"] then
WITH_SDL2 = 1
end

if _OPTIONS["with-sdl3"] then
WITH_SDL3 = 1
end

if _OPTIONS["with-wasapi"] then
WITH_WASAPI = 1
end
Expand All @@ -232,6 +253,7 @@ end
if _OPTIONS["with-sdl-only"] then
WITH_SDL = 1
WITH_SDL2 = 0
WITH_SDL3 = 0
WITH_SDL_STATIC = 0
WITH_SDL2_STATIC = 0
WITH_PORTAUDIO = 0
Expand All @@ -247,6 +269,23 @@ end
if _OPTIONS["with-sdl2-only"] then
WITH_SDL = 0
WITH_SDL2 = 1
WITH_SDL3 = 0
WITH_SDL_STATIC = 0
WITH_SDL2_STATIC = 0
WITH_PORTAUDIO = 0
WITH_OPENAL = 0
WITH_XAUDIO2 = 0
WITH_WINMM = 0
WITH_WASAPI = 0
WITH_OSS = 0
WITH_NOSOUND = 0
WITH_MINIAUDIO = 0
end

if _OPTIONS["with-sdl3-only"] then
WITH_SDL = 0
WITH_SDL2 = 0
WITH_SDL3 = 1
WITH_SDL_STATIC = 0
WITH_SDL2_STATIC = 0
WITH_PORTAUDIO = 0
Expand All @@ -262,6 +301,7 @@ end
if _OPTIONS["with-sdlstatic-only"] then
WITH_SDL = 0
WITH_SDL2 = 0
WITH_SDL3 = 0
WITH_SDL_STATIC = 1
WITH_PORTAUDIO = 0
WITH_OPENAL = 0
Expand All @@ -276,6 +316,7 @@ end
if _OPTIONS["with-sdl2static-only"] then
WITH_SDL = 0
WITH_SDL2 = 0
WITH_SDL3 = 0
WITH_SDL_STATIC = 0
WITH_SDL2_STATIC = 1
WITH_PORTAUDIO = 0
Expand All @@ -291,6 +332,7 @@ end
if _OPTIONS["with-sdl2static-only"] then
WITH_SDL = 0
WITH_SDL2 = 0
WITH_SDL3 = 0
WITH_SDL_STATIC = 0
WITH_SDL2_STATIC = 1
WITH_PORTAUDIO = 0
Expand All @@ -306,6 +348,7 @@ end
if _OPTIONS["with-vita-homebrew-only"] then
WITH_SDL = 0
WITH_SDL2 = 0
WITH_SDL3 = 0
WITH_SDL_STATIC = 0
WITH_SDL2_STATIC = 0
WITH_PORTAUDIO = 0
Expand All @@ -331,6 +374,7 @@ end
if _OPTIONS["with-jack-only"] then
WITH_SDL = 0
WITH_SDL2 = 0
WITH_SDL3 = 0
WITH_SDL_STATIC = 0
WITH_SDL2_STATIC = 0
WITH_PORTAUDIO = 0
Expand All @@ -354,6 +398,7 @@ end
if _OPTIONS["with-miniaudio-only"] then
WITH_SDL = 0
WITH_SDL2 = 0
WITH_SDL3 = 0
WITH_SDL_STATIC = 0
WITH_SDL2_STATIC = 0
WITH_PORTAUDIO = 0
Expand All @@ -373,6 +418,7 @@ end
if _OPTIONS["with-native-only"] then
WITH_SDL = 0
WITH_SDL2 = 0
WITH_SDL3 = 0
WITH_SDL_STATIC = 0
WITH_SDL2_STATIC = 0
WITH_PORTAUDIO = 0
Expand Down Expand Up @@ -400,6 +446,7 @@ print ("")
print ("Active options:")
print ("WITH_SDL = ", WITH_SDL)
print ("WITH_SDL2 = ", WITH_SDL2)
print ("WITH_SDL3 = ", WITH_SDL3)
print ("WITH_PORTAUDIO = ", WITH_PORTAUDIO)
print ("WITH_OPENAL = ", WITH_OPENAL)
print ("WITH_XAUDIO2 = ", WITH_XAUDIO2)
Expand Down Expand Up @@ -601,6 +648,31 @@ if (WITH_SDL2 == 1 or WITH_SDL2STATIC) then

targetname "solouddemocommon"
end
-- 8< -- 8< -- 8< -- 8< -- 8< -- 8< -- 8< -- 8< -- 8< -- 8< --

if (WITH_SDL3 == 1) then

project "SoloudDemoCommon"
kind "StaticLib"
targetdir "../lib"
language "C++"

files {
"../demos/common/**.c*",
"../demos/common/imgui/**.c*",
"../demos/common/glew/GL/**.c*"
}
includedirs {
"../include",
"../demos/common",
"../demos/common/imgui",
"../demos/common/glew",
sdl3_include
}
defines { "GLEW_STATIC" }

targetname "solouddemocommon"
end
-- 8< -- 8< -- 8< -- 8< -- 8< -- 8< -- 8< -- 8< -- 8< -- 8< --

project "SoloudStatic"
Expand Down Expand Up @@ -715,6 +787,17 @@ if (WITH_SDL2 == 1) then
}
end

if (WITH_SDL3 == 1) then
defines { "WITH_SDL3" }
files {
"../src/backend/sdl/**.c*"
}
includedirs {
"../include",
sdl3_include
}
end

if (WITH_SDL_STATIC == 1) then
defines { "WITH_SDL_STATIC" }
files {
Expand Down
5 changes: 4 additions & 1 deletion include/soloud.h
Original file line number Diff line number Diff line change
Expand Up @@ -48,10 +48,12 @@ freely, subject to the following restrictions:
#endif

#ifdef WITH_SDL
#undef WITH_SDL3
#undef WITH_SDL2
#undef WITH_SDL1
#define WITH_SDL1
#define WITH_SDL2
#define WITH_SDL3
#endif

#ifdef WITH_SDL_STATIC
Expand Down Expand Up @@ -194,6 +196,7 @@ namespace SoLoud
MINIAUDIO,
NOSOUND,
NULLDRIVER,
SDL3,
BACKEND_MAX,
};

Expand Down Expand Up @@ -227,7 +230,7 @@ namespace SoLoud
};

// Initialize SoLoud. Must be called before SoLoud can be used.
result init(unsigned int aFlags = Soloud::CLIP_ROUNDOFF, unsigned int aBackend = Soloud::AUTO, unsigned int aSamplerate = Soloud::AUTO, unsigned int aBufferSize = Soloud::AUTO, unsigned int aChannels = 2);
result init(unsigned int aFlags = Soloud::CLIP_ROUNDOFF, unsigned int aBackend = Soloud::AUTO, unsigned int aSamplerate = Soloud::AUTO, unsigned int aBufferSize = Soloud::AUTO, unsigned int aChannels = 2, void const * clientData = NULL);

result pause();
result resume();
Expand Down
55 changes: 55 additions & 0 deletions include/soloud_backend_data_sdl3.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
/*
SoLoud audio engine
Copyright (c) 2013-2015 Jari Komppa

This software is provided 'as-is', without any express or implied
warranty. In no event will the authors be held liable for any damages
arising from the use of this software.

Permission is granted to anyone to use this software for any purpose,
including commercial applications, and to alter it and redistribute it
freely, subject to the following restrictions:

1. The origin of this software must not be misrepresented; you must not
claim that you wrote the original software. If you use this software
in a product, an acknowledgment in the product documentation would be
appreciated but is not required.

2. Altered source versions must be plainly marked as such, and must not be
misrepresented as being the original software.

3. This notice may not be removed or altered from any source
distribution.
*/

#ifndef SOLOUD_BACKEND_DATA_SDL3_H
#define SOLOUD_BACKEND_DATA_SDL3_H

#ifdef WITH_SDL3
#include "SDL3/SDL.h"

namespace SoLoud
{
struct SoLoudBackendDataSdl3
{
SoLoudBackendDataSdl3()
: audioStream{NULL}
, audioDeviceId{0}
, activeAudioSpec{}
{}
SDL_AudioStream * audioStream;
SDL_AudioDeviceID audioDeviceId;
SDL_AudioSpec activeAudioSpec;
};

struct SoLoudClientDataSdl3
{
SoLoudClientDataSdl3(unsigned int deviceId)
: deviceId(deviceId)
{}
unsigned int deviceId;
};
}
#endif

#endif
6 changes: 6 additions & 0 deletions include/soloud_internal.h
Original file line number Diff line number Diff line change
Expand Up @@ -35,12 +35,18 @@ namespace SoLoud
// SDL2 back-end initialization call
result sdl2_init(SoLoud::Soloud *aSoloud, unsigned int aFlags = Soloud::CLIP_ROUNDOFF, unsigned int aSamplerate = 44100, unsigned int aBuffer = 2048, unsigned int aChannels = 2);

// SDL3 back-end initialization call
result sdl3_init(SoLoud::Soloud *aSoloud, unsigned int aFlags = Soloud::CLIP_ROUNDOFF, unsigned int aSamplerate = 44100, unsigned int aBuffer = 2048, unsigned int aChannels = 2, void const * clientData = NULL);

// SDL1 "non-dynamic" back-end initialization call
result sdl1static_init(SoLoud::Soloud *aSoloud, unsigned int aFlags = Soloud::CLIP_ROUNDOFF, unsigned int aSamplerate = 44100, unsigned int aBuffer = 2048, unsigned int aChannels = 2);

// SDL2 "non-dynamic" back-end initialization call
result sdl2static_init(SoLoud::Soloud *aSoloud, unsigned int aFlags = Soloud::CLIP_ROUNDOFF, unsigned int aSamplerate = 44100, unsigned int aBuffer = 2048, unsigned int aChannels = 2);

// SDL3 "non-dynamic" back-end initialization call
result sdl3static_init(SoLoud::Soloud *aSoloud, unsigned int aFlags = Soloud::CLIP_ROUNDOFF, unsigned int aSamplerate = 44100, unsigned int aBuffer = 2048, unsigned int aChannels = 2);

// OpenAL back-end initialization call
result openal_init(SoLoud::Soloud *aSoloud, unsigned int aFlags = Soloud::CLIP_ROUNDOFF, unsigned int aSamplerate = 44100, unsigned int aBuffer = 2048, unsigned int aChannels = 2);

Expand Down
2 changes: 2 additions & 0 deletions src/audiosource/wav/stb_impl.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
#define STB_VORBIS_IMPLEMENTATION
#include "stb_vorbis.c"
Loading