static int _midi_queue_run(UNUSED void *xtop) { int i; #ifdef WIN32 __win32_pick_usleep(); SetPriorityClass(GetCurrentProcess(),HIGH_PRIORITY_CLASS); SetThreadPriority(GetCurrentThread(),THREAD_PRIORITY_TIME_CRITICAL); /*SetThreadPriority(GetCurrentThread(),THREAD_PRIORITY_HIGHEST);*/ #endif SDL_mutexP(midi_play_mutex); for (;;) { SDL_CondWait(midi_play_cond, midi_play_mutex); for (i = 0; i < qlen; i++) { SDL_mutexP(midi_record_mutex); _midi_send_unlocked(qq[i].b, qq[i].used, 0, 1); SDL_mutexV(midi_record_mutex); SLEEP_FUNC(10000); /* 10msec */ qq[i].used = 0; } } return 0; /* never happens */ }
void Cedrus::XIDDevice::RestoreFactoryDefaults() { DWORD bytes_written = 0; m_xidCon->Write((unsigned char*)"f7", 2, &bytes_written); SLEEP_FUNC(100 * SLEEP_INC); if (m_config->IsMPod()) { SetTranslationTable(m_podHostConfig->IsStimTracker2() ? 1 : 0); if (m_config->GetModelID() == 72) // Neuroscan 16-bit { SetMPodLineMapping_Neuroscan16bit(); } else if (m_config->GetModelID() == 104) // Neuroscan Grael { SetMPodLineMapping_NeuroscanGrael(); } } else if (m_config->IsCPod()) { if (m_config->GetModelID()== 104) SetCPodLineMapping_NeuroscanGrael(); // Neuroscan Grael } }
void Cedrus::XIDDevice::ConnectToMpod(unsigned char mpod, unsigned char action) { if (!m_config->IsXID2()) return; int rate = 4; if (action > 0) { m_baudRatePriorToMpod = GetBaudRate(); // m-pods operate at 19200 only SetBaudRate(1); } else { switch (m_baudRatePriorToMpod) { case 9600: rate = 0; break; case 19200: rate = 1; break; case 38400: rate = 2; break; case 57600: rate = 3; break; case 115200: rate = 4; break; default: break; } } static unsigned char ctm_cmd[4] = {'a','q'}; ctm_cmd[2] = '0' + mpod; ctm_cmd[3] = '0' + action; DWORD bytes_written = 0; m_xidCon->Write(ctm_cmd, 4, &bytes_written); SLEEP_FUNC(150 * SLEEP_INC); m_podHostConfig = (action == 0 ? nullptr : m_config); MatchConfigToModel(-1); m_curMinorFwVer = GetMinorFirmwareVersion(); if (action == 0) SetBaudRate(rate); }
void Cedrus::XIDDevice::CommitLineMappingToFlash() { if (!m_config->IsXID2()) return; static unsigned char commit_map_cmd[2] = { 'a','f' }; DWORD bytes_written = 0; m_xidCon->Write(commit_map_cmd, 2, &bytes_written); SLEEP_FUNC(50 * SLEEP_INC); }
void Cedrus::XIDDevice::SetTranslationTable(unsigned char table) { if (!m_config->IsMPod()) return; static unsigned char stt_cmd[3] = { 'a','s' }; stt_cmd[2] = table + '0'; DWORD bytes_written = 0; m_xidCon->Write(stt_cmd, 3, &bytes_written); SLEEP_FUNC(50 * SLEEP_INC); }
void Cedrus::XIDDevice::SetMpodPulseDuration(unsigned char duration) { if (!m_config->IsMPod()) return; static unsigned char smpd_command[3] = { 'a','w' }; smpd_command[2] = duration; DWORD bytes_written = 0; m_xidCon->Write(smpd_command, 3, &bytes_written); SLEEP_FUNC(50 * SLEEP_INC); }
void Cedrus::XIDDevice::SetMpodOutputMode(unsigned char mode) { if (!m_config->IsMPod()) return; static unsigned char smom_command[3] = { 'a','m' }; smom_command[2] = mode + '0'; DWORD bytes_written = 0; m_xidCon->Write(smom_command, 3, &bytes_written); SLEEP_FUNC(50 * SLEEP_INC); }
void Cedrus::XIDDevice::EnableRBx40LED(bool enable) { if (!m_config->IsXID2()) return; static unsigned char enable_rb_led_cmd[3] = { 'i','l' }; enable_rb_led_cmd[2] = enable ? '1' : '0'; DWORD bytes_written = 0; m_xidCon->Write(enable_rb_led_cmd, 3, &bytes_written); SLEEP_FUNC(50 * SLEEP_INC); }
void Cedrus::XIDDevice::SetModelID(unsigned char model) { static char set_model_cmd[3] = { 'd', '3' }; set_model_cmd[2] = model; DWORD bytes_written = 0; m_xidCon->Write((unsigned char*)set_model_cmd, 3, &bytes_written); SLEEP_FUNC(250 * SLEEP_INC); MatchConfigToModel(model); if (m_config->IsMPod()) { if (model == 72) // Neuroscan 16-bit { SetMPodLineMapping_Neuroscan16bit(); } else if (model == 104) // Neuroscan Grael { SetMPodLineMapping_NeuroscanGrael(); } else { ResetMappedLinesToDefault(); CommitLineMappingToFlash(); SetMpodOutputMode(0); } } else if (m_config->IsCPod()) { if (model == 104) SetCPodLineMapping_NeuroscanGrael(); // Neuroscan Grael else { ResetMappedLinesToDefault(); CommitLineMappingToFlash(); } } }
void Cedrus::XIDDevice::SaveSettingsToFlash() { DWORD bytes_written = 0; m_xidCon->Write((unsigned char*)"f9", 2, &bytes_written); SLEEP_FUNC(50 * SLEEP_INC); }