From 75702e36ddb30ca2924cb42dc0b44ddfbdac36e5 Mon Sep 17 00:00:00 2001 From: Bent Bisballe Nyeng Date: Sun, 23 Feb 2014 09:41:01 +0100 Subject: Apllied new multichannel audiofile feature patch from John Hammen. --- src/instrumentparser.cc | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) (limited to 'src/instrumentparser.cc') 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); -- cgit v1.2.3