1
Fork 0

Pass model::Actions reference to Sequencer

This commit is contained in:
gvnnz 2023-06-17 22:20:09 +02:00
parent e1fff8b007
commit a44cf454e2
5 changed files with 17 additions and 20 deletions

View File

@ -459,11 +459,6 @@ void ActionRecorder::recordNonFirstEnvelopeAction(ID channelId, Frame frame, int
/* -------------------------------------------------------------------------- */
const std::vector<Action>* ActionRecorder::getActionsOnFrame(Frame f) const
{
return m_model.get().actions.getActionsOnFrame(f);
}
bool ActionRecorder::hasActions(ID channelId, int type) const
{
return m_model.get().actions.hasActions(channelId, type);

View File

@ -106,17 +106,16 @@ public:
/* Pass-thru functions. See Actions.h */
const std::vector<Action>* getActionsOnFrame(Frame f) const;
bool hasActions(ID channelId, int type = 0) const;
std::vector<Action> getActionsOnChannel(ID channelId) const;
void clearChannel(ID channelId);
void clearActions(ID channelId, int type);
Action rec(ID channelId, Frame frame, MidiEvent e);
void rec(ID channelId, Frame f1, Frame f2, MidiEvent e1, MidiEvent e2);
void updateSiblings(ID id, ID prevId, ID nextId);
void deleteAction(ID channelId, ID id);
void deleteAction(ID channelId, ID currId, ID nextId);
void updateEvent(ID id, MidiEvent e);
bool hasActions(ID channelId, int type = 0) const;
std::vector<Action> getActionsOnChannel(ID channelId) const;
void clearChannel(ID channelId);
void clearActions(ID channelId, int type);
Action rec(ID channelId, Frame frame, MidiEvent e);
void rec(ID channelId, Frame f1, Frame f2, MidiEvent e1, MidiEvent e2);
void updateSiblings(ID id, ID prevId, ID nextId);
void deleteAction(ID channelId, ID id);
void deleteAction(ID channelId, ID currId, ID nextId);
void updateEvent(ID id, MidiEvent e);
private:
/* areComposite

View File

@ -297,6 +297,7 @@ int Engine::audioCallback(mcl::AudioBuffer& out, const mcl::AudioBuffer& in) con
const model::Mixer& mixer = layout_RT.mixer;
const model::Sequencer& sequencer = layout_RT.sequencer;
const model::Channels& channels = layout_RT.channels;
const model::Actions& actions = layout_RT.actions;
/* Mixer disabled or Kernel Audio not ready: nothing to do here. */
@ -320,7 +321,7 @@ int Engine::audioCallback(mcl::AudioBuffer& out, const mcl::AudioBuffer& in) con
const int quantizerStep = m_sequencer.getQuantizerStep(); // TODO pass this to m_sequencer.advance - or better, Advancer class
const Range<Frame> renderRange = {currentFrame, currentFrame + bufferSize}; // TODO pass this to m_sequencer.advance - or better, Advancer class
const Sequencer::EventBuffer& events = m_sequencer.advance(sequencer, bufferSize, kernelAudio.samplerate, m_actionRecorder);
const Sequencer::EventBuffer& events = m_sequencer.advance(sequencer, bufferSize, kernelAudio.samplerate, actions);
m_sequencer.render(out);
if (!layout_RT.locked)
m_mixer.advanceChannels(events, channels, renderRange, quantizerStep);

View File

@ -121,7 +121,7 @@ void Sequencer::setSampleRate(int sampleRate)
/* -------------------------------------------------------------------------- */
const Sequencer::EventBuffer& Sequencer::advance(const model::Sequencer& sequencer,
Frame bufferSize, int sampleRate, const ActionRecorder& actionRecorder) const
Frame bufferSize, int sampleRate, const model::Actions& actions) const
{
m_eventBuffer.clear();
@ -154,7 +154,7 @@ const Sequencer::EventBuffer& Sequencer::advance(const model::Sequencer& sequenc
m_metronome.trigger(Metronome::Click::BEAT, local);
}
const std::vector<Action>* as = actionRecorder.getActionsOnFrame(global);
const std::vector<Action>* as = actions.getActionsOnFrame(global);
if (as != nullptr)
m_eventBuffer.push_back({EventType::ACTIONS, global, local, as});
}

View File

@ -43,6 +43,7 @@ namespace giada::m::model
{
class Model;
class Sequencer;
class Actions;
} // namespace giada::m::model
namespace giada::m
@ -138,7 +139,8 @@ public:
quantizer. Returns a reference to the internal EventBuffer filled with events
(if any). Call this on each new audio block. */
const EventBuffer& advance(const model::Sequencer&, Frame bufferSize, int sampleRate, const ActionRecorder&) const;
const EventBuffer& advance(const model::Sequencer&, Frame bufferSize, int sampleRate,
const model::Actions&) const;
/* render
Renders audio coming out from the sequencer: that is, the metronome! */