Skip to content

Commit

Permalink
Enable rendering for Channel Groups
Browse files Browse the repository at this point in the history
  • Loading branch information
gvnnz committed May 24, 2024
1 parent d0ee4b2 commit 1114fc0
Show file tree
Hide file tree
Showing 2 changed files with 34 additions and 2 deletions.
30 changes: 28 additions & 2 deletions src/core/rendering/renderer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -157,7 +157,7 @@ void Renderer::advanceChannels(
int quantizerStep) const
{
for (const model::ChannelView& view : views)
if (!view.channel->isInternal())
if (!view.channel->isInternal() && !view.channel->isGrouped())
advanceChannel(view, events, block, quantizerStep);
}

Expand All @@ -180,6 +180,9 @@ void Renderer::advanceChannel(
rendering::advanceMidiChannel(ch, e, m_kernelMidi);
else if (ch.type == ChannelType::SAMPLE)
rendering::advanceSampleChannel(ch, e);
else if (ch.type == ChannelType::GROUP)
for (const Channel* child : view.children)
advanceChannel({child, {}}, events, block, quantizerStep);
}
}

Expand All @@ -193,7 +196,7 @@ void Renderer::renderNormalChannels(
bool seqIsRunning) const
{
for (const model::ChannelView& view : views)
if (!view.channel->isInternal())
if (!view.channel->isInternal() && !view.channel->isGrouped())
renderNormalChannel(view, out, in, hasSolos, seqIsRunning);
}

Expand All @@ -218,6 +221,10 @@ void Renderer::renderNormalChannel(
{
renderMidiChannel(ch);
}
else if (ch.type == ChannelType::GROUP)
{
renderGroupChannel(view, in, mixerHasSolos, seqIsRunning);
}

if (ch.isAudible(mixerHasSolos))
out.sum(ch.shared->audioBuffer, ch.volume * ch.shared->volumeInternal.load(), calcPanning_(ch.pan));
Expand Down Expand Up @@ -274,4 +281,23 @@ void Renderer::renderMidiChannel(const Channel& ch) const

rendering::renderAudioAndMidiPlugins(ch, m_pluginHost);
}

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

void Renderer::renderGroupChannel(
const model::ChannelView& view,
const mcl::AudioBuffer& in,
bool mixerHasSolos,
bool seqIsRunning) const
{
assert(view.channel->type == ChannelType::GROUP);

for (const Channel* child : view.children)
{
const model::ChannelView childView = {child, {}};
mcl::AudioBuffer& buffer = child->shared->audioBuffer;
renderNormalChannel(childView, buffer, in, mixerHasSolos, seqIsRunning);
}
rendering::renderAudioPlugins(*view.channel, m_pluginHost);
}
} // namespace giada::m::rendering
6 changes: 6 additions & 0 deletions src/core/rendering/renderer.h
Original file line number Diff line number Diff line change
Expand Up @@ -109,6 +109,12 @@ class Renderer
void renderSampleChannel(const Channel&, const mcl::AudioBuffer& in, bool seqIsRunning) const;
void renderMidiChannel(const Channel&) const;

void renderGroupChannel(
const model::ChannelView&,
const mcl::AudioBuffer& in,
bool mixerHasSolos,
bool seqIsRunning) const;

Sequencer& m_sequencer;
Mixer& m_mixer;
PluginHost& m_pluginHost;
Expand Down

0 comments on commit 1114fc0

Please sign in to comment.