diff options
author | Bent Bisballe Nyeng <deva@aasimon.org> | 2014-02-23 09:41:01 +0100 |
---|---|---|
committer | Bent Bisballe Nyeng <deva@aasimon.org> | 2014-02-23 09:41:01 +0100 |
commit | 75702e36ddb30ca2924cb42dc0b44ddfbdac36e5 (patch) | |
tree | 26054e194ea5370e6428f2384a22126174ecc2ec /src/instrumentparser.cc | |
parent | 89018c1274dcdd396fd708978a29986e12e5a8a7 (diff) |
Apllied new multichannel audiofile feature patch from John Hammen.
Diffstat (limited to 'src/instrumentparser.cc')
-rw-r--r-- | src/instrumentparser.cc | 12 |
1 files changed, 10 insertions, 2 deletions
diff --git a/src/instrumentparser.cc b/src/instrumentparser.cc index 454877f..6580b09 100644 --- a/src/instrumentparser.cc +++ b/src/instrumentparser.cc @@ -97,8 +97,16 @@ void InstrumentParser::startTag(std::string name, DEBUG(instrparser,"Missing required attribute 'channel'.\n"); return; } - - AudioFile *af = new AudioFile(path + "/" + attr["file"]); + int filechannel = 1; // default, override with optional attribute + if(attr.find("filechannel") != attr.end()) { + filechannel = atoi(attr["filechannel"].c_str()); + if(filechannel < 1) { + DEBUG(instrparser,"Invalid value for attribute 'filechannel'.\n"); + filechannel = 1; + } + } + filechannel = filechannel - 1; // 1-based in file, but zero-based internally + AudioFile *af = new AudioFile(path + "/" + attr["file"], filechannel); InstrumentChannel *ch = new InstrumentChannel(attr["channel"]); channellist.push_back(ch); s->addAudioFile(ch, af); |