Check port names for uniqueness
parent
8b8e5e4e97
commit
5753b1f6ff
|
@ -10,6 +10,7 @@ pkg_check_modules(JACK jack>=0.118)
|
||||||
SET(SOURCES
|
SET(SOURCES
|
||||||
client.cpp
|
client.cpp
|
||||||
client.h
|
client.h
|
||||||
|
cvbase.cpp
|
||||||
cvbase.h
|
cvbase.h
|
||||||
cvin.cpp
|
cvin.cpp
|
||||||
cvin.h
|
cvin.h
|
||||||
|
|
|
@ -0,0 +1,12 @@
|
||||||
|
#include <cstring>
|
||||||
|
#include "cvbase.h"
|
||||||
|
|
||||||
|
bool CVBase::find(const char *name) const
|
||||||
|
{
|
||||||
|
MappingList::const_iterator it;
|
||||||
|
for (it = m_mapping_list.begin(); it != m_mapping_list.end(); ++it) {
|
||||||
|
const Mapping *m = &(*it);
|
||||||
|
if (!strcmp(m->name.c_str(), name)) return true;
|
||||||
|
}
|
||||||
|
return false;
|
||||||
|
}
|
2
cvbase.h
2
cvbase.h
|
@ -22,6 +22,8 @@ public:
|
||||||
m_mapping_list.push_back(m);
|
m_mapping_list.push_back(m);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool find(const char *name) const;
|
||||||
|
|
||||||
void stop()
|
void stop()
|
||||||
{
|
{
|
||||||
close();
|
close();
|
||||||
|
|
|
@ -89,12 +89,20 @@ bool read_config(const char *filename)
|
||||||
std::clog << line << ": MIDI channel " << channel << " must be between -1 and 15." << std::endl;
|
std::clog << line << ": MIDI channel " << channel << " must be between -1 and 15." << std::endl;
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
if (cvout.find(name)) {
|
||||||
|
std::clog << line << ": Name '" << name << "' already defined." << std::endl;
|
||||||
|
continue;
|
||||||
|
}
|
||||||
cvout.add_mapping(Mapping(name, channel, itype, ccmsb, cclsb, mrl, mru, crl, cru, latency, has_lsb));
|
cvout.add_mapping(Mapping(name, channel, itype, ccmsb, cclsb, mrl, mru, crl, cru, latency, has_lsb));
|
||||||
} else if (!strcmp(dir, "cvin")) {
|
} else if (!strcmp(dir, "cvin")) {
|
||||||
if (channel < 0 || channel > 15) {
|
if (channel < 0 || channel > 15) {
|
||||||
std::clog << line << ": MIDI channel " << channel << " must be between 0 and 15." << std::endl;
|
std::clog << line << ": MIDI channel " << channel << " must be between 0 and 15." << std::endl;
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
if (cvin.find(name)) {
|
||||||
|
std::clog << line << ": Name '" << name << "' already defined." << std::endl;
|
||||||
|
continue;
|
||||||
|
}
|
||||||
cvin.add_mapping(Mapping(name, channel, itype, ccmsb, cclsb, mrl, mru, crl, cru, latency, has_lsb));
|
cvin.add_mapping(Mapping(name, channel, itype, ccmsb, cclsb, mrl, mru, crl, cru, latency, has_lsb));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue