miscellaneous fixes post-jesse's 24 bit file format changes

git-svn-id: svn://localhost/trunk/ardour2@317 d708f5d6-7413-0410-9779-e7cbd77b26cf
This commit is contained in:
Paul Davis
2006-02-11 02:34:03 +00:00
parent 9ab70fb552
commit cf0da62ff0
25 changed files with 442 additions and 164 deletions

View File

@@ -102,24 +102,24 @@ class AudioEngine : public sigc::trackable
virtual const char *what() const throw() { return "could not connect to engine backend"; }
};
Port *register_audio_input_port (const string& portname);
Port *register_audio_output_port (const string& portname);
Port *register_audio_input_port (const std::string& portname);
Port *register_audio_output_port (const std::string& portname);
int unregister_port (Port *);
int connect (const string& source, const string& destination);
int disconnect (const string& source, const string& destination);
int connect (const std::string& source, const std::string& destination);
int disconnect (const std::string& source, const std::string& destination);
int disconnect (Port *);
const char ** get_ports (const string& port_name_pattern, const string& type_name_pattern, uint32_t flags);
const char ** get_ports (const std::string& port_name_pattern, const std::string& type_name_pattern, uint32_t flags);
uint32_t n_physical_outputs () const;
uint32_t n_physical_inputs () const;
string get_nth_physical_output (uint32_t n) {
std::string get_nth_physical_output (uint32_t n) {
return get_nth_physical (n, JackPortIsInput);
}
string get_nth_physical_input (uint32_t n) {
std::string get_nth_physical_input (uint32_t n) {
return get_nth_physical (n, JackPortIsOutput);
}
@@ -130,7 +130,7 @@ class AudioEngine : public sigc::trackable
the return value
*/
Port *get_port_by_name (const string& name, bool keep = true);
Port *get_port_by_name (const std::string& name, bool keep = true);
enum TransportState {
TransportStopped = JackTransportStopped,
@@ -215,7 +215,7 @@ class AudioEngine : public sigc::trackable
PortConnections port_connections;
void remove_connections_for (Port*);
string get_nth_physical (uint32_t which, int flags);
std::string get_nth_physical (uint32_t which, int flags);
static int _xrun_callback (void *arg);
static int _graph_order_callback (void *arg);

View File

@@ -29,8 +29,6 @@
#include <ardour/types.h>
#include <ardour/stateful.h>
using std::string;
class XMLNode;
namespace ARDOUR {
@@ -42,21 +40,21 @@ class Configuration : public Stateful
virtual ~Configuration();
struct MidiPortDescriptor {
string tag;
string device;
string type;
string mode;
std::string tag;
std::string device;
std::string type;
std::string mode;
MidiPortDescriptor (const XMLNode&);
XMLNode& get_state();
};
std::map<string,MidiPortDescriptor *> midi_ports;
std::map<std::string,MidiPortDescriptor *> midi_ports;
int load_state ();
int save_state ();
XMLNode& option_node (const string &, const string &);
XMLNode& option_node (const std::string &, const std::string &);
int set_state (const XMLNode&);
XMLNode& get_state (void);
@@ -76,8 +74,8 @@ class Configuration : public Stateful
bool get_trace_midi_output ();
void set_trace_midi_output (bool);
string get_raid_path();
void set_raid_path(string);
std::string get_raid_path();
void set_raid_path(std::string);
uint32_t get_minimum_disk_io();
void set_minimum_disk_io(uint32_t);
@@ -88,11 +86,11 @@ class Configuration : public Stateful
bool does_hiding_groups_deactivates_groups();
void set_hiding_groups_deactivates_groups(bool);
string get_auditioner_output_left();
void set_auditioner_output_left(string);
std::string get_auditioner_output_left();
void set_auditioner_output_left(std::string);
string get_auditioner_output_right();
void set_auditioner_output_right(string);
std::string get_auditioner_output_right();
void set_auditioner_output_right(std::string);
bool get_mute_affects_pre_fader();
void set_mute_affects_pre_fader (bool);
@@ -112,14 +110,14 @@ class Configuration : public Stateful
uint32_t get_disk_choice_space_threshold();
void set_disk_choice_space_threshold (uint32_t);
string get_mmc_port_name();
void set_mmc_port_name(string);
std::string get_mmc_port_name();
void set_mmc_port_name(std::string);
string get_mtc_port_name();
void set_mtc_port_name(string);
string get_midi_port_name();
void set_midi_port_name(string);
std::string get_mtc_port_name();
void set_mtc_port_name(std::string);
std::string get_midi_port_name();
void set_midi_port_name(std::string);
uint32_t get_midi_feedback_interval_ms();
void set_midi_feedback_interval_ms (uint32_t);
@@ -163,25 +161,28 @@ class Configuration : public Stateful
bool get_timecode_source_is_synced ();
void set_timecode_source_is_synced (bool);
string get_user_ardour_path ();
string get_system_ardour_path ();
std::string get_user_ardour_path ();
std::string get_system_ardour_path ();
gain_t get_quieten_at_speed ();
void set_quieten_at_speed (gain_t);
std::string get_tape_dir ();
void set_tape_dir (std::string);
private:
void set_defaults ();
string get_system_path();
string get_user_path();
std::string get_system_path();
std::string get_user_path();
/* this is subject to wordexp, so we need
to keep the original (user-entered) form
around. e.g. ~/blah-> /home/foo/blah
*/
string raid_path;
std::string raid_path;
bool raid_path_is_user;
string orig_raid_path;
std::string orig_raid_path;
uint32_t minimum_disk_io_bytes;
bool minimum_disk_io_bytes_is_user;
@@ -189,9 +190,9 @@ class Configuration : public Stateful
bool track_buffer_seconds_is_user;
bool hiding_groups_deactivates_groups;
bool hiding_groups_deactivates_groups_is_user;
string auditioner_output_left;
std::string auditioner_output_left;
bool auditioner_output_left_is_user;
string auditioner_output_right;
std::string auditioner_output_right;
bool auditioner_output_right_is_user;
bool mute_affects_pre_fader;
bool mute_affects_pre_fader_is_user;
@@ -205,11 +206,11 @@ class Configuration : public Stateful
bool solo_latch_is_user;
uint32_t disk_choice_space_threshold;
bool disk_choice_space_threshold_is_user;
string mtc_port_name;
std::string mtc_port_name;
bool mtc_port_name_is_user;
string mmc_port_name;
std::string mmc_port_name;
bool mmc_port_name_is_user;
string midi_port_name;
std::string midi_port_name;
bool midi_port_name_is_user;
bool use_hardware_monitoring;
bool use_hardware_monitoring_is_user;
@@ -248,6 +249,8 @@ class Configuration : public Stateful
bool midi_feedback_interval_ms_is_user;
bool latched_record_enable;
bool latched_record_enable_is_user;
std::string tape_dir;
bool tape_dir_is_user;
XMLNode *key_node;
bool user_configuration;

View File

@@ -53,15 +53,15 @@ class Port : public sigc::trackable {
silent = false;
}
string name() {
std::string name() {
return _name;
}
string short_name() {
std::string short_name() {
return jack_port_short_name (port);
}
int set_name (string str);
int set_name (std::string str);
JackPortFlags flags() const {
return _flags;
@@ -79,7 +79,7 @@ class Port : public sigc::trackable {
return jack_port_connected (port);
}
bool connected_to (const string& portname) const {
bool connected_to (const std::string& portname) const {
return jack_port_connected_to (port, portname.c_str());
}
@@ -191,8 +191,8 @@ class Port : public sigc::trackable {
*/
JackPortFlags _flags;
string _type;
string _name;
std::string _type;
std::string _name;
bool last_monitor : 1;
bool silent : 1;

View File

@@ -243,10 +243,11 @@ class Session : public sigc::trackable, public Stateful
bool dirty() const { return _state_of_the_state & Dirty; }
sigc::signal<void> DirtyChanged;
string sound_dir () const;
string peak_dir () const;
string dead_sound_dir () const;
string automation_dir () const;
std::string sound_dir () const;
std::string tape_dir () const;
std::string peak_dir () const;
std::string dead_sound_dir () const;
std::string automation_dir () const;
static string template_path ();
static string template_dir ();
@@ -1618,10 +1619,11 @@ class Session : public sigc::trackable, public Stateful
PBD::Lock space_lock;
static const char* sound_dir_name;
static const char* tape_dir_name;
static const char* dead_sound_dir_name;
static const char* peak_dir_name;
string discover_best_sound_dir ();
string discover_best_sound_dir (bool destructive = false);
int ensure_sound_dir (string, string&);
void refresh_disk_space ();

View File

@@ -29,13 +29,11 @@
class XMLNode;
using std::ostream;
void elapsed_time_to_str (char *buf, uint32_t seconds);
string legalize_for_path (std::string str);
ostream& operator<< (ostream& o, const ARDOUR::BBT_Time& bbt);
std::string legalize_for_path (std::string str);
std::ostream& operator<< (std::ostream& o, const ARDOUR::BBT_Time& bbt);
XMLNode* find_named_node (const XMLNode& node, std::string name);
string placement_as_string (ARDOUR::Placement);
std::string placement_as_string (ARDOUR::Placement);
static inline float f_max(float x, float a) {
x -= a;
@@ -48,12 +46,12 @@ static inline float f_max(float x, float a) {
int cmp_nocase (const std::string& s, const std::string& s2);
int tokenize_fullpath (string fullpath, string& path, string& name);
int tokenize_fullpath (std::string fullpath, std::string& path, std::string& name);
int touch_file(string path);
int touch_file(std::string path);
uint32_t long get_uid();
string region_name_from_path (string path);
std::string region_name_from_path (std::string path);
#endif /* __ardour_utils_h__ */

View File

@@ -294,6 +294,11 @@ Configuration::state (bool user_only)
if (!user_only || latched_record_enable_is_user) {
node->add_child_nocopy(option_node("latched-record-enable", latched_record_enable?"yes":"no"));
}
if (!user_only || tape_dir_is_user) {
if (!tape_dir.empty()) {
node->add_child_nocopy(option_node("tape-dir", tape_dir));
}
}
/* use-vst is always per-user */
node->add_child_nocopy (option_node ("use-vst", use_vst?"yes":"no"));
@@ -436,6 +441,8 @@ Configuration::set_state (const XMLNode& root)
set_midi_feedback_interval_ms (atoi (option_value.c_str()));
} else if (option_name == "latched-record-enable") {
set_latched_record_enable (option_value == "yes");
} else if (option_name == "tape-dir") {
set_tape_dir (option_value);
}
}
@@ -492,6 +499,7 @@ Configuration::set_defaults ()
timecode_source_is_synced = true;
use_vst = true; /* if we build with VST_SUPPORT, otherwise no effect */
quieten_at_speed = true;
tape_dir = "";
midi_feedback_interval_ms = 100;
@@ -532,6 +540,7 @@ Configuration::set_defaults ()
quieten_at_speed_is_user = false;
midi_feedback_interval_ms_is_user = false;
latched_record_enable_is_user = false;
tape_dir_is_user = false;
}
Configuration::MidiPortDescriptor::MidiPortDescriptor (const XMLNode& node)
@@ -1151,3 +1160,15 @@ Configuration::get_latched_record_enable ()
{
return latched_record_enable;
}
string
Configuration::get_tape_dir ()
{
return tape_dir;
}
void
Configuration::set_tape_dir (string path)
{
tape_dir = path;
}

View File

@@ -117,8 +117,6 @@ DestructiveFileSource::setup_standard_crossfades (jack_nframes_t rate)
int
DestructiveFileSource::seek (jack_nframes_t frame)
{
// file_pos = data_offset + (sizeof (Sample) * frame);
cerr << _name << " Seek to " << frame << " = " << data_offset + (_sample_size * frame) << endl;
return 0;
}

View File

@@ -1701,7 +1701,6 @@ DiskStream::finish_capture (bool rec_monitors_input)
was_recording = false;
if (_flags & Recordable) {
cerr << "STOP CAPTURE\n";
for (ChannelList::iterator chan = channels.begin(); chan != channels.end(); ++chan) {
(*chan).write_source->mark_capture_end ();
}

View File

@@ -21,6 +21,7 @@
#include "ardour/port.h"
using namespace ARDOUR;
using namespace std;
Port::Port (jack_port_t *p)
: port (p)

View File

@@ -76,6 +76,7 @@ const char* Session::_template_suffix = X_(".template");
const char* Session::_statefile_suffix = X_(".ardour");
const char* Session::_pending_suffix = X_(".pending");
const char* Session::sound_dir_name = X_("sounds");
const char* Session::tape_dir_name = X_("tapes");
const char* Session::peak_dir_name = X_("peaks");
const char* Session::dead_sound_dir_name = X_("dead_sounds");
@@ -2658,7 +2659,12 @@ Session::create_file_source (DiskStream& ds, int32_t chan, bool destructive)
for (i = session_dirs.begin(); i != session_dirs.end(); ++i) {
spath = (*i).path;
spath += sound_dir_name;
if (destructive) {
spath += tape_dir_name;
} else {
spath += sound_dir_name;
}
spath += '/';
spath += legalized;

View File

@@ -193,7 +193,7 @@ Session::butler_thread_work ()
<< endmsg;
break;
}
if (pfd[0].revents & ~POLLIN) {
error << _("Error on butler thread request pipe") << endmsg;
break;
@@ -242,9 +242,9 @@ Session::butler_thread_work ()
}
}
// for (DiskStreamList::iterator i = diskstreams.begin(); i != diskstreams.end(); ++i) {
// cerr << "BEFORE " << (*i)->name() << ": pb = " << (*i)->playback_buffer_load() << " cp = " << (*i)->capture_buffer_load() << endl;
// }
for (i = diskstreams.begin(); i != diskstreams.end(); ++i) {
// cerr << "BEFORE " << (*i)->name() << ": pb = " << (*i)->playback_buffer_load() << " cp = " << (*i)->capture_buffer_load() << endl;
}
if (transport_work_requested()) {
butler_transport_work ();

View File

@@ -486,6 +486,15 @@ Session::create (bool& new_session, string* mix_template, jack_nframes_t initial
}
}
dir = tape_dir ();
if (mkdir (dir.c_str(), 0755) < 0) {
if (errno != EEXIST) {
error << string_compose(_("Session: cannot create session tape dir \"%1\" (%2)"), dir, strerror (errno)) << endmsg;
return -1;
}
}
dir = dead_sound_dir ();
if (mkdir (dir.c_str(), 0755) < 0) {
@@ -1956,11 +1965,17 @@ Session::ensure_sound_dir (string path, string& result)
}
string
Session::discover_best_sound_dir ()
Session::discover_best_sound_dir (bool destructive)
{
vector<space_and_path>::iterator i;
string result;
/* destructive files all go into the same place */
if (destructive) {
return tape_dir();
}
/* handle common case without system calls */
if (session_dirs.size() == 1) {
@@ -1968,7 +1983,7 @@ Session::discover_best_sound_dir ()
}
/* OK, here's the algorithm we're following here:
We want to select which directory to use for
the next file source to be created. Ideally,
we'd like to use a round-robin process so as to
@@ -2174,6 +2189,21 @@ Session::sound_dir () const
return res;
}
string
Session::tape_dir () const
{
string res = Config->get_tape_dir();
if (!res.empty()) {
return res;
}
res = _path;
res += tape_dir_name;
res += '/';
return res;
}
string
Session::peak_dir () const
{

View File

@@ -475,7 +475,7 @@ MachineControl::write_track_record_ready (byte *msg, size_t len)
{
size_t n;
size_t base_track;
ssize_t base_track;
/* Bits 0-4 of the first byte are for special tracks: