group.add (*j);
return j;
}
+
+Control*
+Meter::factory (Surface& surface, int id, int ordinal, const char* name, Group& group)
+{
+ Meter* m = new Meter (id, ordinal, name, group);
+ surface.meters[id] = m;
+ surface.controls.push_back (m);
+ group.add (*m);
+ return m;
+}
type_led_ring,
type_fader = 0xe0,
type_button = 0x90,
- type_pot = 0xb0
+ type_pot = 0xb0,
+ type_meter = 0xd0
};
enum base_id_t {
mute_button_base_id = 0x10,
solo_button_base_id = 0x08,
recenable_button_base_id = 0x0,
+ meter_base_id = 0xd0,
};
Control (int id, int ordinal, std::string name, Group& group);
static Control* factory (Surface&, int id, int ordinal, const char*, Group&);
};
+class Meter : public Control
+{
+public:
+ Meter (int id, int ordinal, std::string name, Group & group)
+ : Control (id, ordinal, name, group) {}
+
+ virtual type_t type() const { return type_meter; }
+
+ static Control* factory (Surface&, int id, int ordinal, const char*, Group&);
+};
+
}
#endif /* __mackie_controls_h__ */
if (yn == _active) {
return 0;
}
-
+
try
{
// the reason for the locking and unlocking is that
// glibmm can't do a condition wait on a RecMutex
if (yn) {
// TODO what happens if this fails half way?
+
+ // start an event loop
+
+ BaseUI::run ();
// create MackiePorts
{
// must come after _active = true otherwise it won't run
update_surface();
} else {
+ BaseUI::quit ();
close();
_active = false;
}
os << setw(2) << setfill('0') << bbt_time.beats;
// figure out subdivisions per beat
- const Meter & meter = session->tempo_map().meter_at (now_frame);
+ const ARDOUR::Meter & meter = session->tempo_map().meter_at (now_frame);
int subdiv = 2;
if (meter.note_divisor() == 8 && (meter.divisions_per_bar() == 12.0 || meter.divisions_per_bar() == 9.0 || meter.divisions_per_bar() == 6.0)) {
subdiv = 3;
#include <sstream>
#include <iomanip>
#include <algorithm>
+#include <cmath>
#include "pbd/compose.h"
);
}
+MidiByteArray MackieMidiBuilder::build_meter (const Meter & meter, float val)
+{
+ MIDI::byte segment = lrintf (val*16.0);
+
+ return MidiByteArray (2,
+ 0xD0,
+ (meter.raw_id()<<3) | segment);
+}
+
MidiByteArray MackieMidiBuilder::zero_strip( SurfacePort & port, const Strip & strip )
{
Group::Controls::const_iterator it = strip.controls().begin();
MidiByteArray build_led( const Button & button, LedState ls );
MidiByteArray build_fader( const Fader & fader, float pos );
+
+ MidiByteArray build_meter (const Meter& meter, float val);
/// return bytes that will reset all controls to their zero positions
/// And blank the display for the strip. Pass SurfacePort so we know which sysex header to use.
{ "select", Control::select_button_base_id, Button::factory, },
{ "vselect", Control::vselect_button_base_id, Button::factory, },
{ "fader_touch", Control::fader_touch_button_base_id, Button::factory, },
+ { "meter", 0, Meter::factory, },
{ "", 0, Button::factory, }
};
std::map<int,Pot*> pots;
std::map<int,Button*> buttons;
std::map<int,Led*> leds;
+ std::map<int,Meter*> meters;
/// no strip controls in here because they usually
/// have the same names.