summaryrefslogtreecommitdiff
path: root/libs
diff options
context:
space:
mode:
authorPaul Davis <paul@linuxaudiosystems.com>2008-10-09 14:15:45 +0000
committerPaul Davis <paul@linuxaudiosystems.com>2008-10-09 14:15:45 +0000
commit757c1c1026ffad4e56b0c4b5073d3925468c0a21 (patch)
tree9f2b15bd6c33d04dd1451e15e68d55d9610a88a0 /libs
parent7002aebbda78b11ddc006c3f5863916ce5992bfc (diff)
add global region fade toggle; fixup (?) reload of MIDI config state (both ported from 2.X)
git-svn-id: svn://localhost/ardour2/branches/3.0@3897 d708f5d6-7413-0410-9779-e7cbd77b26cf
Diffstat (limited to 'libs')
-rw-r--r--libs/ardour/ardour/ardour.h14
-rw-r--r--libs/ardour/ardour/configuration_vars.h4
-rw-r--r--libs/ardour/audioregion.cc4
-rw-r--r--libs/ardour/globals.cc10
-rw-r--r--libs/ardour/session_state.cc24
5 files changed, 37 insertions, 19 deletions
diff --git a/libs/ardour/ardour/ardour.h b/libs/ardour/ardour/ardour.h
index fd873f9a6f..635e8a31ca 100644
--- a/libs/ardour/ardour/ardour.h
+++ b/libs/ardour/ardour/ardour.h
@@ -82,14 +82,14 @@ namespace ARDOUR {
static const double SHUTTLE_FRACT_SPEED1=0.48412291827; /* derived from A1,A2 */
void setup_fpu ();
-}
-
-/* how do we make these be within the Ardour namespace? */
-extern MIDI::Port* default_mmc_port;
-extern MIDI::Port* default_mtc_port;
-extern MIDI::Port* default_midi_port;
-extern MIDI::Port *default_midi_clock_port;
+ extern MIDI::Port* default_mmc_port;
+ extern MIDI::Port* default_mtc_port;
+ extern MIDI::Port* default_midi_port;
+ extern MIDI::Port *default_midi_clock_port;
+
+ int setup_midi ();
+}
#endif /* __ardour_ardour_h__ */
diff --git a/libs/ardour/ardour/configuration_vars.h b/libs/ardour/ardour/configuration_vars.h
index 1f455dc308..f84a39067a 100644
--- a/libs/ardour/ardour/configuration_vars.h
+++ b/libs/ardour/ardour/configuration_vars.h
@@ -40,6 +40,7 @@ CONFIG_VARIABLE (bool, midi_clock_control, "midi-clock-control", false)
CONFIG_VARIABLE (bool, midi_feedback, "midi-feedback", false)
CONFIG_VARIABLE (uint8_t, mmc_receive_device_id, "mmc-receive-device-id", 0)
CONFIG_VARIABLE (uint8_t, mmc_send_device_id, "mmc-send-device-id", 0)
+CONFIG_VARIABLE (int32_t, initial_program_change, "initial-program-change", -1)
/* control surfaces */
@@ -63,7 +64,7 @@ CONFIG_VARIABLE (bool, auto_analyse_audio, "auto-analyse-audio", false)
CONFIG_VARIABLE (uint32_t, osc_port, "osc-port", 3819)
CONFIG_VARIABLE (bool, use_osc, "use-osc", false)
-/* crossfades */
+/* fades, crossfades */
CONFIG_VARIABLE (CrossfadeModel, xfade_model, "xfade-model", FullCrossfade)
CONFIG_VARIABLE (bool, auto_xfade, "auto-xfade", true)
@@ -71,6 +72,7 @@ CONFIG_VARIABLE (float, short_xfade_seconds, "short-xfade-seconds", 0.015)
CONFIG_VARIABLE (bool, xfades_active, "xfades-active", true)
CONFIG_VARIABLE (bool, xfades_visible, "xfades-visible", true)
CONFIG_VARIABLE (uint32_t, destructive_xfade_msecs, "destructive-xfade-msecs", 2)
+CONFIG_VARIABLE (bool, use_region_fades, "use-region-fades", true)
/* editing related */
diff --git a/libs/ardour/audioregion.cc b/libs/ardour/audioregion.cc
index d7ade04bc4..c5c04bc33d 100644
--- a/libs/ardour/audioregion.cc
+++ b/libs/ardour/audioregion.cc
@@ -395,7 +395,7 @@ AudioRegion::_read_at (const SourceList& srcs, nframes_t limit,
if (!raw) {
- if (_flags & FadeIn) {
+ if ((_flags & FadeIn) && Config->get_use_region_fades()) {
nframes_t fade_in_length = (nframes_t) _fade_in->back()->when;
@@ -417,7 +417,7 @@ AudioRegion::_read_at (const SourceList& srcs, nframes_t limit,
/* fade out */
- if (_flags & FadeOut) {
+ if ((_flags & FadeOut) && Config->get_use_region_fades()) {
/* see if some part of this read is within the fade out */
diff --git a/libs/ardour/globals.cc b/libs/ardour/globals.cc
index 3401d8c48a..04b4543b71 100644
--- a/libs/ardour/globals.cc
+++ b/libs/ardour/globals.cc
@@ -92,10 +92,10 @@ using namespace ARDOUR;
using namespace std;
using namespace PBD;
-MIDI::Port *default_mmc_port = 0;
-MIDI::Port *default_mtc_port = 0;
-MIDI::Port *default_midi_port = 0;
-MIDI::Port *default_midi_clock_port = 0;
+MIDI::Port *ARDOUR::default_mmc_port = 0;
+MIDI::Port *ARDOUR::default_mtc_port = 0;
+MIDI::Port *ARDOUR::default_midi_port = 0;
+MIDI::Port *ARDOUR::default_midi_clock_port = 0;
Change ARDOUR::StartChanged = ARDOUR::new_change ();
Change ARDOUR::LengthChanged = ARDOUR::new_change ();
@@ -131,7 +131,7 @@ setup_osc ()
#endif
int
-setup_midi ()
+ARDOUR::setup_midi ()
{
if (Config->midi_ports.size() == 0) {
warning << _("no MIDI ports specified: no MMC or MTC control possible") << endmsg;
diff --git a/libs/ardour/session_state.cc b/libs/ardour/session_state.cc
index 0975d4dc8a..099b926fa7 100644
--- a/libs/ardour/session_state.cc
+++ b/libs/ardour/session_state.cc
@@ -872,6 +872,12 @@ Session::load_options (const XMLNode& node)
Config->set_variables (node, ConfigVariableBase::Session);
+ /* now reset MIDI ports because the session can have its own
+ MIDI configuration.
+ */
+
+ setup_midi ();
+
if ((child = find_named_node (node, "end-marker-is-free")) != 0) {
if ((prop = child->property ("val")) != 0) {
_end_location_is_free = (prop->value() == "yes");
@@ -1204,10 +1210,10 @@ Session::set_state (const XMLNode& node)
/* Object loading order:
- MIDI Control
Path
extra
Options/Config
+ MIDI Control // relies on data from Options/Config
Metadata
Locations
Sources
@@ -1221,9 +1227,6 @@ Session::set_state (const XMLNode& node)
ControlProtocols
*/
- if (use_config_midi_ports ()) {
- }
-
if ((child = find_named_node (node, "extra")) != 0) {
_extra_xml = new XMLNode (*child);
}
@@ -1236,6 +1239,9 @@ Session::set_state (const XMLNode& node)
error << _("Session: XML state has no options section") << endmsg;
}
+ if (use_config_midi_ports ()) {
+ }
+
if ((child = find_named_node (node, "Metadata")) == 0) {
warning << _("Session: XML state has no metadata section (2.0 session?)") << endmsg;
} else if (_metadata->set_state (*child)) {
@@ -3252,6 +3258,16 @@ Session::config_changed (const char* parameter_name)
set_history_depth (Config->get_history_depth());
} else if (PARAM_IS ("sync-all-route-ordering")) {
sync_order_keys ();
+ } else if (PARAM_IS ("initial-program-change")) {
+
+ if (_mmc_port && Config->get_initial_program_change() >= 0) {
+ MIDI::byte buf[2];
+
+ buf[0] = MIDI::program; // channel zero by default
+ buf[1] = (Config->get_initial_program_change() & 0x7f);
+
+ _mmc_port->midimsg (buf, sizeof (buf), 0);
+ }
}
set_dirty ();