mirror of
https://github.com/Ardour/ardour.git
synced 2025-12-09 00:04:56 +01:00
FP8: unhardcode IDs and strip-count
This commit is contained in:
parent
0f82302e63
commit
f87e996013
6 changed files with 92 additions and 51 deletions
|
|
@ -354,7 +354,7 @@ FaderPort8::disconnected ()
|
||||||
{
|
{
|
||||||
stop_midi_handling ();
|
stop_midi_handling ();
|
||||||
if (_device_active) {
|
if (_device_active) {
|
||||||
for (uint8_t id = 0; id < 8; ++id) {
|
for (uint8_t id = 0; id < N_STRIPS; ++id) {
|
||||||
_ctrls.strip(id).unset_controllables ();
|
_ctrls.strip(id).unset_controllables ();
|
||||||
}
|
}
|
||||||
_ctrls.all_lights_off ();
|
_ctrls.all_lights_off ();
|
||||||
|
|
@ -937,7 +937,7 @@ FaderPort8::assign_stripables (bool select_only)
|
||||||
|
|
||||||
int n_strips = strips.size();
|
int n_strips = strips.size();
|
||||||
int channel_off = get_channel_off (_ctrls.mix_mode ());
|
int channel_off = get_channel_off (_ctrls.mix_mode ());
|
||||||
channel_off = std::min (channel_off, n_strips - 8);
|
channel_off = std::min (channel_off, n_strips - N_STRIPS);
|
||||||
channel_off = std::max (0, channel_off);
|
channel_off = std::max (0, channel_off);
|
||||||
set_channel_off (_ctrls.mix_mode (), channel_off);
|
set_channel_off (_ctrls.mix_mode (), channel_off);
|
||||||
|
|
||||||
|
|
@ -972,11 +972,11 @@ FaderPort8::assign_stripables (bool select_only)
|
||||||
boost::function<void ()> cb (boost::bind (&FaderPort8::select_strip, this, boost::weak_ptr<Stripable> (*s)));
|
boost::function<void ()> cb (boost::bind (&FaderPort8::select_strip, this, boost::weak_ptr<Stripable> (*s)));
|
||||||
_ctrls.strip(id).set_select_cb (cb);
|
_ctrls.strip(id).set_select_cb (cb);
|
||||||
|
|
||||||
if (++id == 8) {
|
if (++id == N_STRIPS) {
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
for (; id < 8; ++id) {
|
for (; id < N_STRIPS; ++id) {
|
||||||
_ctrls.strip(id).unset_controllables (select_only ? (FP8Strip::CTRL_SELECT | FP8Strip::CTRL_TEXT3) : FP8Strip::CTRL_ALL);
|
_ctrls.strip(id).unset_controllables (select_only ? (FP8Strip::CTRL_SELECT | FP8Strip::CTRL_TEXT3) : FP8Strip::CTRL_ALL);
|
||||||
_ctrls.strip(id).set_periodic_display_mode (FP8Strip::Stripables);
|
_ctrls.strip(id).set_periodic_display_mode (FP8Strip::Stripables);
|
||||||
}
|
}
|
||||||
|
|
@ -1106,7 +1106,7 @@ FaderPort8::assign_processor_ctrls ()
|
||||||
|
|
||||||
int n_parameters = std::max (toggle_params.size(), slider_params.size());
|
int n_parameters = std::max (toggle_params.size(), slider_params.size());
|
||||||
|
|
||||||
_parameter_off = std::min (_parameter_off, n_parameters - 8);
|
_parameter_off = std::min (_parameter_off, n_parameters - N_STRIPS);
|
||||||
_parameter_off = std::max (0, _parameter_off);
|
_parameter_off = std::max (0, _parameter_off);
|
||||||
|
|
||||||
uint8_t id = 0;
|
uint8_t id = 0;
|
||||||
|
|
@ -1130,13 +1130,13 @@ FaderPort8::assign_processor_ctrls ()
|
||||||
_ctrls.strip(id).set_select_controllable (toggle_params[i]->ac);
|
_ctrls.strip(id).set_select_controllable (toggle_params[i]->ac);
|
||||||
_ctrls.strip(id).set_text_line (3, toggle_params[i]->name, true);
|
_ctrls.strip(id).set_text_line (3, toggle_params[i]->name, true);
|
||||||
}
|
}
|
||||||
if (++id == 8) {
|
if (++id == N_STRIPS) {
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// clear remaining
|
// clear remaining
|
||||||
for (; id < 8; ++id) {
|
for (; id < N_STRIPS; ++id) {
|
||||||
_ctrls.strip(id).unset_controllables ();
|
_ctrls.strip(id).unset_controllables ();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -1156,7 +1156,7 @@ FaderPort8::assign_plugin_presets (boost::shared_ptr<PluginInsert> pi)
|
||||||
|
|
||||||
int n_parameters = presets.size ();
|
int n_parameters = presets.size ();
|
||||||
|
|
||||||
_parameter_off = std::min (_parameter_off, n_parameters - 7);
|
_parameter_off = std::min (_parameter_off, n_parameters - (N_STRIPS - 1));
|
||||||
_parameter_off = std::max (0, _parameter_off);
|
_parameter_off = std::max (0, _parameter_off);
|
||||||
Plugin::PresetRecord active = plugin->last_preset ();
|
Plugin::PresetRecord active = plugin->last_preset ();
|
||||||
|
|
||||||
|
|
@ -1177,18 +1177,18 @@ FaderPort8::assign_plugin_presets (boost::shared_ptr<PluginInsert> pi)
|
||||||
_ctrls.strip(id).set_text_line (0, label.substr (0, 9));
|
_ctrls.strip(id).set_text_line (0, label.substr (0, 9));
|
||||||
_ctrls.strip(id).set_text_line (1, label.length () > 9 ? label.substr (9) : "");
|
_ctrls.strip(id).set_text_line (1, label.length () > 9 ? label.substr (9) : "");
|
||||||
_ctrls.strip(id).set_text_line (3, "PRESET", true);
|
_ctrls.strip(id).set_text_line (3, "PRESET", true);
|
||||||
if (++id == 7) {
|
if (++id == (N_STRIPS - 1)) {
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// clear remaining
|
// clear remaining
|
||||||
for (; id < 7; ++id) {
|
for (; id < (N_STRIPS - 1); ++id) {
|
||||||
_ctrls.strip(id).unset_controllables ();
|
_ctrls.strip(id).unset_controllables ();
|
||||||
}
|
}
|
||||||
|
|
||||||
// pin clear-preset to the last slot
|
// pin clear-preset to the last slot
|
||||||
assert (id == 7);
|
assert (id == (N_STRIPS - 1));
|
||||||
_ctrls.strip(id).unset_controllables (FP8Strip::CTRL_ALL & ~FP8Strip::CTRL_TEXT0 & ~FP8Strip::CTRL_TEXT3 & ~FP8Strip::CTRL_SELECT);
|
_ctrls.strip(id).unset_controllables (FP8Strip::CTRL_ALL & ~FP8Strip::CTRL_TEXT0 & ~FP8Strip::CTRL_TEXT3 & ~FP8Strip::CTRL_SELECT);
|
||||||
boost::function<void ()> cb (boost::bind (&FaderPort8::select_plugin_preset, this, SIZE_MAX));
|
boost::function<void ()> cb (boost::bind (&FaderPort8::select_plugin_preset, this, SIZE_MAX));
|
||||||
_ctrls.strip(id).set_select_cb (cb);
|
_ctrls.strip(id).set_select_cb (cb);
|
||||||
|
|
@ -1413,7 +1413,7 @@ FaderPort8::spill_plugins ()
|
||||||
}
|
}
|
||||||
|
|
||||||
int n_plugins = procs.size();
|
int n_plugins = procs.size();
|
||||||
int spillwidth = 8;
|
int spillwidth = N_STRIPS;
|
||||||
bool have_well_known_eq = false;
|
bool have_well_known_eq = false;
|
||||||
bool have_well_known_comp = false;
|
bool have_well_known_comp = false;
|
||||||
|
|
||||||
|
|
@ -1471,7 +1471,7 @@ FaderPort8::spill_plugins ()
|
||||||
}
|
}
|
||||||
|
|
||||||
if (have_well_known_comp) {
|
if (have_well_known_comp) {
|
||||||
assert (id < 8);
|
assert (id < N_STRIPS);
|
||||||
boost::function<void ()> cb (boost::bind (&FaderPort8::select_plugin, this, -2));
|
boost::function<void ()> cb (boost::bind (&FaderPort8::select_plugin, this, -2));
|
||||||
_ctrls.strip(id).unset_controllables (FP8Strip::CTRL_ALL & ~FP8Strip::CTRL_TEXT & ~FP8Strip::CTRL_SELECT);
|
_ctrls.strip(id).unset_controllables (FP8Strip::CTRL_ALL & ~FP8Strip::CTRL_TEXT & ~FP8Strip::CTRL_SELECT);
|
||||||
_ctrls.strip(id).set_select_cb (cb);
|
_ctrls.strip(id).set_select_cb (cb);
|
||||||
|
|
@ -1485,7 +1485,7 @@ FaderPort8::spill_plugins ()
|
||||||
++id;
|
++id;
|
||||||
}
|
}
|
||||||
if (have_well_known_eq) {
|
if (have_well_known_eq) {
|
||||||
assert (id < 8);
|
assert (id < N_STRIPS);
|
||||||
boost::function<void ()> cb (boost::bind (&FaderPort8::select_plugin, this, -1));
|
boost::function<void ()> cb (boost::bind (&FaderPort8::select_plugin, this, -1));
|
||||||
_ctrls.strip(id).unset_controllables (FP8Strip::CTRL_ALL & ~FP8Strip::CTRL_TEXT & ~FP8Strip::CTRL_SELECT);
|
_ctrls.strip(id).unset_controllables (FP8Strip::CTRL_ALL & ~FP8Strip::CTRL_TEXT & ~FP8Strip::CTRL_SELECT);
|
||||||
_ctrls.strip(id).set_select_cb (cb);
|
_ctrls.strip(id).set_select_cb (cb);
|
||||||
|
|
@ -1498,7 +1498,7 @@ FaderPort8::spill_plugins ()
|
||||||
_ctrls.strip(id).set_text_line (3, "");
|
_ctrls.strip(id).set_text_line (3, "");
|
||||||
++id;
|
++id;
|
||||||
}
|
}
|
||||||
assert (id == 8);
|
assert (id == N_STRIPS);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* ****************************************************************************
|
/* ****************************************************************************
|
||||||
|
|
@ -1528,7 +1528,7 @@ FaderPort8::assign_sends ()
|
||||||
|
|
||||||
set_periodic_display_mode (FP8Strip::SendDisplay);
|
set_periodic_display_mode (FP8Strip::SendDisplay);
|
||||||
|
|
||||||
_plugin_off = std::min (_plugin_off, n_sends - 8);
|
_plugin_off = std::min (_plugin_off, n_sends - N_STRIPS);
|
||||||
_plugin_off = std::max (0, _plugin_off);
|
_plugin_off = std::max (0, _plugin_off);
|
||||||
|
|
||||||
uint8_t id = 0;
|
uint8_t id = 0;
|
||||||
|
|
@ -1548,16 +1548,16 @@ FaderPort8::assign_sends ()
|
||||||
_ctrls.strip(id).set_text_line (0, s->send_name (i));
|
_ctrls.strip(id).set_text_line (0, s->send_name (i));
|
||||||
_ctrls.strip(id).set_mute_controllable (s->send_enable_controllable (i));
|
_ctrls.strip(id).set_mute_controllable (s->send_enable_controllable (i));
|
||||||
|
|
||||||
if (++id == 8) {
|
if (++id == N_STRIPS) {
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
// clear remaining
|
// clear remaining
|
||||||
for (; id < 8; ++id) {
|
for (; id < N_STRIPS; ++id) {
|
||||||
_ctrls.strip(id).unset_controllables (FP8Strip::CTRL_ALL & ~FP8Strip::CTRL_TEXT3 & ~FP8Strip::CTRL_SELECT);
|
_ctrls.strip(id).unset_controllables (FP8Strip::CTRL_ALL & ~FP8Strip::CTRL_TEXT3 & ~FP8Strip::CTRL_SELECT);
|
||||||
}
|
}
|
||||||
#ifdef MIXBUS // master-assign on last solo
|
#ifdef MIXBUS // master-assign on last solo
|
||||||
_ctrls.strip(7).set_solo_controllable (s->master_send_enable_controllable ());
|
_ctrls.strip(N_STRIPS - 1).set_solo_controllable (s->master_send_enable_controllable ());
|
||||||
#endif
|
#endif
|
||||||
/* set select buttons */
|
/* set select buttons */
|
||||||
assigned_stripable_connections.drop_connections ();
|
assigned_stripable_connections.drop_connections ();
|
||||||
|
|
@ -1602,7 +1602,7 @@ FaderPort8::assign_strips ()
|
||||||
void
|
void
|
||||||
FaderPort8::set_periodic_display_mode (FP8Strip::DisplayMode m)
|
FaderPort8::set_periodic_display_mode (FP8Strip::DisplayMode m)
|
||||||
{
|
{
|
||||||
for (uint8_t id = 0; id < 8; ++id) {
|
for (uint8_t id = 0; id < N_STRIPS; ++id) {
|
||||||
_ctrls.strip(id).set_periodic_display_mode (m);
|
_ctrls.strip(id).set_periodic_display_mode (m);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -1854,14 +1854,14 @@ FaderPort8::move_selected_into_view ()
|
||||||
int off = std::distance (strips.begin(), it);
|
int off = std::distance (strips.begin(), it);
|
||||||
|
|
||||||
int channel_off = get_channel_off (_ctrls.mix_mode ());
|
int channel_off = get_channel_off (_ctrls.mix_mode ());
|
||||||
if (channel_off <= off && off < channel_off + 8) {
|
if (channel_off <= off && off < channel_off + N_STRIPS) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (channel_off > off) {
|
if (channel_off > off) {
|
||||||
channel_off = off;
|
channel_off = off;
|
||||||
} else {
|
} else {
|
||||||
channel_off = off - 7;
|
channel_off = off - (N_STRIPS - 1);
|
||||||
}
|
}
|
||||||
set_channel_off (_ctrls.mix_mode (), channel_off);
|
set_channel_off (_ctrls.mix_mode (), channel_off);
|
||||||
assign_strips ();
|
assign_strips ();
|
||||||
|
|
@ -1913,7 +1913,7 @@ FaderPort8::select_prev_next (bool next)
|
||||||
void
|
void
|
||||||
FaderPort8::bank (bool down, bool page)
|
FaderPort8::bank (bool down, bool page)
|
||||||
{
|
{
|
||||||
int dt = page ? 8 : 1;
|
int dt = page ? N_STRIPS : 1;
|
||||||
if (down) {
|
if (down) {
|
||||||
dt *= -1;
|
dt *= -1;
|
||||||
}
|
}
|
||||||
|
|
@ -1924,7 +1924,7 @@ FaderPort8::bank (bool down, bool page)
|
||||||
void
|
void
|
||||||
FaderPort8::bank_param (bool down, bool page)
|
FaderPort8::bank_param (bool down, bool page)
|
||||||
{
|
{
|
||||||
int dt = page ? 8 : 1;
|
int dt = page ? N_STRIPS : 1;
|
||||||
if (down) {
|
if (down) {
|
||||||
dt *= -1;
|
dt *= -1;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -96,7 +96,7 @@ public:
|
||||||
std::vector<uint8_t> d;
|
std::vector<uint8_t> d;
|
||||||
sysexhdr (d);
|
sysexhdr (d);
|
||||||
d.push_back (0x12);
|
d.push_back (0x12);
|
||||||
d.push_back (id & 0x07);
|
d.push_back (id & 0x0f);
|
||||||
d.push_back (line & 0x03);
|
d.push_back (line & 0x03);
|
||||||
d.push_back (align & 0x07);
|
d.push_back (align & 0x07);
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -156,11 +156,11 @@ FP8Controls::FP8Controls (FP8Base& b)
|
||||||
BindMix (BtnMUser, MixUser);
|
BindMix (BtnMUser, MixUser);
|
||||||
|
|
||||||
/* create channelstrips */
|
/* create channelstrips */
|
||||||
for (uint8_t id = 0; id < 8; ++id) {
|
for (uint8_t id = 0; id < N_STRIPS; ++id) {
|
||||||
chanstrip[id] = new FP8Strip (b, id);
|
chanstrip[id] = new FP8Strip (b, id);
|
||||||
_midimap_strip[0x08 + id] = &(chanstrip[id]->solo_button());
|
_midimap_strip[FP8Strip::midi_ctrl_id (FP8Strip::BtnSolo, id)] = &(chanstrip[id]->solo_button());
|
||||||
_midimap_strip[0x10 + id] = &(chanstrip[id]->mute_button());
|
_midimap_strip[FP8Strip::midi_ctrl_id (FP8Strip::BtnMute, id)] = &(chanstrip[id]->mute_button());
|
||||||
_midimap_strip[0x18 + id] = &(chanstrip[id]->selrec_button());
|
_midimap_strip[FP8Strip::midi_ctrl_id (FP8Strip::BtnSelect, id)] = &(chanstrip[id]->selrec_button());
|
||||||
}
|
}
|
||||||
|
|
||||||
/* set User button names */
|
/* set User button names */
|
||||||
|
|
@ -190,7 +190,7 @@ FP8Controls::~FP8Controls ()
|
||||||
for (MidiButtonMap::const_iterator i = _midimap.begin (); i != _midimap.end (); ++i) {
|
for (MidiButtonMap::const_iterator i = _midimap.begin (); i != _midimap.end (); ++i) {
|
||||||
delete i->second;
|
delete i->second;
|
||||||
}
|
}
|
||||||
for (uint8_t id = 0; id < 8; ++id) {
|
for (uint8_t id = 0; id < N_STRIPS; ++id) {
|
||||||
delete chanstrip[id];
|
delete chanstrip[id];
|
||||||
}
|
}
|
||||||
_midimap_strip.clear ();
|
_midimap_strip.clear ();
|
||||||
|
|
@ -260,7 +260,7 @@ FP8Controls::initialize ()
|
||||||
button (BtnMFX).set_color (0x0000ffff);
|
button (BtnMFX).set_color (0x0000ffff);
|
||||||
button (BtnMUser).set_color (0x0000ffff);
|
button (BtnMUser).set_color (0x0000ffff);
|
||||||
|
|
||||||
for (uint8_t id = 0; id < 8; ++id) {
|
for (uint8_t id = 0; id < N_STRIPS; ++id) {
|
||||||
chanstrip[id]->initialize ();
|
chanstrip[id]->initialize ();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -298,7 +298,7 @@ FP8Controls::button (ButtonId id)
|
||||||
FP8Strip&
|
FP8Strip&
|
||||||
FP8Controls::strip (uint8_t id)
|
FP8Controls::strip (uint8_t id)
|
||||||
{
|
{
|
||||||
assert (id < 8);
|
assert (id < N_STRIPS);
|
||||||
return *chanstrip[id];
|
return *chanstrip[id];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -326,14 +326,14 @@ FP8Controls::midi_event (uint8_t id, uint8_t val)
|
||||||
bool
|
bool
|
||||||
FP8Controls::midi_touch (uint8_t id, uint8_t val)
|
FP8Controls::midi_touch (uint8_t id, uint8_t val)
|
||||||
{
|
{
|
||||||
assert (id < 8);
|
assert (id < N_STRIPS);
|
||||||
return chanstrip[id]->midi_touch (val > 0x40);
|
return chanstrip[id]->midi_touch (val > 0x40);
|
||||||
}
|
}
|
||||||
|
|
||||||
bool
|
bool
|
||||||
FP8Controls::midi_fader (uint8_t id, unsigned short val)
|
FP8Controls::midi_fader (uint8_t id, unsigned short val)
|
||||||
{
|
{
|
||||||
assert (id < 8);
|
assert (id < N_STRIPS);
|
||||||
return chanstrip[id]->midi_fader ((val >> 4) / 1023.f);
|
return chanstrip[id]->midi_fader ((val >> 4) / 1023.f);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -154,7 +154,7 @@ protected:
|
||||||
CtrlButtonMap _ctrlmap;
|
CtrlButtonMap _ctrlmap;
|
||||||
MidiButtonMap _midimap_strip;
|
MidiButtonMap _midimap_strip;
|
||||||
|
|
||||||
FP8Strip* chanstrip[8];
|
FP8Strip* chanstrip[N_STRIPS];
|
||||||
|
|
||||||
FP8Types::FaderMode _fadermode;
|
FP8Types::FaderMode _fadermode;
|
||||||
FP8Types::NavigationMode _navmode;
|
FP8Types::NavigationMode _navmode;
|
||||||
|
|
|
||||||
|
|
@ -33,18 +33,44 @@ using namespace ARDOUR;
|
||||||
using namespace ArdourSurface;
|
using namespace ArdourSurface;
|
||||||
using namespace ArdourSurface::FP8Types;
|
using namespace ArdourSurface::FP8Types;
|
||||||
|
|
||||||
|
uint8_t /* static */
|
||||||
|
FP8Strip::midi_ctrl_id (CtrlElement type, uint8_t id)
|
||||||
|
{
|
||||||
|
assert (id < N_STRIPS);
|
||||||
|
switch (type) {
|
||||||
|
case BtnSolo:
|
||||||
|
return 0x08 + id;
|
||||||
|
case BtnMute:
|
||||||
|
return 0x10 + id;
|
||||||
|
case BtnSelect:
|
||||||
|
return 0x18 + id;
|
||||||
|
case Fader:
|
||||||
|
return 0xe0 + id;
|
||||||
|
case Meter:
|
||||||
|
return 0xd0 + id;
|
||||||
|
case Redux:
|
||||||
|
return 0xd8 + id;
|
||||||
|
case BarVal:
|
||||||
|
return 0x30 + id;
|
||||||
|
case BarMode:
|
||||||
|
return 0x38 + id;
|
||||||
|
}
|
||||||
|
assert (0);
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
FP8Strip::FP8Strip (FP8Base& b, uint8_t id)
|
FP8Strip::FP8Strip (FP8Base& b, uint8_t id)
|
||||||
: _base (b)
|
: _base (b)
|
||||||
, _id (id)
|
, _id (id)
|
||||||
, _solo (b, 0x08 + id)
|
, _solo (b, midi_ctrl_id (BtnSolo, id))
|
||||||
, _mute (b, 0x10 + id)
|
, _mute (b, midi_ctrl_id (BtnMute, id))
|
||||||
, _selrec (b, 0x18 + id, true)
|
, _selrec (b, midi_ctrl_id (BtnSelect, id), true)
|
||||||
, _touching (false)
|
, _touching (false)
|
||||||
, _strip_mode (0)
|
, _strip_mode (0)
|
||||||
, _bar_mode (0)
|
, _bar_mode (0)
|
||||||
, _displaymode (Stripables)
|
, _displaymode (Stripables)
|
||||||
{
|
{
|
||||||
assert (id < 8);
|
assert (id < N_STRIPS);
|
||||||
|
|
||||||
_last_fader = 65535;
|
_last_fader = 65535;
|
||||||
_last_meter = _last_redux = _last_barpos = 0xff;
|
_last_meter = _last_redux = _last_barpos = 0xff;
|
||||||
|
|
@ -121,10 +147,10 @@ FP8Strip::initialize ()
|
||||||
|
|
||||||
set_bar_mode (4); // off
|
set_bar_mode (4); // off
|
||||||
|
|
||||||
_base.tx_midi2 (0xd0 + _id, 0); // reset meter
|
_base.tx_midi2 (midi_ctrl_id (Meter, _id), 0); // reset meter
|
||||||
_base.tx_midi2 (0xd8 + _id, 0); // reset redux
|
_base.tx_midi2 (midi_ctrl_id (Redux, _id), 0); // reset redux
|
||||||
|
|
||||||
_base.tx_midi3 (0xe0 + _id, 0, 0); // fader
|
_base.tx_midi3 (midi_ctrl_id (Fader, _id), 0, 0); // fader
|
||||||
|
|
||||||
/* clear cached values */
|
/* clear cached values */
|
||||||
_last_fader = 65535;
|
_last_fader = 65535;
|
||||||
|
|
@ -398,7 +424,7 @@ FP8Strip::notify_fader_changed ()
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
_last_fader = mv;
|
_last_fader = mv;
|
||||||
_base.tx_midi3 (0xe0 + _id, (mv & 0x7f), (mv >> 7) & 0x7f);
|
_base.tx_midi3 (midi_ctrl_id (Fader, _id), (mv & 0x7f), (mv >> 7) & 0x7f);
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
|
|
@ -501,13 +527,13 @@ FP8Strip::periodic_update_meter ()
|
||||||
// TODO: deflect meter
|
// TODO: deflect meter
|
||||||
int val = std::min (127.f, std::max (0.f, 2.f * dB + 127.f));
|
int val = std::min (127.f, std::max (0.f, 2.f * dB + 127.f));
|
||||||
if (val != _last_meter || val > 0) {
|
if (val != _last_meter || val > 0) {
|
||||||
_base.tx_midi2 (0xd0 + _id, val & 0x7f); // falls off automatically
|
_base.tx_midi2 (midi_ctrl_id (Meter, _id), val & 0x7f); // falls off automatically
|
||||||
_last_meter = val;
|
_last_meter = val;
|
||||||
}
|
}
|
||||||
|
|
||||||
} else if (show_meters) {
|
} else if (show_meters) {
|
||||||
if (0 != _last_meter) {
|
if (0 != _last_meter) {
|
||||||
_base.tx_midi2 (0xd0 + _id, 0);
|
_base.tx_midi2 (midi_ctrl_id (Meter, _id), 0);
|
||||||
_last_meter = 0;
|
_last_meter = 0;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -518,12 +544,12 @@ FP8Strip::periodic_update_meter ()
|
||||||
// TODO: deflect redux
|
// TODO: deflect redux
|
||||||
int val = std::min (127.f, std::max (0.f, rx));
|
int val = std::min (127.f, std::max (0.f, rx));
|
||||||
if (val != _last_redux) {
|
if (val != _last_redux) {
|
||||||
_base.tx_midi2 (0xd8 + _id, val & 0x7f);
|
_base.tx_midi2 (midi_ctrl_id (Redux, _id), val & 0x7f);
|
||||||
_last_redux = val;
|
_last_redux = val;
|
||||||
}
|
}
|
||||||
} else if (show_meters) {
|
} else if (show_meters) {
|
||||||
if (0 != _last_redux) {
|
if (0 != _last_redux) {
|
||||||
_base.tx_midi2 (0xd8 + _id, 0);
|
_base.tx_midi2 (midi_ctrl_id (Redux, _id), 0);
|
||||||
_last_redux = 0;
|
_last_redux = 0;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -535,7 +561,7 @@ FP8Strip::periodic_update_meter ()
|
||||||
float barpos = _fader_ctrl->internal_to_interface (_fader_ctrl->get_value());
|
float barpos = _fader_ctrl->internal_to_interface (_fader_ctrl->get_value());
|
||||||
int val = std::min (127.f, std::max (0.f, barpos * 128.f));
|
int val = std::min (127.f, std::max (0.f, barpos * 128.f));
|
||||||
if (val != _last_barpos) {
|
if (val != _last_barpos) {
|
||||||
_base.tx_midi3 (0xb0, 0x30 + _id, val & 0x7f);
|
_base.tx_midi3 (0xb0, midi_ctrl_id (BarVal, _id), val & 0x7f);
|
||||||
_last_barpos = val;
|
_last_barpos = val;
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
|
|
@ -559,7 +585,7 @@ FP8Strip::periodic_update_meter ()
|
||||||
int val = std::min (127.f, std::max (0.f, panpos * 128.f));
|
int val = std::min (127.f, std::max (0.f, panpos * 128.f));
|
||||||
set_bar_mode (have_panner ? 1 : 4); // Bipolar or Off
|
set_bar_mode (have_panner ? 1 : 4); // Bipolar or Off
|
||||||
if (val != _last_barpos && have_panner) {
|
if (val != _last_barpos && have_panner) {
|
||||||
_base.tx_midi3 (0xb0, 0x30 + _id, val & 0x7f);
|
_base.tx_midi3 (0xb0, midi_ctrl_id (BarVal, _id), val & 0x7f);
|
||||||
_last_barpos = val;
|
_last_barpos = val;
|
||||||
}
|
}
|
||||||
if (_base.twolinetext ()) {
|
if (_base.twolinetext ()) {
|
||||||
|
|
@ -620,12 +646,12 @@ FP8Strip::set_bar_mode (uint8_t bar_mode, bool force)
|
||||||
}
|
}
|
||||||
|
|
||||||
if (bar_mode == 4) {
|
if (bar_mode == 4) {
|
||||||
_base.tx_midi3 (0xb0, 0x30 + _id, 0);
|
_base.tx_midi3 (0xb0, midi_ctrl_id (BarVal, _id), 0);
|
||||||
_last_barpos = 0xff;
|
_last_barpos = 0xff;
|
||||||
}
|
}
|
||||||
|
|
||||||
_bar_mode = bar_mode;
|
_bar_mode = bar_mode;
|
||||||
_base.tx_midi3 (0xb0, 0x38 + _id, bar_mode);
|
_base.tx_midi3 (0xb0, midi_ctrl_id (BarMode, _id), bar_mode);
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
|
|
|
||||||
|
|
@ -28,6 +28,8 @@
|
||||||
#include "fp8_base.h"
|
#include "fp8_base.h"
|
||||||
#include "fp8_button.h"
|
#include "fp8_button.h"
|
||||||
|
|
||||||
|
#define N_STRIPS 8
|
||||||
|
|
||||||
namespace ARDOUR {
|
namespace ARDOUR {
|
||||||
class Stripable;
|
class Stripable;
|
||||||
class AutomationControl;
|
class AutomationControl;
|
||||||
|
|
@ -43,6 +45,19 @@ public:
|
||||||
FP8Strip (FP8Base& b, uint8_t id);
|
FP8Strip (FP8Base& b, uint8_t id);
|
||||||
~FP8Strip ();
|
~FP8Strip ();
|
||||||
|
|
||||||
|
enum CtrlElement {
|
||||||
|
BtnSolo,
|
||||||
|
BtnMute,
|
||||||
|
BtnSelect,
|
||||||
|
Fader,
|
||||||
|
Meter,
|
||||||
|
Redux,
|
||||||
|
BarVal,
|
||||||
|
BarMode
|
||||||
|
};
|
||||||
|
|
||||||
|
static uint8_t midi_ctrl_id (CtrlElement type, uint8_t id);
|
||||||
|
|
||||||
FP8ButtonInterface& solo_button () { return _solo; }
|
FP8ButtonInterface& solo_button () { return _solo; }
|
||||||
FP8ButtonInterface& mute_button () { return _mute; }
|
FP8ButtonInterface& mute_button () { return _mute; }
|
||||||
FP8ButtonInterface& selrec_button () { return _selrec; }
|
FP8ButtonInterface& selrec_button () { return _selrec; }
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue