use good default instrument when adding ins
This commit is contained in:
parent
79fa8f1d02
commit
4195715dc0
|
@ -742,11 +742,9 @@ DivInstrument* DivEngine::getIns(int index, DivInstrumentType fallbackType) {
|
||||||
if (index<0 || index>=song.insLen) {
|
if (index<0 || index>=song.insLen) {
|
||||||
switch (fallbackType) {
|
switch (fallbackType) {
|
||||||
case DIV_INS_OPLL:
|
case DIV_INS_OPLL:
|
||||||
logV("returning the OPLL null instrument");
|
|
||||||
return &song.nullInsOPLL;
|
return &song.nullInsOPLL;
|
||||||
break;
|
break;
|
||||||
case DIV_INS_OPL:
|
case DIV_INS_OPL:
|
||||||
logV("returning the OPL null instrument");
|
|
||||||
return &song.nullInsOPL;
|
return &song.nullInsOPL;
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
|
@ -1310,8 +1308,19 @@ int DivEngine::addInstrument(int refChan) {
|
||||||
BUSY_BEGIN;
|
BUSY_BEGIN;
|
||||||
DivInstrument* ins=new DivInstrument;
|
DivInstrument* ins=new DivInstrument;
|
||||||
int insCount=(int)song.ins.size();
|
int insCount=(int)song.ins.size();
|
||||||
|
DivInstrumentType prefType=getPreferInsType(refChan);
|
||||||
|
switch (prefType) {
|
||||||
|
case DIV_INS_OPLL:
|
||||||
|
*ins=song.nullInsOPLL;
|
||||||
|
break;
|
||||||
|
case DIV_INS_OPL:
|
||||||
|
*ins=song.nullInsOPL;
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
break;
|
||||||
|
}
|
||||||
ins->name=fmt::sprintf("Instrument %d",insCount);
|
ins->name=fmt::sprintf("Instrument %d",insCount);
|
||||||
ins->type=getPreferInsType(refChan);
|
ins->type=prefType;
|
||||||
saveLock.lock();
|
saveLock.lock();
|
||||||
song.ins.push_back(ins);
|
song.ins.push_back(ins);
|
||||||
song.insLen=insCount+1;
|
song.insLen=insCount+1;
|
||||||
|
|
|
@ -422,6 +422,7 @@ struct DivSong {
|
||||||
|
|
||||||
nullInsOPLL.fm.opllPreset=7;
|
nullInsOPLL.fm.opllPreset=7;
|
||||||
nullInsOPLL.fm.op[1].tl=0;
|
nullInsOPLL.fm.op[1].tl=0;
|
||||||
|
nullInsOPLL.name="This is a bug! Report!";
|
||||||
|
|
||||||
nullInsOPL.fm.alg=0;
|
nullInsOPL.fm.alg=0;
|
||||||
nullInsOPL.fm.fb=7;
|
nullInsOPL.fm.fb=7;
|
||||||
|
@ -434,6 +435,7 @@ struct DivSong {
|
||||||
nullInsOPL.fm.op[1].dr=3;
|
nullInsOPL.fm.op[1].dr=3;
|
||||||
nullInsOPL.fm.op[1].rr=12;
|
nullInsOPL.fm.op[1].rr=12;
|
||||||
nullInsOPL.fm.op[1].mult=1;
|
nullInsOPL.fm.op[1].mult=1;
|
||||||
|
nullInsOPL.name="This is a bug! Report!";
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue