a) fix problems with multichannel tape tracks

b) separate data format and header format for native audio files
 c) expose data/header selections in GUI
 d) fix error in file naming for multichannel tape tracks
 e) remove blocks on GTK rc files during startup


git-svn-id: svn://localhost/trunk/ardour2@423 d708f5d6-7413-0410-9779-e7cbd77b26cf
This commit is contained in:
Paul Davis
2006-03-28 19:22:29 +00:00
parent 744acb7c16
commit e27ac3278b
19 changed files with 231 additions and 117 deletions

View File

@@ -194,6 +194,16 @@
<menuitem action='About'/>
</menu>
<menu name='Options' action='Options'>
<menu action='AudioFileFormat'>
<menu action='AudioFileFormatData'>
<menuitem action='FileDataFormatFloat'/>
<menuitem action='FileDataFormat24bit'/>
</menu>
<menu action='AudioFileFormatHeader'>
<menuitem action='FileHeaderFormatBWF'/>
<menuitem action='FileHeaderFormatWAVE'/>
</menu>
</menu>
<menu action='Autoconnect'>
<menuitem action='AutoConnectNewTrackInputsToHardware'/>
<menuitem action='AutoConnectNewTrackOutputsToHardware'/>
@@ -214,6 +224,7 @@
<menuitem action='toggle-xfades-active'/>
<menuitem action='toggle-xfades-visible'/>
<menuitem action='toggle-auto-xfades'/>
<menuitem action='UnmuteNewFullCrossfades'/>
<separator/>
<menuitem action='CrossfadesFull'/>
<menuitem action='CrossfadesShort'/>
@@ -238,9 +249,6 @@
<menuitem action='StopRecordingOnXrun'/>
<menuitem action='StopTransportAtEndOfSession'/>
<menuitem action='GainReduceFastTransport'/>
<separator/>
<menuitem action='AutomaticallyCreateCrossfades'/>
<menuitem action='UnmuteNewFullCrossfades'/>
</menu>
<menu name='Help' action='Help'>
<menu name='KeyMouse Actions' action='KeyMouse Actions'>

View File

@@ -271,6 +271,10 @@ ARDOUR_UI::set_engine (AudioEngine& e)
blink_timeout_tag = -1;
/* the global configuration object is now valid */
use_config ();
/* this being a GUI and all, we want peakfiles */
FileSource::set_build_peakfiles (true);
@@ -2326,3 +2330,106 @@ ARDOUR_UI::cmdline_new_session (string path)
_will_create_new_session_automatically = false; /* done it */
return FALSE; /* don't call it again */
}
void
ARDOUR_UI::set_native_file_header_format (HeaderFormat hf)
{
Glib::RefPtr<Action> act;
switch (hf) {
case BWF:
act = ActionManager::get_action (X_("options"), X_("FileHeaderFormatBWF"));
break;
case WAVE:
act = ActionManager::get_action (X_("options"), X_("FileHeaderFormatWAVE"));
break;
case WAVE64:
act = ActionManager::get_action (X_("options"), X_("FileHeaderFormatWAVE64"));
break;
case iXML:
act = ActionManager::get_action (X_("options"), X_("FileHeaderFormatiXML"));
break;
case RF64:
act = ActionManager::get_action (X_("options"), X_("FileHeaderFormatRF64"));
break;
}
if (act) {
Glib::RefPtr<RadioAction> ract = Glib::RefPtr<RadioAction>::cast_dynamic(act);
if (ract && ract->get_active() && Config->get_native_file_header_format() != hf) {
Config->set_native_file_header_format (hf);
if (session) {
session->reset_native_file_format ();
}
}
}
}
void
ARDOUR_UI::set_native_file_data_format (SampleFormat sf)
{
Glib::RefPtr<Action> act;
switch (sf) {
case FormatFloat:
act = ActionManager::get_action (X_("options"), X_("FileDataFormatFloat"));
break;
case FormatInt24:
act = ActionManager::get_action (X_("options"), X_("FileDataFormat24bit"));
break;
}
if (act) {
Glib::RefPtr<RadioAction> ract = Glib::RefPtr<RadioAction>::cast_dynamic(act);
if (ract && ract->get_active() && Config->get_native_file_data_format() != sf) {
Config->set_native_file_data_format (sf);
if (session) {
session->reset_native_file_format ();
}
}
}
}
void
ARDOUR_UI::use_config ()
{
Glib::RefPtr<Action> act;
switch (Config->get_native_file_data_format ()) {
case FormatFloat:
act = ActionManager::get_action (X_("options"), X_("FileDataFormatFloat"));
break;
case FormatInt24:
act = ActionManager::get_action (X_("options"), X_("FileDataFormat24bit"));
break;
}
if (act) {
Glib::RefPtr<RadioAction> ract = Glib::RefPtr<RadioAction>::cast_dynamic(act);
ract->set_active ();
}
switch (Config->get_native_file_header_format ()) {
case BWF:
act = ActionManager::get_action (X_("options"), X_("FileHeaderFormatBWF"));
break;
case WAVE:
act = ActionManager::get_action (X_("options"), X_("FileHeaderFormatWAVE"));
break;
case WAVE64:
act = ActionManager::get_action (X_("options"), X_("FileHeaderFormatWAVE64"));
break;
case iXML:
act = ActionManager::get_action (X_("options"), X_("FileHeaderFormatiXML"));
break;
case RF64:
act = ActionManager::get_action (X_("options"), X_("FileHeaderFormatRF64"));
break;
}
if (act) {
Glib::RefPtr<RadioAction> ract = Glib::RefPtr<RadioAction>::cast_dynamic(act);
ract->set_active ();
}
}

View File

@@ -208,6 +208,9 @@ class ARDOUR_UI : public Gtkmm2ext::UI
void maximise_editing_space ();
void restore_editing_space ();
void set_native_file_header_format (ARDOUR::HeaderFormat sf);
void set_native_file_data_format (ARDOUR::SampleFormat sf);
protected:
friend class PublicEditor;
@@ -305,6 +308,8 @@ class ARDOUR_UI : public Gtkmm2ext::UI
void engine_stopped ();
void engine_running ();
void use_config ();
void clear_meters ();
static gint _blink (void *);

View File

@@ -72,7 +72,11 @@ ARDOUR_UI::install_actions ()
ActionManager::register_action (main_actions, X_("Options"), _("Options"));
ActionManager::register_action (main_actions, X_("TransportOptions"), _("Options"));
ActionManager::register_action (main_actions, X_("Help"), _("Help"));
ActionManager::register_action (main_actions, X_("KeyMouse Actions"), _("KeyMouse Actions"));
ActionManager::register_action (main_actions, X_("KeyMouse Actions"), _("KeyMouse Actions"));
ActionManager::register_action (main_actions, X_("AudioFileFormat"), _("Audio File Format"));
ActionManager::register_action (main_actions, X_("AudioFileFormatHeader"), _("Header"));
ActionManager::register_action (main_actions, X_("AudioFileFormatData"), _("Data"));
/* the real actions */
act = ActionManager::register_action (main_actions, X_("New"), _("New"), bind (mem_fun(*this, &ARDOUR_UI::new_session), false, string ()));
@@ -370,6 +374,19 @@ ARDOUR_UI::install_actions ()
act = ActionManager::register_toggle_action (option_actions, X_("AutoConnectNewTrackInputsToHardware"), _("Connect newtrack inputs to hardware"), mem_fun (*this, &ARDOUR_UI::toggle_AutoConnectNewTrackInputsToHardware));
ActionManager::session_sensitive_actions.push_back (act);
RadioAction::Group file_header_group;
act = ActionManager::register_radio_action (option_actions, file_header_group, X_("FileHeaderFormatBWF"), X_("Broadcast WAVE"), bind (mem_fun (*this, &ARDOUR_UI::set_native_file_header_format), ARDOUR::BWF));
act = ActionManager::register_radio_action (option_actions, file_header_group, X_("FileHeaderFormatWAVE"), X_("WAVE"), bind (mem_fun (*this, &ARDOUR_UI::set_native_file_header_format), ARDOUR::WAVE));
act = ActionManager::register_radio_action (option_actions, file_header_group, X_("FileHeaderFormatWAVE64"), X_("WAVE-64"), bind (mem_fun (*this, &ARDOUR_UI::set_native_file_header_format), ARDOUR::WAVE64));
act = ActionManager::register_radio_action (option_actions, file_header_group, X_("FileHeaderFormatiXML"), X_("iXML"), bind (mem_fun (*this, &ARDOUR_UI::set_native_file_header_format), ARDOUR::iXML));
act = ActionManager::register_radio_action (option_actions, file_header_group, X_("FileHeaderFormatRF64"), X_("RF64"), bind (mem_fun (*this, &ARDOUR_UI::set_native_file_header_format), ARDOUR::RF64));
RadioAction::Group file_data_group;
act = ActionManager::register_radio_action (option_actions, file_data_group, X_("FileDataFormatFloat"), X_("32-bit floating point"), bind (mem_fun (*this, &ARDOUR_UI::set_native_file_data_format), ARDOUR::FormatFloat));
act = ActionManager::register_radio_action (option_actions, file_data_group, X_("FileDataFormat24bit"), X_("24-bit signed integer"), bind (mem_fun (*this, &ARDOUR_UI::set_native_file_data_format), ARDOUR::FormatInt24));
RadioAction::Group connect_outputs_group;
act = ActionManager::register_radio_action (option_actions, connect_outputs_group, X_("AutoConnectNewTrackOutputsToHardware"), _("Connect new track outputs to hardware"), mem_fun (*this, &ARDOUR_UI::toggle_AutoConnectNewTrackOutputsToHardware));

View File

@@ -392,7 +392,7 @@ ARDOUR_UI::setup_options ()
session_control_changed (Session::AutoReturn);
session_control_changed (Session::AutoInput);
session_control_changed (Session::Clicking);
session->ControlChanged.connect (mem_fun (*this, &ARDOUR_UI::queue_session_control_changed));
}

View File

@@ -318,22 +318,6 @@ main (int argc, char *argv[])
if (curvetest_file) {
return curvetest (curvetest_file);
}
if (!use_gtk_theme) {
/* desktop standard themes: just say no! */
if (getenv("GTK_RC_FILES")) {
unsetenv("GTK_RC_FILES");
}
if (getenv("GTK2_RC_FILES")) {
unsetenv("GTK_RC_FILES");
}
RC::set_default_files (null_file_list);
}
cout << _("Ardour/GTK ")
<< VERSIONSTRING

View File

@@ -227,12 +227,6 @@ OptionEditor::~OptionEditor ()
{
}
static const gchar *native_format_strings[] = {
N_("Broadcast WAVE/floating point"),
N_("WAVE/floating point"),
0
};
void
OptionEditor::setup_path_options()
{
@@ -251,11 +245,6 @@ OptionEditor::setup_path_options()
path_table.attach (*label, 0, 1, 0, 1, FILL|EXPAND, FILL);
path_table.attach (session_raid_entry, 1, 3, 0, 1, Gtk::FILL|Gtk::EXPAND, FILL);
label = manage(new Label(_("Native Format")));
label->set_name ("OptionsLabel");
path_table.attach (*label, 0, 1, 1, 2, FILL|EXPAND, FILL);
path_table.attach (native_format_combo, 1, 3, 1, 2, Gtk::FILL|Gtk::EXPAND, FILL);
label = manage(new Label(_("Soundfile Search Paths")));
label->set_name("OptionsLabel");
path_table.attach(*label, 0, 1, 2, 3, FILL|EXPAND, FILL);
@@ -264,19 +253,6 @@ OptionEditor::setup_path_options()
sfdb_path_view.append_column(_("Paths"), sfdb_path_columns.paths);
sfdb_path_view.set_size_request(-1, 100);
vector<string> nfstrings = internationalize (native_format_strings);
set_popdown_strings (native_format_combo, nfstrings);
native_format_combo.signal_changed().connect (mem_fun(*this, &OptionEditor::native_format_chosen));
fixup_combo_size (native_format_combo, nfstrings);
if (Config->get_native_format_is_bwf()) {
native_format_combo.set_active_text (native_format_strings[0]);
} else {
native_format_combo.set_active_text (native_format_strings[1]);
}
path_table.show_all();
}
@@ -779,23 +755,6 @@ OptionEditor::click_emphasis_sound_changed ()
}
}
void
OptionEditor::native_format_chosen ()
{
string which;
if (session == 0) {
return;
}
bool use_bwf = (native_format_combo.get_active_text() == native_format_strings[0]);
if (use_bwf != Config->get_native_format_is_bwf()) {
Config->set_native_format_is_bwf (use_bwf);
session->reset_native_file_format ();
}
}
void
OptionEditor::clear_click_editor ()
{

View File

@@ -72,7 +72,6 @@ class OptionEditor : public Gtk::Dialog
Gtk::Table path_table;
Gtk::Entry session_raid_entry;
Gtk::ComboBoxText native_format_combo;
struct SoundFilePathColumns : public Gtk::TreeModel::ColumnRecord {
public:
@@ -88,7 +87,6 @@ class OptionEditor : public Gtk::Dialog
void setup_path_options();
void add_session_paths ();
void remove_session_paths ();
void native_format_chosen ();
void raid_path_changed ();
/* fades */

View File

@@ -986,12 +986,10 @@ AudioRegionView::create_waves ()
uint32_t nchans = atv.get_diskstream()->n_channels();
// if (wait_for_waves) {
/* in tmp_waves, set up null pointers for each channel so the vector is allocated */
for (uint32_t n = 0; n < nchans; ++n) {
tmp_waves.push_back (0);
}
// }
/* in tmp_waves, set up null pointers for each channel so the vector is allocated */
for (uint32_t n = 0; n < nchans; ++n) {
tmp_waves.push_back (0);
}
for (uint32_t n = 0; n < nchans; ++n) {
@@ -1099,8 +1097,12 @@ AudioRegionView::create_one_wave (uint32_t which, bool direct)
void
AudioRegionView::peaks_ready_handler (uint32_t which)
{
peaks_ready_connection.disconnect ();
Gtkmm2ext::UI::instance()->call_slot (bind (mem_fun(*this, &AudioRegionView::create_one_wave), which, false));
if (!waves.empty()) {
/* all waves created, don't hook into peaks ready anymore */
peaks_ready_connection.disconnect ();
}
}
void

View File

@@ -103,7 +103,7 @@ TapeAudioRegionView::init (double amplitude_above_axis, Gdk::Color& basic_color,
/* every time the wave data changes and peaks are ready, redraw */
for (uint32_t n = 0; n < region.n_channels(); ++n) {
region.source(n).PeaksReady.connect (bind (mem_fun(*this, &TapeAudioRegionView::update), n));
}
@@ -117,6 +117,8 @@ TapeAudioRegionView::~TapeAudioRegionView()
void
TapeAudioRegionView::update (uint32_t n)
{
cerr << "new peaks ready for channel " << n << endl;
/* check that all waves are build and ready */
if (!tmp_waves.empty()) {

View File

@@ -1,5 +1,5 @@
#ifdef __APPLE__
CONFIG_VARIABLE(std::string, auditioner_output_left, "auditioner-output-left" "coreaudio:Built-in Audio:in1")
CONFIG_VARIABLE(std::string, auditioner_output_left, "auditioner-output-left", "coreaudio:Built-in Audio:in1")
CONFIG_VARIABLE(std::string, auditioner_output_right, "auditioner-output-right", "coreaudio:Built-in Audio:in2")
#else
CONFIG_VARIABLE(std::string, auditioner_output_left, "auditioner-output-left", "alsa_pcm:playback_1")
@@ -19,7 +19,6 @@ CONFIG_VARIABLE(bool, mute_affects_main_outs, "mute-affects-main-outs", true)
CONFIG_VARIABLE(bool, solo_latch, "solo-latch", true)
CONFIG_VARIABLE(bool, use_hardware_monitoring, "use-hardware-monitoring", true)
CONFIG_VARIABLE(bool, jack_time_master, "jack-time-master", true)
CONFIG_VARIABLE(bool, native_format_is_bwf, "native-format-is-bwf", true)
CONFIG_VARIABLE(bool, trace_midi_input, "trace-midi-input", false)
CONFIG_VARIABLE(bool, trace_midi_output, "trace-midi-output", false)
CONFIG_VARIABLE(bool, plugins_stop_with_transport, "plugins-stop-with-transport", false)
@@ -37,6 +36,8 @@ CONFIG_VARIABLE(bool, quieten_at_speed, "quieten-at-speed", true)
CONFIG_VARIABLE(uint32_t, midi_feedback_interval_ms, "midi-feedback-interval-ms", 100)
CONFIG_VARIABLE(uint32_t, disk_choice_space_threshold, "disk-choice-space-threshold", 57600000)
CONFIG_VARIABLE(uint32_t, destructive_xfade_msecs, "destructive-xfade-msecs", 2)
CONFIG_VARIABLE(SampleFormat, native_file_data_format, "native-file-data-format", ARDOUR::FormatFloat)
CONFIG_VARIABLE(HeaderFormat, native_file_header_format, "native-file-header-format", ARDOUR::WAVE)
/* these variables have custom set() methods */

View File

@@ -25,6 +25,8 @@
#define __STDC_FORMAT_MACROS /* PRI<foo>; C++ requires explicit requesting of these */
#endif
#include <istream>
#include <inttypes.h>
#include <jack/types.h>
#include <map>
@@ -247,8 +249,20 @@ namespace ARDOUR {
FormatFloat = 0,
FormatInt24
};
enum HeaderFormat {
BWF,
WAVE,
WAVE64,
iXML,
RF64
};
};
std::istream& operator>>(std::istream& o, ARDOUR::SampleFormat sf);
std::istream& operator>>(std::istream& o, ARDOUR::HeaderFormat sf);
static inline jack_nframes_t
session_frame_to_track_frame (jack_nframes_t session_frame, double speed)

View File

@@ -47,7 +47,7 @@ AudioFilter::make_new_sources (AudioRegion& region, AudioRegion::SourceList& nsr
}
try {
nsrcs.push_back (new FileSource (path, session.frame_rate()));
nsrcs.push_back (new FileSource (path, session.frame_rate(), false, Config->get_native_file_data_format()));
}
catch (failed_constructor& err) {

View File

@@ -69,16 +69,11 @@ DiskStream::DiskStream (Session &sess, const string &name, Flag flag)
/* prevent any write sources from being created */
in_set_state = true;
init (flag);
use_new_playlist ();
in_set_state = false;
if (destructive()) {
setup_destructive_playlist ();
}
in_set_state = false;
DiskStreamCreated (this); /* EMIT SIGNAL */
}
@@ -457,9 +452,7 @@ DiskStream::setup_destructive_playlist ()
{
AudioRegion::SourceList srcs;
/* make sure we have sources for every channel */
reset_write_sources (true);
cerr << "setting up destructive playlist with " << channels.size() << " channels\n";
for (ChannelList::iterator chan = channels.begin(); chan != channels.end(); ++chan) {
srcs.push_back ((*chan).write_source);
@@ -2143,9 +2136,8 @@ DiskStream::set_state (const XMLNode& node)
capturing_sources.clear ();
/* write sources are handled elsewhere;
for destructive tracks: in {setup,use}_destructive_playlist()
for non-destructive: when we handle the input set up of the IO that owns this DS
/* write sources are handled when we handle the input set
up of the IO that owns this DS (::non_realtime_input_change())
*/
in_set_state = false;
@@ -2210,32 +2202,35 @@ DiskStream::reset_write_sources (bool mark_write_complete, bool force)
return;
}
if (!force && destructive()) {
/* make sure we always have enough sources for the current channel count */
for (chan = channels.begin(), n = 0; chan != channels.end(); ++chan, ++n) {
if ((*chan).write_source == 0) {
break;
}
}
if (chan == channels.end()) {
return;
}
/* some channels do not have a write source */
}
capturing_sources.clear ();
for (chan = channels.begin(), n = 0; chan != channels.end(); ++chan, ++n) {
if ((*chan).write_source && mark_write_complete) {
(*chan).write_source->mark_streaming_write_completed ();
if (!destructive()) {
if ((*chan).write_source && mark_write_complete) {
(*chan).write_source->mark_streaming_write_completed ();
}
use_new_write_source (n);
if (record_enabled()) {
capturing_sources.push_back ((*chan).write_source);
}
} else {
if ((*chan).write_source == 0) {
use_new_write_source (n);
}
}
use_new_write_source (n);
if (record_enabled()) {
capturing_sources.push_back ((*chan).write_source);
}
if (destructive()) {
/* we now have all our write sources set up, so create the
playlist's single region.
*/
if (_playlist->empty()) {
setup_destructive_playlist ();
}
}
}
@@ -2490,7 +2485,7 @@ DiskStream::use_pending_capture_data (XMLNode& node)
}
try {
fs = new FileSource (prop->value(), _session.frame_rate(), true);
fs = new FileSource (prop->value(), _session.frame_rate(), true, Config->get_native_file_data_format());
}
catch (failed_constructor& err) {

View File

@@ -265,7 +265,14 @@ FileSource::init (string pathstr, bool must_exist, jack_nframes_t rate)
if (new_file) {
is_bwf = Config->get_native_format_is_bwf ();
switch (Config->get_native_file_header_format()) {
case BWF:
is_bwf = true;
break;
default:
is_bwf = false;
break;
}
if (fill_header (rate)) {
error << string_compose (_("FileSource: cannot write header in %1"), _path) << endmsg;

View File

@@ -501,3 +501,18 @@ ARDOUR::coverage (jack_nframes_t sa, jack_nframes_t ea,
return OverlapNone;
}
/* not sure where to put these */
std::istream& operator>>(std::istream& o, HeaderFormat hf) {
int val;
o >> val;
hf = (HeaderFormat) val;
return o;
}
std::istream& operator>>(std::istream& o, SampleFormat sf) {
int val;
o >> val;
sf = (SampleFormat) val;
return o;
}

View File

@@ -134,7 +134,7 @@ Session::import_audiofile (import_status& status)
try {
newfiles[n] = new FileSource (buf, frame_rate());
newfiles[n] = new FileSource (buf, frame_rate(), false, Config->get_native_file_data_format());
}
catch (failed_constructor& err) {

View File

@@ -2795,7 +2795,7 @@ Session::audio_path_from_name (string name, uint32_t nchan, uint32_t chan, bool
if (nchan < 2) {
snprintf (buf, sizeof(buf), "%s/T%04d-%s.wav", spath.c_str(), cnt, legalized.c_str());
} else if (nchan == 2) {
if (nchan == 0) {
if (chan == 0) {
snprintf (buf, sizeof(buf), "%s/T%04d-%s%%L.wav", spath.c_str(), cnt, legalized.c_str());
} else {
snprintf (buf, sizeof(buf), "%s/T%04d-%s%%R.wav", spath.c_str(), cnt, legalized.c_str());
@@ -2871,9 +2871,9 @@ Session::create_file_source (DiskStream& ds, int32_t chan, bool destructive)
/* this might throw failed_constructor(), which is OK */
if (destructive) {
return new DestructiveFileSource (spath, frame_rate());
return new DestructiveFileSource (spath, frame_rate(), false, Config->get_native_file_data_format());
} else {
return new FileSource (spath, frame_rate());
return new FileSource (spath, frame_rate(), false, Config->get_native_file_data_format());
}
}
@@ -3585,7 +3585,7 @@ Session::write_one_track (AudioTrack& track, jack_nframes_t start, jack_nframes_
}
try {
fsource = new FileSource (buf, frame_rate());
fsource = new FileSource (buf, frame_rate(), false, Config->get_native_file_data_format());
}
catch (failed_constructor& err) {

View File

@@ -80,7 +80,7 @@ Session::tempoize_region (TimeStretchRequest& tsr)
}
try {
sources.push_back(new FileSource (path, frame_rate()));
sources.push_back(new FileSource (path, frame_rate(), false, Config->get_native_file_data_format()));
} catch (failed_constructor& err) {
error << string_compose (_("tempoize: error creating new audio file %1 (%2)"), path, strerror (errno)) << endmsg;
goto out;