12namespace tracktion {
inline namespace engine
15TrackMidiInputDeviceNode::TrackMidiInputDeviceNode (MidiInputDevice& owner,
std::unique_ptr<Node> inputNode, ProcessState& ps,
16 bool copyInputsToOutputs_)
17 : TracktionEngineNode (ps),
18 midiInputDevice (owner),
20 copyInputsToOutputs (copyInputsToOutputs_)
22 jassert (midiInputDevice.isTrackDevice());
24 setOptimisations ({ tracktion::graph::ClearBuffers::yes,
25 copyInputsToOutputs ? tracktion::graph::AllocateAudioBuffer::no
26 : tracktion::graph::AllocateAudioBuffer::yes });
31 return { input.get() };
36 return input->getNodeProperties();
41 offsetSeconds = tracktion::graph::sampleToTime (info.blockSize, info.sampleRate);
44bool TrackMidiInputDeviceNode::isReadyToProcess()
46 return input->hasProcessed();
54 auto sourceBuffers = input->getProcessedOutput();
56 if (copyInputsToOutputs)
58 setAudioOutput (input.get(), sourceBuffers.audio);
59 pc.buffers.midi.copyFrom (sourceBuffers.midi);
62 const double midiStreamTime = tracktion::graph::sampleToTime (getReferenceSampleRange().getStart(), getSampleRate())
63 - midiInputDevice.getAdjustSecs();
66 for (
auto& m : sourceBuffers.midi)
67 midiInputDevice.handleIncomingMidiMessage (
nullptr,
juce::MidiMessage (m, midiStreamTime + m.getTimeStamp()));
Struct to describe a single iteration of a process call.
Holds some really basic properties of a node.
Passed into Nodes when they are being initialised, to give them useful contextual information that th...