Show selected MIDI track in editor mixer.

Minor code cleanups.


git-svn-id: svn://localhost/ardour2/trunk@1949 d708f5d6-7413-0410-9779-e7cbd77b26cf
This commit is contained in:
David Robillard 2007-06-04 00:05:33 +00:00
parent 5ee4677900
commit 70fd14afe8
14 changed files with 47 additions and 44 deletions

View File

@ -724,7 +724,7 @@ ARDOUR_UI::count_recenabled_streams (Route& route)
{
Track* track = dynamic_cast<Track*>(&route);
if (track && track->diskstream()->record_enabled()) {
rec_enabled_streams += track->n_inputs().get_total();
rec_enabled_streams += track->n_inputs().n_total();
}
}
@ -1620,7 +1620,7 @@ ARDOUR_UI::name_io_setup (AudioEngine& engine,
bool in)
{
if (in) {
if (io.n_inputs().get_total() == 0) {
if (io.n_inputs().n_total() == 0) {
buf = _("none");
return;
}
@ -1639,7 +1639,7 @@ ARDOUR_UI::name_io_setup (AudioEngine& engine,
} else {
if (io.n_outputs().get_total() == 0) {
if (io.n_outputs().n_total() == 0) {
buf = _("none");
return;
}

View File

@ -133,10 +133,10 @@ Editor::show_editor_mixer (bool yn)
void
Editor::set_selected_mixer_strip (TimeAxisView& view)
{
AudioTimeAxisView* at;
RouteTimeAxisView* rt;
bool show = false;
if (!session || (at = dynamic_cast<AudioTimeAxisView*>(&view)) == 0) {
if (!session || (rt = dynamic_cast<RouteTimeAxisView*>(&view)) == 0) {
return;
}
@ -144,7 +144,7 @@ Editor::set_selected_mixer_strip (TimeAxisView& view)
/* might be nothing to do */
if (current_mixer_strip->route() == at->route()) {
if (current_mixer_strip->route() == rt->route()) {
return;
}
@ -157,7 +157,7 @@ Editor::set_selected_mixer_strip (TimeAxisView& view)
current_mixer_strip = new MixerStrip (*ARDOUR_UI::instance()->the_mixer(),
*session,
at->route());
rt->route());
current_mixer_strip->GoingAway.connect (mem_fun(*this, &Editor::cms_deleted));
if (show) {

View File

@ -3404,12 +3404,12 @@ Editor::region_drag_finished_callback (ArdourCanvas::Item* item, GdkEvent* event
boost::shared_ptr<Region> newregion;
boost::shared_ptr<Region> ar;
boost::shared_ptr<Region> mr;
if ((ar = boost::dynamic_pointer_cast<AudioRegion>(rv->region())) != 0) {
newregion = RegionFactory::create (ar);
} else {
/* XXX MIDI HERE drobilla */
continue;
} else if ((mr = boost::dynamic_pointer_cast<MidiRegion>(rv->region())) != 0) {
newregion = RegionFactory::create (mr);
}
/* add it */

View File

@ -411,7 +411,7 @@ GainMeter::hide_all_meters ()
void
GainMeter::setup_meters ()
{
uint32_t nmeters = _io->n_outputs().n_audio();
uint32_t nmeters = _io->n_outputs().n_total();
guint16 width;
hide_all_meters ();
@ -432,7 +432,7 @@ GainMeter::setup_meters ()
} else {
nmeters = _io->n_outputs().n_audio();
nmeters = _io->n_outputs().n_total();
}
@ -453,7 +453,7 @@ GainMeter::setup_meters ()
/* pack them backwards */
if (_width == Wide) {
meter_packer.pack_end (meter_metric_area, false, false);
meter_packer.pack_end (meter_metric_area, false, false);
meter_metric_area.show_all ();
}

View File

@ -622,7 +622,7 @@ MixerStrip::add_bundle_to_input_menu (ARDOUR::Bundle* c)
MenuList& citems = input_menu.items();
if (c->nchannels() == _route->n_inputs().get_total()) {
if (c->nchannels() == _route->n_inputs().n_total()) {
citems.push_back (CheckMenuElem (c->name(), bind (mem_fun(*this, &MixerStrip::bundle_input_chosen), c)));
@ -645,7 +645,7 @@ MixerStrip::add_bundle_to_output_menu (ARDOUR::Bundle* c)
return;
}
if (c->nchannels() == _route->n_outputs().get_total()) {
if (c->nchannels() == _route->n_outputs().n_total()) {
MenuList& citems = output_menu.items();
citems.push_back (CheckMenuElem (c->name(), bind (mem_fun(*this, &MixerStrip::bundle_output_chosen), c)));
@ -1171,6 +1171,7 @@ MixerStrip::route_active_changed ()
set_name ("MidiTrackStripBaseInactive");
gpm.set_meter_strip_name ("MidiTrackStripBaseInactive");
}
gpm.set_fader_name ("MidiTrackFader");
} else if (is_audio_track()) {
if (_route->active()) {
set_name ("AudioTrackStripBase");
@ -1189,6 +1190,8 @@ MixerStrip::route_active_changed ()
gpm.set_meter_strip_name ("AudioBusStripBaseInactive");
}
gpm.set_fader_name ("AudioBusFader");
/* (no MIDI busses yet) */
}
}
@ -1214,20 +1217,20 @@ MixerStrip::meter_changed (void *src)
ENSURE_GUI_THREAD (bind (mem_fun(*this, &MixerStrip::meter_changed), src));
switch (_route->meter_point()) {
switch (_route->meter_point()) {
case MeterInput:
meter_point_label.set_text (_("input"));
break;
case MeterPreFader:
meter_point_label.set_text (_("pre"));
break;
case MeterPostFader:
meter_point_label.set_text (_("post"));
break;
}
}
gpm.setup_meters ();
gpm.setup_meters ();
}

View File

@ -124,7 +124,7 @@ class MixerStrip : public RouteUI, public Gtk::EventBox
RedirectBox pre_redirect_box;
RedirectBox post_redirect_box;
GainMeter gpm;
PannerUI panners;
PannerUI panners;
Gtk::Table button_table;
Gtk::Table middle_button_table;

View File

@ -452,8 +452,8 @@ RedirectBox::weird_plugin_dialog (Plugin& p, uint32_t streams, boost::shared_ptr
p.name(),
p.get_info()->n_inputs,
p.get_info()->n_outputs,
io->n_inputs().get_total(),
io->n_outputs().get_total(),
io->n_inputs().n_total(),
io->n_outputs().n_total(),
streams));
}

View File

@ -47,11 +47,8 @@ public:
// -1 is what to_index does. inlined for speed. this should maybe be changed..
inline size_t n_audio() const { return _counts[DataType::AUDIO-1]; }
inline size_t n_midi() const { return _counts[DataType::MIDI-1]; }
void set(DataType type, size_t count) { _counts[type.to_index()] = count; }
size_t get(DataType type) const { return _counts[type.to_index()]; }
size_t get_total() const
size_t n_total() const
{
size_t ret = 0;
for (size_t i=0; i < DataType::num_types; ++i)
@ -60,6 +57,9 @@ public:
return ret;
}
void set(DataType type, size_t count) { _counts[type.to_index()] = count; }
size_t get(DataType type) const { return _counts[type.to_index()]; }
bool operator==(const ChanCount& other) const
{
for (size_t i=0; i < DataType::num_types; ++i)

View File

@ -63,7 +63,7 @@ public:
const ChanCount& count() const { return _count; }
bool empty() const { return (_count.get_total() == 0); }
bool empty() const { return (_count.n_total() == 0); }
// ITERATORS
@ -95,7 +95,7 @@ public:
iterator end(DataType type = DataType::NIL)
{
return iterator(*this, type,
(type == DataType::NIL) ? _count.get_total() : _count.get(type));
(type == DataType::NIL) ? _count.n_total() : _count.get(type));
}
// FIXME: typeify
@ -118,7 +118,7 @@ public:
};
const_iterator begin() const { return const_iterator(*this, 0); }
const_iterator end() const { return const_iterator(*this, _count.get_total()); }
const_iterator end() const { return const_iterator(*this, _count.n_total()); }
class audio_iterator {

View File

@ -427,7 +427,7 @@ int
AudioTrack::no_roll (nframes_t nframes, nframes_t start_frame, nframes_t end_frame, nframes_t offset,
bool session_state_changing, bool can_record, bool rec_monitors_input)
{
if (n_outputs().get_total() == 0) {
if (n_outputs().n_total() == 0) {
return 0;
}
@ -523,7 +523,7 @@ AudioTrack::roll (nframes_t nframes, nframes_t start_frame, nframes_t end_frame,
}
if (n_outputs().get_total() == 0 && _redirects.empty()) {
if (n_outputs().n_total() == 0 && _redirects.empty()) {
return 0;
}
@ -619,7 +619,7 @@ int
AudioTrack::silent_roll (nframes_t nframes, nframes_t start_frame, nframes_t end_frame, nframes_t offset,
bool can_record, bool rec_monitors_input)
{
if (n_outputs().get_total() == 0 && _redirects.empty()) {
if (n_outputs().n_total() == 0 && _redirects.empty()) {
return 0;
}

View File

@ -493,7 +493,7 @@ IO::set_input (Port* other_port, void* src)
to the specified source.
*/
if (_input_minimum.get_total() > 1) {
if (_input_minimum.n_total() > 1) {
/* sorry, you can't do this */
return -1;
}

View File

@ -426,7 +426,7 @@ MidiTrack::roll (nframes_t nframes, nframes_t start_frame, nframes_t end_frame,
int dret;
boost::shared_ptr<MidiDiskstream> diskstream = midi_diskstream();
if (n_outputs().get_total() == 0 && _redirects.empty()) {
if (n_outputs().n_total() == 0 && _redirects.empty()) {
return 0;
}

View File

@ -2159,8 +2159,8 @@ Route::feeds (boost::shared_ptr<Route> other)
uint32_t i, j;
IO& self = *this;
uint32_t no = self.n_outputs().get_total();
uint32_t ni = other->n_inputs ().get_total();
uint32_t no = self.n_outputs().n_total();
uint32_t ni = other->n_inputs ().n_total();
for (i = 0; i < no; ++i) {
for (j = 0; j < ni; ++j) {
@ -2174,7 +2174,7 @@ Route::feeds (boost::shared_ptr<Route> other)
for (RedirectList::iterator r = _redirects.begin(); r != _redirects.end(); r++) {
no = (*r)->n_outputs().get_total();
no = (*r)->n_outputs().n_total();
for (i = 0; i < no; ++i) {
for (j = 0; j < ni; ++j) {
@ -2189,7 +2189,7 @@ Route::feeds (boost::shared_ptr<Route> other)
if (_control_outs) {
no = _control_outs->n_outputs().get_total();
no = _control_outs->n_outputs().n_total();
for (i = 0; i < no; ++i) {
for (j = 0; j < ni; ++j) {
@ -2321,7 +2321,7 @@ int
Route::no_roll (nframes_t nframes, nframes_t start_frame, nframes_t end_frame, nframes_t offset,
bool session_state_changing, bool can_record, bool rec_monitors_input)
{
if (n_outputs().get_total() == 0) {
if (n_outputs().n_total() == 0) {
return 0;
}
@ -2332,7 +2332,7 @@ Route::no_roll (nframes_t nframes, nframes_t start_frame, nframes_t end_frame, n
apply_gain_automation = false;
if (n_inputs().get_total()) {
if (n_inputs().n_total()) {
passthru (start_frame, end_frame, nframes, offset, 0, false);
} else {
silence (nframes, offset);
@ -2379,7 +2379,7 @@ Route::roll (nframes_t nframes, nframes_t start_frame, nframes_t end_frame, nfra
}
}
if ((n_outputs().get_total() == 0 && _redirects.empty()) || n_inputs().get_total() == 0 || !_active) {
if ((n_outputs().n_total() == 0 && _redirects.empty()) || n_inputs().n_total() == 0 || !_active) {
silence (nframes, offset);
return 0;
}

View File

@ -698,8 +698,8 @@ Session::when_engine_running ()
Bundle* c = new OutputBundle (_("Master Out"), true);
c->set_nchannels (_master_out->n_inputs().get_total());
for (uint32_t n = 0; n < _master_out->n_inputs ().get_total(); ++n) {
c->set_nchannels (_master_out->n_inputs().n_total());
for (uint32_t n = 0; n < _master_out->n_inputs ().n_total(); ++n) {
c->add_port_to_channel ((int) n, _master_out->input(n)->name());
}
add_bundle (c);