Configurable client names

master
Peter Nelson 2010-01-26 09:24:54 +00:00
parent 2ea6303c3b
commit 8b28c2df24
5 changed files with 21 additions and 4 deletions

View File

@ -10,6 +10,7 @@ protected:
MappingList m_mapping_list; MappingList m_mapping_list;
bool m_ready; bool m_ready;
tick_t m_tick; tick_t m_tick;
std::string m_config_name;
sample_t **m_buffers; sample_t **m_buffers;
@ -28,6 +29,11 @@ public:
{ {
close(); close();
} }
void set_name(const char *name)
{
m_config_name = name;
}
}; };
#endif // CVBASE_H #endif // CVBASE_H

View File

@ -99,7 +99,7 @@ void CVIn::start()
m_ports = new jack_port_t *[m_mapping_list.size()]; m_ports = new jack_port_t *[m_mapping_list.size()];
m_buffers = new sample_t *[m_mapping_list.size()]; m_buffers = new sample_t *[m_mapping_list.size()];
open("m2cv_in"); open(m_config_name.empty() ? "m2cv_in" : m_config_name.c_str());
m_midi_out = port_register("midi_out", JACK_DEFAULT_MIDI_TYPE, JackPortIsOutput, 0); m_midi_out = port_register("midi_out", JACK_DEFAULT_MIDI_TYPE, JackPortIsOutput, 0);

View File

@ -125,7 +125,7 @@ void CVOut::start()
m_ports = new jack_port_t *[m_mapping_list.size()]; m_ports = new jack_port_t *[m_mapping_list.size()];
m_buffers = new sample_t *[m_mapping_list.size()]; m_buffers = new sample_t *[m_mapping_list.size()];
open("m2cv_out"); open(m_config_name.empty() ? "m2cv_out" : m_config_name.c_str());
m_midi_in = port_register("midi_in", JACK_DEFAULT_MIDI_TYPE, JackPortIsInput, 0); m_midi_in = port_register("midi_in", JACK_DEFAULT_MIDI_TYPE, JackPortIsInput, 0);

View File

@ -48,3 +48,5 @@ cvin exp1 0 nrpn 0 5 0 16383 -1.0 1.0 10
cvin exp2 0 nrpn7 0 6 0 127 -1.0 1.0 10 cvin exp2 0 nrpn7 0 6 0 127 -1.0 1.0 10
cvin pitch 0 pb -1 -1 0 16383 -1.0 1.0 10 cvin pitch 0 pb -1 -1 0 16383 -1.0 1.0 10
cvin_name bank1_in
cvout_name some_other_name

View File

@ -21,13 +21,22 @@ bool read_config(const char *filename)
while (!feof(f)) { while (!feof(f)) {
line++; line++;
char buf[80]; char buf[80], name[80];
fgets(buf, sizeof buf, f); fgets(buf, sizeof buf, f);
/* Ignore comments */ /* Ignore comments */
if (buf[0] == '#') continue; if (buf[0] == '#') continue;
char dir[80], name[80], type[80]; /* Try parsing port name entries */
if (sscanf(buf, "cvin_name %s", name) == 1) {
cvin.set_name(name);
continue;
} else if (sscanf(buf, "cvout_name %s", name) == 1) {
cvout.set_name(name);
continue;
}
char dir[80], type[80];
int channel, ccmsb, cclsb, mrl, mru; int channel, ccmsb, cclsb, mrl, mru;
float crl, cru; float crl, cru;
float latency; float latency;