Skip to content

Commit

Permalink
Fix formatting
Browse files Browse the repository at this point in the history
  • Loading branch information
gvnnz committed Apr 7, 2024
1 parent d033414 commit 79d9462
Showing 1 changed file with 20 additions and 18 deletions.
38 changes: 20 additions & 18 deletions src/core/channels/channelManager.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -155,7 +155,7 @@ void ChannelManager::loadSampleChannel(ID channelId, Wave& wave)
loadSampleChannel(channel, &newWave);
m_model.swap(model::SwapType::HARD);

/* Remove the old Wave, if any. It is safe to do it now: the audio thread is
/* Remove the old Wave, if any. It is safe to do it now: the audio thread is
already processing the new Document. */

if (oldWave != nullptr)
Expand Down Expand Up @@ -477,26 +477,26 @@ void ChannelManager::consolidateChannels(const std::unordered_set<ID>& ids)

bool ChannelManager::hasInputRecordableChannels() const
{
return m_model.get().channels.anyOf([](const Channel& ch) { return ch.canInputRec(); });
return m_model.get().channels.anyOf([](const Channel& ch)
{ return ch.canInputRec(); });
}

bool ChannelManager::hasActions() const
{
return m_model.get().channels.anyOf([](const Channel& ch) { return ch.hasActions; });
return m_model.get().channels.anyOf([](const Channel& ch)
{ return ch.hasActions; });
}

bool ChannelManager::hasAudioData() const
{
return m_model.get().channels.anyOf([](const Channel& ch) {
return ch.sampleChannel && ch.sampleChannel->hasWave();
});
return m_model.get().channels.anyOf([](const Channel& ch)
{ return ch.sampleChannel && ch.sampleChannel->hasWave(); });
}

bool ChannelManager::hasSolos() const
{
return m_model.get().channels.anyOf([](const Channel& ch) {
return !ch.isInternal() && ch.isSoloed();
});
return m_model.get().channels.anyOf([](const Channel& ch)
{ return !ch.isInternal() && ch.isSoloed(); });
}

/* -------------------------------------------------------------------------- */
Expand All @@ -513,35 +513,37 @@ void ChannelManager::setupChannelCallbacks(const Channel& ch, ChannelShared& sha
{
assert(onChannelPlayStatusChanged != nullptr);

shared.playStatus.onChange = [this, id = ch.id](ChannelStatus status) {
shared.playStatus.onChange = [this, id = ch.id](ChannelStatus status)
{
onChannelPlayStatusChanged(id, status);
};

if (ch.type == ChannelType ::SAMPLE)
{
shared.quantizer->schedule(Q_ACTION_PLAY + ch.id, [&shared](Frame delta) {
rendering::playSampleChannel(shared, delta);
});
shared.quantizer->schedule(Q_ACTION_REWIND + ch.id, [&shared](Frame delta) {
shared.quantizer->schedule(Q_ACTION_PLAY + ch.id, [&shared](Frame delta)
{ rendering::playSampleChannel(shared, delta); });
shared.quantizer->schedule(Q_ACTION_REWIND + ch.id, [&shared](Frame delta)
{
const ChannelStatus status = shared.playStatus.load();
if (status == ChannelStatus::OFF)
rendering::playSampleChannel(shared, delta);
else if (status == ChannelStatus::PLAY || status == ChannelStatus::ENDING)
rendering::rewindSampleChannel(shared, delta);
});
rendering::rewindSampleChannel(shared, delta); });
}
}

/* -------------------------------------------------------------------------- */

std::vector<Channel*> ChannelManager::getRecordableChannels()
{
return m_model.get().channels.getIf([](const Channel& c) { return c.canInputRec() && !c.hasWave(); });
return m_model.get().channels.getIf([](const Channel& c)
{ return c.canInputRec() && !c.hasWave(); });
}

std::vector<Channel*> ChannelManager::getOverdubbableChannels()
{
return m_model.get().channels.getIf([](const Channel& c) { return c.canInputRec() && c.hasWave(); });
return m_model.get().channels.getIf([](const Channel& c)
{ return c.canInputRec() && c.hasWave(); });
}

/* -------------------------------------------------------------------------- */
Expand Down

0 comments on commit 79d9462

Please sign in to comment.