summaryrefslogtreecommitdiff
path: root/src/music.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/music.cpp')
-rw-r--r--src/music.cpp17
1 files changed, 14 insertions, 3 deletions
diff --git a/src/music.cpp b/src/music.cpp
index e131c0210..65e35f955 100644
--- a/src/music.cpp
+++ b/src/music.cpp
@@ -125,6 +125,7 @@ bool MusicSet::FillSetDetails(IniFile *ini, const char *path, const char *full_f
this->num_available = 0;
IniGroup *names = ini->GetGroup("names");
IniGroup *catindex = ini->GetGroup("catindex");
+ IniGroup *timingtrim = ini->GetGroup("timingtrim");
for (uint i = 0, j = 1; i < lengthof(this->songinfo); i++) {
const char *filename = this->files[i].filename;
if (names == NULL || StrEmpty(filename)) {
@@ -150,15 +151,16 @@ bool MusicSet::FillSetDetails(IniFile *ini, const char *path, const char *full_f
this->songinfo[i].filetype = MTT_STANDARDMIDI;
}
+ const char *trimmed_filename = filename;
/* As we possibly add a path to the filename and we compare
* on the filename with the path as in the .obm, we need to
* keep stripping path elements until we find a match. */
- for (const char *p = filename; p != NULL; p = strchr(p, PATHSEPCHAR)) {
+ for (; trimmed_filename != NULL; trimmed_filename = strchr(trimmed_filename, PATHSEPCHAR)) {
/* Remove possible double path separator characters from
* the beginning, so we don't start reading e.g. root. */
- while (*p == PATHSEPCHAR) p++;
+ while (*trimmed_filename == PATHSEPCHAR) trimmed_filename++;
- item = names->GetItem(p, false);
+ item = names->GetItem(trimmed_filename, false);
if (item != NULL && !StrEmpty(item->value)) break;
}
@@ -173,6 +175,15 @@ bool MusicSet::FillSetDetails(IniFile *ini, const char *path, const char *full_f
this->num_available++;
this->songinfo[i].tracknr = j++;
+
+ item = timingtrim->GetItem(trimmed_filename, false);
+ if (item != NULL && !StrEmpty(item->value)) {
+ const char *endpos = strchr(item->value, ':');
+ if (endpos != NULL) {
+ this->songinfo[i].override_start = atoi(item->value);
+ this->songinfo[i].override_end = atoi(endpos + 1);
+ }
+ }
}
}
return ret;