| 1 |
From: Jason Francis <[email protected]> |
| 2 |
Date: Fri, 16 Sep 2022 02:51:55 -0400 |
| 3 |
Subject: Set ALSA MIDI message destination |
| 4 |
Origin: upstream |
| 5 |
Applied-Upstream: 535950902cf57e94d61b795a4cd82ae233d6eb43 |
| 6 |
|
| 7 |
Fixes #41 |
| 8 |
--- |
| 9 |
interfaces/qrtmidi/RtMidi.cpp | 4 ++++ |
| 10 |
1 file changed, 4 insertions(+) |
| 11 |
|
| 12 |
diff --git a/interfaces/qrtmidi/RtMidi.cpp b/interfaces/qrtmidi/RtMidi.cpp |
| 13 |
index 378205f..3e6d48c 100644 |
| 14 |
--- a/interfaces/qrtmidi/RtMidi.cpp |
| 15 |
+++ b/interfaces/qrtmidi/RtMidi.cpp |
| 16 |
@@ -1664,6 +1664,7 @@ void MidiOutAlsa :: initialize( const std::string& clientName ) |
| 17 |
data->seq = seq; |
| 18 |
data->portNum = -1; |
| 19 |
data->vport = -1; |
| 20 |
+ data->subscription = 0; |
| 21 |
data->bufferSize = 32; |
| 22 |
data->coder = 0; |
| 23 |
data->buffer = 0; |
| 24 |
@@ -1808,6 +1809,8 @@ void MidiOutAlsa :: sendMessage( std::vector<unsigned char> *message ) |
| 25 |
{ |
| 26 |
int result; |
| 27 |
AlsaMidiData *data = static_cast<AlsaMidiData *> (apiData_); |
| 28 |
+ if ( data->vport < 0 ) |
| 29 |
+ return; |
| 30 |
unsigned int nBytes = message->size(); |
| 31 |
if ( nBytes > data->bufferSize ) { |
| 32 |
data->bufferSize = nBytes; |
| 33 |
@@ -1827,6 +1830,7 @@ void MidiOutAlsa :: sendMessage( std::vector<unsigned char> *message ) |
| 34 |
snd_seq_event_t ev; |
| 35 |
snd_seq_ev_clear(&ev); |
| 36 |
snd_seq_ev_set_source(&ev, data->vport); |
| 37 |
+ snd_seq_ev_set_dest(&ev, snd_seq_client_id( data->seq ), data->vport); |
| 38 |
snd_seq_ev_set_subs(&ev); |
| 39 |
snd_seq_ev_set_direct(&ev); |
| 40 |
for ( unsigned int i=0; i<nBytes; ++i ) data->buffer[i] = message->at(i); |