Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion Sources/CSFBAudioEngine/Player/AudioPlayer.h
Original file line number Diff line number Diff line change
Expand Up @@ -351,7 +351,7 @@ inline bool AudioPlayer::isPaused() const noexcept {

inline bool AudioPlayer::isStopped() const noexcept {
const auto flags = loadFlags();
return !bits::has_all(flags, Flags::engineIsRunning);
return bits::has_none(flags, Flags::engineIsRunning);
}

inline bool AudioPlayer::isReady() const noexcept {
Expand Down
14 changes: 7 additions & 7 deletions Sources/CSFBAudioEngine/Player/AudioPlayer.mm
Original file line number Diff line number Diff line change
Expand Up @@ -1101,7 +1101,7 @@ Flags loadFlags(std::memory_order order = std::memory_order_acquire) const noexc
// Process cancellations
auto signal = false;
for (const auto &decoderState : activeDecoders_) {
if (!bits::has_all(decoderState->loadFlags(), DecoderState::Flags::cancelRequested)) {
if (bits::has_none(decoderState->loadFlags(), DecoderState::Flags::cancelRequested)) {
continue;
}

Expand Down Expand Up @@ -1281,7 +1281,7 @@ Flags loadFlags(std::memory_order order = std::memory_order_acquire) const noexc

if (decoderState != nullptr) {
// Before decoding starts determine the decoder and ring buffer format compatibility
if (!bits::has_all(decoderState->loadFlags(), DecoderState::Flags::decodingStarted)) {
if (bits::has_none(decoderState->loadFlags(), DecoderState::Flags::decodingStarted)) {
// Start decoding immediately if the join will be gapless (same sample rate, channel count, and channel
// layout)
if (auto renderFormat = decoderState->converter_.outputFormat;
Expand Down Expand Up @@ -1359,12 +1359,12 @@ Flags loadFlags(std::memory_order order = std::memory_order_acquire) const noexc
}

if (decoderState != nullptr) {
if (const auto flags = loadFlags(); !bits::has_all(flags, Flags::drainRequired)) {
if (const auto flags = loadFlags(); bits::has_none(flags, Flags::drainRequired)) {
// Decode and write chunks to the ring buffer
while (audioRingBuffer_.freeSpace() >= ringBufferChunkSize) {
// Decoding started
if (const auto flags = decoderState->loadFlags();
!bits::has_all(flags, DecoderState::Flags::decodingStarted)) {
bits::has_none(flags, DecoderState::Flags::decodingStarted)) {
const bool suspended = bits::has_all(flags, DecoderState::Flags::decodingSuspended);

if (!suspended) {
Expand Down Expand Up @@ -1668,7 +1668,7 @@ Flags loadFlags(std::memory_order order = std::memory_order_acquire) const noexc
[player_.delegate audioPlayer:player_ decodingStarted:decoder];
}

if (!bits::has_all(loadFlags(), Flags::isPlaying) && decoder == currentDecoder) {
if (bits::has_none(loadFlags(), Flags::isPlaying) && decoder == currentDecoder) {
setNowPlaying(decoder);
}

Expand Down Expand Up @@ -2079,7 +2079,7 @@ Flags loadFlags(std::memory_order order = std::memory_order_acquire) const noexc
// Cancel all active decoders
auto signal = false;
for (const auto &decoderState : activeDecoders_) {
if (!bits::has_all(decoderState->loadFlags(), DecoderState::Flags::isCanceled)) {
if (bits::has_none(decoderState->loadFlags(), DecoderState::Flags::isCanceled)) {
decoderState->flags_.fetch_or(static_cast<unsigned int>(DecoderState::Flags::cancelRequested),
std::memory_order_acq_rel);
signal = true;
Expand All @@ -2099,7 +2099,7 @@ Flags loadFlags(std::memory_order order = std::memory_order_acquire) const noexc

const auto iter = std::ranges::find_if(activeDecoders_, [](const auto &decoderState) {
const auto flags = decoderState->loadFlags();
return !bits::has_all(flags, DecoderState::Flags::isCanceled);
return bits::has_none(flags, DecoderState::Flags::isCanceled);
});
if (iter == activeDecoders_.cend()) {
return nullptr;
Expand Down