diff options
author | Bent Bisballe Nyeng <deva@aasimon.org> | 2025-03-06 19:28:55 +0100 |
---|---|---|
committer | Bent Bisballe Nyeng <deva@aasimon.org> | 2025-03-06 19:28:55 +0100 |
commit | e0250f0bcca16c14028b00fd9894446d844e2099 (patch) | |
tree | 796d4e31c3b60958746846f9896f0e8470585955 /src/audiofile.h | |
parent | 23df5bd31202c65952fc181c6ad1b611a0c9e26a (diff) |
Improve load state check when freewheeling to also block during load and not just not loaded at all.audiofile_load_state
Diffstat (limited to 'src/audiofile.h')
-rw-r--r-- | src/audiofile.h | 10 |
1 files changed, 9 insertions, 1 deletions
diff --git a/src/audiofile.h b/src/audiofile.h index cff4f3b..0aae125 100644 --- a/src/audiofile.h +++ b/src/audiofile.h @@ -52,6 +52,7 @@ public: void unload(); bool isLoaded() const; + bool isLoading() const; volatile std::size_t size{0}; // Full size of the file volatile std::size_t preloadedsize{0}; // Number of samples preloaded (in data) @@ -74,6 +75,13 @@ private: friend class InstrumentParserTest; void* magic{}; - std::atomic<bool> is_loaded{false}; + enum class LoadState + { + not_loaded, + loaded, + loading, + failed, + }; + std::atomic<LoadState> load_state{LoadState::not_loaded}; InstrumentChannel* instrument_channel{}; }; |