void MidiWinMM::processOutEvent( const MidiEvent& event, const MidiTime& time, const MidiPort* port ) { const DWORD shortMsg = ( event.type() + event.channel() ) + ( ( event.param( 0 ) & 0xff ) << 8 ) + ( ( event.param( 1 ) & 0xff ) << 16 ); QStringList outDevs; for( SubMap::ConstIterator it = m_outputSubs.begin(); it != m_outputSubs.end(); ++it ) { for( MidiPortList::ConstIterator jt = it.value().begin(); jt != it.value().end(); ++jt ) { if( *jt == port ) { outDevs += it.key(); break; } } } for( QMap<HMIDIOUT, QString>::Iterator it = m_outputDevices.begin(); it != m_outputDevices.end(); ++it ) { if( outDevs.contains( *it ) ) { midiOutShortMsg( it.key(), shortMsg ); } } }
MIDIPacketList MidiApple::createMidiPacketList( const MidiEvent& event ) { MIDIPacketList packetList; packetList.numPackets = 1; MIDIPacket* firstPacket = &packetList.packet[0]; firstPacket->timeStamp = 0; // send immediately firstPacket->length = 3; firstPacket->data[0] = ( event.type() + event.channel() ); firstPacket->data[1] = ( event.param( 0 ) & 0xff ); firstPacket->data[2] = ( event.param( 1 ) & 0xff ); return packetList; }
void RemotePlugin::processMidiEvent( const MidiEvent & _e, const f_cnt_t _offset ) { message m( IdMidiEvent ); m.addInt( _e.type() ); m.addInt( _e.channel() ); m.addInt( _e.param( 0 ) ); m.addInt( _e.param( 1 ) ); m.addInt( _offset ); lock(); sendMessage( m ); unlock(); }
void MidiAlsaSeq::processOutEvent( const MidiEvent& event, const MidiTime& time, const MidiPort* port ) { // HACK!!! - need a better solution which isn't that easy since we // cannot store const-ptrs in our map because we need to call non-const // methods of MIDI-port - it's a mess... MidiPort* p = const_cast<MidiPort *>( port ); snd_seq_event_t ev; snd_seq_ev_clear( &ev ); snd_seq_ev_set_source( &ev, ( m_portIDs[p][1] != -1 ) ? m_portIDs[p][1] : m_portIDs[p][0] ); snd_seq_ev_set_subs( &ev ); snd_seq_ev_schedule_tick( &ev, m_queueID, 1, static_cast<int>( time ) ); ev.queue = m_queueID; switch( event.type() ) { case MidiNoteOn: snd_seq_ev_set_noteon( &ev, event.channel(), event.key() + KeysPerOctave, event.velocity() ); break; case MidiNoteOff: snd_seq_ev_set_noteoff( &ev, event.channel(), event.key() + KeysPerOctave, event.velocity() ); break; case MidiKeyPressure: snd_seq_ev_set_keypress( &ev, event.channel(), event.key() + KeysPerOctave, event.velocity() ); break; case MidiControlChange: snd_seq_ev_set_controller( &ev, event.channel(), event.controllerNumber(), event.controllerValue() ); break; case MidiProgramChange: snd_seq_ev_set_pgmchange( &ev, event.channel(), event.program() ); break; case MidiChannelPressure: snd_seq_ev_set_chanpress( &ev, event.channel(), event.channelPressure() ); break; case MidiPitchBend: snd_seq_ev_set_pitchbend( &ev, event.channel(), event.param( 0 ) - 8192 ); break; default: qWarning( "MidiAlsaSeq: unhandled output event %d\n", (int) event.type() ); return; } m_seqMutex.lock(); snd_seq_event_output( m_seqHandle, &ev ); snd_seq_drain_output( m_seqHandle ); m_seqMutex.unlock(); }