Working on music cross fade and settings
This commit is contained in:
1 parent
84f9fa37a8
commit
b8d79c7b7b
13 files changed
+779
-332
No files matched your search
@@ -24,11 +24,20 @@ public:
|
||||
|
||||
void playSoundAsync(const std::string& filePath, int loops = 0, int channel = -1);
|
||||
void playMusicAsync(const std::string& filePath, int loops = -1);
|
||||
void crossFadeMusicAsync(const std::string& filePath, int fadeDurationMs = 1000, int loops = -1);
|
||||
void crossFadeMusicFromPositionAsync(const std::string& filePath, int fadeDurationMs = 1000, int loops = -1);
|
||||
void stopMusicAsync();
|
||||
void pauseMusicAsync();
|
||||
void resumeMusicAsync();
|
||||
void setMusicVolume(int volume); // 0..128
|
||||
void setSoundVolume(int volume); // 0..128
|
||||
int getMusicVolume() const { return musicVolume_; }
|
||||
int getSoundVolume() const { return soundVolume_; }
|
||||
|
||||
void setMusicEnabled(bool enabled);
|
||||
void setSoundEnabled(bool enabled);
|
||||
bool isMusicEnabled() const { return musicEnabled_; }
|
||||
bool isSoundEnabled() const { return soundEnabled_; }
|
||||
|
||||
void exit() { stop = true; }
|
||||
|
||||
@@ -47,6 +56,12 @@ private:
|
||||
std::mutex soundCacheMutex;
|
||||
|
||||
std::string currentTrack;
|
||||
Mix_Music* currentMusic_ = nullptr;
|
||||
|
||||
int musicVolume_ = 128;
|
||||
int soundVolume_ = 128;
|
||||
bool musicEnabled_ = true;
|
||||
bool soundEnabled_ = true;
|
||||
|
||||
bool initialized = false;
|
||||
};
|
||||
Reference in new issue
Block a user