mirror of
https://github.com/Ardour/ardour.git
synced 2025-12-06 23:05:04 +01:00
Update PatchChange when instrument/midnam changes
This commit is contained in:
parent
d0a116b2ae
commit
4e005540c6
4 changed files with 36 additions and 32 deletions
|
|
@ -1353,16 +1353,14 @@ MidiRegionView::display_patch_changes_on_channel (uint8_t channel, bool active_c
|
||||||
p->hide();
|
p->hide();
|
||||||
} else {
|
} else {
|
||||||
const double x = trackview.editor().sample_to_pixel (region_samples);
|
const double x = trackview.editor().sample_to_pixel (region_samples);
|
||||||
const string patch_name = instrument_info().get_patch_name ((*i)->bank(), (*i)->program(), channel);
|
|
||||||
p->canvas_item()->set_position (ArdourCanvas::Duple (x, 1.0));
|
p->canvas_item()->set_position (ArdourCanvas::Duple (x, 1.0));
|
||||||
p->set_text (patch_name);
|
p->update_name ();
|
||||||
|
|
||||||
p->show();
|
p->show();
|
||||||
}
|
}
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
const string patch_name = instrument_info().get_patch_name ((*i)->bank(), (*i)->program(), channel);
|
add_canvas_patch_change (*i);
|
||||||
add_canvas_patch_change (*i, patch_name, active_channel);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -1960,7 +1958,7 @@ MidiRegionView::step_sustain (Temporal::Beats beats)
|
||||||
* @param active_channel true to display the flag as on an active channel, false to grey it out for an inactive channel.
|
* @param active_channel true to display the flag as on an active channel, false to grey it out for an inactive channel.
|
||||||
*/
|
*/
|
||||||
void
|
void
|
||||||
MidiRegionView::add_canvas_patch_change (MidiModel::PatchChangePtr patch, const string& displaytext, bool /*active_channel*/)
|
MidiRegionView::add_canvas_patch_change (MidiModel::PatchChangePtr patch)
|
||||||
{
|
{
|
||||||
samplecnt_t region_samples = source_beats_to_region_samples (patch->time());
|
samplecnt_t region_samples = source_beats_to_region_samples (patch->time());
|
||||||
const double x = trackview.editor().sample_to_pixel (region_samples);
|
const double x = trackview.editor().sample_to_pixel (region_samples);
|
||||||
|
|
@ -1973,9 +1971,7 @@ MidiRegionView::add_canvas_patch_change (MidiModel::PatchChangePtr patch, const
|
||||||
// up to date.
|
// up to date.
|
||||||
boost::shared_ptr<PatchChange> patch_change = boost::shared_ptr<PatchChange>(
|
boost::shared_ptr<PatchChange> patch_change = boost::shared_ptr<PatchChange>(
|
||||||
new PatchChange(*this, group,
|
new PatchChange(*this, group,
|
||||||
displaytext,
|
height, x, 1.0,
|
||||||
height,
|
|
||||||
x, 1.0,
|
|
||||||
instrument_info(),
|
instrument_info(),
|
||||||
patch,
|
patch,
|
||||||
_patch_change_outline,
|
_patch_change_outline,
|
||||||
|
|
@ -3707,6 +3703,10 @@ void
|
||||||
MidiRegionView::instrument_settings_changed ()
|
MidiRegionView::instrument_settings_changed ()
|
||||||
{
|
{
|
||||||
redisplay_model();
|
redisplay_model();
|
||||||
|
|
||||||
|
for (PatchChanges::iterator x = _patch_changes.begin(); x != _patch_changes.end(); ++x) {
|
||||||
|
(*x).second->update_name ();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
|
|
|
||||||
|
|
@ -131,7 +131,7 @@ public:
|
||||||
bool paste (samplepos_t pos, const ::Selection& selection, PasteContext& ctx, const int32_t sub_num);
|
bool paste (samplepos_t pos, const ::Selection& selection, PasteContext& ctx, const int32_t sub_num);
|
||||||
void paste_internal (samplepos_t pos, unsigned paste_count, float times, const MidiCutBuffer&);
|
void paste_internal (samplepos_t pos, unsigned paste_count, float times, const MidiCutBuffer&);
|
||||||
|
|
||||||
void add_canvas_patch_change (ARDOUR::MidiModel::PatchChangePtr patch, const std::string& displaytext, bool);
|
void add_canvas_patch_change (ARDOUR::MidiModel::PatchChangePtr patch);
|
||||||
void remove_canvas_patch_change (PatchChange* pc);
|
void remove_canvas_patch_change (PatchChange* pc);
|
||||||
|
|
||||||
/** Look up the given time and channel in the 'automation' and set keys accordingly.
|
/** Look up the given time and channel in the 'automation' and set keys accordingly.
|
||||||
|
|
|
||||||
|
|
@ -46,7 +46,6 @@ using Gtkmm2ext::Keyboard;
|
||||||
*/
|
*/
|
||||||
PatchChange::PatchChange(MidiRegionView& region,
|
PatchChange::PatchChange(MidiRegionView& region,
|
||||||
ArdourCanvas::Container* parent,
|
ArdourCanvas::Container* parent,
|
||||||
const string& text,
|
|
||||||
double height,
|
double height,
|
||||||
double x,
|
double x,
|
||||||
double y,
|
double y,
|
||||||
|
|
@ -67,11 +66,12 @@ PatchChange::PatchChange(MidiRegionView& region,
|
||||||
ArdourCanvas::Duple (x, y),
|
ArdourCanvas::Duple (x, y),
|
||||||
true);
|
true);
|
||||||
|
|
||||||
CANVAS_DEBUG_NAME (_flag, text);
|
CANVAS_DEBUG_NAME (_flag, _info.get_patch_name (_patch->bank (), _patch->program (), _patch->channel ()));
|
||||||
|
|
||||||
_flag->Event.connect (sigc::mem_fun (*this, &PatchChange::event_handler));
|
_flag->Event.connect (sigc::mem_fun (*this, &PatchChange::event_handler));
|
||||||
_flag->set_font_description (UIConfiguration::instance().get_SmallFont());
|
_flag->set_font_description (UIConfiguration::instance().get_SmallFont());
|
||||||
_flag->set_text(text);
|
|
||||||
|
update_name ();
|
||||||
}
|
}
|
||||||
|
|
||||||
PatchChange::~PatchChange()
|
PatchChange::~PatchChange()
|
||||||
|
|
@ -79,6 +79,12 @@ PatchChange::~PatchChange()
|
||||||
delete _flag;
|
delete _flag;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void
|
||||||
|
PatchChange::update_name ()
|
||||||
|
{
|
||||||
|
_flag->set_text (_info.get_patch_name (_patch->bank (), _patch->program (), _patch->channel ()));
|
||||||
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
PatchChange::initialize_popup_menus()
|
PatchChange::initialize_popup_menus()
|
||||||
{
|
{
|
||||||
|
|
|
||||||
|
|
@ -34,9 +34,8 @@ namespace MIDI {
|
||||||
class PatchChange
|
class PatchChange
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
PatchChange(MidiRegionView& region,
|
PatchChange (MidiRegionView& region,
|
||||||
ArdourCanvas::Container* parent,
|
ArdourCanvas::Container* parent,
|
||||||
const std::string& text,
|
|
||||||
double height,
|
double height,
|
||||||
double x,
|
double x,
|
||||||
double y,
|
double y,
|
||||||
|
|
@ -45,27 +44,26 @@ public:
|
||||||
Gtkmm2ext::Color outline_color,
|
Gtkmm2ext::Color outline_color,
|
||||||
Gtkmm2ext::Color fill_color);
|
Gtkmm2ext::Color fill_color);
|
||||||
|
|
||||||
~PatchChange();
|
~PatchChange ();
|
||||||
|
|
||||||
void initialize_popup_menus();
|
void initialize_popup_menus ();
|
||||||
|
|
||||||
void on_patch_menu_selected(const MIDI::Name::PatchPrimaryKey& key);
|
|
||||||
|
|
||||||
|
void on_patch_menu_selected (const MIDI::Name::PatchPrimaryKey& key);
|
||||||
|
|
||||||
void move (ArdourCanvas::Duple);
|
void move (ArdourCanvas::Duple);
|
||||||
void set_height (ArdourCanvas::Distance);
|
void set_height (ArdourCanvas::Distance);
|
||||||
void hide ();
|
void hide ();
|
||||||
void show ();
|
void show ();
|
||||||
|
|
||||||
double width() const { return _flag->width(); }
|
void update_name ();
|
||||||
void set_text (std::string const & s) { _flag->set_text (s); }
|
|
||||||
|
|
||||||
ARDOUR::MidiModel::PatchChangePtr patch() const { return _patch; }
|
double width () const { return _flag->width (); }
|
||||||
ArdourCanvas::Item* canvas_item() const { return _flag; }
|
ARDOUR::MidiModel::PatchChangePtr patch () const { return _patch; }
|
||||||
ArdourCanvas::Item& item() const { return *_flag; }
|
ArdourCanvas::Item* canvas_item () const { return _flag; }
|
||||||
|
ArdourCanvas::Item& item () const { return *_flag; }
|
||||||
|
|
||||||
private:
|
private:
|
||||||
bool event_handler (GdkEvent *);
|
bool event_handler (GdkEvent*);
|
||||||
|
|
||||||
MidiRegionView& _region;
|
MidiRegionView& _region;
|
||||||
ARDOUR::InstrumentInfo& _info;
|
ARDOUR::InstrumentInfo& _info;
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue