add command line option to see song summary
This commit is contained in:
parent
94213d7cda
commit
06ba12b270
|
@ -2307,6 +2307,65 @@ void DivEngine::unmuteAll() {
|
||||||
BUSY_END;
|
BUSY_END;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void DivEngine::dumpSongInfo() {
|
||||||
|
printf(
|
||||||
|
"SONG INFORMATION\n"
|
||||||
|
"- name: %s\n"
|
||||||
|
"- author: %s\n"
|
||||||
|
"- album: %s\n"
|
||||||
|
"- system: %s\n"
|
||||||
|
"- %d ins, %d waves, %d samples\n"
|
||||||
|
"<<<\n%s\n>>>\n\n",
|
||||||
|
song.name.c_str(),
|
||||||
|
song.author.c_str(),
|
||||||
|
song.category.c_str(),
|
||||||
|
song.systemName.c_str(),
|
||||||
|
song.insLen,
|
||||||
|
song.waveLen,
|
||||||
|
song.sampleLen,
|
||||||
|
song.notes.c_str()
|
||||||
|
);
|
||||||
|
|
||||||
|
printf("SUB-SONGS\n");
|
||||||
|
int index=0;
|
||||||
|
for (DivSubSong* i: song.subsong) {
|
||||||
|
printf(
|
||||||
|
"=== %d: %s\n"
|
||||||
|
"<<<\n%s\n>>>\n",
|
||||||
|
index,
|
||||||
|
i->name.c_str(),
|
||||||
|
i->notes.c_str()
|
||||||
|
);
|
||||||
|
index++;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!song.ins.empty()) {
|
||||||
|
printf("\nINSTRUMENTS\n");
|
||||||
|
index=0;
|
||||||
|
for (DivInstrument* i: song.ins) {
|
||||||
|
printf(
|
||||||
|
"- %d: %s\n",
|
||||||
|
index,
|
||||||
|
i->name.c_str()
|
||||||
|
);
|
||||||
|
index++;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!song.sample.empty()) {
|
||||||
|
printf("\nSAMPLES\n");
|
||||||
|
index=0;
|
||||||
|
for (DivSample* i: song.sample) {
|
||||||
|
printf(
|
||||||
|
"- %d: %s\n",
|
||||||
|
index,
|
||||||
|
i->name.c_str()
|
||||||
|
);
|
||||||
|
index++;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
int DivEngine::addInstrument(int refChan, DivInstrumentType fallbackType) {
|
int DivEngine::addInstrument(int refChan, DivInstrumentType fallbackType) {
|
||||||
if (song.ins.size()>=256) return -1;
|
if (song.ins.size()>=256) return -1;
|
||||||
BUSY_BEGIN;
|
BUSY_BEGIN;
|
||||||
|
|
|
@ -881,6 +881,9 @@ class DivEngine {
|
||||||
// get ext value
|
// get ext value
|
||||||
unsigned char getExtValue();
|
unsigned char getExtValue();
|
||||||
|
|
||||||
|
// dump song info to stdout
|
||||||
|
void dumpSongInfo();
|
||||||
|
|
||||||
// is playing
|
// is playing
|
||||||
bool isPlaying();
|
bool isPlaying();
|
||||||
|
|
||||||
|
|
27
src/main.cpp
27
src/main.cpp
|
@ -78,6 +78,8 @@ bool vgmOutDirect=false;
|
||||||
bool safeMode=false;
|
bool safeMode=false;
|
||||||
bool safeModeWithAudio=false;
|
bool safeModeWithAudio=false;
|
||||||
|
|
||||||
|
bool infoMode=false;
|
||||||
|
|
||||||
std::vector<TAParam> params;
|
std::vector<TAParam> params;
|
||||||
|
|
||||||
TAParamResult pHelp(String) {
|
TAParamResult pHelp(String) {
|
||||||
|
@ -161,6 +163,11 @@ TAParamResult pDirect(String val) {
|
||||||
return TA_PARAM_SUCCESS;
|
return TA_PARAM_SUCCESS;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
TAParamResult pInfo(String val) {
|
||||||
|
infoMode=true;
|
||||||
|
return TA_PARAM_SUCCESS;
|
||||||
|
}
|
||||||
|
|
||||||
TAParamResult pLogLevel(String val) {
|
TAParamResult pLogLevel(String val) {
|
||||||
if (val=="trace") {
|
if (val=="trace") {
|
||||||
logLevel=LOGLEVEL_TRACE;
|
logLevel=LOGLEVEL_TRACE;
|
||||||
|
@ -364,6 +371,7 @@ void initParams() {
|
||||||
params.push_back(TAParam("b","binary",false,pBinary,"","set command stream output format to binary"));
|
params.push_back(TAParam("b","binary",false,pBinary,"","set command stream output format to binary"));
|
||||||
params.push_back(TAParam("L","loglevel",true,pLogLevel,"debug|info|warning|error","set the log level (info by default)"));
|
params.push_back(TAParam("L","loglevel",true,pLogLevel,"debug|info|warning|error","set the log level (info by default)"));
|
||||||
params.push_back(TAParam("v","view",true,pView,"pattern|commands|nothing","set visualization (pattern by default)"));
|
params.push_back(TAParam("v","view",true,pView,"pattern|commands|nothing","set visualization (pattern by default)"));
|
||||||
|
params.push_back(TAParam("i","info",false,pInfo,"","get info about a song"));
|
||||||
params.push_back(TAParam("c","console",false,pConsole,"","enable console mode"));
|
params.push_back(TAParam("c","console",false,pConsole,"","enable console mode"));
|
||||||
|
|
||||||
params.push_back(TAParam("l","loops",true,pLoops,"<count>","set number of loops (-1 means loop forever)"));
|
params.push_back(TAParam("l","loops",true,pLoops,"<count>","set number of loops (-1 means loop forever)"));
|
||||||
|
@ -525,9 +533,14 @@ int main(int argc, char** argv) {
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (fileName.empty() && (benchMode || infoMode || outName!="" || vgmOutName!="" || cmdOutName!="")) {
|
||||||
|
logE("provide a file!");
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
|
||||||
#ifdef HAVE_GUI
|
#ifdef HAVE_GUI
|
||||||
if (e.preInit(false)) {
|
if (e.preInit(consoleMode || benchMode || infoMode || outName!="" || vgmOutName!="" || cmdOutName!="")) {
|
||||||
if (consoleMode || benchMode || outName!="" || vgmOutName!="" || cmdOutName!="") {
|
if (consoleMode || benchMode || infoMode || outName!="" || vgmOutName!="" || cmdOutName!="") {
|
||||||
logW("engine wants safe mode, but Furnace GUI is not going to start.");
|
logW("engine wants safe mode, but Furnace GUI is not going to start.");
|
||||||
} else {
|
} else {
|
||||||
safeMode=true;
|
safeMode=true;
|
||||||
|
@ -539,7 +552,7 @@ int main(int argc, char** argv) {
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
if (safeMode && (consoleMode || benchMode || outName!="" || vgmOutName!="" || cmdOutName!="")) {
|
if (safeMode && (consoleMode || benchMode || infoMode || outName!="" || vgmOutName!="" || cmdOutName!="")) {
|
||||||
logE("you can't use safe mode and console/export mode together.");
|
logE("you can't use safe mode and console/export mode together.");
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
@ -548,7 +561,7 @@ int main(int argc, char** argv) {
|
||||||
e.setAudio(DIV_AUDIO_DUMMY);
|
e.setAudio(DIV_AUDIO_DUMMY);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!fileName.empty() && ((!e.getConfBool("tutIntroPlayed",false)) || e.getConfInt("alwaysPlayIntro",0)!=3 || consoleMode || benchMode || outName!="" || vgmOutName!="" || cmdOutName!="")) {
|
if (!fileName.empty() && ((!e.getConfBool("tutIntroPlayed",false)) || e.getConfInt("alwaysPlayIntro",0)!=3 || consoleMode || benchMode || infoMode || outName!="" || vgmOutName!="" || cmdOutName!="")) {
|
||||||
logI("loading module...");
|
logI("loading module...");
|
||||||
FILE* f=ps_fopen(fileName.c_str(),"rb");
|
FILE* f=ps_fopen(fileName.c_str(),"rb");
|
||||||
if (f==NULL) {
|
if (f==NULL) {
|
||||||
|
@ -601,6 +614,12 @@ int main(int argc, char** argv) {
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
if (infoMode) {
|
||||||
|
e.dumpSongInfo();
|
||||||
|
finishLogFile();
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
if (!e.init()) {
|
if (!e.init()) {
|
||||||
if (consoleMode) {
|
if (consoleMode) {
|
||||||
reportError("could not initialize engine!");
|
reportError("could not initialize engine!");
|
||||||
|
|
Loading…
Reference in a new issue