MCPcopy Create free account
hub / github.com/davy7125/polyphone / attributeToString

Method attributeToString

sources/editor/pagetable.cpp:1165–1236  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1163}
1164
1165QString PageTable::attributeToString(AttributeType champ, bool isPrst, AttributeValue storedValue)
1166{
1167 QString result = "";
1168
1169 switch (champ)
1170 {
1171 case champ_velRange:
1172 if (storedValue.rValue.byLo == storedValue.rValue.byHi)
1173 result = QString::number(storedValue.rValue.byLo);
1174 else
1175 result = QString::number(storedValue.rValue.byLo) + "-" + QString::number(storedValue.rValue.byHi);
1176 break;
1177 case champ_keyRange:
1178 if (storedValue.rValue.byLo == storedValue.rValue.byHi)
1179 result = ContextManager::keyName()->getKeyName(storedValue.rValue.byLo);
1180 else
1181 result = ContextManager::keyName()->getKeyName(storedValue.rValue.byLo) + "-" + ContextManager::keyName()->getKeyName(storedValue.rValue.byHi);
1182 break;
1183 case champ_initialAttenuation:
1184 // Now with two digits since we have real dB (one step is 0.04 dB)
1185 result = QLocale::system().toString(Attribute::toRealValue(champ, isPrst, storedValue), 'f', 2);
1186 break;
1187 case champ_pan: case champ_initialFilterQ:
1188 case champ_modLfoToVolume:
1189 case champ_sustainVolEnv: case champ_sustainModEnv:
1190 case champ_chorusEffectsSend: case champ_reverbEffectsSend:
1191 result = QLocale::system().toString(Attribute::toRealValue(champ, isPrst, storedValue), 'f', 1);
1192 break;
1193 case champ_keynum: case champ_overridingRootKey:
1194 result = ContextManager::keyName()->getKeyName(storedValue.wValue);
1195 break;
1196 case champ_sampleModes: case champ_exclusiveClass: case champ_velocity: case champ_sfModDestOper:
1197 result = QString::number(storedValue.wValue);
1198 break;
1199 case champ_byOriginalPitch: case champ_chPitchCorrection:
1200 case champ_dwEndLoop: case champ_dwStartLoop:
1201 case champ_scaleTuning: case champ_coarseTune: case champ_fineTune:
1202 case champ_modLfoToFilterFc: case champ_modEnvToFilterFc:
1203 case champ_modEnvToPitch: case champ_modLfoToPitch: case champ_vibLfoToPitch:
1204 case champ_keynumToModEnvHold: case champ_keynumToVolEnvHold:
1205 case champ_keynumToModEnvDecay: case champ_keynumToVolEnvDecay:
1206 case champ_startAddrsOffset: case champ_startAddrsCoarseOffset:
1207 case champ_startloopAddrsOffset: case champ_startloopAddrsCoarseOffset:
1208 case champ_endAddrsOffset: case champ_endAddrsCoarseOffset:
1209 case champ_endloopAddrsOffset: case champ_endloopAddrsCoarseOffset:
1210 case champ_modAmount:
1211 result = QString::number(storedValue.shValue);
1212 break;
1213 case champ_initialFilterFc:
1214 result = QLocale::system().toString(Attribute::toRealValue(champ, isPrst, storedValue), 'f', isPrst ? 3 : 0);
1215 break;
1216 case champ_freqModLFO: case champ_freqVibLFO:
1217 case champ_delayModEnv: case champ_attackModEnv: case champ_holdModEnv: case champ_decayModEnv: case champ_releaseModEnv:
1218 case champ_delayVolEnv: case champ_attackVolEnv: case champ_holdVolEnv: case champ_decayVolEnv: case champ_releaseVolEnv:
1219 case champ_delayModLFO: case champ_delayVibLFO:
1220 result = QLocale::system().toString(Attribute::toRealValue(champ, isPrst, storedValue), 'f', 3);
1221 break;
1222 case champ_sfModTransOper:

Callers

nothing calls this directly

Calls 2

getKeyNameMethod · 0.80
toStringMethod · 0.45

Tested by

no test coverage detected