Fix crash, enum-ise reverse mode
This commit is contained in:
parent
8b934aa4a1
commit
fdd53c1587
|
@ -339,11 +339,17 @@ struct DivInstrumentC64 {
|
||||||
};
|
};
|
||||||
|
|
||||||
struct DivInstrumentAmiga {
|
struct DivInstrumentAmiga {
|
||||||
|
enum DivReverseMode: unsigned char {
|
||||||
|
DIV_REVERSE_DISABLE=0,
|
||||||
|
DIV_REVERSE_ENABLE,
|
||||||
|
DIV_REVERSE_DEFAULT
|
||||||
|
};
|
||||||
|
|
||||||
struct SampleMap {
|
struct SampleMap {
|
||||||
int freq;
|
int freq;
|
||||||
short map;
|
short map;
|
||||||
unsigned char reversed;
|
DivInstrumentAmiga::DivReverseMode reversed;
|
||||||
SampleMap(int f=0, short m=-1, unsigned char r=0):
|
SampleMap(int f=0, short m=-1, DivInstrumentAmiga::DivReverseMode r=DivInstrumentAmiga::DivReverseMode::DIV_REVERSE_DEFAULT):
|
||||||
freq(f),
|
freq(f),
|
||||||
map(m),
|
map(m),
|
||||||
reversed(r) {}
|
reversed(r) {}
|
||||||
|
@ -395,21 +401,21 @@ struct DivInstrumentAmiga {
|
||||||
|
|
||||||
struct TransWaveMap: TransWaveSlice {
|
struct TransWaveMap: TransWaveSlice {
|
||||||
short ind;
|
short ind;
|
||||||
unsigned char reversed;
|
DivReverseMode reversed;
|
||||||
int loopStart, loopEnd;
|
int loopStart, loopEnd;
|
||||||
DivSampleLoopMode loopMode;
|
DivSampleLoopMode loopMode;
|
||||||
|
|
||||||
TransWaveMap():
|
TransWaveMap():
|
||||||
TransWaveSlice(),
|
TransWaveSlice(),
|
||||||
ind(-1),
|
ind(-1),
|
||||||
reversed(0),
|
reversed(DivInstrumentAmiga::DivReverseMode::DIV_REVERSE_DEFAULT),
|
||||||
loopStart(-1),
|
loopStart(-1),
|
||||||
loopEnd(-1),
|
loopEnd(-1),
|
||||||
loopMode(DIV_SAMPLE_LOOP_MAX) {}
|
loopMode(DIV_SAMPLE_LOOP_MAX) {}
|
||||||
};
|
};
|
||||||
|
|
||||||
short initSample;
|
short initSample;
|
||||||
bool reversed;
|
DivInstrumentAmiga::DivReverseMode reversed;
|
||||||
bool useNoteMap;
|
bool useNoteMap;
|
||||||
bool useSample;
|
bool useSample;
|
||||||
bool useWave;
|
bool useWave;
|
||||||
|
@ -448,7 +454,7 @@ struct DivInstrumentAmiga {
|
||||||
* get the sample reversed flag at specified note.
|
* get the sample reversed flag at specified note.
|
||||||
* @return the reversed flag.
|
* @return the reversed flag.
|
||||||
*/
|
*/
|
||||||
inline bool getReversed(int note) {
|
inline DivInstrumentAmiga::DivReverseMode getReversed(int note) {
|
||||||
if (useNoteMap) {
|
if (useNoteMap) {
|
||||||
if (note<0) note=0;
|
if (note<0) note=0;
|
||||||
if (note>119) note=119;
|
if (note>119) note=119;
|
||||||
|
@ -459,7 +465,7 @@ struct DivInstrumentAmiga {
|
||||||
|
|
||||||
DivInstrumentAmiga():
|
DivInstrumentAmiga():
|
||||||
initSample(0),
|
initSample(0),
|
||||||
reversed(false),
|
reversed(DivInstrumentAmiga::DivReverseMode::DIV_REVERSE_DISABLE),
|
||||||
useNoteMap(false),
|
useNoteMap(false),
|
||||||
useSample(false),
|
useSample(false),
|
||||||
useWave(false),
|
useWave(false),
|
||||||
|
|
|
@ -249,7 +249,7 @@ void DivPlatformES5506::e_pin(bool state) {
|
||||||
}
|
}
|
||||||
// get reversed
|
// get reversed
|
||||||
bool reversed=ins->amiga.reversed;
|
bool reversed=ins->amiga.reversed;
|
||||||
if (transWaveInd.reversed!=2) {
|
if (transWaveInd.reversed!=DivInstrumentAmiga::DivReverseMode::DIV_REVERSE_DEFAULT) {
|
||||||
reversed=transWaveInd.reversed;
|
reversed=transWaveInd.reversed;
|
||||||
}
|
}
|
||||||
const unsigned int start=offES5506<<10;
|
const unsigned int start=offES5506<<10;
|
||||||
|
@ -601,7 +601,7 @@ void DivPlatformES5506::tick(bool sysTick) {
|
||||||
}
|
}
|
||||||
// get reversed
|
// get reversed
|
||||||
bool reversed=ins->amiga.reversed;
|
bool reversed=ins->amiga.reversed;
|
||||||
if (transWaveInd.reversed!=2) {
|
if (transWaveInd.reversed!=DivInstrumentAmiga::DivReverseMode::DIV_REVERSE_DEFAULT) {
|
||||||
reversed=transWaveInd.reversed;
|
reversed=transWaveInd.reversed;
|
||||||
}
|
}
|
||||||
chan[i].pcmChanged.slice=1;
|
chan[i].pcmChanged.slice=1;
|
||||||
|
@ -672,9 +672,9 @@ void DivPlatformES5506::tick(bool sysTick) {
|
||||||
}
|
}
|
||||||
// get reversed
|
// get reversed
|
||||||
bool reversed=ins->amiga.reversed;
|
bool reversed=ins->amiga.reversed;
|
||||||
if (ins->amiga.transWave.enable&&transWaveInd.reversed!=2) {
|
if (ins->amiga.transWave.enable&&transWaveInd.reversed!=DivInstrumentAmiga::DivReverseMode::DIV_REVERSE_DEFAULT) {
|
||||||
reversed=transWaveInd.reversed;
|
reversed=transWaveInd.reversed;
|
||||||
} else if (ins->amiga.useNoteMap&¬eMapind.reversed!=2) {
|
} else if (ins->amiga.useNoteMap&¬eMapind.reversed!=DivInstrumentAmiga::DivReverseMode::DIV_REVERSE_DEFAULT) {
|
||||||
reversed=noteMapind.reversed;
|
reversed=noteMapind.reversed;
|
||||||
}
|
}
|
||||||
const unsigned int start=offES5506<<10;
|
const unsigned int start=offES5506<<10;
|
||||||
|
@ -984,9 +984,9 @@ int DivPlatformES5506::dispatch(DivCommand c) {
|
||||||
}
|
}
|
||||||
// get reversed
|
// get reversed
|
||||||
bool reversed=ins->amiga.reversed;
|
bool reversed=ins->amiga.reversed;
|
||||||
if (ins->amiga.transWave.enable&&transWaveInd.reversed!=2) {
|
if (ins->amiga.transWave.enable&&transWaveInd.reversed!=DivInstrumentAmiga::DivReverseMode::DIV_REVERSE_DEFAULT) {
|
||||||
reversed=transWaveInd.reversed;
|
reversed=transWaveInd.reversed;
|
||||||
} else if (ins->amiga.useNoteMap&¬eMapind.reversed!=2) {
|
} else if (ins->amiga.useNoteMap&¬eMapind.reversed!=DivInstrumentAmiga::DivReverseMode::DIV_REVERSE_DEFAULT) {
|
||||||
reversed=noteMapind.reversed;
|
reversed=noteMapind.reversed;
|
||||||
}
|
}
|
||||||
const unsigned int start=offES5506<<10;
|
const unsigned int start=offES5506<<10;
|
||||||
|
|
|
@ -3765,7 +3765,10 @@ void FurnaceGUI::drawInsEdit() {
|
||||||
ImGui::EndCombo();
|
ImGui::EndCombo();
|
||||||
}
|
}
|
||||||
ImGui::BeginDisabled(ins->amiga.useWave);
|
ImGui::BeginDisabled(ins->amiga.useWave);
|
||||||
P(ImGui::Checkbox("Reversed playback",&ins->amiga.reversed));
|
bool reversed=ins->amiga.reversed==DivInstrumentAmiga::DivReverseMode::DIV_REVERSE_ENABLE;
|
||||||
|
if (ImGui::Checkbox("Reversed playback",&reversed)) { PARAMETER
|
||||||
|
ins->amiga.reversed=reversed?DivInstrumentAmiga::DivReverseMode::DIV_REVERSE_ENABLE:DivInstrumentAmiga::DivReverseMode::DIV_REVERSE_DISABLE;
|
||||||
|
}
|
||||||
ImGui::EndDisabled();
|
ImGui::EndDisabled();
|
||||||
// Wavetable
|
// Wavetable
|
||||||
if (ins->type==DIV_INS_AMIGA || ins->type==DIV_INS_SNES) {
|
if (ins->type==DIV_INS_AMIGA || ins->type==DIV_INS_SNES) {
|
||||||
|
@ -3850,14 +3853,14 @@ void FurnaceGUI::drawInsEdit() {
|
||||||
}
|
}
|
||||||
*/
|
*/
|
||||||
ImGui::TableNextColumn();
|
ImGui::TableNextColumn();
|
||||||
if (ImGui::RadioButton(fmt::sprintf("Disable##SampleMap_Reversed_Disable_%d",i).c_str(),sampleMap.reversed==0)) { MARK_MODIFIED
|
if (ImGui::RadioButton(fmt::sprintf("Disable##SampleMap_Reversed_Disable_%d",i).c_str(),sampleMap.reversed==DivInstrumentAmiga::DivReverseMode::DIV_REVERSE_DISABLE)) { MARK_MODIFIED
|
||||||
sampleMap.reversed=0;
|
sampleMap.reversed=DivInstrumentAmiga::DivReverseMode::DIV_REVERSE_DISABLE;
|
||||||
}
|
}
|
||||||
if (ImGui::RadioButton(fmt::sprintf("Enable##SampleMap_Reversed_Enable_%d",i).c_str(),sampleMap.reversed==1)) { MARK_MODIFIED
|
if (ImGui::RadioButton(fmt::sprintf("Enable##SampleMap_Reversed_Enable_%d",i).c_str(),sampleMap.reversed==DivInstrumentAmiga::DivReverseMode::DIV_REVERSE_ENABLE)) { MARK_MODIFIED
|
||||||
sampleMap.reversed=1;
|
sampleMap.reversed=DivInstrumentAmiga::DivReverseMode::DIV_REVERSE_ENABLE;
|
||||||
}
|
}
|
||||||
if (ImGui::RadioButton(fmt::sprintf("Use instrument setting##SampleMap_Reversed_Default_%d",i).c_str(),sampleMap.reversed==2)) { MARK_MODIFIED
|
if (ImGui::RadioButton(fmt::sprintf("Use instrument setting##SampleMap_Reversed_Default_%d",i).c_str(),sampleMap.reversed==DivInstrumentAmiga::DivReverseMode::DIV_REVERSE_DEFAULT)) { MARK_MODIFIED
|
||||||
sampleMap.reversed=2;
|
sampleMap.reversed=DivInstrumentAmiga::DivReverseMode::DIV_REVERSE_DEFAULT;
|
||||||
}
|
}
|
||||||
ImGui::PopID();
|
ImGui::PopID();
|
||||||
}
|
}
|
||||||
|
@ -3962,10 +3965,10 @@ void FurnaceGUI::drawInsEdit() {
|
||||||
if (ImGui::Selectable(id.c_str(),transWaveMap.ind==j)) { PARAMETER
|
if (ImGui::Selectable(id.c_str(),transWaveMap.ind==j)) { PARAMETER
|
||||||
transWaveMap.ind=j;
|
transWaveMap.ind=j;
|
||||||
if (transWaveMap.loopStart<0 || transWaveMap.loopStart>(int)(s->samples)) {
|
if (transWaveMap.loopStart<0 || transWaveMap.loopStart>(int)(s->samples)) {
|
||||||
transWaveMap.loopStart=s->loopStart;
|
transWaveMap.loopStart=CLAMP(s->loopStart,0,s->samples);
|
||||||
}
|
}
|
||||||
if (transWaveMap.loopEnd<0 || transWaveMap.loopEnd>(int)(s->samples)) {
|
if (transWaveMap.loopEnd<0 || transWaveMap.loopEnd>(int)(s->samples)) {
|
||||||
transWaveMap.loopEnd=s->loopEnd;
|
transWaveMap.loopEnd=CLAMP(s->loopEnd,0,s->samples);
|
||||||
}
|
}
|
||||||
transWaveMap.updateSize(s->samples,transWaveMap.loopStart,transWaveMap.loopEnd);
|
transWaveMap.updateSize(s->samples,transWaveMap.loopStart,transWaveMap.loopEnd);
|
||||||
if (ins->amiga.transWave.sliceEnable && (int)i==ins->amiga.transWave.ind) {
|
if (ins->amiga.transWave.sliceEnable && (int)i==ins->amiga.transWave.ind) {
|
||||||
|
@ -4019,14 +4022,14 @@ void FurnaceGUI::drawInsEdit() {
|
||||||
transWaveMap.loopMode=DIV_SAMPLE_LOOP_MAX;
|
transWaveMap.loopMode=DIV_SAMPLE_LOOP_MAX;
|
||||||
}
|
}
|
||||||
ImGui::TableNextColumn();
|
ImGui::TableNextColumn();
|
||||||
if (ImGui::RadioButton(fmt::sprintf("Disable##TransWaveMap_Reversed_Disable_%d",i).c_str(),transWaveMap.reversed==0)) { MARK_MODIFIED
|
if (ImGui::RadioButton(fmt::sprintf("Disable##TransWaveMap_Reversed_Disable_%d",i).c_str(),transWaveMap.reversed==DivInstrumentAmiga::DivReverseMode::DIV_REVERSE_DISABLE)) { MARK_MODIFIED
|
||||||
transWaveMap.reversed=0;
|
transWaveMap.reversed=DivInstrumentAmiga::DivReverseMode::DIV_REVERSE_DISABLE;
|
||||||
}
|
}
|
||||||
if (ImGui::RadioButton(fmt::sprintf("Enable##TransWaveMap_Reversed_Enable_%d",i).c_str(),transWaveMap.reversed==1)) { MARK_MODIFIED
|
if (ImGui::RadioButton(fmt::sprintf("Enable##TransWaveMap_Reversed_Enable_%d",i).c_str(),transWaveMap.reversed==DivInstrumentAmiga::DivReverseMode::DIV_REVERSE_ENABLE)) { MARK_MODIFIED
|
||||||
transWaveMap.reversed=1;
|
transWaveMap.reversed=DivInstrumentAmiga::DivReverseMode::DIV_REVERSE_ENABLE;
|
||||||
}
|
}
|
||||||
if (ImGui::RadioButton(fmt::sprintf("Use instrument setting##TransWaveMap_Reversed_Default_%d",i).c_str(),transWaveMap.reversed==2)) { MARK_MODIFIED
|
if (ImGui::RadioButton(fmt::sprintf("Use instrument setting##TransWaveMap_Reversed_Default_%d",i).c_str(),transWaveMap.reversed==DivInstrumentAmiga::DivReverseMode::DIV_REVERSE_DEFAULT)) { MARK_MODIFIED
|
||||||
transWaveMap.reversed=2;
|
transWaveMap.reversed=DivInstrumentAmiga::DivReverseMode::DIV_REVERSE_DEFAULT;
|
||||||
}
|
}
|
||||||
ImGui::EndDisabled();
|
ImGui::EndDisabled();
|
||||||
ImGui::PopID();
|
ImGui::PopID();
|
||||||
|
@ -4044,8 +4047,6 @@ void FurnaceGUI::drawInsEdit() {
|
||||||
drawMacros(macroList);
|
drawMacros(macroList);
|
||||||
ImGui::EndTabItem();
|
ImGui::EndTabItem();
|
||||||
}
|
}
|
||||||
ImGui::EndDisabled();
|
|
||||||
ImGui::EndTabItem();
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (ins->type==DIV_INS_N163) if (ImGui::BeginTabItem(settings.c163Name.c_str())) {
|
if (ins->type==DIV_INS_N163) if (ImGui::BeginTabItem(settings.c163Name.c_str())) {
|
||||||
|
|
Loading…
Reference in New Issue