void getSwitchAudioFile(char * filename, swsrc_t index) { char * str = getModelAudioPath(filename); #if defined(PCBTARANIS) if (index <= SWSRC_LAST_SWITCH) { div_t swinfo = switchInfo(index); *str++ = 'S'; *str++ = 'A' + swinfo.quot; const char * positions[] = { "-up", "-mid", "-down" }; strcpy(str, positions[swinfo.rem]); } else { div_t swinfo = div(index - SWSRC_FIRST_MULTIPOS_SWITCH, XPOTS_MULTIPOS_COUNT); *str++ = 'S'; *str++ = '1' + swinfo.quot; *str++ = '1' + swinfo.rem; *str = '\0'; } #else int len = STR_VSWITCHES[0]; strncpy(str, &STR_VSWITCHES[1+(len*index)], len); str += len; *str = '\0'; #endif strcat(str, SOUNDS_EXT); }
void Arranger::updateTrackInfo(MusECore::SongChangedFlags_t flags) { if (!showTrackinfoFlag) { switchInfo(-1); return; } if (selected == 0) { switchInfo(0); return; } if (selected->isMidiTrack()) { switchInfo(1); // If a different part was selected if(midiTrackInfo->track() != selected) // Set a new track and do a complete update. midiTrackInfo->setTrack(selected); else // Otherwise just regular update with specific flags. midiTrackInfo->updateTrackInfo(flags); } else { switchInfo(2); } }
swsrc_t checkIncDecMovedSwitch(swsrc_t val) { if (s_editMode>0) { swsrc_t swtch = getMovedSwitch(); if (swtch) { div_t info = switchInfo(swtch); if (IS_TOGGLE(info.quot)) { if (info.rem != 0) { val = (val == swtch ? swtch-2 : swtch); } } else { val = swtch; } } } return val; }
bool isSwitchAvailable(int swtch, SwitchContext context) { bool negative = false; if (swtch < 0) { negative = true; if (swtch == -SWSRC_ON || swtch == -SWSRC_ONE) { return false; } swtch = -swtch; } if (swtch >= SWSRC_SA0 && swtch <= SWSRC_LAST_SWITCH) { div_t swinfo = switchInfo(swtch); if (!SWITCH_EXISTS(swinfo.quot)) { return false; } if (!IS_3POS(swinfo.quot)) { if (negative) { return false; } if (IS_3POS_MIDDLE(swinfo.rem)) { return false; } } return true; } if (swtch >= SWSRC_FIRST_MULTIPOS_SWITCH && swtch <= SWSRC_LAST_MULTIPOS_SWITCH) { int index = (swtch - SWSRC_FIRST_MULTIPOS_SWITCH) / XPOTS_MULTIPOS_COUNT; if (IS_POT_MULTIPOS(POT1+index)) { StepsCalibData * calib = (StepsCalibData *) &g_eeGeneral.calib[POT1+index]; return (calib->count >= ((swtch - SWSRC_FIRST_MULTIPOS_SWITCH) % XPOTS_MULTIPOS_COUNT)); } else { return false; } } if (swtch >= SWSRC_FIRST_LOGICAL_SWITCH && swtch <= SWSRC_LAST_LOGICAL_SWITCH) { if (context == GeneralCustomFunctionsContext) { return false; } else if (context != LogicalSwitchesContext) { return isLogicalSwitchAvailable(swtch - SWSRC_FIRST_LOGICAL_SWITCH); } } if (context != ModelCustomFunctionsContext && context != GeneralCustomFunctionsContext && (swtch == SWSRC_ON || swtch == SWSRC_ONE)) { return false; } if (swtch >= SWSRC_FIRST_FLIGHT_MODE && swtch <= SWSRC_LAST_FLIGHT_MODE) { if (context == MixesContext || context == GeneralCustomFunctionsContext) { return false; } else { swtch -= SWSRC_FIRST_FLIGHT_MODE; if (swtch == 0) { return true; } FlightModeData * fm = flightModeAddress(swtch); return (fm->swtch != SWSRC_NONE); } } return true; }