Restrict OpenSLES to Android via CMake
This commit is contained in:
parent
e638bb658f
commit
e2aefe13a6
|
@ -18,14 +18,17 @@ add_library(audiocommon
|
||||||
WaveFile.h
|
WaveFile.h
|
||||||
)
|
)
|
||||||
|
|
||||||
find_package(OpenSLES)
|
if(ANDROID)
|
||||||
if(OPENSLES_FOUND)
|
find_package(OpenSLES)
|
||||||
message(STATUS "OpenSLES found, enabling OpenSLES sound backend")
|
if(OPENSLES_FOUND)
|
||||||
target_sources(audiocommon PRIVATE
|
message(STATUS "OpenSLES found, enabling OpenSLES sound backend")
|
||||||
OpenSLESStream.cpp
|
target_sources(audiocommon PRIVATE
|
||||||
OpenSLESStream.h
|
OpenSLESStream.cpp
|
||||||
)
|
OpenSLESStream.h
|
||||||
target_link_libraries(audiocommon PRIVATE OpenSLES::OpenSLES)
|
)
|
||||||
|
target_link_libraries(audiocommon PRIVATE OpenSLES::OpenSLES)
|
||||||
|
target_compile_definitions(audiocommon PRIVATE HAVE_OPENSL_ES=1)
|
||||||
|
endif()
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
if(ENABLE_ALSA)
|
if(ENABLE_ALSA)
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
// Copyright 2013 Dolphin Emulator Project
|
// Copyright 2013 Dolphin Emulator Project
|
||||||
// SPDX-License-Identifier: GPL-2.0-or-later
|
// SPDX-License-Identifier: GPL-2.0-or-later
|
||||||
|
|
||||||
#ifdef ANDROID
|
#ifdef HAVE_OPENSL_ES
|
||||||
#include "AudioCommon/OpenSLESStream.h"
|
#include "AudioCommon/OpenSLESStream.h"
|
||||||
|
|
||||||
#include <cmath>
|
#include <cmath>
|
||||||
|
@ -143,4 +143,4 @@ void OpenSLESStream::SetVolume(int volume)
|
||||||
volume <= 0 ? SL_MILLIBEL_MIN : static_cast<SLmillibel>(2000 * std::log10(volume / 100.0f));
|
volume <= 0 ? SL_MILLIBEL_MIN : static_cast<SLmillibel>(2000 * std::log10(volume / 100.0f));
|
||||||
(*bqPlayerVolume)->SetVolumeLevel(bqPlayerVolume, attenuation);
|
(*bqPlayerVolume)->SetVolumeLevel(bqPlayerVolume, attenuation);
|
||||||
}
|
}
|
||||||
#endif
|
#endif // HAVE_OPENSL_ES
|
||||||
|
|
|
@ -10,7 +10,7 @@
|
||||||
|
|
||||||
class OpenSLESStream final : public SoundStream
|
class OpenSLESStream final : public SoundStream
|
||||||
{
|
{
|
||||||
#ifdef ANDROID
|
#ifdef HAVE_OPENSL_ES
|
||||||
public:
|
public:
|
||||||
~OpenSLESStream() override;
|
~OpenSLESStream() override;
|
||||||
bool Init() override;
|
bool Init() override;
|
||||||
|
@ -21,5 +21,5 @@ public:
|
||||||
private:
|
private:
|
||||||
std::thread thread;
|
std::thread thread;
|
||||||
Common::Event soundSyncEvent;
|
Common::Event soundSyncEvent;
|
||||||
#endif // HAVE_OPENSL
|
#endif // HAVE_OPENSL_ES
|
||||||
};
|
};
|
||||||
|
|
Loading…
Reference in New Issue