| 
					
				 | 
			
			
				@@ -6,11 +6,11 @@ namespace midi { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				  
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 Message* Message::parse(std::vector<unsigned char> &messageBytes) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-	// msg[0] has 8 bits                                                                         
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+	// msg[0] has 8 bits 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     //	- 4 higher significant bits: message type 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     //	- 4 lower significant bits: channel (0 - 15) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 	unsigned char messageType = messageBytes[0] >> 4; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-	if(messageType == 0xF)  
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+	if(messageType == 0xF) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 	{ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 		// system message 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 		throw "Message::parseMessage() does not support system messages yet."; 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@@ -41,10 +41,10 @@ Message* Message::parse(std::vector<unsigned char> &messageBytes) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 			case ProgramChangeMessage::messageType: 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 				return new ProgramChangeMessage(channel, messageBytes[1]); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 			case PitchBendChangeMessage::messageType: 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-				// messageBytes[1] are the least significant 7 bits.  
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+				// messageBytes[1] are the least significant 7 bits. 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 				// messageBytes[2] are the most significant 7 bits. 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 				return new PitchBendChangeMessage( 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-					channel,  
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+					channel, 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 					(messageBytes[2] << 7) + messageBytes[1] 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 					); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 			default: 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@@ -97,7 +97,7 @@ std::vector<unsigned char> PitchBendChangeMessage::getBytes() const 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 	std::vector<unsigned char> bytes(3); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 	bytes[0] = messageType << 4 | channel; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-	// bytes[1] are the seven least significant bits.  
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+	// bytes[1] are the seven least significant bits. 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 	// bytes[2] are the seven most significant bits. 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 	bytes[1] = value & ((1 << 7) - 1); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 	bytes[2] = value >> 7; 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@@ -113,32 +113,32 @@ std::ostream& operator<<(std::ostream& stream, const Message& message) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 void NoteOnMessage::print(std::ostream& stream) const 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 	stream	<< "channel #" << (unsigned short)(channel + 1) << ": " 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-			<< "note " << (unsigned short)pitch << " with velocity " << (unsigned short)velocity << " on\n";  
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+			<< "note " << (unsigned short)pitch << " with velocity " << (unsigned short)velocity << " on\n"; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				  
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 void NoteOffMessage::print(std::ostream& stream) const 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 	stream	<< "channel #" << (unsigned short)(channel + 1) << ": " 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-			<< "note " << (unsigned short)pitch << " off\n";  
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+			<< "note " << (unsigned short)pitch << " off\n"; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				  
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 void ControlChangeMessage::print(std::ostream& stream) const 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 	stream	<< "channel #" << (unsigned short)(channel + 1) << ": " 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 			<< "change value of control #" << (unsigned short)(control + 1) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-			<< " to " << (unsigned short)value << "\n";  
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+			<< " to " << (unsigned short)value << "\n"; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				  
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 void ProgramChangeMessage::print(std::ostream& stream) const 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 	stream	<< "channel #" << (unsigned short)(channel + 1) << ": " 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-			<< "switch to program # " << (unsigned short)(program + 1) << "\n";  
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+			<< "switch to program # " << (unsigned short)(program + 1) << "\n"; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				  
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 void PitchBendChangeMessage::print(std::ostream& stream) const 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 	stream	<< "channel #" << (unsigned short)(channel + 1) << ": " 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-			<< "pitch bended to " << value << "\n";  
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+			<< "pitch bended to " << value << "\n"; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				  
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 } // namespace 
			 |