Working on Android version
This commit is contained in:
1 parent
0975f3b9cd
commit
e773b51985
19 files changed
+418
-264
No files matched your search
+24
-13
@@ -22,7 +22,7 @@ AudioPlayerAsync::~AudioPlayerAsync() {
|
||||
}
|
||||
|
||||
bool AudioPlayerAsync::init() {
|
||||
if (initialized) return true;
|
||||
/*if (initialized) return true;
|
||||
|
||||
if (SDL_InitSubSystem(SDL_INIT_AUDIO) < 0) {
|
||||
std::cerr << "SDL_InitSubSystem(SDL_INIT_AUDIO) failed: " << SDL_GetError() << std::endl;
|
||||
@@ -37,13 +37,13 @@ bool AudioPlayerAsync::init() {
|
||||
Mix_AllocateChannels(16);
|
||||
|
||||
initialized = true;
|
||||
FRG::logger() << "AudioPlayerAsync initialized with SDL2_mixer" << std::endl;
|
||||
FRG::logger() << "AudioPlayerAsync initialized with SDL2_mixer" << std::endl;*/
|
||||
return true;
|
||||
}
|
||||
|
||||
void AudioPlayerAsync::shutdown() {
|
||||
if (!initialized) return;
|
||||
|
||||
/*
|
||||
if (currentMusic_) {
|
||||
Mix_HaltMusic();
|
||||
Mix_FreeMusic(currentMusic_);
|
||||
@@ -61,11 +61,11 @@ void AudioPlayerAsync::shutdown() {
|
||||
Mix_CloseAudio();
|
||||
SDL_QuitSubSystem(SDL_INIT_AUDIO);
|
||||
initialized = false;
|
||||
FRG::logger() << "AudioPlayerAsync shutdown" << std::endl;
|
||||
FRG::logger() << "AudioPlayerAsync shutdown" << std::endl;*/
|
||||
}
|
||||
|
||||
void AudioPlayerAsync::playSoundAsync(const std::string& filePath, int loops, int channel) {
|
||||
if (!initialized) {
|
||||
/*if (!initialized) {
|
||||
std::cerr << "AudioPlayerAsync not initialized" << std::endl;
|
||||
return;
|
||||
}
|
||||
@@ -104,10 +104,11 @@ void AudioPlayerAsync::playSoundAsync(const std::string& filePath, int loops, in
|
||||
taskQueue.push(std::move(task));
|
||||
cv.notify_one();
|
||||
#endif
|
||||
*/
|
||||
}
|
||||
|
||||
void AudioPlayerAsync::playMusicAsync(const std::string& filePath, int loops) {
|
||||
if (!initialized) return;
|
||||
/*if (!initialized) return;
|
||||
|
||||
if (filePath == currentTrack)
|
||||
return;
|
||||
@@ -141,10 +142,11 @@ void AudioPlayerAsync::playMusicAsync(const std::string& filePath, int loops) {
|
||||
taskQueue.push(std::move(task));
|
||||
cv.notify_one();
|
||||
#endif
|
||||
*/
|
||||
}
|
||||
|
||||
void AudioPlayerAsync::stopMusicAsync() {
|
||||
if (!initialized) return;
|
||||
/*if (!initialized) return;
|
||||
|
||||
currentTrack = "";
|
||||
|
||||
@@ -157,10 +159,11 @@ void AudioPlayerAsync::stopMusicAsync() {
|
||||
});
|
||||
cv.notify_one();
|
||||
#endif
|
||||
*/
|
||||
}
|
||||
|
||||
void AudioPlayerAsync::pauseMusicAsync() {
|
||||
if (!initialized) return;
|
||||
/*if (!initialized) return;
|
||||
#ifdef __EMSCRIPTEN__
|
||||
Mix_PauseMusic();
|
||||
#else
|
||||
@@ -170,10 +173,11 @@ void AudioPlayerAsync::pauseMusicAsync() {
|
||||
});
|
||||
cv.notify_one();
|
||||
#endif
|
||||
*/
|
||||
}
|
||||
|
||||
void AudioPlayerAsync::resumeMusicAsync() {
|
||||
if (!initialized) return;
|
||||
/*if (!initialized) return;
|
||||
#ifdef __EMSCRIPTEN__
|
||||
Mix_ResumeMusic();
|
||||
#else
|
||||
@@ -183,9 +187,11 @@ void AudioPlayerAsync::resumeMusicAsync() {
|
||||
});
|
||||
cv.notify_one();
|
||||
#endif
|
||||
*/
|
||||
}
|
||||
|
||||
void AudioPlayerAsync::setMusicVolume(int volume) {
|
||||
/*
|
||||
if (!initialized) return;
|
||||
volume = std::max(0, std::min(128, volume));
|
||||
musicVolume_ = volume;
|
||||
@@ -198,9 +204,11 @@ void AudioPlayerAsync::setMusicVolume(int volume) {
|
||||
});
|
||||
cv.notify_one();
|
||||
#endif
|
||||
*/
|
||||
}
|
||||
|
||||
void AudioPlayerAsync::setSoundVolume(int volume) {
|
||||
/*
|
||||
if (!initialized) return;
|
||||
volume = std::max(0, std::min(128, volume));
|
||||
soundVolume_ = volume;
|
||||
@@ -213,10 +221,11 @@ void AudioPlayerAsync::setSoundVolume(int volume) {
|
||||
});
|
||||
cv.notify_one();
|
||||
#endif
|
||||
*/
|
||||
}
|
||||
|
||||
void AudioPlayerAsync::crossFadeMusicAsync(const std::string& filePath, int fadeDurationMs, int loops) {
|
||||
if (!initialized) return;
|
||||
/*if (!initialized) return;
|
||||
if (filePath == currentTrack) return;
|
||||
currentTrack = filePath;
|
||||
if (!musicEnabled_) return;
|
||||
@@ -253,10 +262,11 @@ void AudioPlayerAsync::crossFadeMusicAsync(const std::string& filePath, int fade
|
||||
taskQueue.push(std::move(task));
|
||||
cv.notify_one();
|
||||
#endif
|
||||
*/
|
||||
}
|
||||
|
||||
void AudioPlayerAsync::crossFadeMusicFromPositionAsync(const std::string& filePath, int fadeDurationMs, int loops) {
|
||||
if (!initialized) return;
|
||||
/*if (!initialized) return;
|
||||
if (filePath == currentTrack) return;
|
||||
currentTrack = filePath;
|
||||
if (!musicEnabled_) return;
|
||||
@@ -296,10 +306,11 @@ void AudioPlayerAsync::crossFadeMusicFromPositionAsync(const std::string& filePa
|
||||
taskQueue.push(std::move(task));
|
||||
cv.notify_one();
|
||||
#endif
|
||||
*/
|
||||
}
|
||||
|
||||
void AudioPlayerAsync::setMusicEnabled(bool enabled) {
|
||||
if (musicEnabled_ == enabled) return;
|
||||
/*if (musicEnabled_ == enabled) return;
|
||||
musicEnabled_ = enabled;
|
||||
if (!initialized) return;
|
||||
|
||||
@@ -319,7 +330,7 @@ void AudioPlayerAsync::setMusicEnabled(bool enabled) {
|
||||
currentTrack = ""; // clear so crossFadeMusicAsync doesn't bail early
|
||||
crossFadeMusicAsync(track);
|
||||
}
|
||||
}
|
||||
}*/
|
||||
}
|
||||
|
||||
void AudioPlayerAsync::setSoundEnabled(bool enabled) {
|
||||
|
||||
Reference in new issue
Block a user