implement channel hiding, names and song comment

This commit is contained in:
tildearrow 2022-02-05 01:48:35 -05:00
parent 2e157d7b22
commit 088e49a3f4
5 changed files with 103 additions and 5 deletions

View file

@ -844,6 +844,7 @@ const DivInstrumentType chanPrefType[42][24]={
const char* DivEngine::getChannelName(int chan) {
if (chan<0 || chan>chans) return "??";
if (!song.chanName[chan].empty()) return song.chanName[chan].c_str();
switch (sysOfChan[chan]) {
case DIV_SYSTEM_NULL: case DIV_SYSTEM_YMU759:
return chanNames[0][dispatchChanOfChan[chan]];
@ -974,6 +975,7 @@ const char* DivEngine::getChannelName(int chan) {
const char* DivEngine::getChannelShortName(int chan) {
if (chan<0 || chan>chans) return "??";
if (!song.chanShortName[chan].empty()) return song.chanShortName[chan].c_str();
switch (sysOfChan[chan]) {
case DIV_SYSTEM_NULL: case DIV_SYSTEM_YMU759:
return chanShortNames[0][dispatchChanOfChan[chan]];
@ -2167,6 +2169,26 @@ bool DivEngine::loadFur(unsigned char* file, size_t len) {
ds.pat[i].effectRows=reader.readC();
}
if (ds.version>=39) {
for (int i=0; i<tchans; i++) {
song.chanShow[i]=reader.readC();
}
for (int i=0; i<tchans; i++) {
song.chanCollapse[i]=reader.readC();
}
for (int i=0; i<tchans; i++) {
song.chanName[i]=reader.readString();
}
for (int i=0; i<tchans; i++) {
song.chanShortName[i]=reader.readString();
}
song.notes=reader.readString();
}
// read instruments
for (int i=0; i<ds.insLen; i++) {
DivInstrument* ins=new DivInstrument;
@ -2535,6 +2557,24 @@ SafeWriter* DivEngine::saveFur() {
w->writeC(song.pat[i].effectRows);
}
for (int i=0; i<chans; i++) {
w->writeC(song.chanShow[i]);
}
for (int i=0; i<chans; i++) {
w->writeC(song.chanCollapse[i]);
}
for (int i=0; i<chans; i++) {
w->writeString(song.chanName[i],false);
}
for (int i=0; i<chans; i++) {
w->writeString(song.chanShortName[i],false);
}
w->writeString(song.notes,false);
/// INSTRUMENT
for (int i=0; i<song.insLen; i++) {
DivInstrument* ins=song.ins[i];

View file

@ -11,8 +11,8 @@
#include <map>
#include <queue>
#define DIV_VERSION "0.5.2pre2"
#define DIV_ENGINE_VERSION 38
#define DIV_VERSION "0.5.2pre3"
#define DIV_ENGINE_VERSION 39
enum DivStatusView {
DIV_STATUS_NOTHING=0,

View file

@ -192,6 +192,11 @@ struct DivSong {
// legacy song information
String carrier, composer, vendor, category, writer, arranger, copyright, manGroup, manInfo, createdDate, revisionDate;
// other things
String chanName[DIV_MAX_CHANS];
String chanShortName[DIV_MAX_CHANS];
String notes;
// highlight
unsigned char hilightA, hilightB;
@ -217,6 +222,9 @@ struct DivSong {
std::vector<DivWavetable*> wave;
std::vector<DivSample*> sample;
bool chanShow[DIV_MAX_CHANS];
bool chanCollapse[DIV_MAX_CHANS];
DivInstrument nullIns;
DivWavetable nullWave;
@ -262,6 +270,10 @@ struct DivSong {
systemPan[i]=0;
systemFlags[i]=0;
}
for (int i=0; i<DIV_MAX_CHANS; i++) {
chanShow[i]=true;
chanCollapse[i]=false;
}
system[0]=DIV_SYSTEM_GENESIS;
}
};