mirror of
https://github.com/Ardour/ardour.git
synced 2025-12-17 12:16:30 +01:00
add User metadata. user metadata is edited from the same dialog and read/writable using the same mechanism as session metadata, but it is stored in the ardour.rc file instead of with the session. Importing metadata from another session does not change user metadata. SessionMetadata is now a singleton that is available to the session object and the various config objects.
git-svn-id: svn://localhost/ardour2/branches/3.0@12014 d708f5d6-7413-0410-9779-e7cbd77b26cf
This commit is contained in:
parent
c7c9c1bd26
commit
45ac9c8861
11 changed files with 230 additions and 56 deletions
|
|
@ -27,6 +27,7 @@
|
||||||
#include "ardour/session.h"
|
#include "ardour/session.h"
|
||||||
#include "ardour/session_directory.h"
|
#include "ardour/session_directory.h"
|
||||||
#include "ardour/session_utils.h"
|
#include "ardour/session_utils.h"
|
||||||
|
#include "ardour/configuration.h"
|
||||||
|
|
||||||
#include "i18n.h"
|
#include "i18n.h"
|
||||||
|
|
||||||
|
|
@ -81,8 +82,8 @@ TextMetadataField::load_data (ARDOUR::SessionMetadata const & data)
|
||||||
Gtk::Widget &
|
Gtk::Widget &
|
||||||
TextMetadataField::name_widget ()
|
TextMetadataField::name_widget ()
|
||||||
{
|
{
|
||||||
label = Gtk::manage (new Gtk::Label(_name + ':', Gtk::ALIGN_LEFT));
|
label = Gtk::manage (new Gtk::Label(_name + ':'));
|
||||||
label->set_alignment (0, 0.5);
|
label->set_alignment (1, 0.5);
|
||||||
return *label;
|
return *label;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -160,8 +161,8 @@ NumberMetadataField::update_value ()
|
||||||
Gtk::Widget &
|
Gtk::Widget &
|
||||||
NumberMetadataField::name_widget ()
|
NumberMetadataField::name_widget ()
|
||||||
{
|
{
|
||||||
label = Gtk::manage (new Gtk::Label(_name + ':', Gtk::ALIGN_LEFT));
|
label = Gtk::manage (new Gtk::Label(_name + ':'));
|
||||||
label->set_alignment (0, 0.5);
|
label->set_alignment (1, 0.5);
|
||||||
return *label;
|
return *label;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -255,7 +256,7 @@ SessionMetadataSetEditable::set_session (ARDOUR::Session * s)
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
ARDOUR::SessionMetadata const & data = _session->metadata();
|
ARDOUR::SessionMetadata const & data = *(ARDOUR::SessionMetadata::Metadata());
|
||||||
|
|
||||||
table.resize (list.size(), 2);
|
table.resize (list.size(), 2);
|
||||||
uint32_t row = 0;
|
uint32_t row = 0;
|
||||||
|
|
@ -272,7 +273,7 @@ SessionMetadataSetEditable::set_session (ARDOUR::Session * s)
|
||||||
void
|
void
|
||||||
SessionMetadataSetEditable::save_data ()
|
SessionMetadataSetEditable::save_data ()
|
||||||
{
|
{
|
||||||
ARDOUR::SessionMetadata & data = _session->metadata();
|
ARDOUR::SessionMetadata & data = *(ARDOUR::SessionMetadata::Metadata());
|
||||||
for (DataList::const_iterator it = list.begin(); it != list.end(); ++it) {
|
for (DataList::const_iterator it = list.begin(); it != list.end(); ++it) {
|
||||||
(*it)->save_data(data);
|
(*it)->save_data(data);
|
||||||
}
|
}
|
||||||
|
|
@ -330,7 +331,7 @@ SessionMetadataSetImportable::load_extra_data (ARDOUR::SessionMetadata const & d
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
ARDOUR::SessionMetadata & session_data = _session->metadata();
|
ARDOUR::SessionMetadata const & session_data = *(ARDOUR::SessionMetadata::Metadata());
|
||||||
|
|
||||||
MetadataPtr session_field;
|
MetadataPtr session_field;
|
||||||
MetadataPtr import_field;
|
MetadataPtr import_field;
|
||||||
|
|
@ -378,7 +379,7 @@ SessionMetadataSetImportable::save_data ()
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
ARDOUR::SessionMetadata & session_data = _session->metadata();
|
ARDOUR::SessionMetadata & session_data = *(ARDOUR::SessionMetadata::Metadata());
|
||||||
|
|
||||||
Gtk::TreeModel::Children fields = tree->children();
|
Gtk::TreeModel::Children fields = tree->children();
|
||||||
Gtk::TreeModel::Children::iterator it;
|
Gtk::TreeModel::Children::iterator it;
|
||||||
|
|
@ -421,22 +422,25 @@ SessionMetadataDialog<DataSet>::SessionMetadataDialog (string const & name) :
|
||||||
{
|
{
|
||||||
cancel_button = add_button (Gtk::Stock::CANCEL, Gtk::RESPONSE_CANCEL);
|
cancel_button = add_button (Gtk::Stock::CANCEL, Gtk::RESPONSE_CANCEL);
|
||||||
cancel_button->signal_clicked().connect (sigc::mem_fun(*this, &SessionMetadataDialog::end_dialog));
|
cancel_button->signal_clicked().connect (sigc::mem_fun(*this, &SessionMetadataDialog::end_dialog));
|
||||||
save_button = add_button (Gtk::Stock::SAVE, Gtk::RESPONSE_ACCEPT);
|
save_button = add_button (Gtk::Stock::OK, Gtk::RESPONSE_ACCEPT);
|
||||||
save_button->signal_clicked().connect (sigc::mem_fun(*this, &SessionMetadataDialog::save_and_close));
|
save_button->signal_clicked().connect (sigc::mem_fun(*this, &SessionMetadataDialog::save_and_close));
|
||||||
}
|
}
|
||||||
|
|
||||||
template <typename DataSet>
|
template <typename DataSet>
|
||||||
void
|
void
|
||||||
SessionMetadataDialog<DataSet>::init_data ()
|
SessionMetadataDialog<DataSet>::init_data ( bool skip_user )
|
||||||
{
|
{
|
||||||
if (!_session) {
|
if (!_session) {
|
||||||
std::cerr << "Programming error: no session set for SessionMetaDataDialog (in init_data)!" << std::endl;
|
std::cerr << "Programming error: no session set for SessionMetaDataDialog (in init_data)!" << std::endl;
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (!skip_user)
|
||||||
|
init_user_data ();
|
||||||
init_track_data ();
|
init_track_data ();
|
||||||
init_album_data ();
|
init_album_data ();
|
||||||
init_people_data ();
|
init_people_data ();
|
||||||
|
init_school_data ();
|
||||||
|
|
||||||
for (DataSetList::iterator it = data_list.begin(); it != data_list.end(); ++it) {
|
for (DataSetList::iterator it = data_list.begin(); it != data_list.end(); ++it) {
|
||||||
(*it)->set_session (_session);
|
(*it)->set_session (_session);
|
||||||
|
|
@ -468,6 +472,7 @@ void
|
||||||
SessionMetadataDialog<DataSet>::save_and_close ()
|
SessionMetadataDialog<DataSet>::save_and_close ()
|
||||||
{
|
{
|
||||||
save_data ();
|
save_data ();
|
||||||
|
_session->set_dirty();
|
||||||
end_dialog ();
|
end_dialog ();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -507,6 +512,32 @@ SessionMetadataDialog<DataSet>::add_widget (Gtk::Widget & widget)
|
||||||
get_vbox()->pack_start (widget, true, true, 0);
|
get_vbox()->pack_start (widget, true, true, 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
template <typename DataSet>
|
||||||
|
void
|
||||||
|
SessionMetadataDialog<DataSet>::init_user_data ()
|
||||||
|
{
|
||||||
|
DataSetPtr data_set (new DataSet (_("User")));
|
||||||
|
data_list.push_back (data_set);
|
||||||
|
|
||||||
|
MetadataPtr ptr;
|
||||||
|
|
||||||
|
ptr = MetadataPtr (new TextMetadataField (&ARDOUR::SessionMetadata::user_name, &ARDOUR::SessionMetadata::set_user_name, _("Name")));
|
||||||
|
data_set->add_data_field (ptr);
|
||||||
|
|
||||||
|
ptr = MetadataPtr (new TextMetadataField (&ARDOUR::SessionMetadata::user_email, &ARDOUR::SessionMetadata::set_user_email, _("Email")));
|
||||||
|
data_set->add_data_field (ptr);
|
||||||
|
|
||||||
|
ptr = MetadataPtr (new TextMetadataField (&ARDOUR::SessionMetadata::user_web, &ARDOUR::SessionMetadata::set_user_web, _("Web")));
|
||||||
|
data_set->add_data_field (ptr);
|
||||||
|
|
||||||
|
ptr = MetadataPtr (new TextMetadataField (&ARDOUR::SessionMetadata::organization, &ARDOUR::SessionMetadata::set_organization, _("Organization")));
|
||||||
|
data_set->add_data_field (ptr);
|
||||||
|
|
||||||
|
ptr = MetadataPtr (new TextMetadataField (&ARDOUR::SessionMetadata::country, &ARDOUR::SessionMetadata::set_country, _("Country")));
|
||||||
|
data_set->add_data_field (ptr);
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
template <typename DataSet>
|
template <typename DataSet>
|
||||||
void
|
void
|
||||||
SessionMetadataDialog<DataSet>::init_track_data ()
|
SessionMetadataDialog<DataSet>::init_track_data ()
|
||||||
|
|
@ -615,6 +646,23 @@ SessionMetadataDialog<DataSet>::init_people_data ()
|
||||||
data_set->add_data_field (ptr);
|
data_set->add_data_field (ptr);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
template <typename DataSet>
|
||||||
|
void
|
||||||
|
SessionMetadataDialog<DataSet>::init_school_data ()
|
||||||
|
{
|
||||||
|
DataSetPtr data_set (new DataSet (_("School")));
|
||||||
|
data_list.push_back (data_set);
|
||||||
|
|
||||||
|
MetadataPtr ptr;
|
||||||
|
|
||||||
|
ptr = MetadataPtr (new TextMetadataField (&ARDOUR::SessionMetadata::instructor, &ARDOUR::SessionMetadata::set_instructor, _("Instructor")));
|
||||||
|
data_set->add_data_field (ptr);
|
||||||
|
|
||||||
|
ptr = MetadataPtr (new TextMetadataField (&ARDOUR::SessionMetadata::course, &ARDOUR::SessionMetadata::set_course, _("Course")));
|
||||||
|
data_set->add_data_field (ptr);
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
/* SessionMetadataEditor */
|
/* SessionMetadataEditor */
|
||||||
|
|
||||||
SessionMetadataEditor::SessionMetadataEditor () :
|
SessionMetadataEditor::SessionMetadataEditor () :
|
||||||
|
|
@ -722,10 +770,10 @@ SessionMetadataImporter::run ()
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//create a temporary
|
||||||
ARDOUR::SessionMetadata data;
|
ARDOUR::SessionMetadata data;
|
||||||
data.set_state (*node, version);
|
data.set_state (*node, version);
|
||||||
|
init_data ( true ); //skip user data here
|
||||||
init_data ();
|
|
||||||
load_extra_data (data);
|
load_extra_data (data);
|
||||||
init_gui();
|
init_gui();
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -209,7 +209,7 @@ class SessionMetadataDialog : public ArdourDialog
|
||||||
SessionMetadataDialog (std::string const & name);
|
SessionMetadataDialog (std::string const & name);
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
void init_data ();
|
void init_data ( bool skip_user = false );
|
||||||
void load_extra_data (ARDOUR::SessionMetadata const & data);
|
void load_extra_data (ARDOUR::SessionMetadata const & data);
|
||||||
void save_data ();
|
void save_data ();
|
||||||
|
|
||||||
|
|
@ -232,9 +232,11 @@ class SessionMetadataDialog : public ArdourDialog
|
||||||
Gtk::Notebook notebook;
|
Gtk::Notebook notebook;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
void init_user_data ();
|
||||||
void init_track_data ();
|
void init_track_data ();
|
||||||
void init_album_data ();
|
void init_album_data ();
|
||||||
void init_people_data ();
|
void init_people_data ();
|
||||||
|
void init_school_data ();
|
||||||
|
|
||||||
typedef boost::shared_ptr<SessionMetadataSet> DataSetPtr;
|
typedef boost::shared_ptr<SessionMetadataSet> DataSetPtr;
|
||||||
typedef std::list<DataSetPtr> DataSetList;
|
typedef std::list<DataSetPtr> DataSetList;
|
||||||
|
|
|
||||||
|
|
@ -294,22 +294,6 @@ SessionOptionEditor::SessionOptionEditor (Session* s)
|
||||||
|
|
||||||
add_option (_("Misc"), li);
|
add_option (_("Misc"), li);
|
||||||
|
|
||||||
add_option (_("Misc"), new OptionEditorHeading (_("Broadcast WAVE metadata")));
|
|
||||||
|
|
||||||
add_option (_("Misc"), new EntryOption (
|
|
||||||
"bwf-country-code",
|
|
||||||
_("Country code"),
|
|
||||||
sigc::mem_fun (*_session_config, &SessionConfiguration::get_bwf_country_code),
|
|
||||||
sigc::mem_fun (*_session_config, &SessionConfiguration::set_bwf_country_code)
|
|
||||||
));
|
|
||||||
|
|
||||||
add_option (_("Misc"), new EntryOption (
|
|
||||||
"bwf-organization-code",
|
|
||||||
_("Organization code"),
|
|
||||||
sigc::mem_fun (*_session_config, &SessionConfiguration::get_bwf_organization_code),
|
|
||||||
sigc::mem_fun (*_session_config, &SessionConfiguration::set_bwf_organization_code)
|
|
||||||
));
|
|
||||||
|
|
||||||
add_option (_("Misc"), new OptionEditorHeading (_("Glue to bars and beats")));
|
add_option (_("Misc"), new OptionEditorHeading (_("Glue to bars and beats")));
|
||||||
|
|
||||||
add_option (_("Misc"), new BoolOption (
|
add_option (_("Misc"), new BoolOption (
|
||||||
|
|
|
||||||
|
|
@ -777,8 +777,6 @@ class Session : public PBD::StatefulDestructible, public PBD::ScopedConnectionLi
|
||||||
|
|
||||||
boost::shared_ptr<PBD::Controllable> solo_cut_control() const;
|
boost::shared_ptr<PBD::Controllable> solo_cut_control() const;
|
||||||
|
|
||||||
SessionMetadata & metadata () { return *_metadata; }
|
|
||||||
|
|
||||||
SessionConfiguration config;
|
SessionConfiguration config;
|
||||||
|
|
||||||
bool exporting () const {
|
bool exporting () const {
|
||||||
|
|
@ -1466,8 +1464,6 @@ class Session : public PBD::StatefulDestructible, public PBD::ScopedConnectionLi
|
||||||
|
|
||||||
static bool _disable_all_loaded_plugins;
|
static bool _disable_all_loaded_plugins;
|
||||||
|
|
||||||
SessionMetadata * _metadata;
|
|
||||||
|
|
||||||
mutable bool have_looped; ///< Used in ::audible_frame(*)
|
mutable bool have_looped; ///< Used in ::audible_frame(*)
|
||||||
|
|
||||||
void update_have_rec_enabled_track ();
|
void update_have_rec_enabled_track ();
|
||||||
|
|
|
||||||
|
|
@ -45,8 +45,6 @@ CONFIG_VARIABLE (TimecodeFormat, timecode_format, "timecode-format", timecode_30
|
||||||
CONFIG_VARIABLE_SPECIAL(std::string, raid_path, "raid-path", "", path_expand)
|
CONFIG_VARIABLE_SPECIAL(std::string, raid_path, "raid-path", "", path_expand)
|
||||||
CONFIG_VARIABLE_SPECIAL(std::string, audio_search_path, "audio-search-path", "", search_path_expand)
|
CONFIG_VARIABLE_SPECIAL(std::string, audio_search_path, "audio-search-path", "", search_path_expand)
|
||||||
CONFIG_VARIABLE_SPECIAL(std::string, midi_search_path, "midi-search-path", "", search_path_expand)
|
CONFIG_VARIABLE_SPECIAL(std::string, midi_search_path, "midi-search-path", "", search_path_expand)
|
||||||
CONFIG_VARIABLE (std::string, bwf_country_code, "bwf-country-code", "US")
|
|
||||||
CONFIG_VARIABLE (std::string, bwf_organization_code, "bwf-organization-code", "US")
|
|
||||||
CONFIG_VARIABLE (std::string, auditioner_output_left, "auditioner-output-left", "default")
|
CONFIG_VARIABLE (std::string, auditioner_output_left, "auditioner-output-left", "default")
|
||||||
CONFIG_VARIABLE (std::string, auditioner_output_right, "auditioner-output-right", "default")
|
CONFIG_VARIABLE (std::string, auditioner_output_right, "auditioner-output-right", "default")
|
||||||
CONFIG_VARIABLE (bool, timecode_source_is_synced, "timecode-source-is-synced", true)
|
CONFIG_VARIABLE (bool, timecode_source_is_synced, "timecode-source-is-synced", true)
|
||||||
|
|
|
||||||
|
|
@ -37,6 +37,9 @@ namespace ARDOUR {
|
||||||
class SessionMetadata : public PBD::StatefulDestructible
|
class SessionMetadata : public PBD::StatefulDestructible
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
|
//singleton instance:
|
||||||
|
static SessionMetadata *Metadata() { if (_metadata == NULL) _metadata = new SessionMetadata(); return _metadata; }
|
||||||
|
|
||||||
SessionMetadata ();
|
SessionMetadata ();
|
||||||
~SessionMetadata ();
|
~SessionMetadata ();
|
||||||
|
|
||||||
|
|
@ -72,6 +75,15 @@ class SessionMetadata : public PBD::StatefulDestructible
|
||||||
|
|
||||||
std::string genre () const;
|
std::string genre () const;
|
||||||
|
|
||||||
|
std::string instructor () const;
|
||||||
|
std::string course () const;
|
||||||
|
|
||||||
|
std::string user_name () const;
|
||||||
|
std::string user_email () const;
|
||||||
|
std::string user_web () const;
|
||||||
|
std::string organization () const;
|
||||||
|
std::string country () const;
|
||||||
|
|
||||||
/*** Editing ***/
|
/*** Editing ***/
|
||||||
void set_comment (const std::string &);
|
void set_comment (const std::string &);
|
||||||
void set_copyright (const std::string &);
|
void set_copyright (const std::string &);
|
||||||
|
|
@ -104,15 +116,28 @@ class SessionMetadata : public PBD::StatefulDestructible
|
||||||
|
|
||||||
void set_genre (const std::string &);
|
void set_genre (const std::string &);
|
||||||
|
|
||||||
|
void set_instructor (const std::string &);
|
||||||
|
void set_course (const std::string &);
|
||||||
|
|
||||||
|
void set_user_name (const std::string &);
|
||||||
|
void set_user_email (const std::string &);
|
||||||
|
void set_user_web (const std::string &);
|
||||||
|
void set_organization (const std::string &);
|
||||||
|
void set_country (const std::string &);
|
||||||
|
|
||||||
/*** Serialization ***/
|
/*** Serialization ***/
|
||||||
XMLNode & get_state ();
|
XMLNode & get_state (); //serializes stuff in the map, to be stored in session file
|
||||||
int set_state (const XMLNode &, int version);
|
XMLNode & get_user_state (); //serializes stuff in the user_map, to be stored in user's config file
|
||||||
|
int set_state (const XMLNode &, int version_num);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
|
||||||
|
static SessionMetadata *_metadata; //singleton instance
|
||||||
|
|
||||||
typedef std::pair<std::string, std::string> Property;
|
typedef std::pair<std::string, std::string> Property;
|
||||||
typedef std::map<std::string, std::string> PropertyMap;
|
typedef std::map<std::string, std::string> PropertyMap;
|
||||||
PropertyMap map;
|
PropertyMap map;
|
||||||
|
PropertyMap user_map;
|
||||||
|
|
||||||
XMLNode * get_xml (const std::string & name);
|
XMLNode * get_xml (const std::string & name);
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -28,6 +28,7 @@
|
||||||
#include "ardour/svn_revision.h"
|
#include "ardour/svn_revision.h"
|
||||||
#include "ardour/ardour.h"
|
#include "ardour/ardour.h"
|
||||||
#include "ardour/session.h"
|
#include "ardour/session.h"
|
||||||
|
#include "ardour/session_metadata.h"
|
||||||
|
|
||||||
#include "pbd/convert.h"
|
#include "pbd/convert.h"
|
||||||
|
|
||||||
|
|
@ -94,8 +95,8 @@ BroadcastInfo::set_originator_ref_from_session (Session const & session)
|
||||||
serial_number << "ARDOUR" << "r" << std::setfill('0') << std::right << std::setw(5) << svn_revision;
|
serial_number << "ARDOUR" << "r" << std::setfill('0') << std::right << std::setw(5) << svn_revision;
|
||||||
|
|
||||||
snprintf_bounded_null_filled (info->originator_reference, sizeof (info->originator_reference), "%2s%3s%12s%02d%02d%02d%9d",
|
snprintf_bounded_null_filled (info->originator_reference, sizeof (info->originator_reference), "%2s%3s%12s%02d%02d%02d%9d",
|
||||||
session.config.get_bwf_country_code().c_str(),
|
SessionMetadata::Metadata()->country().c_str(),
|
||||||
session.config.get_bwf_organization_code().c_str(),
|
SessionMetadata::Metadata()->organization().c_str(),
|
||||||
serial_number.str().c_str(),
|
serial_number.str().c_str(),
|
||||||
_time.tm_hour,
|
_time.tm_hour,
|
||||||
_time.tm_min,
|
_time.tm_min,
|
||||||
|
|
|
||||||
|
|
@ -36,6 +36,7 @@
|
||||||
#include "ardour/audio_diskstream.h"
|
#include "ardour/audio_diskstream.h"
|
||||||
#include "ardour/control_protocol_manager.h"
|
#include "ardour/control_protocol_manager.h"
|
||||||
#include "ardour/filesystem_paths.h"
|
#include "ardour/filesystem_paths.h"
|
||||||
|
#include "ardour/session_metadata.h"
|
||||||
|
|
||||||
#include "i18n.h"
|
#include "i18n.h"
|
||||||
|
|
||||||
|
|
@ -208,6 +209,8 @@ RCConfiguration::get_state ()
|
||||||
|
|
||||||
root->add_child_nocopy (get_variables ());
|
root->add_child_nocopy (get_variables ());
|
||||||
|
|
||||||
|
root->add_child_nocopy (SessionMetadata::Metadata()->get_user_state());
|
||||||
|
|
||||||
if (_extra_xml) {
|
if (_extra_xml) {
|
||||||
root->add_child_copy (*_extra_xml);
|
root->add_child_copy (*_extra_xml);
|
||||||
}
|
}
|
||||||
|
|
@ -239,7 +242,7 @@ RCConfiguration::get_variables ()
|
||||||
}
|
}
|
||||||
|
|
||||||
int
|
int
|
||||||
RCConfiguration::set_state (const XMLNode& root, int /*version*/)
|
RCConfiguration::set_state (const XMLNode& root, int version)
|
||||||
{
|
{
|
||||||
if (root.name() != "Ardour") {
|
if (root.name() != "Ardour") {
|
||||||
return -1;
|
return -1;
|
||||||
|
|
@ -263,6 +266,8 @@ RCConfiguration::set_state (const XMLNode& root, int /*version*/)
|
||||||
|
|
||||||
if (node->name() == "Config") {
|
if (node->name() == "Config") {
|
||||||
set_variables (*node);
|
set_variables (*node);
|
||||||
|
} else if (node->name() == "Metadata") {
|
||||||
|
SessionMetadata::Metadata()->set_state (*node, version);
|
||||||
} else if (node->name() == ControlProtocolManager::state_node_name) {
|
} else if (node->name() == ControlProtocolManager::state_node_name) {
|
||||||
_control_protocol_state = new XMLNode (*node);
|
_control_protocol_state = new XMLNode (*node);
|
||||||
} else if (node->name() == MIDI::Port::state_node_name) {
|
} else if (node->name() == MIDI::Port::state_node_name) {
|
||||||
|
|
|
||||||
|
|
@ -94,7 +94,6 @@
|
||||||
#include "ardour/session.h"
|
#include "ardour/session.h"
|
||||||
#include "ardour/session_directory.h"
|
#include "ardour/session_directory.h"
|
||||||
#include "ardour/session_directory.h"
|
#include "ardour/session_directory.h"
|
||||||
#include "ardour/session_metadata.h"
|
|
||||||
#include "ardour/session_playlists.h"
|
#include "ardour/session_playlists.h"
|
||||||
#include "ardour/slave.h"
|
#include "ardour/slave.h"
|
||||||
#include "ardour/smf_source.h"
|
#include "ardour/smf_source.h"
|
||||||
|
|
@ -162,7 +161,6 @@ Session::Session (AudioEngine &eng,
|
||||||
, click_data (0)
|
, click_data (0)
|
||||||
, click_emphasis_data (0)
|
, click_emphasis_data (0)
|
||||||
, main_outs (0)
|
, main_outs (0)
|
||||||
, _metadata (new SessionMetadata())
|
|
||||||
, _have_rec_enabled_track (false)
|
, _have_rec_enabled_track (false)
|
||||||
, _suspend_timecode_transmission (0)
|
, _suspend_timecode_transmission (0)
|
||||||
{
|
{
|
||||||
|
|
|
||||||
|
|
@ -26,6 +26,8 @@ using namespace std;
|
||||||
using namespace Glib;
|
using namespace Glib;
|
||||||
using namespace ARDOUR;
|
using namespace ARDOUR;
|
||||||
|
|
||||||
|
SessionMetadata *SessionMetadata::_metadata = NULL; //singleton instance
|
||||||
|
|
||||||
SessionMetadata::SessionMetadata ()
|
SessionMetadata::SessionMetadata ()
|
||||||
{
|
{
|
||||||
/*** General ***/
|
/*** General ***/
|
||||||
|
|
@ -53,6 +55,10 @@ SessionMetadata::SessionMetadata ()
|
||||||
map.insert (Property ("mixer", ""));
|
map.insert (Property ("mixer", ""));
|
||||||
//map.insert (Property ("performers", "")); // Multiple values [instrument]
|
//map.insert (Property ("performers", "")); // Multiple values [instrument]
|
||||||
|
|
||||||
|
/*** Education... ***/
|
||||||
|
map.insert (Property ("instructor", ""));
|
||||||
|
map.insert (Property ("course", ""));
|
||||||
|
|
||||||
/*** Album info ***/
|
/*** Album info ***/
|
||||||
map.insert (Property ("album", ""));
|
map.insert (Property ("album", ""));
|
||||||
map.insert (Property ("compilation", ""));
|
map.insert (Property ("compilation", ""));
|
||||||
|
|
@ -79,7 +85,14 @@ SessionMetadata::SessionMetadata ()
|
||||||
//map.insert (Property ("album_sort", ""));
|
//map.insert (Property ("album_sort", ""));
|
||||||
//map.insert (Property ("album_artist_sort", ""));
|
//map.insert (Property ("album_artist_sort", ""));
|
||||||
//map.insert (Property ("artist_sort", ""));
|
//map.insert (Property ("artist_sort", ""));
|
||||||
//map.insert (Property ("title_sort", ""));
|
//map.insert (Property ("title_sort", ""));\
|
||||||
|
|
||||||
|
/*** Globals ***/
|
||||||
|
user_map.insert (Property ("user_name", ""));
|
||||||
|
user_map.insert (Property ("user_email", ""));
|
||||||
|
user_map.insert (Property ("user_web", ""));
|
||||||
|
user_map.insert (Property ("user_organization", ""));
|
||||||
|
user_map.insert (Property ("user_country", ""));
|
||||||
}
|
}
|
||||||
|
|
||||||
SessionMetadata::~SessionMetadata ()
|
SessionMetadata::~SessionMetadata ()
|
||||||
|
|
@ -107,10 +120,13 @@ SessionMetadata::get_value (const string & name) const
|
||||||
{
|
{
|
||||||
PropertyMap::const_iterator it = map.find (name);
|
PropertyMap::const_iterator it = map.find (name);
|
||||||
if (it == map.end()) {
|
if (it == map.end()) {
|
||||||
|
it = user_map.find (name);
|
||||||
|
if (it == user_map.end()) {
|
||||||
// Should not be reached!
|
// Should not be reached!
|
||||||
std::cerr << "Programming error in SessionMetadata::get_value" << std::endl;
|
std::cerr << "Programming error in SessionMetadata::get_value" << std::endl;
|
||||||
return "";
|
return "";
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
return it->second;
|
return it->second;
|
||||||
}
|
}
|
||||||
|
|
@ -126,10 +142,13 @@ SessionMetadata::set_value (const string & name, const string & value)
|
||||||
{
|
{
|
||||||
PropertyMap::iterator it = map.find (name);
|
PropertyMap::iterator it = map.find (name);
|
||||||
if (it == map.end()) {
|
if (it == map.end()) {
|
||||||
|
it = user_map.find (name);
|
||||||
|
if (it == user_map.end()) {
|
||||||
// Should not be reached!
|
// Should not be reached!
|
||||||
std::cerr << "Programming error in SessionMetadata::set_value" << std::endl;
|
std::cerr << "Programming error in SessionMetadata::set_value" << std::endl;
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
it->second = value;
|
it->second = value;
|
||||||
}
|
}
|
||||||
|
|
@ -163,7 +182,7 @@ SessionMetadata::get_state ()
|
||||||
}
|
}
|
||||||
|
|
||||||
int
|
int
|
||||||
SessionMetadata::set_state (const XMLNode & state, int /*version*/)
|
SessionMetadata::set_state (const XMLNode & state, int version_num)
|
||||||
{
|
{
|
||||||
const XMLNodeList & children = state.children();
|
const XMLNodeList & children = state.children();
|
||||||
string name;
|
string name;
|
||||||
|
|
@ -186,6 +205,22 @@ SessionMetadata::set_state (const XMLNode & state, int /*version*/)
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
XMLNode &
|
||||||
|
SessionMetadata::get_user_state ()
|
||||||
|
{
|
||||||
|
XMLNode * node = new XMLNode ("Metadata");
|
||||||
|
XMLNode * prop;
|
||||||
|
|
||||||
|
for (PropertyMap::const_iterator it = user_map.begin(); it != user_map.end(); ++it) {
|
||||||
|
if ((prop = get_xml (it->first))) {
|
||||||
|
node->add_child_nocopy (*prop);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return *node;
|
||||||
|
}
|
||||||
|
|
||||||
/*** Accessing ***/
|
/*** Accessing ***/
|
||||||
string
|
string
|
||||||
SessionMetadata::comment () const
|
SessionMetadata::comment () const
|
||||||
|
|
@ -343,6 +378,51 @@ SessionMetadata::genre () const
|
||||||
return get_value("genre");
|
return get_value("genre");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
string
|
||||||
|
SessionMetadata::instructor () const
|
||||||
|
{
|
||||||
|
return get_value("instructor");
|
||||||
|
}
|
||||||
|
|
||||||
|
string
|
||||||
|
SessionMetadata::course () const
|
||||||
|
{
|
||||||
|
return get_value("course");
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
string
|
||||||
|
SessionMetadata::user_name () const
|
||||||
|
{
|
||||||
|
return get_value("user_name");
|
||||||
|
}
|
||||||
|
|
||||||
|
string
|
||||||
|
SessionMetadata::user_email () const
|
||||||
|
{
|
||||||
|
return get_value("user_email");
|
||||||
|
}
|
||||||
|
|
||||||
|
string
|
||||||
|
SessionMetadata::user_web () const
|
||||||
|
{
|
||||||
|
return get_value("user_web");
|
||||||
|
}
|
||||||
|
|
||||||
|
string
|
||||||
|
SessionMetadata::organization () const
|
||||||
|
{
|
||||||
|
return get_value("user_organization");
|
||||||
|
}
|
||||||
|
|
||||||
|
string
|
||||||
|
SessionMetadata::country () const
|
||||||
|
{
|
||||||
|
return get_value("user_country");
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/*** Editing ***/
|
/*** Editing ***/
|
||||||
void
|
void
|
||||||
SessionMetadata::set_comment (const string & v)
|
SessionMetadata::set_comment (const string & v)
|
||||||
|
|
@ -499,3 +579,44 @@ SessionMetadata::set_genre (const string & v)
|
||||||
{
|
{
|
||||||
set_value ("genre", v);
|
set_value ("genre", v);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void
|
||||||
|
SessionMetadata::set_instructor (const string & v)
|
||||||
|
{
|
||||||
|
set_value ("instructor", v);
|
||||||
|
}
|
||||||
|
|
||||||
|
void
|
||||||
|
SessionMetadata::set_course (const string & v)
|
||||||
|
{
|
||||||
|
set_value ("course", v);
|
||||||
|
}
|
||||||
|
|
||||||
|
void
|
||||||
|
SessionMetadata::set_user_name (const string & v)
|
||||||
|
{
|
||||||
|
set_value ("user_name", v);
|
||||||
|
}
|
||||||
|
|
||||||
|
void
|
||||||
|
SessionMetadata::set_user_email (const string & v)
|
||||||
|
{
|
||||||
|
set_value ("user_email", v);
|
||||||
|
}
|
||||||
|
|
||||||
|
void
|
||||||
|
SessionMetadata::set_user_web (const string & v)
|
||||||
|
{
|
||||||
|
set_value ("user_web", v);
|
||||||
|
}
|
||||||
|
|
||||||
|
void
|
||||||
|
SessionMetadata::set_organization (const string & v)
|
||||||
|
{
|
||||||
|
set_value ("user_organization", v);
|
||||||
|
}
|
||||||
|
void
|
||||||
|
SessionMetadata::set_country (const string & v)
|
||||||
|
{
|
||||||
|
set_value ("user_country", v);
|
||||||
|
}
|
||||||
|
|
|
||||||
|
|
@ -566,10 +566,6 @@ Session::create (const string& session_template, BusProfile* bus_profile)
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Instantiate metadata */
|
|
||||||
|
|
||||||
_metadata = new SessionMetadata ();
|
|
||||||
|
|
||||||
/* set initial start + end point */
|
/* set initial start + end point */
|
||||||
|
|
||||||
_state_of_the_state = Clean;
|
_state_of_the_state = Clean;
|
||||||
|
|
@ -1058,7 +1054,7 @@ Session::state(bool full_state)
|
||||||
|
|
||||||
node->add_child_nocopy (config.get_variables ());
|
node->add_child_nocopy (config.get_variables ());
|
||||||
|
|
||||||
node->add_child_nocopy (_metadata->get_state());
|
node->add_child_nocopy (ARDOUR::SessionMetadata::Metadata()->get_state());
|
||||||
|
|
||||||
child = node->add_child ("Sources");
|
child = node->add_child ("Sources");
|
||||||
|
|
||||||
|
|
@ -1275,7 +1271,7 @@ Session::set_state (const XMLNode& node, int version)
|
||||||
if (version >= 3000) {
|
if (version >= 3000) {
|
||||||
if ((child = find_named_node (node, "Metadata")) == 0) {
|
if ((child = find_named_node (node, "Metadata")) == 0) {
|
||||||
warning << _("Session: XML state has no metadata section") << endmsg;
|
warning << _("Session: XML state has no metadata section") << endmsg;
|
||||||
} else if (_metadata->set_state (*child, version)) {
|
} else if ( ARDOUR::SessionMetadata::Metadata()->set_state (*child, version) ) {
|
||||||
goto out;
|
goto out;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue