mirror of
https://github.com/mudita/MuditaOS.git
synced 2026-01-01 10:28:52 -05:00
32 lines
809 B
C++
32 lines
809 B
C++
// Copyright (c) 2017-2021, Mudita Sp. z.o.o. All rights reserved.
|
|
// For licensing, see https://github.com/mudita/MuditaOS/LICENSE.md
|
|
|
|
#include "SongContext.hpp"
|
|
#include <optional>
|
|
|
|
namespace app::music
|
|
{
|
|
void SongContext::clear()
|
|
{
|
|
currentSongState = SongState::NotPlaying;
|
|
currentFileToken = std::nullopt;
|
|
filePath = "";
|
|
currentPos = 0;
|
|
}
|
|
|
|
bool SongContext::isValid() const
|
|
{
|
|
return (currentFileToken && currentFileToken->IsValid() && !filePath.empty());
|
|
}
|
|
|
|
bool SongContext::isPlaying() const
|
|
{
|
|
return isValid() && currentSongState == SongState::Playing;
|
|
}
|
|
|
|
bool SongContext::isPaused() const
|
|
{
|
|
return isValid() && currentSongState == SongState::NotPlaying;
|
|
}
|
|
} // namespace app::music
|