Skip to content

Commit

Permalink
Use model::ChannelView for rendering channels in Renderer
Browse files Browse the repository at this point in the history
  • Loading branch information
gvnnz committed May 20, 2024
1 parent 2982dad commit 3615fef
Show file tree
Hide file tree
Showing 2 changed files with 35 additions and 12 deletions.
26 changes: 18 additions & 8 deletions src/core/rendering/renderer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -137,7 +137,7 @@ void Renderer::render(mcl::AudioBuffer& out, const mcl::AudioBuffer& in, const m
renderMasterIn(masterInCh, mixer.getInBuffer());

if (!document_RT.locked)
renderNormalChannels(channels.getAll(), out, mixer.getInBuffer(), hasSolos, sequencer.isRunning());
renderNormalChannels(channels.getView(), out, mixer.getInBuffer(), hasSolos, sequencer.isRunning());

renderMasterOut(masterOutCh, out);
if (mixer.renderPreview)
Expand Down Expand Up @@ -185,19 +185,29 @@ void Renderer::advanceChannel(

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

void Renderer::renderNormalChannels(const std::vector<Channel>& channels, mcl::AudioBuffer& out,
const mcl::AudioBuffer& in, bool hasSolos, bool seqIsRunning) const
void Renderer::renderNormalChannels(
const std::vector<model::ChannelView>& views,
mcl::AudioBuffer& out,
const mcl::AudioBuffer& in,
bool hasSolos,
bool seqIsRunning) const
{
for (const Channel& c : channels)
if (!c.isInternal())
renderNormalChannel(c, out, in, hasSolos, seqIsRunning);
for (const model::ChannelView& view : views)
if (!view.channel->isInternal())
renderNormalChannel(view, out, in, hasSolos, seqIsRunning);
}

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

void Renderer::renderNormalChannel(const Channel& ch, mcl::AudioBuffer& out,
const mcl::AudioBuffer& in, bool mixerHasSolos, bool seqIsRunning) const
void Renderer::renderNormalChannel(
const model::ChannelView& view,
mcl::AudioBuffer& out,
const mcl::AudioBuffer& in,
bool mixerHasSolos,
bool seqIsRunning) const
{
const Channel& ch = *view.channel;

ch.shared->audioBuffer.clear();

if (ch.type == ChannelType::SAMPLE)
Expand Down
21 changes: 17 additions & 4 deletions src/core/rendering/renderer.h
Original file line number Diff line number Diff line change
Expand Up @@ -86,10 +86,23 @@ class Renderer
geompp::Range<Frame>,
Frame quantizerStep) const;

void renderNormalChannels(const std::vector<Channel>& channels, mcl::AudioBuffer& out,
const mcl::AudioBuffer& in, bool hasSolos, bool seqIsRunning) const;
void renderNormalChannel(const Channel& ch, mcl::AudioBuffer& out,
const mcl::AudioBuffer& in, bool mixerHasSolos, bool seqIsRunning) const;
/* renderNormalChannels
Generates audio out of non-internal channels. */

void renderNormalChannels(
const std::vector<model::ChannelView>&,
mcl::AudioBuffer& out,
const mcl::AudioBuffer& in,
bool hasSolos,
bool seqIsRunning) const;

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

void renderMasterIn(const Channel&, mcl::AudioBuffer& in) const;
void renderMasterOut(const Channel&, mcl::AudioBuffer& out) const;
void renderPreview(const Channel&, mcl::AudioBuffer& out) const;
Expand Down

0 comments on commit 3615fef

Please sign in to comment.