mirror of
https://github.com/tildearrow/furnace.git
synced 2024-11-23 13:05:11 +00:00
remove extension when loading ins from file
This commit is contained in:
parent
271b3fb0fe
commit
1a69794efe
1 changed files with 14 additions and 5 deletions
|
@ -1151,15 +1151,24 @@ enum DivInsFormats {
|
|||
DIV_INSFORMAT_BTI
|
||||
};
|
||||
|
||||
bool DivEngine::addInstrumentFromFile(const char *path) {
|
||||
bool DivEngine::addInstrumentFromFile(const char* path) {
|
||||
warnings="";
|
||||
|
||||
const char* pathRedux=strrchr(path,DIR_SEPARATOR);
|
||||
if (pathRedux==NULL) {
|
||||
pathRedux="Instrument";
|
||||
pathRedux=path;
|
||||
} else {
|
||||
pathRedux++;
|
||||
}
|
||||
String stripPath;
|
||||
const char* pathReduxEnd=strrchr(pathRedux,'.');
|
||||
if (pathReduxEnd==NULL) {
|
||||
stripPath=pathRedux;
|
||||
} else {
|
||||
for (const char* i=pathRedux; pathRedux!=pathReduxEnd && (*i); i++) {
|
||||
stripPath+=*i;
|
||||
}
|
||||
}
|
||||
|
||||
FILE* f=ps_fopen(path,"rb");
|
||||
if (f==NULL) {
|
||||
|
@ -1284,7 +1293,7 @@ bool DivEngine::addInstrumentFromFile(const char *path) {
|
|||
return false;
|
||||
}
|
||||
|
||||
ins->name=pathRedux;
|
||||
ins->name=stripPath;
|
||||
|
||||
if (version>=11) { // 1.0
|
||||
try {
|
||||
|
@ -1517,7 +1526,7 @@ bool DivEngine::addInstrumentFromFile(const char *path) {
|
|||
reader.seek(0,SEEK_SET);
|
||||
|
||||
ins->type=DIV_INS_FM;
|
||||
ins->name=pathRedux;
|
||||
ins->name=stripPath;
|
||||
|
||||
ins->fm.alg=reader.readC();
|
||||
ins->fm.fb=reader.readC();
|
||||
|
@ -1549,7 +1558,7 @@ bool DivEngine::addInstrumentFromFile(const char *path) {
|
|||
reader.seek(0,SEEK_SET);
|
||||
|
||||
ins->type=DIV_INS_FM;
|
||||
ins->name=pathRedux;
|
||||
ins->name=stripPath;
|
||||
|
||||
ins->fm.alg=reader.readC();
|
||||
ins->fm.fb=reader.readC();
|
||||
|
|
Loading…
Reference in a new issue