Skip to content

Commit ae53a59

Browse files
committed
- MIDI Program Change events (PC) now have their proper
program number as parameter, instead of value, on the internal MIDI event representation. (EXPERIMENTAL)
1 parent a7c2b12 commit ae53a59

17 files changed

+40
-33
lines changed

ChangeLog

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,10 @@ ChangeLog
66

77
GIT HEAD
88

9+
- MIDI Program Change events (PC) now have their proper
10+
program number as parameter, instead of value, on the
11+
internal MIDI event representation. (EXPERIMENTAL)
12+
913
- Merging MIDI clips while on SMF Format 0 has been fixed:
1014
was merging always onto the same MIDI channel (2), most
1115
often the wrong one, resulting in an empty or blank clip.

src/qtractorMidiClip.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1433,7 +1433,7 @@ void qtractorMidiClip::enqueue_export ( qtractorTrack *pTrack,
14331433
case qtractorMidiEvent::PGMCHANGE:
14341434
ev.type = SND_SEQ_EVENT_PGMCHANGE;
14351435
ev.data.control.channel = pTrack->midiChannel();
1436-
ev.data.control.value = pEvent->value();
1436+
ev.data.control.value = pEvent->param();
14371437
break;
14381438
case qtractorMidiEvent::CHANPRESS:
14391439
ev.type = SND_SEQ_EVENT_CHANPRESS;

src/qtractorMidiEditor.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
// qtractorMidiEditor.cpp
22
//
33
/****************************************************************************
4-
Copyright (C) 2005-2016, rncbc aka Rui Nuno Capela. All rights reserved.
4+
Copyright (C) 2005-2018, rncbc aka Rui Nuno Capela. All rights reserved.
55
66
This program is free software; you can redistribute it and/or
77
modify it under the terms of the GNU General Public License
@@ -4855,7 +4855,7 @@ QString qtractorMidiEditor::eventToolTip ( qtractorMidiEvent *pEvent,
48554855
break;
48564856
case qtractorMidiEvent::PGMCHANGE:
48574857
sToolTip += tr("Pgm Change (%1)")
4858-
.arg(safeValue(pEvent->value() + iValueDelta));
4858+
.arg(safeValue(pEvent->param() + iValueDelta));
48594859
break;
48604860
case qtractorMidiEvent::CHANPRESS:
48614861
sToolTip += tr("Chan Press (%1)")

src/qtractorMidiEditor.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
// qtractorMidiEditor.h
22
//
33
/****************************************************************************
4-
Copyright (C) 2005-2016, rncbc aka Rui Nuno Capela. All rights reserved.
4+
Copyright (C) 2005-2018, rncbc aka Rui Nuno Capela. All rights reserved.
55
66
This program is free software; you can redistribute it and/or
77
modify it under the terms of the GNU General Public License

src/qtractorMidiEngine.cpp

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
// qtractorMidiEngine.cpp
22
//
33
/****************************************************************************
4-
Copyright (C) 2005-2017, rncbc aka Rui Nuno Capela. All rights reserved.
4+
Copyright (C) 2005-2018, rncbc aka Rui Nuno Capela. All rights reserved.
55
66
This program is free software; you can redistribute it and/or
77
modify it under the terms of the GNU General Public License
@@ -1091,7 +1091,7 @@ void qtractorMidiPlayer::enqueue ( unsigned short iMidiChannel,
10911091
case qtractorMidiEvent::PGMCHANGE:
10921092
ev.type = SND_SEQ_EVENT_PGMCHANGE;
10931093
ev.data.control.channel = iMidiChannel;
1094-
ev.data.control.value = pEvent->value();
1094+
ev.data.control.value = pEvent->param();
10951095
break;
10961096
case qtractorMidiEvent::CHANPRESS:
10971097
ev.type = SND_SEQ_EVENT_CHANPRESS;
@@ -1659,8 +1659,8 @@ void qtractorMidiEngine::capture ( snd_seq_event_t *pEv )
16591659
case SND_SEQ_EVENT_PGMCHANGE:
16601660
type = qtractorMidiEvent::PGMCHANGE;
16611661
channel = pEv->data.control.channel;
1662-
// param = 0;
1663-
value = pEv->data.control.value;
1662+
param = pEv->data.control.value;
1663+
value = 0;
16641664
break;
16651665
case SND_SEQ_EVENT_CHANPRESS:
16661666
type = qtractorMidiEvent::CHANPRESS;
@@ -2019,7 +2019,7 @@ void qtractorMidiEngine::enqueue ( qtractorTrack *pTrack,
20192019
case qtractorMidiEvent::PGMCHANGE:
20202020
ev.type = SND_SEQ_EVENT_PGMCHANGE;
20212021
ev.data.control.channel = pTrack->midiChannel();
2022-
ev.data.control.value = pEvent->value();
2022+
ev.data.control.value = pEvent->param();
20232023
// HACK: Track properties override...
20242024
if (pTrack->midiProg() >= 0)
20252025
ev.data.control.value = pTrack->midiProg();
@@ -4268,7 +4268,7 @@ void qtractorMidiBus::sendEvent ( qtractorMidiEvent::EventType etype,
42684268
ev.type = SND_SEQ_EVENT_PGMCHANGE;
42694269
ev.data.control.channel = iChannel;
42704270
ev.data.control.param = 0;
4271-
ev.data.control.value = iValue;
4271+
ev.data.control.value = iParam;
42724272
break;
42734273
case qtractorMidiEvent::CHANPRESS:
42744274
ev.type = SND_SEQ_EVENT_CHANPRESS;

src/qtractorMidiEngine.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
// qtractorMidiEngine.h
22
//
33
/****************************************************************************
4-
Copyright (C) 2005-2017, rncbc aka Rui Nuno Capela. All rights reserved.
4+
Copyright (C) 2005-2018, rncbc aka Rui Nuno Capela. All rights reserved.
55
66
This program is free software; you can redistribute it and/or
77
modify it under the terms of the GNU General Public License

src/qtractorMidiEventList.cpp

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -362,11 +362,12 @@ QString qtractorMidiEventListModel::itemDisplay (
362362
case qtractorMidiEvent::NOTEOFF:
363363
case qtractorMidiEvent::KEYPRESS:
364364
return QString::number(pEvent->velocity());
365+
case qtractorMidiEvent::PGMCHANGE:
366+
return QString::number(pEvent->param());
365367
case qtractorMidiEvent::CONTROLLER:
366368
case qtractorMidiEvent::REGPARAM:
367369
case qtractorMidiEvent::NONREGPARAM:
368370
case qtractorMidiEvent::CONTROL14:
369-
case qtractorMidiEvent::PGMCHANGE:
370371
case qtractorMidiEvent::CHANPRESS:
371372
return QString::number(pEvent->value());
372373
case qtractorMidiEvent::PITCHBEND:

src/qtractorMidiFile.cpp

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
// qtractorMidiFile.cpp
22
//
33
/****************************************************************************
4-
Copyright (C) 2005-2016, rncbc aka Rui Nuno Capela. All rights reserved.
4+
Copyright (C) 2005-2018, rncbc aka Rui Nuno Capela. All rights reserved.
55
66
This program is free software; you can redistribute it and/or
77
modify it under the terms of the GNU General Public License
@@ -406,8 +406,8 @@ bool qtractorMidiFile::readTracks ( qtractorMidiSequence **ppSeqs,
406406
}
407407
break;
408408
case qtractorMidiEvent::PGMCHANGE:
409-
data1 = 0;
410-
data2 = readInt(1);
409+
data1 = readInt(1);
410+
data2 = 0;
411411
// Check if its channel filtered...
412412
if (bChannelEvent) {
413413
// Create the new event...
@@ -416,7 +416,7 @@ bool qtractorMidiFile::readTracks ( qtractorMidiSequence **ppSeqs,
416416
pSeq->setChannel(iChannel);
417417
// Set the primordial program patch...
418418
if (pSeq->prog() < 0)
419-
pSeq->setProg(data2);
419+
pSeq->setProg(data1);
420420
}
421421
break;
422422
case qtractorMidiEvent::CHANPRESS:
@@ -1019,6 +1019,8 @@ bool qtractorMidiFile::writeTracks (
10191019
writeInt((pEvent->value() & 0x007f), 1);
10201020
break;
10211021
case qtractorMidiEvent::PGMCHANGE:
1022+
writeInt(pEvent->param(), 1);
1023+
break;
10221024
case qtractorMidiEvent::CHANPRESS:
10231025
writeInt(pEvent->value(), 1);
10241026
break;

src/qtractorMidiFile.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
// qtractorMidiFile.h
22
//
33
/****************************************************************************
4-
Copyright (C) 2005-2016, rncbc aka Rui Nuno Capela. All rights reserved.
4+
Copyright (C) 2005-2018, rncbc aka Rui Nuno Capela. All rights reserved.
55
66
This program is free software; you can redistribute it and/or
77
modify it under the terms of the GNU General Public License

src/translations/qtractor_cs.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8620,15 +8620,15 @@ Chcete uložit změny?</translation>
86208620
<context>
86218621
<name>qtractorMidiEventItemDelegate</name>
86228622
<message>
8623-
<location filename="../qtractorMidiEventList.cpp" line="637"/>
8623+
<location filename="../qtractorMidiEventList.cpp" line="638"/>
86248624
<source>edit %1</source>
86258625
<translation>Upravit %1</translation>
86268626
</message>
86278627
</context>
86288628
<context>
86298629
<name>qtractorMidiEventList</name>
86308630
<message>
8631-
<location filename="../qtractorMidiEventList.cpp" line="876"/>
8631+
<location filename="../qtractorMidiEventList.cpp" line="877"/>
86328632
<source>Events</source>
86338633
<translation>Události</translation>
86348634
</message>

0 commit comments

Comments
 (0)