(Android) Fixed some compile errors

This commit is contained in:
Leon Styhre 2023-11-19 17:40:41 +01:00
parent 145cd85b0a
commit bbab5c6b93
2 changed files with 9 additions and 9 deletions

View file

@ -15,14 +15,14 @@
#include <cmath> #include <cmath>
#endif #endif
#if defined(__linux__) #if defined(__linux__) && !defined(__ANDROID__)
std::string VolumeControl::mixerName = "Master"; std::string VolumeControl::mixerName = "Master";
std::string VolumeControl::mixerCard = "default"; std::string VolumeControl::mixerCard = "default";
#endif #endif
VolumeControl::VolumeControl() VolumeControl::VolumeControl()
// clang-format off // clang-format off
#if defined(__linux__) #if defined(__linux__) && !defined(__ANDROID__)
: mixerIndex {0} : mixerIndex {0}
, mixerHandle {nullptr} , mixerHandle {nullptr}
, mixerElem {nullptr} , mixerElem {nullptr}
@ -39,7 +39,7 @@ VolumeControl::VolumeControl()
VolumeControl::~VolumeControl() VolumeControl::~VolumeControl()
{ {
deinit(); deinit();
#if defined(__linux__) #if defined(__linux__) && !defined(__ANDROID__)
snd_config_update_free_global(); snd_config_update_free_global();
#endif #endif
} }
@ -48,7 +48,7 @@ void VolumeControl::init()
{ {
// Initialize audio mixer interface. // Initialize audio mixer interface.
#if defined(__linux__) #if defined(__linux__) && !defined(__ANDROID__)
// Try to open mixer device. // Try to open mixer device.
if (mixerHandle == nullptr) { if (mixerHandle == nullptr) {
snd_mixer_selem_id_alloca(&mixerSelemId); snd_mixer_selem_id_alloca(&mixerSelemId);
@ -139,7 +139,7 @@ void VolumeControl::deinit()
{ {
// Deinitialize audio mixer interface. // Deinitialize audio mixer interface.
#if defined(__linux__) #if defined(__linux__) && !defined(__ANDROID__)
if (mixerHandle != nullptr) { if (mixerHandle != nullptr) {
snd_mixer_detach(mixerHandle, mixerCard.c_str()); snd_mixer_detach(mixerHandle, mixerCard.c_str());
snd_mixer_free(mixerHandle); snd_mixer_free(mixerHandle);
@ -160,7 +160,7 @@ int VolumeControl::getVolume() const
{ {
int volume = 0; int volume = 0;
#if defined(__linux__) #if defined(__linux__) && !defined(__ANDROID__)
if (mixerElem != nullptr) { if (mixerElem != nullptr) {
// Get volume range. // Get volume range.
long minVolume; long minVolume;
@ -204,7 +204,7 @@ void VolumeControl::setVolume(int volume)
{ {
volume = glm::clamp(volume, 0, 100); volume = glm::clamp(volume, 0, 100);
#if defined(__linux__) #if defined(__linux__) && !defined(__ANDROID__)
if (mixerElem != nullptr) { if (mixerElem != nullptr) {
// Get volume range. // Get volume range.
long minVolume; long minVolume;

View file

@ -11,7 +11,7 @@
#include <memory> #include <memory>
#if defined(__linux__) #if defined(__linux__) && !defined(__ANDROID__)
#include <alsa/asoundlib.h> #include <alsa/asoundlib.h>
#include <fcntl.h> #include <fcntl.h>
#include <unistd.h> #include <unistd.h>
@ -33,7 +33,7 @@ public:
int getVolume() const; int getVolume() const;
void setVolume(int volume); void setVolume(int volume);
#if defined(__linux__) #if defined(__linux__) && !defined(__ANDROID__)
static std::string mixerName; static std::string mixerName;
static std::string mixerCard; static std::string mixerCard;
int mixerIndex; int mixerIndex;