MCPcopy Create free account
hub / github.com/HertzDevil/0CC-FamiTracker / Event

Method Event

Source/MIDI.cpp:229–266  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

227}
228
229void CMIDI::Event(unsigned char Status, unsigned char Data1, unsigned char Data2)
230{
231 const unsigned char MsgType = Status >> 4;
232 const unsigned char MsgChannel = Status & 0x0F;
233
234 CFrameWnd *pFrame = static_cast<CFrameWnd*>(AfxGetApp()->m_pMainWnd);
235 CView *pView = pFrame->GetActiveView();
236
237 TRACE(L"%i: MIDI message %02X %02X %02X\n", GetTickCount(), Status, Data1, Data2);
238
239 // Timing
240 switch (Status) {
241 case 0xF8: // Timing tick
242 if (m_bMasterSync) {
243 if (++m_iTimingCounter == 6) {
244 m_iTimingCounter = 0;
245 Enqueue(MsgType, MsgChannel, Data1, Data2);
246 pView->PostMessageW(WM_USER_MIDI_EVENT);
247 }
248 }
249 break;
250 case 0xFA: // Start
251 m_iTimingCounter = 0;
252 break;
253 case 0xFC: // Stop
254 m_iTimingCounter = 0;
255 break;
256 default:
257 switch (MsgType) {
258 case MIDI_MSG_NOTE_OFF:
259 case MIDI_MSG_NOTE_ON:
260 case MIDI_MSG_PITCH_WHEEL:
261 Enqueue(MsgType, MsgChannel, Data1, Data2);
262 pView->PostMessageW(WM_USER_MIDI_EVENT);
263 break;
264 }
265 }
266}
267
268bool CMIDI::ReadMessage(unsigned char & Message, unsigned char & Channel, unsigned char & Data1, unsigned char & Data2)
269{

Callers 1

MidiInProcMethod · 0.80

Calls

no outgoing calls

Tested by

no test coverage detected