summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/channel.h2
-rw-r--r--src/drumgizmo.cc2
-rw-r--r--src/drumkit.cc33
-rw-r--r--src/drumkit.h13
-rw-r--r--src/drumkitparser.cc70
-rw-r--r--src/instrument.cc18
-rw-r--r--src/instrument.h6
-rw-r--r--src/instrumentparser.cc5
-rw-r--r--src/powerlist.cc8
-rw-r--r--src/sample.cc4
-rw-r--r--src/sample.h4
11 files changed, 27 insertions, 138 deletions
diff --git a/src/channel.h b/src/channel.h
index b473a97..9439db4 100644
--- a/src/channel.h
+++ b/src/channel.h
@@ -40,8 +40,6 @@ public:
Channel(std::string id = "");
std::string id;
- std::string name;
- std::string microphone;
channel_t num;
};
diff --git a/src/drumgizmo.cc b/src/drumgizmo.cc
index ae3b8e4..0ce1f09 100644
--- a/src/drumgizmo.cc
+++ b/src/drumgizmo.cc
@@ -63,9 +63,7 @@ bool DrumGizmo::loadkit(std::string file)
// Delete all Channels, Instruments, Samples and AudioFiles.
kit.clear();
- printf("1\n");
DrumKitParser parser(file, kit);
- printf("2\n");
if(parser.parse()) {
ERR(drumgizmo, "Drumkit parser failed: %s\n", file.c_str());
diff --git a/src/drumkit.cc b/src/drumkit.cc
index 76342d5..cc3878a 100644
--- a/src/drumkit.cc
+++ b/src/drumkit.cc
@@ -48,8 +48,7 @@ void DrumKit::clear()
channels.clear();
- _name = "";
- _description = "";
+ _id = "";
}
bool DrumKit::isValid()
@@ -62,36 +61,6 @@ std::string DrumKit::file()
return _file;
}
-std::string DrumKit::name()
-{
- return _name;
-}
-
-std::string DrumKit::description()
-{
- return _description;
-}
-
-std::string DrumKit::notes()
-{
- return _notes;
-}
-
-std::string DrumKit::author()
-{
- return _author;
-}
-
-std::string DrumKit::email()
-{
- return _email;
-}
-
-std::string DrumKit::website()
-{
- return _website;
-}
-
#ifdef TEST_DRUMKIT
//Additional dependency files
//deps:
diff --git a/src/drumkit.h b/src/drumkit.h
index f72ff50..a1d5b49 100644
--- a/src/drumkit.h
+++ b/src/drumkit.h
@@ -42,13 +42,6 @@ public:
~DrumKit();
std::string file();
-
- std::string name();
- std::string description();
- std::string notes();
- std::string author();
- std::string email();
- std::string website();
Instruments instruments;
Channels channels;
@@ -62,12 +55,8 @@ private:
std::string _file;
- std::string _name;
+ std::string _id;
std::string _description;
- std::string _notes;
- std::string _author;
- std::string _email;
- std::string _website;
VersionStr _version;
};
diff --git a/src/drumkitparser.cc b/src/drumkitparser.cc
index e426852..fc33a1b 100644
--- a/src/drumkitparser.cc
+++ b/src/drumkitparser.cc
@@ -140,52 +140,22 @@ void DrumKitParser::endTag(std::string name)
{
if(in_metadata) {
if(name == "name") {
- if(data != "") {
- kit._name = data;
- } else {
- kit._name = "No drumkit " + name + " found";
- }
- meta.name = kit._name;
+ meta.name = data;
}
if(name == "description") {
- if(data != "") {
- kit._description = data;
- } else {
- kit._description = "No drumkit " + name + " found";
- }
- meta.description = kit._description;
+ meta.description = data;
}
if(name == "notes") {
- if(data != "") {
- kit._notes = data;
- } else {
- kit._notes = "No drumkit " + name + " found";
- }
- meta.notes = kit._notes;
+ meta.notes = data;
}
if(name == "author") {
- if(data != "") {
- kit._author = data;
- } else {
- kit._author = "No drumkit " + name + " found";
- }
- meta.author = kit._author;
+ meta.author = data;
}
if(name == "email") {
- if(data != "") {
- kit._email = data;
- } else {
- kit._email = "No drumkit " + name + " found";
- }
- meta.email = kit._email;
+ meta.email = data;
}
if(name == "website") {
- if(data != "") {
- kit._website = data;
- } else {
- kit._website = "No drumkit " + name + " found";
- }
- meta.website = kit._website;
+ meta.website = data;
}
}
@@ -195,25 +165,15 @@ void DrumKitParser::endTag(std::string name)
if(in_channel) {
if(name == "name") {
- if(data != "") {
- ch_name = data;
- } else {
- ch_name = "No channel " + name + " found";
- }
+ ch_name = data;
}
if(name == "microphone") {
- if(data != "") {
- ch_microphone = data;
- } else {
- ch_microphone = "No channel " + name + " found";
- }
+ ch_microphone = data;
}
}
if(name == "channel") {
Channel c(ch_id);
- c.name = ch_name;
- c.microphone = ch_microphone;
c.num = kit.channels.size();
kit.channels.push_back(c);
@@ -224,27 +184,17 @@ void DrumKitParser::endTag(std::string name)
if(in_instrument) {
if(name == "name") {
- if(data != "") {
- instr_name = data;
- } else {
- instr_name = "No instrument " + name + " found";
- }
+ instr_name = data;
}
if(name == "description") {
- if(data != "") {
- instr_description = data;
- } else {
- instr_description = "No instrument " + name + " found";
- }
+ instr_description = data;
}
}
if(name == "instrument") {
Instrument *i = new Instrument();
- i->setName(instr_name);
- i->setDescription(instr_description);
i->setGroup(instr_group);
// Instrument &i = kit.instruments[kit.instruments.size() - 1];
InstrumentParser parser(path + "/" + instr_file, *i);
diff --git a/src/instrument.cc b/src/instrument.cc
index 12d5af3..82c9a58 100644
--- a/src/instrument.cc
+++ b/src/instrument.cc
@@ -126,29 +126,19 @@ std::string Instrument::id()
return _id;
}
-std::string Instrument::description()
-{
- return _description;
-}
-
std::string Instrument::group()
{
return _group;
}
-void Instrument::setGroup(std::string g)
-{
- _group = g;
-}
-
-void Instrument::setName(std::string n)
+void Instrument::setId(std::string id)
{
- _name = n;
+ _id = id;
}
-void Instrument::setDescription(std::string d)
+void Instrument::setGroup(std::string group)
{
- _description = d;
+ _group = group;
}
#ifdef TEST_INSTRUMENT
diff --git a/src/instrument.h b/src/instrument.h
index 46e95f9..9708f00 100644
--- a/src/instrument.h
+++ b/src/instrument.h
@@ -50,8 +50,7 @@ public:
std::string group();
void setGroup(std::string group);
- void setDescription(std::string description);
- void setName(std::string name);
+ void setId(std::string id);
// std::map<std::string, std::string> channelmap;
std::vector<AudioFile*> audiofiles;
@@ -62,8 +61,7 @@ private:
void *magic;
std::string _id;
- std::string _name;
- std::string _description;
+ //std::string _name;
std::string _group;
VersionStr version;
diff --git a/src/instrumentparser.cc b/src/instrumentparser.cc
index 8d097e9..c26ffe5 100644
--- a/src/instrumentparser.cc
+++ b/src/instrumentparser.cc
@@ -55,9 +55,6 @@ void InstrumentParser::startTag(std::string name,
if(attr.find("id") != attr.end())
instrument._id = attr["id"];
- if(attr.find("description") != attr.end())
- instrument._description = attr["description"];
-
if(attr.find("version") != attr.end()) {
try {
instrument.version = VersionStr(attr["version"]);
@@ -149,7 +146,7 @@ void InstrumentParser::startTag(std::string name,
Sample *sample = NULL;
std::vector<Sample *>::iterator i = instrument.samplelist.begin();
while(i != instrument.samplelist.end()) {
- if((*i)->name == attr["name"]) {
+ if((*i)->id == attr["id"]) {
sample = *i;
break;
}
diff --git a/src/powerlist.cc b/src/powerlist.cc
index 6fc77ad..7386237 100644
--- a/src/powerlist.cc
+++ b/src/powerlist.cc
@@ -134,7 +134,7 @@ Channel *PowerList::getMasterChannel()
std::map<Channel *, int>::iterator ci = count.begin();
while(ci != count.end()) {
if(ci->second > max_count &&
- strstr(ci->first->name.c_str(), "Alesis") == 0) {
+ strstr(ci->first->id.c_str(), "Alesis") == 0) {
master = ci->first;
max_count = ci->second;
}
@@ -154,7 +154,7 @@ void PowerList::finalise()
return; // This should not happen...
}
- DEBUG(rand, "Master channel: %s\n", master_channel->name.c_str());
+ DEBUG(rand, "Master channel: %s\n", master_channel->id.c_str());
#endif/*AUTO_CALCULATE_POWER*/
std::vector<PowerListItem>::iterator si = samples.begin();
@@ -163,13 +163,13 @@ void PowerList::finalise()
Sample *sample = item.sample;
#ifdef AUTO_CALCULATE_POWER
- DEBUG(rand, "Sample: %s\n", sample->name.c_str());
+ DEBUG(rand, "Sample: %s\n", sample->id.c_str());
AudioFile *master = NULL;
AudioFiles::iterator afi = sample->audiofiles.begin();
while(afi != sample->audiofiles.end()) {
- if(afi->first->name == master_channel->name) {
+ if(afi->first->id == master_channel->id) {
master = afi->second;
break;
}
diff --git a/src/sample.cc b/src/sample.cc
index d50137d..aaa7c4b 100644
--- a/src/sample.cc
+++ b/src/sample.cc
@@ -31,9 +31,9 @@
#include <sndfile.h>
-Sample::Sample(std::string name, float power)
+Sample::Sample(std::string id, float power)
{
- this->name = name;
+ this->id = id;
this->power = power;
}
diff --git a/src/sample.h b/src/sample.h
index 61a3468..025b8fe 100644
--- a/src/sample.h
+++ b/src/sample.h
@@ -40,7 +40,7 @@ class Sample {
friend class InstrumentParser;
friend class PowerList;
public:
- Sample(std::string name, float power);
+ Sample(std::string id, float power);
~Sample();
AudioFile *getAudioFile(InstrumentChannel *c);
@@ -48,7 +48,7 @@ public:
private:
void addAudioFile(InstrumentChannel *c, AudioFile *a);
- std::string name;
+ std::string id;
float power;
AudioFiles audiofiles;
};