bool CMidiOutDevice::Open(UINT uDeviceID, UINT* pResult /*=NULL*/) { UINT result = midiOutOpen( &m_Handle, //LPHMIDIOUT lphmo uDeviceID, //UINT uDeviceID 0, //DWORD dwCallback 0, //DWORD dwCallbackInstance CALLBACK_NULL //DWORD dwFlags ); if(pResult) *pResult = result; if(result==MMSYSERR_NOERROR){ m_bOpened = true; return true; }else{ return false; } } |
//MIDIデバイス CMidiOutDevice mod; UINT result; //オープン mod.Open(2, &result); ::wxMessageBox( wxString::Format(wxT("Open %u"), result) ); |
void CMidiOutDevice::OutShortMsg(DWORD dwMessage) throw(MMRESULT) { if(!IsOpened()) throw MMSYSERR_INVALHANDLE; MMRESULT result = midiOutShortMsg(m_Handle, dwMessage); if(result!=MMSYSERR_NOERROR) throw result; } |