Skip to content

Commit 34fde88

Browse files
binary1248ChrisThrasherkimci86vittorioromeo
authored andcommitted
Replaced OpenAL with miniaudio.
Co-authored-by: Chris Thrasher <[email protected]> Co-authored-by: kimci86 <[email protected]> Co-authored-by: vittorioromeo <[email protected]>
1 parent b0e45cf commit 34fde88

File tree

84 files changed

+95630
-3995
lines changed

Some content is hidden

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

84 files changed

+95630
-3995
lines changed

.clang-format

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -112,7 +112,7 @@ IncludeCategories:
112112
- Priority: 8
113113
Regex: '^<SFML\/System'
114114
- Priority: 9
115-
Regex: '^<(glad|gl|X11|jni|android|stb_|GLES2|vorbis|catch2)'
115+
Regex: '^<(glad|gl|X11|jni|android|stb_|GLES2|vorbis|miniaudio|catch2)'
116116
- Priority: 10
117117
Regex: '^<([^c](.+)|coroutine|charconv|chrono|complex|concepts|condition_variable)>$'
118118
- Priority: 11

.github/workflows/ci.yml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -105,7 +105,7 @@ jobs:
105105
run: |
106106
CLANG_VERSION=$(clang++ --version | sed -n 's/.*version \([0-9]\+\)\..*/\1/p')
107107
echo "CLANG_VERSION=$CLANG_VERSION" >> $GITHUB_ENV
108-
sudo apt-get update && sudo apt-get install xorg-dev libxrandr-dev libxcursor-dev libudev-dev libopenal-dev libflac-dev libvorbis-dev libgl1-mesa-dev libegl1-mesa-dev libdrm-dev libgbm-dev xvfb fluxbox ccache gcovr ${{ matrix.platform.name == 'Linux Clang' && 'llvm-$CLANG_VERSION' || '' }}
108+
sudo apt-get update && sudo apt-get install xorg-dev libxrandr-dev libxcursor-dev libudev-dev libflac-dev libvorbis-dev libgl1-mesa-dev libegl1-mesa-dev libdrm-dev libgbm-dev xvfb fluxbox ccache gcovr ${{ matrix.platform.name == 'Linux Clang' && 'llvm-$CLANG_VERSION' || '' }}
109109
110110
- name: Install Android Components
111111
if: matrix.platform.name == 'Android'
@@ -288,7 +288,7 @@ jobs:
288288
289289
- name: Install Linux Dependencies
290290
if: runner.os == 'Linux'
291-
run: sudo apt-get update && sudo apt-get install libxrandr-dev libxcursor-dev libudev-dev libopenal-dev libflac-dev libvorbis-dev libgl1-mesa-dev libegl1-mesa-dev libdrm-dev libgbm-dev
291+
run: sudo apt-get update && sudo apt-get install libxrandr-dev libxcursor-dev libudev-dev libflac-dev libvorbis-dev libgl1-mesa-dev libegl1-mesa-dev libdrm-dev libgbm-dev
292292

293293
- name: Install macOS Dependencies
294294
if: runner.os == 'macOS'
@@ -327,7 +327,7 @@ jobs:
327327

328328
- name: Install Linux Dependencies
329329
if: runner.os == 'Linux'
330-
run: sudo apt-get update && sudo apt-get install xorg-dev libxrandr-dev libxcursor-dev libudev-dev libopenal-dev libflac-dev libvorbis-dev libgl1-mesa-dev libegl1-mesa-dev libdrm-dev libgbm-dev xvfb fluxbox
330+
run: sudo apt-get update && sudo apt-get install xorg-dev libxrandr-dev libxcursor-dev libudev-dev libflac-dev libvorbis-dev libgl1-mesa-dev libegl1-mesa-dev libdrm-dev libgbm-dev xvfb fluxbox
331331

332332
- name: Configure
333333
run: cmake --preset dev -GNinja -DCMAKE_BUILD_TYPE=Debug -DCMAKE_CXX_COMPILER=clang++ -DSFML_BUILD_EXAMPLES=OFF -DSFML_ENABLE_SANITIZERS=ON ${{matrix.platform.flags}}

CMakeLists.txt

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -378,14 +378,12 @@ if(SFML_OS_WINDOWS)
378378
if(NOT SFML_USE_SYSTEM_DEPS)
379379
# install the binaries of SFML dependencies
380380
if(ARCH_32BITS)
381-
install(DIRECTORY extlibs/bin/x86/ DESTINATION ${CMAKE_INSTALL_BINDIR})
382381
if(SFML_COMPILER_MSVC OR (SFML_COMPILER_CLANG AND NOT MINGW))
383382
install(DIRECTORY extlibs/libs-msvc-universal/x86/ DESTINATION ${CMAKE_INSTALL_LIBDIR})
384383
else()
385384
install(DIRECTORY extlibs/libs-mingw/x86/ DESTINATION ${CMAKE_INSTALL_LIBDIR})
386385
endif()
387386
elseif(ARCH_64BITS)
388-
install(DIRECTORY extlibs/bin/x64/ DESTINATION ${CMAKE_INSTALL_BINDIR})
389387
if(SFML_COMPILER_MSVC OR (SFML_COMPILER_CLANG AND NOT MINGW))
390388
install(DIRECTORY extlibs/libs-msvc-universal/x64/ DESTINATION ${CMAKE_INSTALL_LIBDIR})
391389
else()
@@ -422,10 +420,6 @@ elseif(SFML_OS_MACOS)
422420
if(VORBISFILE_LIBRARY STREQUAL "${PROJECT_SOURCE_DIR}/extlibs/libs-macos/Frameworks/vorbisfile.framework")
423421
install(DIRECTORY extlibs/libs-macos/Frameworks/vorbisfile.framework DESTINATION ${CMAKE_INSTALL_LIBDIR})
424422
endif()
425-
426-
if(OPENAL_LIBRARY STREQUAL "${PROJECT_SOURCE_DIR}/extlibs/libs-macos/Frameworks/OpenAL.framework")
427-
install(DIRECTORY "${OPENAL_LIBRARY}" DESTINATION ${CMAKE_INSTALL_LIBDIR})
428-
endif()
429423
endif()
430424

431425
# install the Xcode templates if requested

cmake/Modules/FindOpenAL.cmake

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

cmake/SFMLConfigDependencies.cmake.in

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,6 @@ if(SFML_STATIC_LIBRARIES)
6060
# SFML::Audio
6161
list(FIND SFML_FIND_COMPONENTS "Audio" FIND_SFML_AUDIO_COMPONENT_INDEX)
6262
if(FIND_SFML_AUDIO_COMPONENT_INDEX GREATER -1)
63-
find_package(OpenAL)
6463
find_package(Vorbis)
6564
find_package(FLAC)
6665
endif()

examples/sound_capture/SoundCapture.cpp

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,30 @@ int main()
2323
return EXIT_SUCCESS;
2424
}
2525

26+
// List the available capture devices
27+
auto devices = sf::SoundRecorder::getAvailableDevices();
28+
29+
std::cout << "Available capture devices:\n" << std::endl;
30+
31+
for (auto i = 0u; i < devices.size(); ++i)
32+
std::cout << i << ": " << devices[i] << '\n';
33+
34+
std::cout << std::endl;
35+
36+
std::size_t deviceIndex = 0;
37+
38+
// Choose the capture device
39+
if (devices.size() > 1)
40+
{
41+
deviceIndex = devices.size();
42+
std::cout << "Please choose the capture device to use [0-" << devices.size() - 1 << "]: ";
43+
do
44+
{
45+
std::cin >> deviceIndex;
46+
std::cin.ignore(10000, '\n');
47+
} while (deviceIndex >= devices.size());
48+
}
49+
2650
// Choose the sample rate
2751
unsigned int sampleRate;
2852
std::cout << "Please choose the sample rate for sound capture (44100 is CD quality): ";
@@ -36,6 +60,12 @@ int main()
3660
// Here we'll use an integrated custom recorder, which saves the captured data into a SoundBuffer
3761
sf::SoundBufferRecorder recorder;
3862

63+
if (!recorder.setDevice(devices[deviceIndex]))
64+
{
65+
std::cerr << "Failed to set the capture device" << std::endl;
66+
return EXIT_FAILURE;
67+
}
68+
3969
// Audio capture is done in a separate thread, so we can block the main thread while it is capturing
4070
if (!recorder.start(sampleRate))
4171
{

examples/voip/Server.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ class NetworkAudioStream : public sf::SoundStream
3232
NetworkAudioStream()
3333
{
3434
// Set the sound parameters
35-
initialize(1, 44100);
35+
initialize(1, 44100, {sf::SoundChannel::Mono});
3636
}
3737

3838
////////////////////////////////////////////////////////////

extlibs/bin/x64/openal32.dll

-654 KB
Binary file not shown.

extlibs/bin/x86/openal32.dll

-616 KB
Binary file not shown.

0 commit comments

Comments
 (0)