Loading/Saving of sessions containing MIDI tracks and/or busses

git-svn-id: svn://localhost/ardour2/branches/midi@667 d708f5d6-7413-0410-9779-e7cbd77b26cf
This commit is contained in:
David Robillard 2006-07-06 19:45:23 +00:00
parent 22c20ab6f2
commit edd841895b
9 changed files with 87 additions and 13 deletions

View File

@ -1,7 +1,7 @@
cWaveForm 0.0 0.0 0.0 0.80
cMutedWaveForm 0.35 0.35 0.35 1.0
cSelectedFrameBase 0.71 0.57 0.66 1.0
cFrameBase 0.75 0.75 0.76 1.0
cSelectedFrameBase 0.0 0.57 0.66 0.5
cFrameBase 0.0 0.76 0.75 0.5
cAudioTrackBase 0.75 0.75 0.85 0.41
cAudioTrackOutline 0.00 0.00 0.00 1.00
cAudioBusBase 0.75 0.80 0.75 0.41

View File

@ -517,7 +517,7 @@ style "audio_bus_base"
font_name = "sans 6"
fg[NORMAL] = { 0.77, 0.77, 0.72 }
fg[NORMAL] = { 0.7, 0.8, 0.2 }
bg[NORMAL] = {0, 0.36, 0.40 }
bg[NORMAL] = {0, 0.40, 0.36 }
}
style "midi_track_base" = "default_base"
@ -1028,13 +1028,19 @@ widget "*BBTRuler" style "editor_time_ruler"
widget "*FramesRuler" style "editor_time_ruler"
widget "*MinSecRuler" style "editor_time_ruler"
widget "*BaseFrame" style "base_frame"
widget "*BusControlsBaseUnselected" style "audio_bus_base"
widget "*AudioTimeAxisViewControlsBaseUnselected" style "audio_track_base"
widget "*AudioTrackStripBase" style "audio_track_base"
widget "*TimeAxisViewControlsBaseUnselected" style "audio_track_base"
widget "*AudioTrackControlsBaseUnselected" style "audio_track_base"
widget "*AudioTrackFader" style "audio_track_base"
widget "*AudioBusStripBase" style "audio_bus_base"
widget "*BusControlsBaseUnselected" style "audio_bus_base"
widget "*AudioBusFader" style "audio_bus_base"
widget "*MidiTimeAxisViewControlsBaseUnselected" style "midi_track_base"
widget "*MidiTrackStripBase" style "midi_track_base"
widget "*MidiTrackControlsBaseUnselected" style "midi_track_base"
widget "*MidiTrackFader" style "midi_track_base"
widget "*MidiBusStripBase" style "midi_bus_base"
widget "*MidiBusFader" style "midi_bus_base"
widget "*TrackSeparator" style "track_separator"
widget "*TrackEditIndicator0*" style "edit_group_0"
widget "*TrackEditIndicator1*" style "edit_group_1"

View File

@ -157,6 +157,12 @@ AudioTimeAxisView::AudioTimeAxisView (PublicEditor& ed, Session& sess, Route& rt
visual_button.signal_clicked().connect (mem_fun(*this, &AudioTimeAxisView::visual_click));
hide_button.signal_clicked().connect (mem_fun(*this, &AudioTimeAxisView::hide_click));
// FIXME: hack (pretty colours)
if (is_audio_track())
controls_ebox.set_name ("AudioTimeAxisViewControlsBaseUnselected");
else
controls_ebox.set_name ("MidiTimeAxisViewControlsBaseUnselected");
if (is_audio_track()) {
controls_table.attach (*rec_enable_button, 5, 6, 0, 1, Gtk::FILL|Gtk::EXPAND, Gtk::FILL|Gtk::EXPAND, 0, 0);
}

View File

@ -79,6 +79,8 @@ ColorManager::load (string path)
return -1;
}
cerr << "Loading color definition file " << path << endl;
while (in) {
string name;
double r, g, b, a;

View File

@ -1170,7 +1170,18 @@ MixerStrip::route_active_changed ()
{
RouteUI::route_active_changed ();
if (is_audio_track()) {
// FIXME: MIDI/Audio bus distinction
if (is_midi_track()) {
if (_route.active()) {
set_name ("MidiTrackStripBase");
gpm.set_meter_strip_name ("MidiTrackStripBase");
} else {
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");
gpm.set_meter_strip_name ("AudioTrackStripBase");

View File

@ -131,8 +131,8 @@ TimeAxisView::TimeAxisView (ARDOUR::Session& sess, PublicEditor& ed, TimeAxisVie
controls_vbox.pack_start (controls_table, false, false);
controls_vbox.show ();
controls_ebox.set_name ("TimeAxisViewControlsBaseUnselected");
//controls_ebox.set_name ("TimeAxisViewControlsBaseUnselected");
controls_ebox.add (controls_vbox);
controls_ebox.add_events (BUTTON_PRESS_MASK|BUTTON_RELEASE_MASK|SCROLL_MASK);
controls_ebox.set_flags (CAN_FOCUS);

View File

@ -29,6 +29,10 @@
namespace ARDOUR {
/* Yes, this is a bit of a mess right now. I'll clean it up when everything
* using it works out.. */
/** A buffer of recordable/playable data.
*
* This is a datatype-agnostic base class for all buffers (there are no
@ -60,13 +64,17 @@ public:
size_t size() const { return _size; }
/** Type of this buffer.
* Based on this you can cast a Buffer* to the desired type. */
* Based on this you can static cast a Buffer* to the desired type. */
virtual Type type() const { return _type; }
/** Jack type (eg JACK_DEFAULT_AUDIO_TYPE) */
const char* jack_type() const { return type_to_jack_type(type()); }
/** Separate for creating ports (before a buffer exists to call jack_type on) */
/** String type as saved in session XML files (eg "audio" or "midi") */
const char* type_string() const { return type_to_string(type()); }
/* The below static methods need to be separate from the above methods
* because the conversion is needed in places where there's no Buffer */
static const char* type_to_jack_type(Type t) {
switch (t) {
case AUDIO: return JACK_DEFAULT_AUDIO_TYPE;
@ -74,6 +82,24 @@ public:
default: return "";
}
}
static const char* type_to_string(Type t) {
switch (t) {
case AUDIO: return "audio";
case MIDI: return "midi";
default: return "unknown"; // reeeally shouldn't ever happen
}
}
/** Used for loading from XML (route default types etc) */
static Type type_from_string(const string& str) {
if (str == "audio")
return AUDIO;
else if (str == "midi")
return MIDI;
else
return NIL;
}
protected:
Type _type;
@ -82,7 +108,7 @@ protected:
};
/* Since we only have two types, templates aren't worth it, yet.. */
/* Inside every class with a type in it's name is a template waiting to get out... */
/** Buffer containing 32-bit floating point (audio) data. */

View File

@ -20,6 +20,7 @@
#include <cmath>
#include <fstream>
#include <cassert>
#include <sigc++/bind.h>
#include <pbd/xml++.h>
@ -1346,6 +1347,10 @@ Route::state(bool full_state)
snprintf (buf, sizeof (buf), "0x%x", _flags);
node->add_property("flags", buf);
}
// FIXME: assumes there's only audio and MIDI types
node->add_property("default-type", Buffer::type_to_string(_default_type));
node->add_property("active", _active?"yes":"no");
node->add_property("muted", _muted?"yes":"no");
node->add_property("soloed", _soloed?"yes":"no");
@ -1541,6 +1546,11 @@ Route::set_state (const XMLNode& node)
} else {
_flags = Flag (0);
}
if ((prop = node.property ("default-type")) != 0) {
_default_type = Buffer::type_from_string(prop->value());
assert(_default_type != Buffer::NIL);
}
if ((prop = node.property ("phase-invert")) != 0) {
set_phase_invert(prop->value()=="yes"?true:false, this);

View File

@ -74,6 +74,7 @@
#include <ardour/slave.h>
#include <ardour/tempo.h>
#include <ardour/audio_track.h>
#include <ardour/midi_track.h>
#include <ardour/cycle_timer.h>
#include <ardour/utils.h>
#include <ardour/named_selection.h>
@ -1716,8 +1717,20 @@ Session::XMLRouteFactory (const XMLNode& node)
return 0;
}
if (node.property ("diskstream") != 0 || node.property ("diskstream-id") != 0) {
return new AudioTrack (*this, node);
bool has_diskstream = (node.property ("diskstream") != 0 || node.property ("diskstream-id") != 0);
Buffer::Type type = Buffer::AUDIO;
const XMLProperty* prop = node.property("default-type");
if (prop)
type = Buffer::type_from_string(prop->value());
assert(type != Buffer::NIL);
if (has_diskstream) {
if (type == Buffer::AUDIO)
return new AudioTrack (*this, node);
else
return new MidiTrack (*this, node);
} else {
return new Route (*this, node);
}