Click here to Skip to main content
15,912,578 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
C#
for(r=0;r<m_Keys.LBtnDownCount;r++)
 {
   m_Keys.NoteOn(RecordKeyNo[r]+36);
 
  }



To interrupt the m_Keys.NoteOn(RecordKeyNo[r]+36); before completing at a particular time.
I need this because if
the r=0 m_Keys.NoteOn(RecordKeyNo[0]+36) should be executed for say 456msecond
the r=1 m_Keys.NoteOn(RecordKeyNo[1]+36) should be executed for say 300msecond
how can i do that?
Posted
Updated 18-Jan-12 0:45am
v2

Assuming that you have some function call for stopping the note (NoteOff() perhaps) you can follow the NoteOn() call with a Sleep()[^].
 
Share this answer
 
Comments
chaiein 18-Jan-12 7:13am    
The NoteOff is called only after NoteOn completes.But i want to stop the execution in between.
Richard MacCutchan 18-Jan-12 7:25am    
Are you saying that the NoteOn() call does not return until the playing of the note is complete? So how does it know how long to play it for?
chaiein 18-Jan-12 7:47am    
Ya that works.
chaiein 18-Jan-12 7:49am    
m_Keys.NoteOn(RecordKeyNo[r]+36);
XSleep(1000);
chaiein 18-Jan-12 7:50am    
Instead of Sleep ,XSleep() is very help full and it works. Sleep() causing a complete Sleep.
http://www.codeguru.com/cpp/misc/misc/article.php/c211[^]

just XSleep.h and XSleep.cpp to be included in the project and write XSleep(<value>);
Example: XSleep(1000);

Thanks to all who gave clue:)
 
Share this answer
 
v2
Simple Use a timer
http://msdn.microsoft.com/en-us/library/bb398865.aspx[^]
Check this out it will help you!
 
Share this answer
 
v2
Comments
Richard MacCutchan 18-Jan-12 7:23am    
For MFC/C++?

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900