From ec9148f95b0c47c8eecf26f6f2f16c1db558a3b9 Mon Sep 17 00:00:00 2001 From: Bent Bisballe Nyeng Date: Thu, 12 Jan 2012 16:30:41 +0100 Subject: Changed instrument list to containing pointers. --- src/drumkitparser.cc | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) (limited to 'src') diff --git a/src/drumkitparser.cc b/src/drumkitparser.cc index 53b0a6d..5d7ae92 100644 --- a/src/drumkitparser.cc +++ b/src/drumkitparser.cc @@ -40,7 +40,7 @@ DrumKitParser::DrumKitParser(const std::string &kitfile, DrumKit &k) fd = fopen(kitfile.c_str(), "r"); - printf("Parsing drumkit in %s\n", kitfile.c_str()); + // printf("Parsing drumkit in %s\n", kitfile.c_str()); if(!fd) return; } @@ -108,10 +108,11 @@ void DrumKitParser::startTag(std::string name, void DrumKitParser::endTag(std::string name) { if(name == "instrument") { - Instrument i; - InstrumentParser parser(path + "/" + instr_file, i); + Instrument *i = new Instrument(); + // Instrument &i = kit.instruments[kit.instruments.size() - 1]; + InstrumentParser parser(path + "/" + instr_file, *i); parser.parse(); - kit.instruments.push_back(i);//[attr["name"]] = i; + kit.instruments.push_back(i); // Assign kit channel numbers to instruments channels. std::vector::iterator ic = parser.channellist.begin(); @@ -126,7 +127,7 @@ void DrumKitParser::endTag(std::string name) } if(c->num == NO_CHANNEL) { printf("Missing channel '%s' in instrument '%s'\n", - c->name.c_str(), i.name().c_str()); + c->name.c_str(), i->name().c_str()); } else { /* printf("Assigned channel '%s' to number %d in instrument '%s'\n", -- cgit v1.2.3