added support for MIDI out in WinMM MIDI client

git-svn-id: https://lmms.svn.sf.net/svnroot/lmms/trunk/lmms@1684 0778d3d1-df1d-0410-868b-ea421aaaa00d
This commit is contained in:
Tobias Doerffel
2008-09-22 20:26:45 +00:00
parent f3d94b0e63
commit d6457f039f
2 changed files with 51 additions and 8 deletions

View File

@@ -1,3 +1,8 @@
2008-09-22 Tobias Doerffel <tobydox/at/users/dot/sourceforge/dot/net>
* src/core/midi/midi_winmm.cpp:
added support for MIDI out in WinMM MIDI client
2008-09-22 Paul Giblock <drfaygo/at/gmail/dot/com>
* plugins/midi_import/portsmf/allegro.cpp:

View File

@@ -63,6 +63,33 @@ void midiWinMM::processOutEvent( const midiEvent & _me,
const midiTime & _time,
const midiPort * _port )
{
const DWORD short_msg = ( _me.m_type + _me.channel() ) +
( ( _me.m_data.m_param[0] & 0xff ) << 8 ) +
( ( _me.m_data.m_param[1] & 0xff ) << 16 );
QStringList out_devs;
for( subMap::iterator it = m_outputSubs.begin();
it != m_outputSubs.end(); ++it )
{
for( midiPortList::iterator jt = it.value().begin();
jt != it.value().end(); ++jt )
{
if( *jt == _port )
{
out_devs += it.key();
break;
}
}
}
for( QMap<HMIDIOUT, QString>::iterator it = m_outputDevices.begin();
it != m_outputDevices.end(); ++it )
{
if( out_devs.contains( *it ) )
{
midiOutShortMsg( it.key(), short_msg );
}
}
}
@@ -119,7 +146,7 @@ void midiWinMM::subscribeReadablePort( midiPort * _port,
if( _subscribe && _port->inputEnabled() == FALSE )
{
printf( "port %s can't be (un)subscribed!\n",
_port->name().toAscii().constData() );
_port->displayName().toAscii().constData() );
return;
}
@@ -140,17 +167,14 @@ void midiWinMM::subscribeWriteablePort( midiPort * _port,
if( _subscribe && _port->outputEnabled() == FALSE )
{
printf( "port %s can't be (un)subscribed!\n",
_port->name().toAscii().constData() );
_port->displayName().toAscii().constData() );
return;
}
if( m_outputSubs.contains( _dest ) )
m_outputSubs[_dest].removeAll( _port );
if( _subscribe )
{
m_outputSubs[_dest].removeAll( _port );
if( _subscribe )
{
m_outputSubs[_dest].push_back( _port );
}
m_outputSubs[_dest].push_back( _port );
}
}
@@ -296,6 +320,20 @@ void midiWinMM::openDevices( void )
midiInStart( hm );
}
}
m_outputDevices.clear();
for( int i = 0; i < midiOutGetNumDevs(); ++i )
{
MIDIOUTCAPS c;
midiOutGetDevCaps( i, &c, sizeof( c ) );
HMIDIOUT hm = 0;
MMRESULT res = midiOutOpen( &hm, i, NULL, NULL, CALLBACK_NULL );
if( res == MMSYSERR_NOERROR )
{
m_outputDevices[hm] = qstrdup( c.szPname );
// midiOutStart( hm );
}
}
}