summaryrefslogtreecommitdiff
path: root/RtMidi.cpp
diff options
context:
space:
mode:
authorGary Scavone <gary@music.mcgill.ca>2013-12-30 18:27:27 -0800
committerGary Scavone <gary@music.mcgill.ca>2013-12-30 18:27:27 -0800
commite03b61cfe11901bc696eb17d639f78830b81eac5 (patch)
treed17ea99917dbdd1122a49b083bc702e6b452c4ba /RtMidi.cpp
parenta0d187b872eefe9efe1fa55dc1e804ddb78ecc76 (diff)
Various bug fixes reported by users over past 1.5 years.
Diffstat (limited to 'RtMidi.cpp')
-rw-r--r--RtMidi.cpp30
1 files changed, 15 insertions, 15 deletions
diff --git a/RtMidi.cpp b/RtMidi.cpp
index c31754a..4b2eabb 100644
--- a/RtMidi.cpp
+++ b/RtMidi.cpp
@@ -276,7 +276,7 @@ void MidiInApi :: setCallback( RtMidiIn::RtMidiCallback callback, void *userData
return;
}
- inputData_.userCallback = (void *) callback;
+ inputData_.userCallback = callback;
inputData_.userData = userData;
inputData_.usingCallback = true;
}
@@ -372,7 +372,7 @@ struct CoreMidiData {
// Class Definitions: MidiInCore
//*********************************************************************//
-static void midiInputCallback( const MIDIPacketList *list, void *procRef, void *srcRef )
+static void midiInputCallback( const MIDIPacketList *list, void *procRef, void */*srcRef*/ )
{
MidiInApi::RtMidiInData *data = static_cast<MidiInApi::RtMidiInData *> (procRef);
CoreMidiData *apiData = static_cast<CoreMidiData *> (data->apiData);
@@ -789,7 +789,7 @@ std::string MidiInCore :: getPortName( unsigned int portNumber )
portRef = MIDIGetSource( portNumber );
nameRef = ConnectedEndpointName(portRef);
- CFStringGetCString( nameRef, name, sizeof(name), 0);
+ CFStringGetCString( nameRef, name, sizeof(name), CFStringGetSystemEncoding());
CFRelease( nameRef );
return stringName = name;
@@ -858,7 +858,7 @@ std::string MidiOutCore :: getPortName( unsigned int portNumber )
portRef = MIDIGetDestination( portNumber );
nameRef = ConnectedEndpointName(portRef);
- CFStringGetCString( nameRef, name, sizeof(name), 0);
+ CFStringGetCString( nameRef, name, sizeof(name), CFStringGetSystemEncoding());
CFRelease( nameRef );
return stringName = name;
@@ -947,7 +947,7 @@ void MidiOutCore :: openVirtualPort( std::string portName )
static char *sysexBuffer = 0;
-static void sysexCompletionProc( MIDISysexSendRequest * sreq )
+static void sysexCompletionProc( MIDISysexSendRequest * /*sreq*/ )
{
//std::cout << "Completed SysEx send\n";
delete sysexBuffer;
@@ -999,9 +999,9 @@ void MidiOutCore :: sendMessage( std::vector<unsigned char> *message )
return;
}
else if ( nBytes > 3 ) {
- errorString_ = "MidiOutCore::sendMessage: message format problem ... not sysex but > 3 bytes?";
- RtMidi::error( RtMidiError::WARNING, errorString_ );
- return;
+ errorString_ = "MidiOutCore::sendMessage: message format problem ... not sysex but > 3 bytes?";
+ RtMidi::error( RtMidiError::WARNING, errorString_ );
+ return;
}
MIDIPacketList packetList;
@@ -1399,8 +1399,8 @@ std::string MidiInAlsa :: getPortName( unsigned int portNumber )
snd_seq_get_any_client_info( data->seq, cnum, cinfo );
std::ostringstream os;
os << snd_seq_client_info_get_name( cinfo );
- os << " "; // GO: These lines added to make sure devices are listed
- os << snd_seq_port_info_get_client( pinfo ); // GO: with full portnames added to ensure individual device names
+ os << " "; // These lines added to make sure devices are listed
+ os << snd_seq_port_info_get_client( pinfo ); // with full portnames added to ensure individual device names
os << ":";
os << snd_seq_port_info_get_port( pinfo );
stringName = os.str();
@@ -1422,7 +1422,7 @@ void MidiInAlsa :: openPort( unsigned int portNumber, const std::string portName
}
unsigned int nSrc = this->getPortCount();
- if (nSrc < 1) {
+ if ( nSrc < 1 ) {
errorString_ = "MidiInAlsa::openPort: no MIDI input sources found!";
RtMidi::error( RtMidiError::NO_DEVICES_FOUND, errorString_ );
}
@@ -1437,7 +1437,6 @@ void MidiInAlsa :: openPort( unsigned int portNumber, const std::string portName
RtMidi::error( RtMidiError::INVALID_PARAMETER, errorString_ );
}
-
snd_seq_addr_t sender, receiver;
sender.client = snd_seq_port_info_get_client( pinfo );
sender.port = snd_seq_port_info_get_port( pinfo );
@@ -1464,6 +1463,7 @@ void MidiInAlsa :: openPort( unsigned int portNumber, const std::string portName
errorString_ = "MidiInAlsa::openPort: ALSA error creating input port.";
RtMidi::error( RtMidiError::DRIVER_ERROR, errorString_ );
}
+ data->vport = snd_seq_port_info_get_port(pinfo);
}
receiver.port = data->vport;
@@ -1865,7 +1865,7 @@ struct WinMidiData {
// Class Definitions: MidiInWinMM
//*********************************************************************//
-static void CALLBACK midiInputCallback( HMIDIIN hmin,
+static void CALLBACK midiInputCallback( HMIDIIN /*hmin*/,
UINT inputStatus,
DWORD_PTR instancePtr,
DWORD_PTR midiMessage,
@@ -2111,7 +2111,7 @@ std::string MidiInWinMM :: getPortName( unsigned int portNumber )
midiInGetDevCaps( portNumber, &deviceCaps, sizeof(MIDIINCAPS));
#if defined( UNICODE ) || defined( _UNICODE )
- int length = WideCharToMultiByte(CP_UTF8, 0, deviceCaps.szPname, -1, NULL, 0, NULL, NULL);
+ int length = WideCharToMultiByte(CP_UTF8, 0, deviceCaps.szPname, -1, NULL, 0, NULL, NULL) - 1;
stringName.assign( length, 0 );
length = WideCharToMultiByte(CP_UTF8, 0, deviceCaps.szPname, wcslen(deviceCaps.szPname), &stringName[0], length, NULL, NULL);
#else
@@ -2185,7 +2185,7 @@ std::string MidiOutWinMM :: getPortName( unsigned int portNumber )
midiOutGetDevCaps( portNumber, &deviceCaps, sizeof(MIDIOUTCAPS));
#if defined( UNICODE ) || defined( _UNICODE )
- int length = WideCharToMultiByte(CP_UTF8, 0, deviceCaps.szPname, -1, NULL, 0, NULL, NULL);
+ int length = WideCharToMultiByte(CP_UTF8, 0, deviceCaps.szPname, -1, NULL, 0, NULL, NULL) - 1;
stringName.assign( length, 0 );
length = WideCharToMultiByte(CP_UTF8, 0, deviceCaps.szPname, wcslen(deviceCaps.szPname), &stringName[0], length, NULL, NULL);
#else