Skip to content

Commit 4f95df0

Browse files
Fixed MIDI track init
1 parent 8053ed1 commit 4f95df0

File tree

2 files changed

+14
-1
lines changed

2 files changed

+14
-1
lines changed

src/audioCore/graph/SeqSourceProcessor.cpp

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -334,6 +334,16 @@ void SeqSourceProcessor::applyMIDI() {
334334
/** Callback */
335335
auto callback = [ptr = SafePointer{ this }] {
336336
if (ptr) {
337+
/** Current MIDI Track Change */
338+
if (ptr->getTotalMIDITrackNum() > 0
339+
&& ptr->getCurrentMIDITrack() < 0) {
340+
ptr->setCurrentMIDITrack(0);
341+
}
342+
if (ptr->getTotalMIDITrackNum() <= 0
343+
&& ptr->getCurrentMIDITrack() >= 0) {
344+
ptr->setCurrentMIDITrack(-1);
345+
}
346+
337347
/** ARA Change */
338348
if (auto plugin = ptr->getInstrProcessor()) {
339349
plugin->invokeARADocumentContextChange();

src/audioCore/source/SourceInternalContainer.cpp

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -98,7 +98,10 @@ void SourceInternalContainer::initMidiData() {
9898
this->midiData = std::make_unique<SourceMIDITemp>();
9999
}
100100

101-
//this->midiData->addTrack(juce::MidiMessageSequence{});
101+
/** Add First Track */
102+
if (this->midiData->getTrackNum() <= 0) {
103+
this->midiData->addTrack(juce::MidiMessageSequence{});
104+
}
102105

103106
this->changed();
104107
}

0 commit comments

Comments
 (0)