From 6572d0f944544a5b82eca3cdca4dbe5631d1e388 Mon Sep 17 00:00:00 2001 From: profezzorn Date: Sat, 16 Mar 2024 00:44:19 -0700 Subject: [PATCH] remove sound queue from prop_base (now in separate file) --- props/prop_base.h | 54 +---------------------------------------------- 1 file changed, 1 insertion(+), 53 deletions(-) diff --git a/props/prop_base.h b/props/prop_base.h index 73f95f4fc..44d0f3ce1 100644 --- a/props/prop_base.h +++ b/props/prop_base.h @@ -64,58 +64,6 @@ class SavePresetStateFile : public ConfigFile { #endif }; -#ifdef ENABLE_AUDIO -struct SoundToPlay { - const char* filename_; - Effect* effect_; - int selection_; - - SoundToPlay() :filename_(nullptr), effect_(nullptr) {} - explicit SoundToPlay(const char* file) : filename_(file){ } - SoundToPlay(Effect* effect, int selection = -1) : filename_(nullptr), effect_(effect), selection_(selection) {} - bool Play(BufferedWavPlayer* player) { - if (filename_) return player->PlayInCurrentDir(filename_); - effect_->Select(selection_); - player->PlayOnce(effect_); - return true; - } - bool isSet() { - return filename_ != nullptr || effect_ != nullptr; - } -}; - -template -class SoundQueue { -public: - bool Play(SoundToPlay p) { - if (sounds_ < QueueLength) { - queue_[sounds_++] = p; - return true; - } - return false; - } - bool Play(const char* p) { - return Play(SoundToPlay(p)); - } - // Called from Loop() - void PollSoundQueue(RefPtr& player) { - if (sounds_ && (!player || !player->isPlaying())) { - if (!player) { - player = GetFreeWavPlayer(); - if (!player) return; - player->set_volume_now(1.0f); - } - queue_[0].Play(player.get()); - sounds_--; - for (int i = 0; i < sounds_; i++) queue_[i] = queue_[i+1]; - } - } -private: - int sounds_; - SoundToPlay queue_[QueueLength]; -}; -#endif - // Base class for props. class PropBase : CommandParser, Looper, protected SaberBase, public ModeInterface { public: @@ -1184,7 +1132,7 @@ class PropBase : CommandParser, Looper, protected SaberBase, public ModeInterfac void ToggleColorChangeMode() { if (!current_style()) return; if (current_mode == this) { - pushMode::RootMenu>(); + pushMode::RootMenu>(); } } #endif // DISABLE_COLOR_CHANGE