Browse Source

Configurable client names

master
Peter Nelson 12 years ago
parent
commit
8b28c2df24
  1. 6
      cvbase.h
  2. 2
      cvin.cpp
  3. 2
      cvout.cpp
  4. 2
      example.cfg
  5. 13
      jm2cv.cpp

6
cvbase.h

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

2
cvin.cpp

@ -99,7 +99,7 @@ void CVIn::start()
m_ports = new jack_port_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);

2
cvout.cpp

@ -125,7 +125,7 @@ void CVOut::start()
m_ports = new jack_port_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);

2
example.cfg

@ -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 pitch 0 pb -1 -1 0 16383 -1.0 1.0 10
cvin_name bank1_in
cvout_name some_other_name

13
jm2cv.cpp

@ -21,13 +21,22 @@ bool read_config(const char *filename)
while (!feof(f)) {
line++;
char buf[80];
char buf[80], name[80];
fgets(buf, sizeof buf, f);
/* Ignore comments */
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;
float crl, cru;
float latency;

Loading…
Cancel
Save