diff --git a/examples/DemoRunner/Builds/Android/app/CMakeLists.txt b/examples/DemoRunner/Builds/Android/app/CMakeLists.txt index b87f38ac38..024598514b 100644 --- a/examples/DemoRunner/Builds/Android/app/CMakeLists.txt +++ b/examples/DemoRunner/Builds/Android/app/CMakeLists.txt @@ -313,6 +313,8 @@ add_library( ${BINARY_NAME} "../../../../../modules/juce_audio_devices/native/oboe/src/flowgraph/SampleRateConverter.h" "../../../../../modules/juce_audio_devices/native/oboe/src/flowgraph/SinkFloat.cpp" "../../../../../modules/juce_audio_devices/native/oboe/src/flowgraph/SinkFloat.h" + "../../../../../modules/juce_audio_devices/native/oboe/src/flowgraph/SinkI8_24.cpp" + "../../../../../modules/juce_audio_devices/native/oboe/src/flowgraph/SinkI8_24.h" "../../../../../modules/juce_audio_devices/native/oboe/src/flowgraph/SinkI16.cpp" "../../../../../modules/juce_audio_devices/native/oboe/src/flowgraph/SinkI16.h" "../../../../../modules/juce_audio_devices/native/oboe/src/flowgraph/SinkI24.cpp" @@ -321,6 +323,8 @@ add_library( ${BINARY_NAME} "../../../../../modules/juce_audio_devices/native/oboe/src/flowgraph/SinkI32.h" "../../../../../modules/juce_audio_devices/native/oboe/src/flowgraph/SourceFloat.cpp" "../../../../../modules/juce_audio_devices/native/oboe/src/flowgraph/SourceFloat.h" + "../../../../../modules/juce_audio_devices/native/oboe/src/flowgraph/SourceI8_24.cpp" + "../../../../../modules/juce_audio_devices/native/oboe/src/flowgraph/SourceI8_24.h" "../../../../../modules/juce_audio_devices/native/oboe/src/flowgraph/SourceI16.cpp" "../../../../../modules/juce_audio_devices/native/oboe/src/flowgraph/SourceI16.h" "../../../../../modules/juce_audio_devices/native/oboe/src/flowgraph/SourceI24.cpp" @@ -2895,6 +2899,8 @@ set_source_files_properties( "../../../../../modules/juce_audio_devices/native/oboe/src/flowgraph/SampleRateConverter.h" "../../../../../modules/juce_audio_devices/native/oboe/src/flowgraph/SinkFloat.cpp" "../../../../../modules/juce_audio_devices/native/oboe/src/flowgraph/SinkFloat.h" + "../../../../../modules/juce_audio_devices/native/oboe/src/flowgraph/SinkI8_24.cpp" + "../../../../../modules/juce_audio_devices/native/oboe/src/flowgraph/SinkI8_24.h" "../../../../../modules/juce_audio_devices/native/oboe/src/flowgraph/SinkI16.cpp" "../../../../../modules/juce_audio_devices/native/oboe/src/flowgraph/SinkI16.h" "../../../../../modules/juce_audio_devices/native/oboe/src/flowgraph/SinkI24.cpp" @@ -2903,6 +2909,8 @@ set_source_files_properties( "../../../../../modules/juce_audio_devices/native/oboe/src/flowgraph/SinkI32.h" "../../../../../modules/juce_audio_devices/native/oboe/src/flowgraph/SourceFloat.cpp" "../../../../../modules/juce_audio_devices/native/oboe/src/flowgraph/SourceFloat.h" + "../../../../../modules/juce_audio_devices/native/oboe/src/flowgraph/SourceI8_24.cpp" + "../../../../../modules/juce_audio_devices/native/oboe/src/flowgraph/SourceI8_24.h" "../../../../../modules/juce_audio_devices/native/oboe/src/flowgraph/SourceI16.cpp" "../../../../../modules/juce_audio_devices/native/oboe/src/flowgraph/SourceI16.h" "../../../../../modules/juce_audio_devices/native/oboe/src/flowgraph/SourceI24.cpp" diff --git a/examples/DemoRunner/Builds/VisualStudio2019/DemoRunner_App.vcxproj b/examples/DemoRunner/Builds/VisualStudio2019/DemoRunner_App.vcxproj index de3b4229d6..7aa76908e5 100644 --- a/examples/DemoRunner/Builds/VisualStudio2019/DemoRunner_App.vcxproj +++ b/examples/DemoRunner/Builds/VisualStudio2019/DemoRunner_App.vcxproj @@ -473,6 +473,9 @@ true + + true + true @@ -485,6 +488,9 @@ true + + true + true @@ -3367,10 +3373,12 @@ + + diff --git a/examples/DemoRunner/Builds/VisualStudio2019/DemoRunner_App.vcxproj.filters b/examples/DemoRunner/Builds/VisualStudio2019/DemoRunner_App.vcxproj.filters index a729569ab5..393a9c53db 100644 --- a/examples/DemoRunner/Builds/VisualStudio2019/DemoRunner_App.vcxproj.filters +++ b/examples/DemoRunner/Builds/VisualStudio2019/DemoRunner_App.vcxproj.filters @@ -1162,6 +1162,9 @@ JUCE Modules\juce_audio_devices\native\oboe\src\flowgraph + + JUCE Modules\juce_audio_devices\native\oboe\src\flowgraph + JUCE Modules\juce_audio_devices\native\oboe\src\flowgraph @@ -1174,6 +1177,9 @@ JUCE Modules\juce_audio_devices\native\oboe\src\flowgraph + + JUCE Modules\juce_audio_devices\native\oboe\src\flowgraph + JUCE Modules\juce_audio_devices\native\oboe\src\flowgraph @@ -4554,6 +4560,9 @@ JUCE Modules\juce_audio_devices\native\oboe\src\flowgraph + + JUCE Modules\juce_audio_devices\native\oboe\src\flowgraph + JUCE Modules\juce_audio_devices\native\oboe\src\flowgraph @@ -4566,6 +4575,9 @@ JUCE Modules\juce_audio_devices\native\oboe\src\flowgraph + + JUCE Modules\juce_audio_devices\native\oboe\src\flowgraph + JUCE Modules\juce_audio_devices\native\oboe\src\flowgraph diff --git a/examples/DemoRunner/Builds/VisualStudio2022/DemoRunner_App.vcxproj b/examples/DemoRunner/Builds/VisualStudio2022/DemoRunner_App.vcxproj index 7b63be293f..6afd542756 100644 --- a/examples/DemoRunner/Builds/VisualStudio2022/DemoRunner_App.vcxproj +++ b/examples/DemoRunner/Builds/VisualStudio2022/DemoRunner_App.vcxproj @@ -473,6 +473,9 @@ true + + true + true @@ -485,6 +488,9 @@ true + + true + true @@ -3367,10 +3373,12 @@ + + diff --git a/examples/DemoRunner/Builds/VisualStudio2022/DemoRunner_App.vcxproj.filters b/examples/DemoRunner/Builds/VisualStudio2022/DemoRunner_App.vcxproj.filters index dc90c6dcb6..162bc7ab7a 100644 --- a/examples/DemoRunner/Builds/VisualStudio2022/DemoRunner_App.vcxproj.filters +++ b/examples/DemoRunner/Builds/VisualStudio2022/DemoRunner_App.vcxproj.filters @@ -1162,6 +1162,9 @@ JUCE Modules\juce_audio_devices\native\oboe\src\flowgraph + + JUCE Modules\juce_audio_devices\native\oboe\src\flowgraph + JUCE Modules\juce_audio_devices\native\oboe\src\flowgraph @@ -1174,6 +1177,9 @@ JUCE Modules\juce_audio_devices\native\oboe\src\flowgraph + + JUCE Modules\juce_audio_devices\native\oboe\src\flowgraph + JUCE Modules\juce_audio_devices\native\oboe\src\flowgraph @@ -4554,6 +4560,9 @@ JUCE Modules\juce_audio_devices\native\oboe\src\flowgraph + + JUCE Modules\juce_audio_devices\native\oboe\src\flowgraph + JUCE Modules\juce_audio_devices\native\oboe\src\flowgraph @@ -4566,6 +4575,9 @@ JUCE Modules\juce_audio_devices\native\oboe\src\flowgraph + + JUCE Modules\juce_audio_devices\native\oboe\src\flowgraph + JUCE Modules\juce_audio_devices\native\oboe\src\flowgraph diff --git a/extras/AudioPerformanceTest/Builds/Android/app/CMakeLists.txt b/extras/AudioPerformanceTest/Builds/Android/app/CMakeLists.txt index 05fcb65b7f..1d93a40e1b 100644 --- a/extras/AudioPerformanceTest/Builds/Android/app/CMakeLists.txt +++ b/extras/AudioPerformanceTest/Builds/Android/app/CMakeLists.txt @@ -268,6 +268,8 @@ add_library( ${BINARY_NAME} "../../../../../modules/juce_audio_devices/native/oboe/src/flowgraph/SampleRateConverter.h" "../../../../../modules/juce_audio_devices/native/oboe/src/flowgraph/SinkFloat.cpp" "../../../../../modules/juce_audio_devices/native/oboe/src/flowgraph/SinkFloat.h" + "../../../../../modules/juce_audio_devices/native/oboe/src/flowgraph/SinkI8_24.cpp" + "../../../../../modules/juce_audio_devices/native/oboe/src/flowgraph/SinkI8_24.h" "../../../../../modules/juce_audio_devices/native/oboe/src/flowgraph/SinkI16.cpp" "../../../../../modules/juce_audio_devices/native/oboe/src/flowgraph/SinkI16.h" "../../../../../modules/juce_audio_devices/native/oboe/src/flowgraph/SinkI24.cpp" @@ -276,6 +278,8 @@ add_library( ${BINARY_NAME} "../../../../../modules/juce_audio_devices/native/oboe/src/flowgraph/SinkI32.h" "../../../../../modules/juce_audio_devices/native/oboe/src/flowgraph/SourceFloat.cpp" "../../../../../modules/juce_audio_devices/native/oboe/src/flowgraph/SourceFloat.h" + "../../../../../modules/juce_audio_devices/native/oboe/src/flowgraph/SourceI8_24.cpp" + "../../../../../modules/juce_audio_devices/native/oboe/src/flowgraph/SourceI8_24.h" "../../../../../modules/juce_audio_devices/native/oboe/src/flowgraph/SourceI16.cpp" "../../../../../modules/juce_audio_devices/native/oboe/src/flowgraph/SourceI16.h" "../../../../../modules/juce_audio_devices/native/oboe/src/flowgraph/SourceI24.cpp" @@ -2533,6 +2537,8 @@ set_source_files_properties( "../../../../../modules/juce_audio_devices/native/oboe/src/flowgraph/SampleRateConverter.h" "../../../../../modules/juce_audio_devices/native/oboe/src/flowgraph/SinkFloat.cpp" "../../../../../modules/juce_audio_devices/native/oboe/src/flowgraph/SinkFloat.h" + "../../../../../modules/juce_audio_devices/native/oboe/src/flowgraph/SinkI8_24.cpp" + "../../../../../modules/juce_audio_devices/native/oboe/src/flowgraph/SinkI8_24.h" "../../../../../modules/juce_audio_devices/native/oboe/src/flowgraph/SinkI16.cpp" "../../../../../modules/juce_audio_devices/native/oboe/src/flowgraph/SinkI16.h" "../../../../../modules/juce_audio_devices/native/oboe/src/flowgraph/SinkI24.cpp" @@ -2541,6 +2547,8 @@ set_source_files_properties( "../../../../../modules/juce_audio_devices/native/oboe/src/flowgraph/SinkI32.h" "../../../../../modules/juce_audio_devices/native/oboe/src/flowgraph/SourceFloat.cpp" "../../../../../modules/juce_audio_devices/native/oboe/src/flowgraph/SourceFloat.h" + "../../../../../modules/juce_audio_devices/native/oboe/src/flowgraph/SourceI8_24.cpp" + "../../../../../modules/juce_audio_devices/native/oboe/src/flowgraph/SourceI8_24.h" "../../../../../modules/juce_audio_devices/native/oboe/src/flowgraph/SourceI16.cpp" "../../../../../modules/juce_audio_devices/native/oboe/src/flowgraph/SourceI16.h" "../../../../../modules/juce_audio_devices/native/oboe/src/flowgraph/SourceI24.cpp" diff --git a/extras/AudioPerformanceTest/Builds/VisualStudio2022/AudioPerformanceTest_App.vcxproj b/extras/AudioPerformanceTest/Builds/VisualStudio2022/AudioPerformanceTest_App.vcxproj index c98a271a5b..b9ae419ca2 100644 --- a/extras/AudioPerformanceTest/Builds/VisualStudio2022/AudioPerformanceTest_App.vcxproj +++ b/extras/AudioPerformanceTest/Builds/VisualStudio2022/AudioPerformanceTest_App.vcxproj @@ -433,6 +433,9 @@ true + + true + true @@ -445,6 +448,9 @@ true + + true + true @@ -2939,10 +2945,12 @@ + + diff --git a/extras/AudioPerformanceTest/Builds/VisualStudio2022/AudioPerformanceTest_App.vcxproj.filters b/extras/AudioPerformanceTest/Builds/VisualStudio2022/AudioPerformanceTest_App.vcxproj.filters index d3cb19667d..588e9fdec6 100644 --- a/extras/AudioPerformanceTest/Builds/VisualStudio2022/AudioPerformanceTest_App.vcxproj.filters +++ b/extras/AudioPerformanceTest/Builds/VisualStudio2022/AudioPerformanceTest_App.vcxproj.filters @@ -979,6 +979,9 @@ JUCE Modules\juce_audio_devices\native\oboe\src\flowgraph + + JUCE Modules\juce_audio_devices\native\oboe\src\flowgraph + JUCE Modules\juce_audio_devices\native\oboe\src\flowgraph @@ -991,6 +994,9 @@ JUCE Modules\juce_audio_devices\native\oboe\src\flowgraph + + JUCE Modules\juce_audio_devices\native\oboe\src\flowgraph + JUCE Modules\juce_audio_devices\native\oboe\src\flowgraph @@ -3912,6 +3918,9 @@ JUCE Modules\juce_audio_devices\native\oboe\src\flowgraph + + JUCE Modules\juce_audio_devices\native\oboe\src\flowgraph + JUCE Modules\juce_audio_devices\native\oboe\src\flowgraph @@ -3924,6 +3933,9 @@ JUCE Modules\juce_audio_devices\native\oboe\src\flowgraph + + JUCE Modules\juce_audio_devices\native\oboe\src\flowgraph + JUCE Modules\juce_audio_devices\native\oboe\src\flowgraph diff --git a/extras/AudioPluginHost/Builds/Android/app/CMakeLists.txt b/extras/AudioPluginHost/Builds/Android/app/CMakeLists.txt index ba4030cf86..ff5a5a9e88 100644 --- a/extras/AudioPluginHost/Builds/Android/app/CMakeLists.txt +++ b/extras/AudioPluginHost/Builds/Android/app/CMakeLists.txt @@ -301,6 +301,8 @@ add_library( ${BINARY_NAME} "../../../../../modules/juce_audio_devices/native/oboe/src/flowgraph/SampleRateConverter.h" "../../../../../modules/juce_audio_devices/native/oboe/src/flowgraph/SinkFloat.cpp" "../../../../../modules/juce_audio_devices/native/oboe/src/flowgraph/SinkFloat.h" + "../../../../../modules/juce_audio_devices/native/oboe/src/flowgraph/SinkI8_24.cpp" + "../../../../../modules/juce_audio_devices/native/oboe/src/flowgraph/SinkI8_24.h" "../../../../../modules/juce_audio_devices/native/oboe/src/flowgraph/SinkI16.cpp" "../../../../../modules/juce_audio_devices/native/oboe/src/flowgraph/SinkI16.h" "../../../../../modules/juce_audio_devices/native/oboe/src/flowgraph/SinkI24.cpp" @@ -309,6 +311,8 @@ add_library( ${BINARY_NAME} "../../../../../modules/juce_audio_devices/native/oboe/src/flowgraph/SinkI32.h" "../../../../../modules/juce_audio_devices/native/oboe/src/flowgraph/SourceFloat.cpp" "../../../../../modules/juce_audio_devices/native/oboe/src/flowgraph/SourceFloat.h" + "../../../../../modules/juce_audio_devices/native/oboe/src/flowgraph/SourceI8_24.cpp" + "../../../../../modules/juce_audio_devices/native/oboe/src/flowgraph/SourceI8_24.h" "../../../../../modules/juce_audio_devices/native/oboe/src/flowgraph/SourceI16.cpp" "../../../../../modules/juce_audio_devices/native/oboe/src/flowgraph/SourceI16.h" "../../../../../modules/juce_audio_devices/native/oboe/src/flowgraph/SourceI24.cpp" @@ -2719,6 +2723,8 @@ set_source_files_properties( "../../../../../modules/juce_audio_devices/native/oboe/src/flowgraph/SampleRateConverter.h" "../../../../../modules/juce_audio_devices/native/oboe/src/flowgraph/SinkFloat.cpp" "../../../../../modules/juce_audio_devices/native/oboe/src/flowgraph/SinkFloat.h" + "../../../../../modules/juce_audio_devices/native/oboe/src/flowgraph/SinkI8_24.cpp" + "../../../../../modules/juce_audio_devices/native/oboe/src/flowgraph/SinkI8_24.h" "../../../../../modules/juce_audio_devices/native/oboe/src/flowgraph/SinkI16.cpp" "../../../../../modules/juce_audio_devices/native/oboe/src/flowgraph/SinkI16.h" "../../../../../modules/juce_audio_devices/native/oboe/src/flowgraph/SinkI24.cpp" @@ -2727,6 +2733,8 @@ set_source_files_properties( "../../../../../modules/juce_audio_devices/native/oboe/src/flowgraph/SinkI32.h" "../../../../../modules/juce_audio_devices/native/oboe/src/flowgraph/SourceFloat.cpp" "../../../../../modules/juce_audio_devices/native/oboe/src/flowgraph/SourceFloat.h" + "../../../../../modules/juce_audio_devices/native/oboe/src/flowgraph/SourceI8_24.cpp" + "../../../../../modules/juce_audio_devices/native/oboe/src/flowgraph/SourceI8_24.h" "../../../../../modules/juce_audio_devices/native/oboe/src/flowgraph/SourceI16.cpp" "../../../../../modules/juce_audio_devices/native/oboe/src/flowgraph/SourceI16.h" "../../../../../modules/juce_audio_devices/native/oboe/src/flowgraph/SourceI24.cpp" diff --git a/extras/AudioPluginHost/Builds/VisualStudio2019/AudioPluginHost_App.vcxproj b/extras/AudioPluginHost/Builds/VisualStudio2019/AudioPluginHost_App.vcxproj index 15c06d120c..49c4ab206f 100644 --- a/extras/AudioPluginHost/Builds/VisualStudio2019/AudioPluginHost_App.vcxproj +++ b/extras/AudioPluginHost/Builds/VisualStudio2019/AudioPluginHost_App.vcxproj @@ -441,6 +441,9 @@ true + + true + true @@ -453,6 +456,9 @@ true + + true + true @@ -3119,10 +3125,12 @@ + + diff --git a/extras/AudioPluginHost/Builds/VisualStudio2019/AudioPluginHost_App.vcxproj.filters b/extras/AudioPluginHost/Builds/VisualStudio2019/AudioPluginHost_App.vcxproj.filters index ddf55fa8ae..d2047ee98b 100644 --- a/extras/AudioPluginHost/Builds/VisualStudio2019/AudioPluginHost_App.vcxproj.filters +++ b/extras/AudioPluginHost/Builds/VisualStudio2019/AudioPluginHost_App.vcxproj.filters @@ -1054,6 +1054,9 @@ JUCE Modules\juce_audio_devices\native\oboe\src\flowgraph + + JUCE Modules\juce_audio_devices\native\oboe\src\flowgraph + JUCE Modules\juce_audio_devices\native\oboe\src\flowgraph @@ -1066,6 +1069,9 @@ JUCE Modules\juce_audio_devices\native\oboe\src\flowgraph + + JUCE Modules\juce_audio_devices\native\oboe\src\flowgraph + JUCE Modules\juce_audio_devices\native\oboe\src\flowgraph @@ -4188,6 +4194,9 @@ JUCE Modules\juce_audio_devices\native\oboe\src\flowgraph + + JUCE Modules\juce_audio_devices\native\oboe\src\flowgraph + JUCE Modules\juce_audio_devices\native\oboe\src\flowgraph @@ -4200,6 +4209,9 @@ JUCE Modules\juce_audio_devices\native\oboe\src\flowgraph + + JUCE Modules\juce_audio_devices\native\oboe\src\flowgraph + JUCE Modules\juce_audio_devices\native\oboe\src\flowgraph diff --git a/extras/AudioPluginHost/Builds/VisualStudio2022/AudioPluginHost_App.vcxproj b/extras/AudioPluginHost/Builds/VisualStudio2022/AudioPluginHost_App.vcxproj index 3e7ee35953..1902839141 100644 --- a/extras/AudioPluginHost/Builds/VisualStudio2022/AudioPluginHost_App.vcxproj +++ b/extras/AudioPluginHost/Builds/VisualStudio2022/AudioPluginHost_App.vcxproj @@ -441,6 +441,9 @@ true + + true + true @@ -453,6 +456,9 @@ true + + true + true @@ -3119,10 +3125,12 @@ + + diff --git a/extras/AudioPluginHost/Builds/VisualStudio2022/AudioPluginHost_App.vcxproj.filters b/extras/AudioPluginHost/Builds/VisualStudio2022/AudioPluginHost_App.vcxproj.filters index c5337335d7..4743a46145 100644 --- a/extras/AudioPluginHost/Builds/VisualStudio2022/AudioPluginHost_App.vcxproj.filters +++ b/extras/AudioPluginHost/Builds/VisualStudio2022/AudioPluginHost_App.vcxproj.filters @@ -1054,6 +1054,9 @@ JUCE Modules\juce_audio_devices\native\oboe\src\flowgraph + + JUCE Modules\juce_audio_devices\native\oboe\src\flowgraph + JUCE Modules\juce_audio_devices\native\oboe\src\flowgraph @@ -1066,6 +1069,9 @@ JUCE Modules\juce_audio_devices\native\oboe\src\flowgraph + + JUCE Modules\juce_audio_devices\native\oboe\src\flowgraph + JUCE Modules\juce_audio_devices\native\oboe\src\flowgraph @@ -4188,6 +4194,9 @@ JUCE Modules\juce_audio_devices\native\oboe\src\flowgraph + + JUCE Modules\juce_audio_devices\native\oboe\src\flowgraph + JUCE Modules\juce_audio_devices\native\oboe\src\flowgraph @@ -4200,6 +4209,9 @@ JUCE Modules\juce_audio_devices\native\oboe\src\flowgraph + + JUCE Modules\juce_audio_devices\native\oboe\src\flowgraph + JUCE Modules\juce_audio_devices\native\oboe\src\flowgraph diff --git a/extras/NetworkGraphicsDemo/Builds/Android/app/CMakeLists.txt b/extras/NetworkGraphicsDemo/Builds/Android/app/CMakeLists.txt index 53a2725a42..78663b6b83 100644 --- a/extras/NetworkGraphicsDemo/Builds/Android/app/CMakeLists.txt +++ b/extras/NetworkGraphicsDemo/Builds/Android/app/CMakeLists.txt @@ -272,6 +272,8 @@ add_library( ${BINARY_NAME} "../../../../../modules/juce_audio_devices/native/oboe/src/flowgraph/SampleRateConverter.h" "../../../../../modules/juce_audio_devices/native/oboe/src/flowgraph/SinkFloat.cpp" "../../../../../modules/juce_audio_devices/native/oboe/src/flowgraph/SinkFloat.h" + "../../../../../modules/juce_audio_devices/native/oboe/src/flowgraph/SinkI8_24.cpp" + "../../../../../modules/juce_audio_devices/native/oboe/src/flowgraph/SinkI8_24.h" "../../../../../modules/juce_audio_devices/native/oboe/src/flowgraph/SinkI16.cpp" "../../../../../modules/juce_audio_devices/native/oboe/src/flowgraph/SinkI16.h" "../../../../../modules/juce_audio_devices/native/oboe/src/flowgraph/SinkI24.cpp" @@ -280,6 +282,8 @@ add_library( ${BINARY_NAME} "../../../../../modules/juce_audio_devices/native/oboe/src/flowgraph/SinkI32.h" "../../../../../modules/juce_audio_devices/native/oboe/src/flowgraph/SourceFloat.cpp" "../../../../../modules/juce_audio_devices/native/oboe/src/flowgraph/SourceFloat.h" + "../../../../../modules/juce_audio_devices/native/oboe/src/flowgraph/SourceI8_24.cpp" + "../../../../../modules/juce_audio_devices/native/oboe/src/flowgraph/SourceI8_24.h" "../../../../../modules/juce_audio_devices/native/oboe/src/flowgraph/SourceI16.cpp" "../../../../../modules/juce_audio_devices/native/oboe/src/flowgraph/SourceI16.h" "../../../../../modules/juce_audio_devices/native/oboe/src/flowgraph/SourceI24.cpp" @@ -2617,6 +2621,8 @@ set_source_files_properties( "../../../../../modules/juce_audio_devices/native/oboe/src/flowgraph/SampleRateConverter.h" "../../../../../modules/juce_audio_devices/native/oboe/src/flowgraph/SinkFloat.cpp" "../../../../../modules/juce_audio_devices/native/oboe/src/flowgraph/SinkFloat.h" + "../../../../../modules/juce_audio_devices/native/oboe/src/flowgraph/SinkI8_24.cpp" + "../../../../../modules/juce_audio_devices/native/oboe/src/flowgraph/SinkI8_24.h" "../../../../../modules/juce_audio_devices/native/oboe/src/flowgraph/SinkI16.cpp" "../../../../../modules/juce_audio_devices/native/oboe/src/flowgraph/SinkI16.h" "../../../../../modules/juce_audio_devices/native/oboe/src/flowgraph/SinkI24.cpp" @@ -2625,6 +2631,8 @@ set_source_files_properties( "../../../../../modules/juce_audio_devices/native/oboe/src/flowgraph/SinkI32.h" "../../../../../modules/juce_audio_devices/native/oboe/src/flowgraph/SourceFloat.cpp" "../../../../../modules/juce_audio_devices/native/oboe/src/flowgraph/SourceFloat.h" + "../../../../../modules/juce_audio_devices/native/oboe/src/flowgraph/SourceI8_24.cpp" + "../../../../../modules/juce_audio_devices/native/oboe/src/flowgraph/SourceI8_24.h" "../../../../../modules/juce_audio_devices/native/oboe/src/flowgraph/SourceI16.cpp" "../../../../../modules/juce_audio_devices/native/oboe/src/flowgraph/SourceI16.h" "../../../../../modules/juce_audio_devices/native/oboe/src/flowgraph/SourceI24.cpp" diff --git a/extras/NetworkGraphicsDemo/Builds/VisualStudio2022/NetworkGraphicsDemo_App.vcxproj b/extras/NetworkGraphicsDemo/Builds/VisualStudio2022/NetworkGraphicsDemo_App.vcxproj index bdab9480c7..72d02587c2 100644 --- a/extras/NetworkGraphicsDemo/Builds/VisualStudio2022/NetworkGraphicsDemo_App.vcxproj +++ b/extras/NetworkGraphicsDemo/Builds/VisualStudio2022/NetworkGraphicsDemo_App.vcxproj @@ -433,6 +433,9 @@ true + + true + true @@ -445,6 +448,9 @@ true + + true + true @@ -3030,10 +3036,12 @@ + + diff --git a/extras/NetworkGraphicsDemo/Builds/VisualStudio2022/NetworkGraphicsDemo_App.vcxproj.filters b/extras/NetworkGraphicsDemo/Builds/VisualStudio2022/NetworkGraphicsDemo_App.vcxproj.filters index bdb0f6ca94..96f9375c7c 100644 --- a/extras/NetworkGraphicsDemo/Builds/VisualStudio2022/NetworkGraphicsDemo_App.vcxproj.filters +++ b/extras/NetworkGraphicsDemo/Builds/VisualStudio2022/NetworkGraphicsDemo_App.vcxproj.filters @@ -1009,6 +1009,9 @@ JUCE Modules\juce_audio_devices\native\oboe\src\flowgraph + + JUCE Modules\juce_audio_devices\native\oboe\src\flowgraph + JUCE Modules\juce_audio_devices\native\oboe\src\flowgraph @@ -1021,6 +1024,9 @@ JUCE Modules\juce_audio_devices\native\oboe\src\flowgraph + + JUCE Modules\juce_audio_devices\native\oboe\src\flowgraph + JUCE Modules\juce_audio_devices\native\oboe\src\flowgraph @@ -4053,6 +4059,9 @@ JUCE Modules\juce_audio_devices\native\oboe\src\flowgraph + + JUCE Modules\juce_audio_devices\native\oboe\src\flowgraph + JUCE Modules\juce_audio_devices\native\oboe\src\flowgraph @@ -4065,6 +4074,9 @@ JUCE Modules\juce_audio_devices\native\oboe\src\flowgraph + + JUCE Modules\juce_audio_devices\native\oboe\src\flowgraph + JUCE Modules\juce_audio_devices\native\oboe\src\flowgraph diff --git a/extras/UnitTestRunner/Builds/VisualStudio2019/UnitTestRunner_ConsoleApp.vcxproj b/extras/UnitTestRunner/Builds/VisualStudio2019/UnitTestRunner_ConsoleApp.vcxproj index 728838a489..d12540dfac 100644 --- a/extras/UnitTestRunner/Builds/VisualStudio2019/UnitTestRunner_ConsoleApp.vcxproj +++ b/extras/UnitTestRunner/Builds/VisualStudio2019/UnitTestRunner_ConsoleApp.vcxproj @@ -449,6 +449,9 @@ true + + true + true @@ -461,6 +464,9 @@ true + + true + true @@ -3215,10 +3221,12 @@ + + diff --git a/extras/UnitTestRunner/Builds/VisualStudio2019/UnitTestRunner_ConsoleApp.vcxproj.filters b/extras/UnitTestRunner/Builds/VisualStudio2019/UnitTestRunner_ConsoleApp.vcxproj.filters index 38db8b39c1..21be4af8b3 100644 --- a/extras/UnitTestRunner/Builds/VisualStudio2019/UnitTestRunner_ConsoleApp.vcxproj.filters +++ b/extras/UnitTestRunner/Builds/VisualStudio2019/UnitTestRunner_ConsoleApp.vcxproj.filters @@ -1075,6 +1075,9 @@ JUCE Modules\juce_audio_devices\native\oboe\src\flowgraph + + JUCE Modules\juce_audio_devices\native\oboe\src\flowgraph + JUCE Modules\juce_audio_devices\native\oboe\src\flowgraph @@ -1087,6 +1090,9 @@ JUCE Modules\juce_audio_devices\native\oboe\src\flowgraph + + JUCE Modules\juce_audio_devices\native\oboe\src\flowgraph + JUCE Modules\juce_audio_devices\native\oboe\src\flowgraph @@ -4302,6 +4308,9 @@ JUCE Modules\juce_audio_devices\native\oboe\src\flowgraph + + JUCE Modules\juce_audio_devices\native\oboe\src\flowgraph + JUCE Modules\juce_audio_devices\native\oboe\src\flowgraph @@ -4314,6 +4323,9 @@ JUCE Modules\juce_audio_devices\native\oboe\src\flowgraph + + JUCE Modules\juce_audio_devices\native\oboe\src\flowgraph + JUCE Modules\juce_audio_devices\native\oboe\src\flowgraph diff --git a/extras/UnitTestRunner/Builds/VisualStudio2022/UnitTestRunner_ConsoleApp.vcxproj b/extras/UnitTestRunner/Builds/VisualStudio2022/UnitTestRunner_ConsoleApp.vcxproj index 8a72351c82..0ff48cff0b 100644 --- a/extras/UnitTestRunner/Builds/VisualStudio2022/UnitTestRunner_ConsoleApp.vcxproj +++ b/extras/UnitTestRunner/Builds/VisualStudio2022/UnitTestRunner_ConsoleApp.vcxproj @@ -449,6 +449,9 @@ true + + true + true @@ -461,6 +464,9 @@ true + + true + true @@ -3215,10 +3221,12 @@ + + diff --git a/extras/UnitTestRunner/Builds/VisualStudio2022/UnitTestRunner_ConsoleApp.vcxproj.filters b/extras/UnitTestRunner/Builds/VisualStudio2022/UnitTestRunner_ConsoleApp.vcxproj.filters index 9303b28f4a..45441cd12f 100644 --- a/extras/UnitTestRunner/Builds/VisualStudio2022/UnitTestRunner_ConsoleApp.vcxproj.filters +++ b/extras/UnitTestRunner/Builds/VisualStudio2022/UnitTestRunner_ConsoleApp.vcxproj.filters @@ -1075,6 +1075,9 @@ JUCE Modules\juce_audio_devices\native\oboe\src\flowgraph + + JUCE Modules\juce_audio_devices\native\oboe\src\flowgraph + JUCE Modules\juce_audio_devices\native\oboe\src\flowgraph @@ -1087,6 +1090,9 @@ JUCE Modules\juce_audio_devices\native\oboe\src\flowgraph + + JUCE Modules\juce_audio_devices\native\oboe\src\flowgraph + JUCE Modules\juce_audio_devices\native\oboe\src\flowgraph @@ -4302,6 +4308,9 @@ JUCE Modules\juce_audio_devices\native\oboe\src\flowgraph + + JUCE Modules\juce_audio_devices\native\oboe\src\flowgraph + JUCE Modules\juce_audio_devices\native\oboe\src\flowgraph @@ -4314,6 +4323,9 @@ JUCE Modules\juce_audio_devices\native\oboe\src\flowgraph + + JUCE Modules\juce_audio_devices\native\oboe\src\flowgraph + JUCE Modules\juce_audio_devices\native\oboe\src\flowgraph diff --git a/extras/WindowsDLL/Builds/VisualStudio2022/WindowsDLL_DynamicLibrary.vcxproj b/extras/WindowsDLL/Builds/VisualStudio2022/WindowsDLL_DynamicLibrary.vcxproj index 54891cc9ce..865654c7b3 100644 --- a/extras/WindowsDLL/Builds/VisualStudio2022/WindowsDLL_DynamicLibrary.vcxproj +++ b/extras/WindowsDLL/Builds/VisualStudio2022/WindowsDLL_DynamicLibrary.vcxproj @@ -432,6 +432,9 @@ true + + true + true @@ -444,6 +447,9 @@ true + + true + true @@ -3006,10 +3012,12 @@ + + diff --git a/extras/WindowsDLL/Builds/VisualStudio2022/WindowsDLL_DynamicLibrary.vcxproj.filters b/extras/WindowsDLL/Builds/VisualStudio2022/WindowsDLL_DynamicLibrary.vcxproj.filters index 21348392bd..67e8292dab 100644 --- a/extras/WindowsDLL/Builds/VisualStudio2022/WindowsDLL_DynamicLibrary.vcxproj.filters +++ b/extras/WindowsDLL/Builds/VisualStudio2022/WindowsDLL_DynamicLibrary.vcxproj.filters @@ -1006,6 +1006,9 @@ JUCE Modules\juce_audio_devices\native\oboe\src\flowgraph + + JUCE Modules\juce_audio_devices\native\oboe\src\flowgraph + JUCE Modules\juce_audio_devices\native\oboe\src\flowgraph @@ -1018,6 +1021,9 @@ JUCE Modules\juce_audio_devices\native\oboe\src\flowgraph + + JUCE Modules\juce_audio_devices\native\oboe\src\flowgraph + JUCE Modules\juce_audio_devices\native\oboe\src\flowgraph @@ -4020,6 +4026,9 @@ JUCE Modules\juce_audio_devices\native\oboe\src\flowgraph + + JUCE Modules\juce_audio_devices\native\oboe\src\flowgraph + JUCE Modules\juce_audio_devices\native\oboe\src\flowgraph @@ -4032,6 +4041,9 @@ JUCE Modules\juce_audio_devices\native\oboe\src\flowgraph + + JUCE Modules\juce_audio_devices\native\oboe\src\flowgraph + JUCE Modules\juce_audio_devices\native\oboe\src\flowgraph diff --git a/modules/juce_audio_devices/native/oboe/CMakeLists.txt b/modules/juce_audio_devices/native/oboe/CMakeLists.txt index 6f697da77c..ac798aac48 100644 --- a/modules/juce_audio_devices/native/oboe/CMakeLists.txt +++ b/modules/juce_audio_devices/native/oboe/CMakeLists.txt @@ -45,10 +45,12 @@ set (oboe_sources src/flowgraph/SinkI16.cpp src/flowgraph/SinkI24.cpp src/flowgraph/SinkI32.cpp + src/flowgraph/SinkI8_24.cpp src/flowgraph/SourceFloat.cpp src/flowgraph/SourceI16.cpp src/flowgraph/SourceI24.cpp src/flowgraph/SourceI32.cpp + src/flowgraph/SourceI8_24.cpp src/flowgraph/resampler/IntegerRatio.cpp src/flowgraph/resampler/LinearResampler.cpp src/flowgraph/resampler/MultiChannelResampler.cpp @@ -76,20 +78,19 @@ target_include_directories(oboe PRIVATE src PUBLIC include) -# JUCE CHANGE STARTS HERE - -# This comment provided for Apache License compliance. We've removed the extra warnings flags and -# the `-Werror` option, to avoid cases where compilers produce unexpected errors and fail the build. -# We've also removed the explicit `-std=c++17` compile option, and replaced it with a more -# cmake-friendly way of specifying the language standard. - +# Compile Flags: +# Enable -Werror when building debug config +# Enable -Ofast target_compile_options(oboe PRIVATE + -std=c++17 + -Wall + -Wextra-semi + -Wshadow + -Wshadow-field "$<$:-Ofast>" - "$<$:-O3>") -target_compile_features(oboe PRIVATE cxx_std_17) - -# JUCE CHANGE ENDS HERE + "$<$:-O3>" + "$<$:-Werror>") # Enable logging of D,V for debug builds target_compile_definitions(oboe PUBLIC $<$:OBOE_ENABLE_LOGGING=1>) diff --git a/modules/juce_audio_devices/native/oboe/README.md b/modules/juce_audio_devices/native/oboe/README.md index cff7332f73..4a2d2fe560 100644 --- a/modules/juce_audio_devices/native/oboe/README.md +++ b/modules/juce_audio_devices/native/oboe/README.md @@ -1,7 +1,7 @@ The files in this directory are reproduced from the official Oboe repository, which can be found at github.com/google/oboe. -These files are from tag 1.8.0 (987538b). +These files are from tag 1.9.0 (03242e9ef9495e418e6ae83954d239dc9193ec5c). We've included only those parts of the original repository which are required to build the Oboe library. Documentation, samples, tests, and other non-library items have been omitted. diff --git a/modules/juce_audio_devices/native/oboe/include/oboe/AudioStream.h b/modules/juce_audio_devices/native/oboe/include/oboe/AudioStream.h index 261772a1aa..d4c2a06e34 100644 --- a/modules/juce_audio_devices/native/oboe/include/oboe/AudioStream.h +++ b/modules/juce_audio_devices/native/oboe/include/oboe/AudioStream.h @@ -54,7 +54,7 @@ public: */ explicit AudioStream(const AudioStreamBuilder &builder); - virtual ~AudioStream() = default; + virtual ~AudioStream(); /** * Open a stream based on the current settings. @@ -194,6 +194,13 @@ public: * * This cannot be set higher than getBufferCapacity(). * + * This should only be used with Output streams. It will + * be ignored for Input streams because they are generally kept as empty as possible. + * + * For OpenSL ES, this method only has an effect on output stream that do NOT + * use a callback. The blocking writes goes into a buffer in Oboe and the size of that + * buffer is controlled by this method. + * * @param requestedFrames requested number of frames that can be filled without blocking * @return the resulting buffer size in frames (obtained using value()) or an error (obtained * using error()) @@ -622,7 +629,7 @@ protected: * This may be called internally at the end of a callback. * @param numFrames passed to the callback */ - virtual void endPerformanceHintInCallback(int32_t numFrames) {} + virtual void endPerformanceHintInCallback(int32_t /*numFrames*/) {} /** * This will be called when the stream is closed just in case performance hints were enabled. diff --git a/modules/juce_audio_devices/native/oboe/include/oboe/AudioStreamBase.h b/modules/juce_audio_devices/native/oboe/include/oboe/AudioStreamBase.h index 6222e44807..c2cf88f34b 100644 --- a/modules/juce_audio_devices/native/oboe/include/oboe/AudioStreamBase.h +++ b/modules/juce_audio_devices/native/oboe/include/oboe/AudioStreamBase.h @@ -307,7 +307,7 @@ protected: // Control whether Oboe can convert data formats to achieve optimal results. bool mFormatConversionAllowed = false; // Control whether and how Oboe can convert sample rates to achieve optimal results. - SampleRateConversionQuality mSampleRateConversionQuality = SampleRateConversionQuality::None; + SampleRateConversionQuality mSampleRateConversionQuality = SampleRateConversionQuality::Medium; /** Validate stream parameters that might not be checked in lower layers */ virtual Result isValidConfig() { diff --git a/modules/juce_audio_devices/native/oboe/include/oboe/AudioStreamBuilder.h b/modules/juce_audio_devices/native/oboe/include/oboe/AudioStreamBuilder.h index 89e1447eff..04f4af7243 100644 --- a/modules/juce_audio_devices/native/oboe/include/oboe/AudioStreamBuilder.h +++ b/modules/juce_audio_devices/native/oboe/include/oboe/AudioStreamBuilder.h @@ -465,6 +465,10 @@ public: * This can occur when a stream is disconnected because a headset is plugged in or unplugged. * It can also occur if the audio service fails or if an exclusive stream is stolen by * another stream. + * + * Note that error callbacks will only be called when a data callback has been specified + * and the stream is started. If you are not using a data callback then the read(), write() + * and requestStart() methods will return errors if the stream is disconnected. * * Important: See AudioStreamCallback for restrictions on what may be called * from the callback methods. @@ -556,7 +560,7 @@ public: * * If you do the conversion in Oboe then you might still get a low latency stream. * - * Default is SampleRateConversionQuality::None + * Default is SampleRateConversionQuality::Medium */ AudioStreamBuilder *setSampleRateConversionQuality(SampleRateConversionQuality quality) { mSampleRateConversionQuality = quality; @@ -647,6 +651,14 @@ public: private: + /** + * Use this internally to implement opening with a shared_ptr. + * + * @param stream pointer to a variable to receive the stream address + * @return OBOE_OK if successful or a negative error code. + */ + Result openStreamInternal(AudioStream **streamPP); + /** * @param other * @return true if channels, format and sample rate match diff --git a/modules/juce_audio_devices/native/oboe/include/oboe/AudioStreamCallback.h b/modules/juce_audio_devices/native/oboe/include/oboe/AudioStreamCallback.h index 17d28ba708..8d8e2feb4b 100644 --- a/modules/juce_audio_devices/native/oboe/include/oboe/AudioStreamCallback.h +++ b/modules/juce_audio_devices/native/oboe/include/oboe/AudioStreamCallback.h @@ -48,7 +48,8 @@ public: * write() on the stream that is making the callback. * * Note that numFrames can vary unless AudioStreamBuilder::setFramesPerCallback() - * is called. + * is called. If AudioStreamBuilder::setFramesPerCallback() is NOT called then + * numFrames should always be <= AudioStream::getFramesPerBurst(). * * Also note that this callback function should be considered a "real-time" function. * It must not do anything that could cause an unbounded delay because that can cause the diff --git a/modules/juce_audio_devices/native/oboe/include/oboe/FullDuplexStream.h b/modules/juce_audio_devices/native/oboe/include/oboe/FullDuplexStream.h index 15d2489a53..d3ee3abf56 100644 --- a/modules/juce_audio_devices/native/oboe/include/oboe/FullDuplexStream.h +++ b/modules/juce_audio_devices/native/oboe/include/oboe/FullDuplexStream.h @@ -177,7 +177,7 @@ public: * */ DataCallbackResult onAudioReady( - AudioStream *audioStream, + AudioStream * /*audioStream*/, void *audioData, int numFrames) { DataCallbackResult callbackResult = DataCallbackResult::Continue; diff --git a/modules/juce_audio_devices/native/oboe/include/oboe/Version.h b/modules/juce_audio_devices/native/oboe/include/oboe/Version.h index 4c77a6754f..6603bbf39d 100644 --- a/modules/juce_audio_devices/native/oboe/include/oboe/Version.h +++ b/modules/juce_audio_devices/native/oboe/include/oboe/Version.h @@ -34,7 +34,7 @@ #define OBOE_VERSION_MAJOR 1 // Type: 8-bit unsigned int. Min value: 0 Max value: 255. See below for description. -#define OBOE_VERSION_MINOR 8 +#define OBOE_VERSION_MINOR 9 // Type: 16-bit unsigned int. Min value: 0 Max value: 65535. See below for description. #define OBOE_VERSION_PATCH 0 diff --git a/modules/juce_audio_devices/native/oboe/src/aaudio/AAudioExtensions.h b/modules/juce_audio_devices/native/oboe/src/aaudio/AAudioExtensions.h index 3a9d782d01..eed73f3730 100644 --- a/modules/juce_audio_devices/native/oboe/src/aaudio/AAudioExtensions.h +++ b/modules/juce_audio_devices/native/oboe/src/aaudio/AAudioExtensions.h @@ -89,7 +89,7 @@ public: if (loadSymbols()) return false; if (mAAudio_getMMapPolicy == nullptr) return false; int32_t policy = mAAudio_getMMapPolicy(); - return isPolicyEnabled(policy); + return (policy == Unspecified) ? mMMapSupported : isPolicyEnabled(policy); } bool isMMapSupported() { diff --git a/modules/juce_audio_devices/native/oboe/src/aaudio/AudioStreamAAudio.cpp b/modules/juce_audio_devices/native/oboe/src/aaudio/AudioStreamAAudio.cpp index db7e658bcf..7aad6dda36 100644 --- a/modules/juce_audio_devices/native/oboe/src/aaudio/AudioStreamAAudio.cpp +++ b/modules/juce_audio_devices/native/oboe/src/aaudio/AudioStreamAAudio.cpp @@ -60,9 +60,13 @@ static aaudio_data_callback_result_t oboe_aaudio_data_callback_proc( // This runs in its own thread. // Only one of these threads will be launched from internalErrorCallback(). // It calls app error callbacks from a static function in case the stream gets deleted. -static void oboe_aaudio_error_thread_proc(AudioStreamAAudio *oboeStream, +static void oboe_aaudio_error_thread_proc_common(AudioStreamAAudio *oboeStream, Result error) { - LOGD("%s(,%d) - entering >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>", __func__, error); +#if 0 + LOGE("%s() sleep for 5 seconds", __func__); + usleep(5*1000*1000); + LOGD("%s() - woke up -------------------------", __func__); +#endif AudioStreamErrorCallback *errorCallback = oboeStream->getErrorCallback(); if (errorCallback == nullptr) return; // should be impossible bool isErrorHandled = errorCallback->onError(oboeStream, error); @@ -74,16 +78,24 @@ static void oboe_aaudio_error_thread_proc(AudioStreamAAudio *oboeStream, // Warning, oboeStream may get deleted by this callback. errorCallback->onErrorAfterClose(oboeStream, error); } +} + +// Callback thread for raw pointers. +static void oboe_aaudio_error_thread_proc(AudioStreamAAudio *oboeStream, + Result error) { + LOGD("%s(,%d) - entering >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>", __func__, error); + oboe_aaudio_error_thread_proc_common(oboeStream, error); LOGD("%s() - exiting <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<", __func__); } -// This runs in its own thread. -// Only one of these threads will be launched from internalErrorCallback(). -// Prevents deletion of the stream if the app is using AudioStreamBuilder::openSharedStream() +// Callback thread for shared pointers. static void oboe_aaudio_error_thread_proc_shared(std::shared_ptr sharedStream, Result error) { + LOGD("%s(,%d) - entering >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>", __func__, error); + // Hold the shared pointer while we use the raw pointer. AudioStreamAAudio *oboeStream = reinterpret_cast(sharedStream.get()); - oboe_aaudio_error_thread_proc(oboeStream, error); + oboe_aaudio_error_thread_proc_common(oboeStream, error); + LOGD("%s() - exiting <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<", __func__); } namespace oboe { @@ -528,7 +540,7 @@ DataCallbackResult AudioStreamAAudio::callOnAudioReady(AAudioStream * /*stream*/ if (result == DataCallbackResult::Stop) { LOGD("Oboe callback returned DataCallbackResult::Stop"); } else { - LOGE("Oboe callback returned unexpected value = %d", result); + LOGE("Oboe callback returned unexpected value. Error: %d", static_cast(result)); } // Returning Stop caused various problems before S. See #1230 diff --git a/modules/juce_audio_devices/native/oboe/src/common/AudioStream.cpp b/modules/juce_audio_devices/native/oboe/src/common/AudioStream.cpp index 06c01118e4..c27370f116 100644 --- a/modules/juce_audio_devices/native/oboe/src/common/AudioStream.cpp +++ b/modules/juce_audio_devices/native/oboe/src/common/AudioStream.cpp @@ -30,6 +30,12 @@ namespace oboe { */ AudioStream::AudioStream(const AudioStreamBuilder &builder) : AudioStreamBase(builder) { + LOGD("Constructor for AudioStream at %p", this); +} + +AudioStream::~AudioStream() { + // This is to help debug use after free bugs. + LOGD("Destructor for AudioStream at %p", this); } Result AudioStream::close() { @@ -113,8 +119,12 @@ Result AudioStream::start(int64_t timeoutNanoseconds) Result result = requestStart(); if (result != Result::OK) return result; if (timeoutNanoseconds <= 0) return result; - return waitForStateTransition(StreamState::Starting, + result = waitForStateTransition(StreamState::Starting, StreamState::Started, timeoutNanoseconds); + if (result != Result::OK) { + LOGE("AudioStream::%s() timed out before moving from STARTING to STARTED", __func__); + } + return result; } Result AudioStream::pause(int64_t timeoutNanoseconds) diff --git a/modules/juce_audio_devices/native/oboe/src/common/AudioStreamBuilder.cpp b/modules/juce_audio_devices/native/oboe/src/common/AudioStreamBuilder.cpp index 5dbe38cc82..7604dc9521 100644 --- a/modules/juce_audio_devices/native/oboe/src/common/AudioStreamBuilder.cpp +++ b/modules/juce_audio_devices/native/oboe/src/common/AudioStreamBuilder.cpp @@ -89,9 +89,14 @@ bool AudioStreamBuilder::isCompatible(AudioStreamBase &other) { } Result AudioStreamBuilder::openStream(AudioStream **streamPP) { + LOGW("Passing AudioStream pointer deprecated, Use openStream(std::shared_ptr &stream) instead."); + return openStreamInternal(streamPP); +} + +Result AudioStreamBuilder::openStreamInternal(AudioStream **streamPP) { auto result = isValidConfig(); if (result != Result::OK) { - LOGW("%s() invalid config %d", __func__, result); + LOGW("%s() invalid config. Error %s", __func__, oboe::convertToText(result)); return result; } @@ -112,7 +117,7 @@ Result AudioStreamBuilder::openStream(AudioStream **streamPP) { // Do we need to make a child stream and convert. if (conversionNeeded) { AudioStream *tempStream; - result = childBuilder.openStream(&tempStream); + result = childBuilder.openStreamInternal(&tempStream); if (result != Result::OK) { return result; } @@ -139,7 +144,9 @@ Result AudioStreamBuilder::openStream(AudioStream **streamPP) { // Use childStream in a FilterAudioStream. LOGI("%s() create a FilterAudioStream for data conversion.", __func__); - FilterAudioStream *filterStream = new FilterAudioStream(parentBuilder, tempStream); + std::shared_ptr childStream(tempStream); + FilterAudioStream *filterStream = new FilterAudioStream(parentBuilder, childStream); + childStream->setWeakThis(childStream); result = filterStream->configureFlowGraph(); if (result != Result::OK) { filterStream->close(); @@ -202,6 +209,7 @@ Result AudioStreamBuilder::openStream(AudioStream **streamPP) { } Result AudioStreamBuilder::openManagedStream(oboe::ManagedStream &stream) { + LOGW("`openManagedStream` is deprecated. Use openStream(std::shared_ptr &stream) instead."); stream.reset(); AudioStream *streamptr; auto result = openStream(&streamptr); @@ -212,7 +220,7 @@ Result AudioStreamBuilder::openManagedStream(oboe::ManagedStream &stream) { Result AudioStreamBuilder::openStream(std::shared_ptr &sharedStream) { sharedStream.reset(); AudioStream *streamptr; - auto result = openStream(&streamptr); + auto result = openStreamInternal(&streamptr); if (result == Result::OK) { sharedStream.reset(streamptr); // Save a weak_ptr in the stream for use with callbacks. diff --git a/modules/juce_audio_devices/native/oboe/src/common/DataConversionFlowGraph.cpp b/modules/juce_audio_devices/native/oboe/src/common/DataConversionFlowGraph.cpp index 374fffd198..0bb51ae2eb 100644 --- a/modules/juce_audio_devices/native/oboe/src/common/DataConversionFlowGraph.cpp +++ b/modules/juce_audio_devices/native/oboe/src/common/DataConversionFlowGraph.cpp @@ -92,14 +92,14 @@ Result DataConversionFlowGraph::configure(AudioStream *sourceStream, AudioStream int32_t sinkSampleRate = sinkStream->getSampleRate(); int32_t sinkFramesPerCallback = sinkStream->getFramesPerDataCallback(); - LOGI("%s() flowgraph converts channels: %d to %d, format: %d to %d" - ", rate: %d to %d, cbsize: %d to %d, qual = %d", + LOGI("%s() flowgraph converts channels: %d to %d, format: %s to %s" + ", rate: %d to %d, cbsize: %d to %d, qual = %s", __func__, sourceChannelCount, sinkChannelCount, - sourceFormat, sinkFormat, + oboe::convertToText(sourceFormat), oboe::convertToText(sinkFormat), sourceSampleRate, sinkSampleRate, sourceFramesPerCallback, sinkFramesPerCallback, - sourceStream->getSampleRateConversionQuality()); + oboe::convertToText(sourceStream->getSampleRateConversionQuality())); // Source // IF OUTPUT and using a callback then call back to the app using a SourceCaller. @@ -128,7 +128,7 @@ Result DataConversionFlowGraph::configure(AudioStream *sourceStream, AudioStream actualSourceFramesPerCallback); break; default: - LOGE("%s() Unsupported source caller format = %d", __func__, sourceFormat); + LOGE("%s() Unsupported source caller format = %d", __func__, static_cast(sourceFormat)); return Result::ErrorIllegalArgument; } mSourceCaller->setStream(sourceStream); @@ -150,7 +150,7 @@ Result DataConversionFlowGraph::configure(AudioStream *sourceStream, AudioStream mSource = std::make_unique(sourceChannelCount); break; default: - LOGE("%s() Unsupported source format = %d", __func__, sourceFormat); + LOGE("%s() Unsupported source format = %d", __func__, static_cast(sourceFormat)); return Result::ErrorIllegalArgument; } if (isInput) { @@ -226,7 +226,7 @@ Result DataConversionFlowGraph::configure(AudioStream *sourceStream, AudioStream mSink = std::make_unique(sinkChannelCount); break; default: - LOGE("%s() Unsupported sink format = %d", __func__, sinkFormat); + LOGE("%s() Unsupported sink format = %d", __func__, static_cast(sinkFormat)); return Result::ErrorIllegalArgument;; } lastOutput->connect(&mSink->input); diff --git a/modules/juce_audio_devices/native/oboe/src/common/FilterAudioStream.h b/modules/juce_audio_devices/native/oboe/src/common/FilterAudioStream.h index 189074997f..99f6f5ac92 100644 --- a/modules/juce_audio_devices/native/oboe/src/common/FilterAudioStream.h +++ b/modules/juce_audio_devices/native/oboe/src/common/FilterAudioStream.h @@ -38,9 +38,9 @@ public: * * @param builder containing all the stream's attributes */ - FilterAudioStream(const AudioStreamBuilder &builder, AudioStream *childStream) + FilterAudioStream(const AudioStreamBuilder &builder, std::shared_ptr childStream) : AudioStream(builder) - , mChildStream(childStream) { + , mChildStream(childStream) { // Intercept the callback if used. if (builder.isErrorCallbackSpecified()) { mErrorCallback = mChildStream->swapErrorCallback(this); @@ -66,10 +66,6 @@ public: virtual ~FilterAudioStream() = default; - AudioStream *getChildStream() const { - return mChildStream.get(); - } - Result configureFlowGraph(); // Close child and parent. @@ -216,7 +212,7 @@ public: private: - std::unique_ptr mChildStream; // this stream wraps the child stream + std::shared_ptr mChildStream; // this stream wraps the child stream std::unique_ptr mFlowGraph; // for converting data std::unique_ptr mBlockingBuffer; // temp buffer for write() double mRateScaler = 1.0; // ratio parent/child sample rates diff --git a/modules/juce_audio_devices/native/oboe/src/common/Utilities.cpp b/modules/juce_audio_devices/native/oboe/src/common/Utilities.cpp index f6718afca0..d84d35f48c 100644 --- a/modules/juce_audio_devices/native/oboe/src/common/Utilities.cpp +++ b/modules/juce_audio_devices/native/oboe/src/common/Utilities.cpp @@ -278,6 +278,20 @@ const char *convertToText(ChannelCount channelCount) { } } +template<> +const char *convertToText(SampleRateConversionQuality sampleRateConversionQuality) { + + switch (sampleRateConversionQuality) { + case SampleRateConversionQuality::None: return "None"; + case SampleRateConversionQuality::Fastest: return "Fastest"; + case SampleRateConversionQuality::Low: return "Low"; + case SampleRateConversionQuality::Medium: return "Medium"; + case SampleRateConversionQuality::High: return "High"; + case SampleRateConversionQuality::Best: return "Best"; + default: return "Unrecognized sample rate conversion quality"; + } +} + std::string getPropertyString(const char * name) { std::string result; #ifdef __ANDROID__ diff --git a/modules/juce_audio_devices/native/oboe/src/flowgraph/FlowgraphUtilities.h b/modules/juce_audio_devices/native/oboe/src/flowgraph/FlowgraphUtilities.h index 5e90588ce9..e277d6e6f7 100644 --- a/modules/juce_audio_devices/native/oboe/src/flowgraph/FlowgraphUtilities.h +++ b/modules/juce_audio_devices/native/oboe/src/flowgraph/FlowgraphUtilities.h @@ -17,6 +17,7 @@ #ifndef FLOWGRAPH_UTILITIES_H #define FLOWGRAPH_UTILITIES_H +#include #include using namespace FLOWGRAPH_OUTER_NAMESPACE::flowgraph; @@ -50,6 +51,20 @@ static int32_t clamp32FromFloat(float f) return f > 0 ? f + 0.5 : f - 0.5; } +/** + * Convert a single-precision floating point value to a Q0.23 integer value, stored in a + * 32 bit signed integer (technically stored as Q8.23, but clamped to Q0.23). + * + * Values outside the range [-1.0, 1.0) are properly clamped to -8388608 and 8388607, + * including -Inf and +Inf. NaN values are considered undefined, and behavior may change + * depending on hardware and future implementation of this function. + */ +static int32_t clamp24FromFloat(float f) +{ + static const float scale = 1 << 23; + return (int32_t) lroundf(fmaxf(fminf(f * scale, scale - 1.f), -scale)); +} + }; #endif // FLOWGRAPH_UTILITIES_H diff --git a/modules/juce_audio_devices/native/oboe/src/flowgraph/SampleRateConverter.cpp b/modules/juce_audio_devices/native/oboe/src/flowgraph/SampleRateConverter.cpp index a15fcb8ce9..890057db07 100644 --- a/modules/juce_audio_devices/native/oboe/src/flowgraph/SampleRateConverter.cpp +++ b/modules/juce_audio_devices/native/oboe/src/flowgraph/SampleRateConverter.cpp @@ -28,7 +28,8 @@ SampleRateConverter::SampleRateConverter(int32_t channelCount, void SampleRateConverter::reset() { FlowGraphNode::reset(); - mInputCursor = kInitialCallCount; + mInputCallCount = kInitialCallCount; + mInputCursor = 0; } // Return true if there is a sample available. diff --git a/modules/juce_audio_devices/native/oboe/src/flowgraph/SampleRateConverter.h b/modules/juce_audio_devices/native/oboe/src/flowgraph/SampleRateConverter.h index f883e6ce28..a4318f0423 100644 --- a/modules/juce_audio_devices/native/oboe/src/flowgraph/SampleRateConverter.h +++ b/modules/juce_audio_devices/native/oboe/src/flowgraph/SampleRateConverter.h @@ -54,7 +54,7 @@ private: int32_t mNumValidInputFrames = 0; // number of valid frames currently in the input port buffer // We need our own callCount for upstream calls because calls occur at a different rate. // This means we cannot have cyclic graphs or merges that contain an SRC. - int64_t mInputCallCount = 0; + int64_t mInputCallCount = kInitialCallCount; }; diff --git a/modules/juce_audio_devices/native/oboe/src/flowgraph/SinkI8_24.cpp b/modules/juce_audio_devices/native/oboe/src/flowgraph/SinkI8_24.cpp new file mode 100644 index 0000000000..d5e4b808a4 --- /dev/null +++ b/modules/juce_audio_devices/native/oboe/src/flowgraph/SinkI8_24.cpp @@ -0,0 +1,55 @@ +/* + * Copyright 2023 The Android Open Source Project + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#include "FlowGraphNode.h" +#include "FlowgraphUtilities.h" +#include "SinkI8_24.h" + +#if FLOWGRAPH_ANDROID_INTERNAL +#include +#endif + +using namespace FLOWGRAPH_OUTER_NAMESPACE::flowgraph; + +SinkI8_24::SinkI8_24(int32_t channelCount) + : FlowGraphSink(channelCount) {} + +int32_t SinkI8_24::read(void *data, int32_t numFrames) { + int32_t *intData = (int32_t *) data; + const int32_t channelCount = input.getSamplesPerFrame(); + + int32_t framesLeft = numFrames; + while (framesLeft > 0) { + // Run the graph and pull data through the input port. + int32_t framesRead = pullData(framesLeft); + if (framesRead <= 0) { + break; + } + const float *signal = input.getBuffer(); + int32_t numSamples = framesRead * channelCount; +#if FLOWGRAPH_ANDROID_INTERNAL + memcpy_to_q8_23_from_float_with_clamp(intData, signal, numSamples); + intData += numSamples; + signal += numSamples; +#else + for (int i = 0; i < numSamples; i++) { + *intData++ = FlowgraphUtilities::clamp24FromFloat(*signal++); + } +#endif + framesLeft -= framesRead; + } + return numFrames - framesLeft; +} diff --git a/modules/juce_audio_devices/native/oboe/src/flowgraph/SinkI8_24.h b/modules/juce_audio_devices/native/oboe/src/flowgraph/SinkI8_24.h new file mode 100644 index 0000000000..366b4ba813 --- /dev/null +++ b/modules/juce_audio_devices/native/oboe/src/flowgraph/SinkI8_24.h @@ -0,0 +1,40 @@ +/* + * Copyright 2023 The Android Open Source Project + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#ifndef FLOWGRAPH_SINK_I8_24_H +#define FLOWGRAPH_SINK_I8_24_H + +#include + +#include "FlowGraphNode.h" + +namespace FLOWGRAPH_OUTER_NAMESPACE::flowgraph { + + class SinkI8_24 : public FlowGraphSink { + public: + explicit SinkI8_24(int32_t channelCount); + ~SinkI8_24() override = default; + + int32_t read(void *data, int32_t numFrames) override; + + const char *getName() override { + return "SinkI8_24"; + } + }; + +} /* namespace FLOWGRAPH_OUTER_NAMESPACE::flowgraph */ + +#endif //FLOWGRAPH_SINK_I8_24_H diff --git a/modules/juce_audio_devices/native/oboe/src/flowgraph/SourceI8_24.cpp b/modules/juce_audio_devices/native/oboe/src/flowgraph/SourceI8_24.cpp new file mode 100644 index 0000000000..684446cc06 --- /dev/null +++ b/modules/juce_audio_devices/native/oboe/src/flowgraph/SourceI8_24.cpp @@ -0,0 +1,54 @@ +/* + * Copyright 2023 The Android Open Source Project + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#include +#include + +#include "FlowGraphNode.h" +#include "SourceI8_24.h" + +#if FLOWGRAPH_ANDROID_INTERNAL +#include +#endif + +using namespace FLOWGRAPH_OUTER_NAMESPACE::flowgraph; + +SourceI8_24::SourceI8_24(int32_t channelCount) + : FlowGraphSourceBuffered(channelCount) { +} + +int32_t SourceI8_24::onProcess(int32_t numFrames) { + float *floatData = output.getBuffer(); + const int32_t channelCount = output.getSamplesPerFrame(); + + const int32_t framesLeft = mSizeInFrames - mFrameIndex; + const int32_t framesToProcess = std::min(numFrames, framesLeft); + const int32_t numSamples = framesToProcess * channelCount; + + const int32_t *intBase = static_cast(mData); + const int32_t *intData = &intBase[mFrameIndex * channelCount]; + +#if FLOWGRAPH_ANDROID_INTERNAL + memcpy_to_float_from_q8_23(floatData, intData, numSamples); +#else + for (int i = 0; i < numSamples; i++) { + *floatData++ = *intData++ * kScale; + } +#endif + + mFrameIndex += framesToProcess; + return framesToProcess; +} diff --git a/modules/juce_audio_devices/native/oboe/src/flowgraph/SourceI8_24.h b/modules/juce_audio_devices/native/oboe/src/flowgraph/SourceI8_24.h new file mode 100644 index 0000000000..91c756c8d8 --- /dev/null +++ b/modules/juce_audio_devices/native/oboe/src/flowgraph/SourceI8_24.h @@ -0,0 +1,42 @@ +/* + * Copyright 2023 The Android Open Source Project + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#ifndef FLOWGRAPH_SOURCE_I8_24_H +#define FLOWGRAPH_SOURCE_I8_24_H + +#include + +#include "FlowGraphNode.h" + +namespace FLOWGRAPH_OUTER_NAMESPACE::flowgraph { + +class SourceI8_24 : public FlowGraphSourceBuffered { +public: + explicit SourceI8_24(int32_t channelCount); + ~SourceI8_24() override = default; + + int32_t onProcess(int32_t numFrames) override; + + const char *getName() override { + return "SourceI8_24"; + } +private: + static constexpr float kScale = 1.0 / (1UL << 23); +}; + +} /* namespace FLOWGRAPH_OUTER_NAMESPACE::flowgraph */ + +#endif //FLOWGRAPH_SOURCE_I8_24_H diff --git a/modules/juce_audio_devices/native/oboe/src/flowgraph/resampler/MultiChannelResampler.cpp b/modules/juce_audio_devices/native/oboe/src/flowgraph/resampler/MultiChannelResampler.cpp index 611ddcd152..245b669db4 100644 --- a/modules/juce_audio_devices/native/oboe/src/flowgraph/resampler/MultiChannelResampler.cpp +++ b/modules/juce_audio_devices/native/oboe/src/flowgraph/resampler/MultiChannelResampler.cpp @@ -120,7 +120,7 @@ void MultiChannelResampler::writeFrame(const float *frame) { } float MultiChannelResampler::sinc(float radians) { - if (abs(radians) < 1.0e-9) return 1.0f; // avoid divide by zero + if (fabsf(radians) < 1.0e-9f) return 1.0f; // avoid divide by zero return sinf(radians) / radians; // Sinc function } diff --git a/modules/juce_audio_devices/native/oboe/src/opensles/AudioInputStreamOpenSLES.cpp b/modules/juce_audio_devices/native/oboe/src/opensles/AudioInputStreamOpenSLES.cpp index 3653d964ef..482070ced5 100644 --- a/modules/juce_audio_devices/native/oboe/src/opensles/AudioInputStreamOpenSLES.cpp +++ b/modules/juce_audio_devices/native/oboe/src/opensles/AudioInputStreamOpenSLES.cpp @@ -16,9 +16,6 @@ #include -#include -#include - #include "common/OboeDebug.h" #include "oboe/AudioStreamBuilder.h" #include "AudioInputStreamOpenSLES.h" @@ -151,8 +148,8 @@ Result AudioInputStreamOpenSLES::open() { // Configure the stream. result = (*mObjectInterface)->GetInterface(mObjectInterface, - SL_IID_ANDROIDCONFIGURATION, - &configItf); + EngineOpenSLES::getInstance().getIidAndroidConfiguration(), + &configItf); if (SL_RESULT_SUCCESS != result) { LOGW("%s() GetInterface(SL_IID_ANDROIDCONFIGURATION) failed with %s", @@ -190,7 +187,9 @@ Result AudioInputStreamOpenSLES::open() { goto error; } - result = (*mObjectInterface)->GetInterface(mObjectInterface, SL_IID_RECORD, &mRecordInterface); + result = (*mObjectInterface)->GetInterface(mObjectInterface, + EngineOpenSLES::getInstance().getIidRecord(), + &mRecordInterface); if (SL_RESULT_SUCCESS != result) { LOGE("GetInterface RECORD result:%s", getSLErrStr(result)); goto error; diff --git a/modules/juce_audio_devices/native/oboe/src/opensles/AudioInputStreamOpenSLES.h b/modules/juce_audio_devices/native/oboe/src/opensles/AudioInputStreamOpenSLES.h index 08e7a05646..0da64801aa 100644 --- a/modules/juce_audio_devices/native/oboe/src/opensles/AudioInputStreamOpenSLES.h +++ b/modules/juce_audio_devices/native/oboe/src/opensles/AudioInputStreamOpenSLES.h @@ -18,10 +18,8 @@ #define AUDIO_INPUT_STREAM_OPENSL_ES_H_ -#include -#include - #include "oboe/Oboe.h" +#include "EngineOpenSLES.h" #include "AudioStreamOpenSLES.h" namespace oboe { diff --git a/modules/juce_audio_devices/native/oboe/src/opensles/AudioOutputStreamOpenSLES.cpp b/modules/juce_audio_devices/native/oboe/src/opensles/AudioOutputStreamOpenSLES.cpp index 91f9882d50..1d7503d594 100644 --- a/modules/juce_audio_devices/native/oboe/src/opensles/AudioOutputStreamOpenSLES.cpp +++ b/modules/juce_audio_devices/native/oboe/src/opensles/AudioOutputStreamOpenSLES.cpp @@ -16,8 +16,6 @@ #include -#include -#include #include #include "common/OboeDebug.h" @@ -30,9 +28,10 @@ using namespace oboe; static SLuint32 OpenSLES_convertOutputUsage(Usage oboeUsage) { - SLuint32 openslStream = SL_ANDROID_STREAM_MEDIA; + SLuint32 openslStream; switch(oboeUsage) { case Usage::Media: + case Usage::Game: openslStream = SL_ANDROID_STREAM_MEDIA; break; case Usage::VoiceCommunication: @@ -43,18 +42,15 @@ static SLuint32 OpenSLES_convertOutputUsage(Usage oboeUsage) { openslStream = SL_ANDROID_STREAM_ALARM; break; case Usage::Notification: - case Usage::NotificationRingtone: case Usage::NotificationEvent: openslStream = SL_ANDROID_STREAM_NOTIFICATION; break; + case Usage::NotificationRingtone: + openslStream = SL_ANDROID_STREAM_RING; + break; case Usage::AssistanceAccessibility: case Usage::AssistanceNavigationGuidance: case Usage::AssistanceSonification: - openslStream = SL_ANDROID_STREAM_SYSTEM; - break; - case Usage::Game: - openslStream = SL_ANDROID_STREAM_MEDIA; - break; case Usage::Assistant: default: openslStream = SL_ANDROID_STREAM_SYSTEM; @@ -182,8 +178,8 @@ Result AudioOutputStreamOpenSLES::open() { // Configure the stream. result = (*mObjectInterface)->GetInterface(mObjectInterface, - SL_IID_ANDROIDCONFIGURATION, - (void *)&configItf); + EngineOpenSLES::getInstance().getIidAndroidConfiguration(), + (void *)&configItf); if (SL_RESULT_SUCCESS != result) { LOGW("%s() GetInterface(SL_IID_ANDROIDCONFIGURATION) failed with %s", __func__, getSLErrStr(result)); @@ -209,7 +205,9 @@ Result AudioOutputStreamOpenSLES::open() { goto error; } - result = (*mObjectInterface)->GetInterface(mObjectInterface, SL_IID_PLAY, &mPlayInterface); + result = (*mObjectInterface)->GetInterface(mObjectInterface, + EngineOpenSLES::getInstance().getIidPlay(), + &mPlayInterface); if (SL_RESULT_SUCCESS != result) { LOGE("GetInterface PLAY result:%s", getSLErrStr(result)); goto error; @@ -374,7 +372,7 @@ Result AudioOutputStreamOpenSLES::requestFlush_l() { } else { SLresult slResult = (*mSimpleBufferQueueInterface)->Clear(mSimpleBufferQueueInterface); if (slResult != SL_RESULT_SUCCESS){ - LOGW("Failed to clear buffer queue. OpenSLES error: %d", result); + LOGW("Failed to clear buffer queue. OpenSLES error: %s", getSLErrStr(slResult)); result = Result::ErrorInternal; } } diff --git a/modules/juce_audio_devices/native/oboe/src/opensles/AudioOutputStreamOpenSLES.h b/modules/juce_audio_devices/native/oboe/src/opensles/AudioOutputStreamOpenSLES.h index fc57fd374f..29b3de6a55 100644 --- a/modules/juce_audio_devices/native/oboe/src/opensles/AudioOutputStreamOpenSLES.h +++ b/modules/juce_audio_devices/native/oboe/src/opensles/AudioOutputStreamOpenSLES.h @@ -18,10 +18,8 @@ #define AUDIO_OUTPUT_STREAM_OPENSL_ES_H_ -#include -#include - #include "oboe/Oboe.h" +#include "EngineOpenSLES.h" #include "AudioStreamOpenSLES.h" namespace oboe { diff --git a/modules/juce_audio_devices/native/oboe/src/opensles/AudioStreamOpenSLES.cpp b/modules/juce_audio_devices/native/oboe/src/opensles/AudioStreamOpenSLES.cpp index 9013d61c55..b54a8621e8 100644 --- a/modules/juce_audio_devices/native/oboe/src/opensles/AudioStreamOpenSLES.cpp +++ b/modules/juce_audio_devices/native/oboe/src/opensles/AudioStreamOpenSLES.cpp @@ -16,13 +16,12 @@ #include #include -#include -#include #include #include #include "common/OboeDebug.h" #include "oboe/AudioStreamBuilder.h" +#include "EngineOpenSLES.h" #include "AudioStreamOpenSLES.h" #include "OpenSLESUtilities.h" @@ -72,8 +71,8 @@ Result AudioStreamOpenSLES::open() { // OpenSL ES only supports I16 and Float if (mFormat != AudioFormat::I16 && mFormat != AudioFormat::Float) { - LOGW("%s() Android's OpenSL ES implementation only supports I16 and Float. Format: %d", - __func__, mFormat); + LOGW("%s() Android's OpenSL ES implementation only supports I16 and Float. Format: %s", + __func__, oboe::convertToText(mFormat)); return Result::ErrorInvalidFormat; } @@ -422,7 +421,7 @@ bool AudioStreamOpenSLES::processBufferCallback(SLAndroidSimpleBufferQueueItf bq LOGD("Oboe callback returned Stop"); shouldStopStream = true; } else { - LOGW("Oboe callback returned unexpected value = %d", result); + LOGW("Oboe callback returned unexpected value = %d", static_cast(result)); shouldStopStream = true; } if (shouldStopStream) { @@ -442,8 +441,9 @@ static void bqCallbackGlue(SLAndroidSimpleBufferQueueItf bq, void *context) { SLresult AudioStreamOpenSLES::registerBufferQueueCallback() { // The BufferQueue - SLresult result = (*mObjectInterface)->GetInterface(mObjectInterface, SL_IID_ANDROIDSIMPLEBUFFERQUEUE, - &mSimpleBufferQueueInterface); + SLresult result = (*mObjectInterface)->GetInterface(mObjectInterface, + EngineOpenSLES::getInstance().getIidAndroidSimpleBufferQueue(), + &mSimpleBufferQueueInterface); if (SL_RESULT_SUCCESS != result) { LOGE("get buffer queue interface:%p result:%s", mSimpleBufferQueueInterface, diff --git a/modules/juce_audio_devices/native/oboe/src/opensles/AudioStreamOpenSLES.h b/modules/juce_audio_devices/native/oboe/src/opensles/AudioStreamOpenSLES.h index 0164b839ac..d86ed22ead 100644 --- a/modules/juce_audio_devices/native/oboe/src/opensles/AudioStreamOpenSLES.h +++ b/modules/juce_audio_devices/native/oboe/src/opensles/AudioStreamOpenSLES.h @@ -19,9 +19,6 @@ #include -#include -#include - #include "oboe/Oboe.h" #include "common/MonotonicCounter.h" #include "opensles/AudioStreamBuffered.h" diff --git a/modules/juce_audio_devices/native/oboe/src/opensles/EngineOpenSLES.cpp b/modules/juce_audio_devices/native/oboe/src/opensles/EngineOpenSLES.cpp index e1007d1086..9abfe262a3 100644 --- a/modules/juce_audio_devices/native/oboe/src/opensles/EngineOpenSLES.cpp +++ b/modules/juce_audio_devices/native/oboe/src/opensles/EngineOpenSLES.cpp @@ -15,6 +15,7 @@ */ #include + #include "common/OboeDebug.h" #include "EngineOpenSLES.h" #include "OpenSLESUtilities.h" @@ -24,42 +25,94 @@ using namespace oboe; // OpenSL ES is deprecated in SDK 30. // So we use custom dynamic linking to access the library. #define LIB_OPENSLES_NAME "libOpenSLES.so" -typedef SLresult (*prototype_slCreateEngine)( - SLObjectItf *pEngine, - SLuint32 numOptions, - const SLEngineOption *pEngineOptions, - SLuint32 numInterfaces, - const SLInterfaceID *pInterfaceIds, - const SLboolean *pInterfaceRequired -); -static prototype_slCreateEngine gFunction_slCreateEngine = nullptr; -static void *gLibOpenSlesLibraryHandle = nullptr; - -// Load the OpenSL ES library and the one primary entry point. -// @return true if linked OK -static bool linkOpenSLES() { - if (gLibOpenSlesLibraryHandle == nullptr && gFunction_slCreateEngine == nullptr) { - // Use RTLD_NOW to avoid the unpredictable behavior that RTLD_LAZY can cause. - // Also resolving all the links now will prevent a run-time penalty later. - gLibOpenSlesLibraryHandle = dlopen(LIB_OPENSLES_NAME, RTLD_NOW); - if (gLibOpenSlesLibraryHandle == nullptr) { - LOGE("linkOpenSLES() could not find " LIB_OPENSLES_NAME); - } else { - gFunction_slCreateEngine = (prototype_slCreateEngine) dlsym( - gLibOpenSlesLibraryHandle, - "slCreateEngine"); - LOGD("linkOpenSLES(): dlsym(%s) returned %p", "slCreateEngine", - gFunction_slCreateEngine); - } - } - return gFunction_slCreateEngine != nullptr; -} EngineOpenSLES &EngineOpenSLES::getInstance() { static EngineOpenSLES sInstance; return sInstance; } +// Satisfy extern in OpenSLES.h +// These are required because of b/337360630, which was causing +// Oboe to have link failures if libOpenSLES.so was not available. +SL_API const SLInterfaceID SL_IID_ENGINE = nullptr; +SL_API const SLInterfaceID SL_IID_ANDROIDSIMPLEBUFFERQUEUE = nullptr; +SL_API const SLInterfaceID SL_IID_ANDROIDCONFIGURATION = nullptr; +SL_API const SLInterfaceID SL_IID_RECORD = nullptr; +SL_API const SLInterfaceID SL_IID_BUFFERQUEUE = nullptr; +SL_API const SLInterfaceID SL_IID_VOLUME = nullptr; +SL_API const SLInterfaceID SL_IID_PLAY = nullptr; + +static const char *getSafeDlerror() { + static const char *defaultMessage = "not found?"; + char *errorMessage = dlerror(); + return (errorMessage == nullptr) ? defaultMessage : errorMessage; +} + +// Load the OpenSL ES library and the one primary entry point. +// @return true if linked OK +bool EngineOpenSLES::linkOpenSLES() { + if (mDynamicLinkState == kLinkStateBad) { + LOGE("%s(), OpenSL ES not available, based on previous link failure.", __func__); + } else if (mDynamicLinkState == kLinkStateUninitialized) { + // Set to BAD now in case we return because of an error. + // This is safe form race conditions because this function is always called + // under mLock amd the state is only accessed from this function. + mDynamicLinkState = kLinkStateBad; + // Use RTLD_NOW to avoid the unpredictable behavior that RTLD_LAZY can cause. + // Also resolving all the links now will prevent a run-time penalty later. + mLibOpenSlesLibraryHandle = dlopen(LIB_OPENSLES_NAME, RTLD_NOW); + if (mLibOpenSlesLibraryHandle == nullptr) { + LOGE("%s() could not dlopen(%s), %s", __func__, LIB_OPENSLES_NAME, getSafeDlerror()); + return false; + } else { + mFunction_slCreateEngine = (prototype_slCreateEngine) dlsym( + mLibOpenSlesLibraryHandle, + "slCreateEngine"); + LOGD("%s(): dlsym(%s) returned %p", __func__, + "slCreateEngine", mFunction_slCreateEngine); + if (mFunction_slCreateEngine == nullptr) { + LOGE("%s(): dlsym(slCreateEngine) returned null, %s", __func__, getSafeDlerror()); + return false; + } + + // Load IID interfaces. + LOCAL_SL_IID_ENGINE = getIidPointer("SL_IID_ENGINE"); + if (LOCAL_SL_IID_ENGINE == nullptr) return false; + LOCAL_SL_IID_ANDROIDSIMPLEBUFFERQUEUE = getIidPointer( + "SL_IID_ANDROIDSIMPLEBUFFERQUEUE"); + if (LOCAL_SL_IID_ANDROIDSIMPLEBUFFERQUEUE == nullptr) return false; + LOCAL_SL_IID_ANDROIDCONFIGURATION = getIidPointer( + "SL_IID_ANDROIDCONFIGURATION"); + if (LOCAL_SL_IID_ANDROIDCONFIGURATION == nullptr) return false; + LOCAL_SL_IID_RECORD = getIidPointer("SL_IID_RECORD"); + if (LOCAL_SL_IID_RECORD == nullptr) return false; + LOCAL_SL_IID_BUFFERQUEUE = getIidPointer("SL_IID_BUFFERQUEUE"); + if (LOCAL_SL_IID_BUFFERQUEUE == nullptr) return false; + LOCAL_SL_IID_VOLUME = getIidPointer("SL_IID_VOLUME"); + if (LOCAL_SL_IID_VOLUME == nullptr) return false; + LOCAL_SL_IID_PLAY = getIidPointer("SL_IID_PLAY"); + if (LOCAL_SL_IID_PLAY == nullptr) return false; + + mDynamicLinkState = kLinkStateGood; + } + } + return (mDynamicLinkState == kLinkStateGood); +} + +// A symbol like SL_IID_PLAY is a pointer to a structure. +// The dlsym() function returns the address of the pointer, not the structure. +// To get the address of the structure we have to dereference the pointer. +SLInterfaceID EngineOpenSLES::getIidPointer(const char *symbolName) { + SLInterfaceID *iid_address = (SLInterfaceID *) dlsym( + mLibOpenSlesLibraryHandle, + symbolName); + if (iid_address == nullptr) { + LOGE("%s(): dlsym(%s) returned null, %s", __func__, symbolName, getSafeDlerror()); + return (SLInterfaceID) nullptr; + } + return *iid_address; // Get address of the structure. +} + SLresult EngineOpenSLES::open() { std::lock_guard lock(mLock); @@ -72,7 +125,7 @@ SLresult EngineOpenSLES::open() { }; // create engine - result = (*gFunction_slCreateEngine)(&mEngineObject, 0, NULL, 0, NULL, NULL); + result = (*mFunction_slCreateEngine)(&mEngineObject, 0, NULL, 0, NULL, NULL); if (SL_RESULT_SUCCESS != result) { LOGE("EngineOpenSLES - slCreateEngine() result:%s", getSLErrStr(result)); goto error; @@ -86,7 +139,9 @@ SLresult EngineOpenSLES::open() { } // get the engine interface, which is needed in order to create other objects - result = (*mEngineObject)->GetInterface(mEngineObject, SL_IID_ENGINE, &mEngineInterface); + result = (*mEngineObject)->GetInterface(mEngineObject, + EngineOpenSLES::getInstance().getIidEngine(), + &mEngineInterface); if (SL_RESULT_SUCCESS != result) { LOGE("EngineOpenSLES - GetInterface() engine result:%s", getSLErrStr(result)); goto error; @@ -96,12 +151,17 @@ SLresult EngineOpenSLES::open() { return result; error: - close(); + close_l(); return result; } void EngineOpenSLES::close() { std::lock_guard lock(mLock); + close_l(); +} + +// This must be called under mLock +void EngineOpenSLES::close_l() { if (--mOpenCount == 0) { if (mEngineObject != nullptr) { (*mEngineObject)->Destroy(mEngineObject); @@ -119,8 +179,8 @@ SLresult EngineOpenSLES::createAudioPlayer(SLObjectItf *objectItf, SLDataSource *audioSource, SLDataSink *audioSink) { - const SLInterfaceID ids[] = {SL_IID_BUFFERQUEUE, SL_IID_ANDROIDCONFIGURATION}; - const SLboolean reqs[] = {SL_BOOLEAN_TRUE, SL_BOOLEAN_TRUE}; + SLInterfaceID ids[] = {LOCAL_SL_IID_BUFFERQUEUE, LOCAL_SL_IID_ANDROIDCONFIGURATION}; + SLboolean reqs[] = {SL_BOOLEAN_TRUE, SL_BOOLEAN_TRUE}; return (*mEngineInterface)->CreateAudioPlayer(mEngineInterface, objectItf, audioSource, audioSink, @@ -131,8 +191,9 @@ SLresult EngineOpenSLES::createAudioRecorder(SLObjectItf *objectItf, SLDataSource *audioSource, SLDataSink *audioSink) { - const SLInterfaceID ids[] = {SL_IID_ANDROIDSIMPLEBUFFERQUEUE, SL_IID_ANDROIDCONFIGURATION }; - const SLboolean reqs[] = {SL_BOOLEAN_TRUE, SL_BOOLEAN_TRUE}; + SLInterfaceID ids[] = {LOCAL_SL_IID_ANDROIDSIMPLEBUFFERQUEUE, + LOCAL_SL_IID_ANDROIDCONFIGURATION }; + SLboolean reqs[] = {SL_BOOLEAN_TRUE, SL_BOOLEAN_TRUE}; return (*mEngineInterface)->CreateAudioRecorder(mEngineInterface, objectItf, audioSource, audioSink, diff --git a/modules/juce_audio_devices/native/oboe/src/opensles/EngineOpenSLES.h b/modules/juce_audio_devices/native/oboe/src/opensles/EngineOpenSLES.h index 3d238a8c09..f856406be1 100644 --- a/modules/juce_audio_devices/native/oboe/src/opensles/EngineOpenSLES.h +++ b/modules/juce_audio_devices/native/oboe/src/opensles/EngineOpenSLES.h @@ -25,6 +25,15 @@ namespace oboe { +typedef SLresult (*prototype_slCreateEngine)( + SLObjectItf *pEngine, + SLuint32 numOptions, + const SLEngineOption *pEngineOptions, + SLuint32 numInterfaces, + const SLInterfaceID *pInterfaceIds, + const SLboolean *pInterfaceRequired +); + /** * INTERNAL USE ONLY */ @@ -32,6 +41,8 @@ class EngineOpenSLES { public: static EngineOpenSLES &getInstance(); + bool linkOpenSLES(); + SLresult open(); void close(); @@ -45,6 +56,14 @@ public: SLDataSource *audioSource, SLDataSink *audioSink); + SLInterfaceID getIidEngine() { return LOCAL_SL_IID_ENGINE; } + SLInterfaceID getIidAndroidSimpleBufferQueue() { return LOCAL_SL_IID_ANDROIDSIMPLEBUFFERQUEUE; } + SLInterfaceID getIidAndroidConfiguration() { return LOCAL_SL_IID_ANDROIDCONFIGURATION; } + SLInterfaceID getIidRecord() { return LOCAL_SL_IID_RECORD; } + SLInterfaceID getIidBufferQueue() { return LOCAL_SL_IID_BUFFERQUEUE; } + SLInterfaceID getIidVolume() { return LOCAL_SL_IID_VOLUME; } + SLInterfaceID getIidPlay() { return LOCAL_SL_IID_PLAY; } + private: // Make this a safe Singleton EngineOpenSLES()= default; @@ -52,11 +71,34 @@ private: EngineOpenSLES(const EngineOpenSLES&)= delete; EngineOpenSLES& operator=(const EngineOpenSLES&)= delete; + SLInterfaceID getIidPointer(const char *symbolName); + + /** + * Close the OpenSL ES engine. + * This must be called under mLock + */ + void close_l(); + std::mutex mLock; int32_t mOpenCount = 0; + static constexpr int32_t kLinkStateUninitialized = 0; + static constexpr int32_t kLinkStateGood = 1; + static constexpr int32_t kLinkStateBad = 2; + int32_t mDynamicLinkState = kLinkStateUninitialized; SLObjectItf mEngineObject = nullptr; SLEngineItf mEngineInterface = nullptr; + + // These symbols are loaded using dlsym(). + prototype_slCreateEngine mFunction_slCreateEngine = nullptr; + void *mLibOpenSlesLibraryHandle = nullptr; + SLInterfaceID LOCAL_SL_IID_ENGINE = nullptr; + SLInterfaceID LOCAL_SL_IID_ANDROIDSIMPLEBUFFERQUEUE = nullptr; + SLInterfaceID LOCAL_SL_IID_ANDROIDCONFIGURATION = nullptr; + SLInterfaceID LOCAL_SL_IID_RECORD = nullptr; + SLInterfaceID LOCAL_SL_IID_BUFFERQUEUE = nullptr; + SLInterfaceID LOCAL_SL_IID_VOLUME = nullptr; + SLInterfaceID LOCAL_SL_IID_PLAY = nullptr; }; } // namespace oboe diff --git a/modules/juce_audio_devices/native/oboe/src/opensles/OutputMixerOpenSLES.h b/modules/juce_audio_devices/native/oboe/src/opensles/OutputMixerOpenSLES.h index 813fd01881..c378488279 100644 --- a/modules/juce_audio_devices/native/oboe/src/opensles/OutputMixerOpenSLES.h +++ b/modules/juce_audio_devices/native/oboe/src/opensles/OutputMixerOpenSLES.h @@ -20,8 +20,7 @@ #include #include -#include -#include +#include "EngineOpenSLES.h" namespace oboe {