:confused::confused:Hi, I am building a wind synth that uses the API midi functions of a soundcard. m_Note2 is an int value according to the keys pressed and m_PBAD_2 is an int value ranging from 0-127 according to the airflow thru the synth, updated according to the timer set at 250 millisec. When I blow into the synth a note is played every 25msec but does not stop, because the m_note in stopnote() outdated. I have no idea what to add to the playnote() function. Any suggestions appreciated, my knowledge of VC++ is very limited. Cheers, Rob robert.harrington2@mail.dcu.ie void CAD_mouthDlg::PlayNote() { UpdateData(TRUE); MidiOutMessage (hMidiOut, 0x00, 0x90, m_Note2,m_PBAD_2) ; } void CAD_mouthDlg::StopNote() { if(m_Key_Press == FALSE) { MidiOutMessage (hMidiOut, 0x00, 0x90, m_Note2,0) ; } else { } } void CAD_mouthDlg::OnTimer(UINT nIDEvent) { CAD_mouthDlg::read_analog(); CAD_mouthDlg::SetPortChigh(); CAD_mouthDlg::OnButtonReadPort(); CAD_mouthDlg::PlayNote(); CAD_mouthDlg::StopNote(); CDialog::OnTimer(nIDEvent); }
bob_000
Posts
-
Newbie help, API -
Midi API, please help:confused::confused: Hi, I am building a wind synth that uses the API midi functions of a soundcard. m_Note2 is an int value according to the keys pressed and m_PBAD_2 is an int value ranging from 0-127 according to the airflow thru the synth, updated according to the timer set at 250 millisec. When I blow into the synth a note is played every 25sec but does not stop, because the m_note in stopnote() outdated. I have no idea what to add to the playnote() function. Any suggestions appreciated, my knowledge of VC++ is very limited. Cheers, Rob robert.harrington2@mail.dcu.ie void CAD_mouthDlg::PlayNote() { UpdateData(TRUE); MidiOutMessage (hMidiOut, 0x00, 0x90, m_Note2,m_PBAD_2) ; } void CAD_mouthDlg::StopNote() { if(m_Key_Press == FALSE) { MidiOutMessage (hMidiOut, 0x00, 0x90, m_Note2,0) ; } else { } } void CAD_mouthDlg::OnTimer(UINT nIDEvent) { CAD_mouthDlg::read_analog(); CAD_mouthDlg::SetPortChigh(); CAD_mouthDlg::OnButtonReadPort(); CAD_mouthDlg::PlayNote(); CAD_mouthDlg::StopNote(); CDialog::OnTimer(nIDEvent); }