Fix broken whitespace (no functional changes).

git-svn-id: svn://localhost/ardour2/branches/3.0@9288 d708f5d6-7413-0410-9779-e7cbd77b26cf
This commit is contained in:
David Robillard 2011-04-04 22:46:48 +00:00
parent 847e8f0610
commit 62e730b57a
11 changed files with 561 additions and 560 deletions

View File

@ -100,9 +100,9 @@ Please consider the possibilities, and perhaps (re)start JACK."));
win.run ();
}
static void export_search_path (const string& base_dir, const char* varname, const char* dir)
static void export_search_path (const string& base_dir, const char* varname, const char* dir)
{
string path;
string path;
const char * cstr = getenv (varname);
if (cstr) {
@ -113,8 +113,8 @@ static void export_search_path (const string& base_dir, const char* varname, con
}
path += base_dir;
path += dir;
setenv (varname, path.c_str(), 1);
setenv (varname, path.c_str(), 1);
}
#ifdef __APPLE__
@ -131,7 +131,7 @@ fixup_bundle_environment (int, char* [])
return;
}
EnvironmentalProtectionAgency::set_global_epa (new EnvironmentalProtectionAgency (true, "PREBUNDLE_ENV"));
EnvironmentalProtectionAgency::set_global_epa (new EnvironmentalProtectionAgency (true, "PREBUNDLE_ENV"));
set_language_preference ();
@ -152,11 +152,11 @@ fixup_bundle_environment (int, char* [])
path = dir_path;
/* JACK is often in /usr/local/bin and since Info.plist refuses to
/* JACK is often in /usr/local/bin and since Info.plist refuses to
set PATH, we have to force this in order to discover a running
instance of JACK ...
*/
path += ':';
path += "/usr/local/bin";
@ -175,8 +175,8 @@ fixup_bundle_environment (int, char* [])
setenv ("ARDOUR_MODULE_PATH", path.c_str(), 1);
path = user_config_directory().to_string();
path += ':';
path = user_config_directory().to_string();
path += ':';
path += dir_path;
path += "/../Resources/icons:";
path += dir_path;
@ -193,28 +193,28 @@ fixup_bundle_environment (int, char* [])
path += "/../Resources";
setenv ("ARDOUR_INSTANT_XML_PATH", path.c_str(), 1);
export_search_path (dir_path, "LADSPA_PATH", "/../Plugins");
export_search_path (dir_path, "VAMP_PATH", "/../Frameworks");
export_search_path (dir_path, "ARDOUR_PANNER_PATH", "/lib/panners");
export_search_path (dir_path, "ARDOUR_SURFACES_PATH", "/lib/surfaces");
export_search_path (dir_path, "ARDOUR_MIDIMAPS_PATH", "/share/midi_maps");
export_search_path (dir_path, "ARDOUR_EXPORT_FORMATS_PATH", "/share/exports");
export_search_path (dir_path, "LADSPA_PATH", "/../Plugins");
export_search_path (dir_path, "VAMP_PATH", "/../Frameworks");
export_search_path (dir_path, "ARDOUR_PANNER_PATH", "/lib/panners");
export_search_path (dir_path, "ARDOUR_SURFACES_PATH", "/lib/surfaces");
export_search_path (dir_path, "ARDOUR_MIDIMAPS_PATH", "/share/midi_maps");
export_search_path (dir_path, "ARDOUR_EXPORT_FORMATS_PATH", "/share/exports");
path = dir_path;
path += "/../Frameworks/clearlooks";
setenv ("GTK_PATH", path.c_str(), 1);
/* unset GTK_RC_FILES so that we only load the RC files that we define
*/
/* unset GTK_RC_FILES so that we only load the RC files that we define
*/
unsetenv ("GTK_RC_FILES");
unsetenv ("GTK_RC_FILES");
if (!ARDOUR::translations_are_disabled ()) {
path = dir_path;
path += "/../Resources/locale";
localedir = strdup (path.c_str());
setenv ("GTK_LOCALEDIR", localedir, 1);
}
@ -293,22 +293,22 @@ fixup_bundle_environment (int /*argc*/, char* argv[])
if (!getenv ("ARDOUR_BUNDLED")) {
return;
}
EnvironmentalProtectionAgency::set_global_epa (new EnvironmentalProtectionAgency (true, "PREBUNDLE_ENV"));
EnvironmentalProtectionAgency::set_global_epa (new EnvironmentalProtectionAgency (true, "PREBUNDLE_ENV"));
Glib::ustring exec_path = argv[0];
Glib::ustring dir_path = Glib::path_get_dirname (Glib::path_get_dirname (exec_path));
Glib::ustring path;
Glib::ustring userconfigdir = user_config_directory().to_string();
Glib::ustring userconfigdir = user_config_directory().to_string();
/* ensure that we find any bundled executables (e.g. JACK),
and find them before any instances of the same name
elsewhere in PATH
*/
/* note that this function is POSIX/Linux specific, so using / as
a dir separator in this context is just fine.
*/
/* note that this function is POSIX/Linux specific, so using / as
a dir separator in this context is just fine.
*/
path = dir_path;
path += "/etc:";
@ -319,8 +319,8 @@ fixup_bundle_environment (int /*argc*/, char* argv[])
setenv ("ARDOUR_MODULE_PATH", path.c_str(), 1);
path = userconfigdir;
path += ':';
path = userconfigdir;
path += ':';
path += dir_path;
path += "/etc/icons:";
path += dir_path;
@ -336,34 +336,34 @@ fixup_bundle_environment (int /*argc*/, char* argv[])
path = dir_path;
path += "/etc";
setenv ("ARDOUR_INSTANT_XML_PATH", path.c_str(), 1);
export_search_path (dir_path, "LADSPA_PATH", "/../plugins");
export_search_path (dir_path, "VAMP_PATH", "/lib");
export_search_path (dir_path, "ARDOUR_PANNER_PATH", "/lib/panners");
export_search_path (dir_path, "ARDOUR_SURFACES_PATH", "/lib/surfaces");
export_search_path (dir_path, "ARDOUR_MIDIMAPS_PATH", "/share/midi_maps");
export_search_path (dir_path, "ARDOUR_EXPORT_FORMATS_PATH", "/share/export");
export_search_path (dir_path, "LADSPA_PATH", "/../plugins");
export_search_path (dir_path, "VAMP_PATH", "/lib");
export_search_path (dir_path, "ARDOUR_PANNER_PATH", "/lib/panners");
export_search_path (dir_path, "ARDOUR_SURFACES_PATH", "/lib/surfaces");
export_search_path (dir_path, "ARDOUR_MIDIMAPS_PATH", "/share/midi_maps");
export_search_path (dir_path, "ARDOUR_EXPORT_FORMATS_PATH", "/share/export");
path = dir_path;
path += "/lib/clearlooks";
setenv ("GTK_PATH", path.c_str(), 1);
/* unset GTK_RC_FILES so that we only load the RC files that we define
*/
/* unset GTK_RC_FILES so that we only load the RC files that we define
*/
unsetenv ("GTK_RC_FILES");
unsetenv ("GTK_RC_FILES");
if (!ARDOUR::translations_are_disabled ()) {
path = dir_path;
path += "/share/locale";
localedir = strdup (path.c_str());
setenv ("GTK_LOCALEDIR", localedir, 1);
}
path = dir_path;
path += "/share/locale";
localedir = strdup (path.c_str());
setenv ("GTK_LOCALEDIR", localedir, 1);
}
/* write a pango.rc file and tell pango to use it. we'd love
to put this into the Ardour.app bundle and leave it there,
but the user may not have write permission. so ...
but the user may not have write permission. so ...
we also have to make sure that the user ardour directory
actually exists ...
@ -374,29 +374,29 @@ fixup_bundle_environment (int /*argc*/, char* argv[])
<< endmsg;
} else {
Glib::ustring mpath;
Glib::ustring mpath;
path = Glib::build_filename (userconfigdir, "pango.rc");
std::ofstream pangorc (path.c_str());
if (!pangorc) {
error << string_compose (_("cannot open pango.rc file %1") , path) << endmsg;
} else {
mpath = Glib::build_filename (userconfigdir, "pango.modules");
} else {
mpath = Glib::build_filename (userconfigdir, "pango.modules");
pangorc << "[Pango]\nModuleFiles=";
pangorc << mpath << endl;
pangorc.close ();
}
}
setenv ("PANGO_RC_FILE", path.c_str(), 1);
setenv ("PANGO_RC_FILE", path.c_str(), 1);
/* similar for GDK pixbuf loaders, but there's no RC file required
to specify where it lives.
*/
/* similar for GDK pixbuf loaders, but there's no RC file required
to specify where it lives.
*/
mpath = Glib::build_filename (userconfigdir, "gdk-pixbuf.loaders");
setenv ("GDK_PIXBUF_MODULE_FILE", mpath.c_str(), 1);
mpath = Glib::build_filename (userconfigdir, "gdk-pixbuf.loaders");
setenv ("GDK_PIXBUF_MODULE_FILE", mpath.c_str(), 1);
}
}
@ -415,14 +415,14 @@ tell_about_jack_death (void* /* ignored */)
This could be due to misconfiguration or to an error inside JACK.\n\
\n\
Click OK to exit %1."), PROGRAM_NAME));
msg.run ();
_exit (0);
} else {
/* engine has already run, so this is a mid-session JACK death */
MessageDialog* msg = manage (new MessageDialog (_("JACK exited"), false, Gtk::MESSAGE_INFO, Gtk::BUTTONS_NONE));
msg->set_secondary_text (string_compose (_(
"JACK exited unexpectedly, and without notifying %1.\n\
@ -438,11 +438,11 @@ session at this time, because we would lose your connection information.\n"), PR
static void
sigpipe_handler (int /*signal*/)
{
/* XXX fix this so that we do this again after a reconnect to JACK
*/
/* XXX fix this so that we do this again after a reconnect to JACK
*/
static bool done_the_jack_thing = false;
static bool done_the_jack_thing = false;
if (!done_the_jack_thing) {
AudioEngine::instance()->died ();
g_idle_add (tell_about_jack_death, 0);
@ -472,7 +472,7 @@ int main (int argc, char *argv[])
if (!Glib::thread_supported()) {
Glib::thread_init();
}
}
gtk_set_locale ();
@ -501,9 +501,9 @@ int main (int argc, char *argv[])
text_receiver.listen_to (warning);
#ifdef BOOST_SP_ENABLE_DEBUG_HOOKS
if (getenv ("BOOST_DEBUG")) {
boost_debug_shared_ptr_show_live_debugging (true);
}
if (getenv ("BOOST_DEBUG")) {
boost_debug_shared_ptr_show_live_debugging (true);
}
#endif
if (parse_opts (argc, argv)) {
@ -555,7 +555,7 @@ int main (int argc, char *argv[])
}
ui->run (text_receiver);
Gtkmm2ext::Application::instance()->cleanup();
Gtkmm2ext::Application::instance()->cleanup();
ui = 0;
ARDOUR::cleanup ();

View File

@ -92,7 +92,7 @@ AudioTrack::set_diskstream (boost::shared_ptr<Diskstream> ds)
{
Track::set_diskstream (ds);
_diskstream->set_track (this);
_diskstream->set_track (this);
_diskstream->set_destructive (_mode == Destructive);
_diskstream->set_non_layered (_mode == NonLayered);
@ -231,9 +231,9 @@ AudioTrack::_set_state (const XMLNode& node, int version, bool call_base)
}
}
/* set rec-enable control *AFTER* setting up diskstream, because it may want to operate
on the diskstream as it sets its own state
*/
/* set rec-enable control *AFTER* setting up diskstream, because it may want to operate
on the diskstream as it sets its own state
*/
XMLNodeList nlist;
XMLNodeConstIterator niter;
@ -242,14 +242,13 @@ AudioTrack::_set_state (const XMLNode& node, int version, bool call_base)
for (niter = nlist.begin(); niter != nlist.end(); ++niter){
child = *niter;
if (child->name() == Controllable::xml_node_name && (prop = child->property ("name")) != 0) {
if (prop->value() == X_("recenable")) {
_rec_enable_control->set_state (*child, version);
}
}
if (child->name() == Controllable::xml_node_name && (prop = child->property ("name")) != 0) {
if (prop->value() == X_("recenable")) {
_rec_enable_control->set_state (*child, version);
}
}
}
pending_state = const_cast<XMLNode*> (&node);
if (_session.state_of_the_state() & Session::Loading) {
@ -375,7 +374,7 @@ AudioTrack::roll (pframes_t nframes, framepos_t start_frame, framepos_t end_fram
}
if (!_active) {
silence (nframes);
silence (nframes);
return 0;
}
@ -387,7 +386,7 @@ AudioTrack::roll (pframes_t nframes, framepos_t start_frame, framepos_t end_fram
playback distance to zero, thus causing diskstream::commit
to do nothing.
*/
cerr << name() << " Can't operate at " << transport_frame << " since roll delay is only " << _roll_delay << endl;
cerr << name() << " Can't operate at " << transport_frame << " since roll delay is only " << _roll_delay << endl;
return diskstream->process (transport_frame, 0, can_record, rec_monitors_input, need_butler);
}
@ -506,9 +505,11 @@ AudioTrack::roll (pframes_t nframes, framepos_t start_frame, framepos_t end_fram
/* final argument: don't waste time with automation if we're recording or we've just stopped (yes it can happen) */
process_output_buffers (bufs, start_frame, end_frame, nframes, (!_session.get_record_enabled() || !Config->get_do_not_record_plugins()), declick,
(!diskstream->record_enabled() && _session.transport_rolling()));
process_output_buffers (
bufs, start_frame, end_frame, nframes,
(!_session.get_record_enabled() || !Config->get_do_not_record_plugins()),
declick,
(!diskstream->record_enabled() && _session.transport_rolling()));
} else {
/* problem with the diskstream; just be quiet for a bit */

View File

@ -96,9 +96,9 @@ _render_callback(void *userData,
}
static OSStatus
_get_beat_and_tempo_callback (void* userData,
Float64* outCurrentBeat,
Float64* outCurrentTempo)
_get_beat_and_tempo_callback (void* userData,
Float64* outCurrentBeat,
Float64* outCurrentTempo)
{
if (userData) {
return ((AUPlugin*)userData)->get_beat_and_tempo_callback (outCurrentBeat, outCurrentTempo);
@ -109,10 +109,10 @@ _get_beat_and_tempo_callback (void* userData,
static OSStatus
_get_musical_time_location_callback (void * userData,
UInt32 * outDeltaSampleOffsetToNextBeat,
Float32 * outTimeSig_Numerator,
UInt32 * outTimeSig_Denominator,
Float64 * outCurrentMeasureDownBeat)
UInt32 * outDeltaSampleOffsetToNextBeat,
Float32 * outTimeSig_Numerator,
UInt32 * outTimeSig_Denominator,
Float64 * outCurrentMeasureDownBeat)
{
if (userData) {
return ((AUPlugin*)userData)->get_musical_time_location_callback (outDeltaSampleOffsetToNextBeat,
@ -133,9 +133,10 @@ _get_transport_state_callback (void* userData,
Float64* outCycleEndBeat)
{
if (userData) {
return ((AUPlugin*)userData)->get_transport_state_callback (outIsPlaying, outTransportStateChanged,
outCurrentSampleInTimeLine, outIsCycling,
outCycleStartBeat, outCycleEndBeat);
return ((AUPlugin*)userData)->get_transport_state_callback (
outIsPlaying, outTransportStateChanged,
outCurrentSampleInTimeLine, outIsCycling,
outCycleStartBeat, outCycleEndBeat);
}
return paramErr;
}
@ -162,9 +163,11 @@ save_property_list (CFPropertyListRef propertyList, Glib::ustring path)
fd = open (path.c_str(), O_WRONLY|O_CREAT|O_EXCL, 0664);
while (fd < 0) {
if (errno == EEXIST) {
error << string_compose (_("Preset file %1 exists; not overwriting"), path);
error << string_compose (_("Preset file %1 exists; not overwriting"),
path) << endmsg;
} else {
error << string_compose (_("Cannot open preset file %1 (%2)"), path, strerror (errno)) << endmsg;
error << string_compose (_("Cannot open preset file %1 (%2)"),
path, strerror (errno)) << endmsg;
}
CFRelease (xmlData);
return -1;
@ -451,19 +454,19 @@ AUPlugin::init ()
TRACE_API ("count output elements\n");
unit->GetElementCount (kAudioUnitScope_Output, output_elements);
if (input_elements > 0) {
AURenderCallbackStruct renderCallbackInfo;
if (input_elements > 0) {
AURenderCallbackStruct renderCallbackInfo;
renderCallbackInfo.inputProc = _render_callback;
renderCallbackInfo.inputProcRefCon = this;
renderCallbackInfo.inputProc = _render_callback;
renderCallbackInfo.inputProcRefCon = this;
TRACE_API ("set render callback in input scope\n");
if ((err = unit->SetProperty (kAudioUnitProperty_SetRenderCallback, kAudioUnitScope_Input,
0, (void*) &renderCallbackInfo, sizeof(renderCallbackInfo))) != 0) {
cerr << "cannot install render callback (err = " << err << ')' << endl;
throw failed_constructor();
}
}
TRACE_API ("set render callback in input scope\n");
if ((err = unit->SetProperty (kAudioUnitProperty_SetRenderCallback, kAudioUnitScope_Input,
0, (void*) &renderCallbackInfo, sizeof(renderCallbackInfo))) != 0) {
cerr << "cannot install render callback (err = " << err << ')' << endl;
throw failed_constructor();
}
}
/* tell the plugin about tempo/meter/transport callbacks in case it wants them */
@ -474,7 +477,7 @@ AUPlugin::init ()
info.musicalTimeLocationProc = _get_musical_time_location_callback;
info.transportStateProc = _get_transport_state_callback;
//ignore result of this - don't care if the property isn't supported
//ignore result of this - don't care if the property isn't supported
TRACE_API ("set host callbacks in global scope\n");
unit->SetProperty (kAudioUnitProperty_HostCallbacks,
kAudioUnitScope_Global,
@ -1214,7 +1217,7 @@ AUPlugin::render_callback(AudioUnitRenderActionFlags*,
{
const uint8_t* b = ev.buffer();
unit->MIDIEvent (b[0], b[1], b[2], ev.time());
break;
break;
}
default:
@ -1817,43 +1820,43 @@ GetDictionarySInt32Value(CFDictionaryRef inAUStateDictionary, CFStringRef inDict
static OSStatus
GetAUComponentDescriptionFromStateData(CFPropertyListRef inAUStateData, ComponentDescription * outComponentDescription)
{
CFDictionaryRef auStateDictionary;
ComponentDescription tempDesc = {0,0,0,0,0};
SInt32 versionValue;
Boolean gotValue;
CFDictionaryRef auStateDictionary;
ComponentDescription tempDesc = {0,0,0,0,0};
SInt32 versionValue;
Boolean gotValue;
if ( (inAUStateData == NULL) || (outComponentDescription == NULL) )
return paramErr;
if ( (inAUStateData == NULL) || (outComponentDescription == NULL) )
return paramErr;
// the property list for AU state data must be of the dictionary type
if (CFGetTypeID(inAUStateData) != CFDictionaryGetTypeID()) {
return kAudioUnitErr_InvalidPropertyValue;
// the property list for AU state data must be of the dictionary type
if (CFGetTypeID(inAUStateData) != CFDictionaryGetTypeID()) {
return kAudioUnitErr_InvalidPropertyValue;
}
auStateDictionary = (CFDictionaryRef)inAUStateData;
auStateDictionary = (CFDictionaryRef)inAUStateData;
// first check to make sure that the version of the AU state data is one that we know understand
// XXX should I really do this? later versions would probably still hold these ID keys, right?
versionValue = GetDictionarySInt32Value(auStateDictionary, CFSTR(kAUPresetVersionKey), &gotValue);
// first check to make sure that the version of the AU state data is one that we know understand
// XXX should I really do this? later versions would probably still hold these ID keys, right?
versionValue = GetDictionarySInt32Value(auStateDictionary, CFSTR(kAUPresetVersionKey), &gotValue);
if (!gotValue) {
return kAudioUnitErr_InvalidPropertyValue;
if (!gotValue) {
return kAudioUnitErr_InvalidPropertyValue;
}
#define kCurrentSavedStateVersion 0
if (versionValue != kCurrentSavedStateVersion) {
return kAudioUnitErr_InvalidPropertyValue;
if (versionValue != kCurrentSavedStateVersion) {
return kAudioUnitErr_InvalidPropertyValue;
}
// grab the ComponentDescription values from the AU state data
tempDesc.componentType = (OSType) GetDictionarySInt32Value(auStateDictionary, CFSTR(kAUPresetTypeKey), NULL);
tempDesc.componentSubType = (OSType) GetDictionarySInt32Value(auStateDictionary, CFSTR(kAUPresetSubtypeKey), NULL);
tempDesc.componentManufacturer = (OSType) GetDictionarySInt32Value(auStateDictionary, CFSTR(kAUPresetManufacturerKey), NULL);
// zero values are illegit for specific ComponentDescriptions, so zero for any value means that there was an error
if ( (tempDesc.componentType == 0) || (tempDesc.componentSubType == 0) || (tempDesc.componentManufacturer == 0) )
return kAudioUnitErr_InvalidPropertyValue;
// grab the ComponentDescription values from the AU state data
tempDesc.componentType = (OSType) GetDictionarySInt32Value(auStateDictionary, CFSTR(kAUPresetTypeKey), NULL);
tempDesc.componentSubType = (OSType) GetDictionarySInt32Value(auStateDictionary, CFSTR(kAUPresetSubtypeKey), NULL);
tempDesc.componentManufacturer = (OSType) GetDictionarySInt32Value(auStateDictionary, CFSTR(kAUPresetManufacturerKey), NULL);
// zero values are illegit for specific ComponentDescriptions, so zero for any value means that there was an error
if ( (tempDesc.componentType == 0) || (tempDesc.componentSubType == 0) || (tempDesc.componentManufacturer == 0) )
return kAudioUnitErr_InvalidPropertyValue;
*outComponentDescription = tempDesc;
return noErr;
*outComponentDescription = tempDesc;
return noErr;
}
@ -1898,8 +1901,8 @@ static bool au_preset_filter (const string& str, void* arg)
bool
check_and_get_preset_name (Component component, const string& pathstr, string& preset_name)
{
OSStatus status;
CFPropertyListRef plist;
OSStatus status;
CFPropertyListRef plist;
ComponentDescription presetDesc;
bool ret = false;
@ -1999,13 +2002,13 @@ AUPlugin::find_presets ()
delete preset_files;
/* now fill the vector<string> with the names we have */
/* now fill the vector<string> with the names we have */
for (UserPresetMap::iterator i = user_preset_map.begin(); i != user_preset_map.end(); ++i) {
_presets.insert (i->second, Plugin::PresetRecord (i->second, i->first));
}
/* add factory presets */
/* add factory presets */
for (FactoryPresetMap::iterator i = factory_preset_map.begin(); i != factory_preset_map.end(); ++i) {
/* XXX: dubious */

View File

@ -103,7 +103,7 @@ void
ExportPreset::save (std::string const & filename)
{
save_instant_xml ();
if (global.root()) {
global.set_filename (filename);
global.write ();

View File

@ -1,23 +1,22 @@
/*
Copyright (C) 2000 Paul Davis
Copyright (C) 2000 Paul Davis
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*/
#ifdef WAF_BUILD
#include "libardour-config.h"
#endif
@ -76,19 +75,19 @@ static boost::shared_ptr<ImportableSource>
open_importable_source (const string& path, framecnt_t samplerate, ARDOUR::SrcQuality quality)
{
/* try libsndfile first, because it can get BWF info from .wav, which ExtAudioFile cannot.
We don't necessarily need that information in an ImportableSource, but it keeps the
logic the same as in SourceFactory::create()
*/
We don't necessarily need that information in an ImportableSource, but it keeps the
logic the same as in SourceFactory::create()
*/
try {
try {
boost::shared_ptr<SndFileImportableSource> source(new SndFileImportableSource(path));
if (source->samplerate() == samplerate) {
return source;
}
/* rewrap as a resampled source */
return boost::shared_ptr<ImportableSource>(new ResampledImportableSource(source, samplerate, quality));
}
@ -97,16 +96,16 @@ open_importable_source (const string& path, framecnt_t samplerate, ARDOUR::SrcQu
#ifdef HAVE_COREAUDIO
/* libsndfile failed, see if we can use CoreAudio to handle the IO */
CAImportableSource* src = new CAImportableSource(path);
boost::shared_ptr<CAImportableSource> source (src);
if (source->samplerate() == samplerate) {
return source;
}
/* rewrap as a resampled source */
return boost::shared_ptr<ImportableSource>(new ResampledImportableSource(source, samplerate, quality));
#else
@ -123,43 +122,43 @@ get_non_existent_filename (HeaderFormat hf, DataType type, const bool allow_repl
bool goodfile = false;
string base = basename;
string ext = native_header_format_extension (hf, type);
uint32_t cnt = 1;
uint32_t cnt = 1;
do {
if (type == DataType::AUDIO && channels == 2) {
if (channel == 0) {
if (cnt == 1) {
snprintf (buf, sizeof(buf), "%s-L%s", base.c_str(), ext.c_str());
} else {
snprintf (buf, sizeof(buf), "%s-%d-L%s", base.c_str(), cnt, ext.c_str());
}
if (cnt == 1) {
snprintf (buf, sizeof(buf), "%s-L%s", base.c_str(), ext.c_str());
} else {
snprintf (buf, sizeof(buf), "%s-%d-L%s", base.c_str(), cnt, ext.c_str());
}
} else {
if (cnt == 1) {
snprintf (buf, sizeof(buf), "%s-R%s", base.c_str(), ext.c_str());
} else {
snprintf (buf, sizeof(buf), "%s-%d-R%s", base.c_str(), cnt, ext.c_str());
}
if (cnt == 1) {
snprintf (buf, sizeof(buf), "%s-R%s", base.c_str(), ext.c_str());
} else {
snprintf (buf, sizeof(buf), "%s-%d-R%s", base.c_str(), cnt, ext.c_str());
}
}
} else if (channels > 1) {
if (cnt == 1) {
snprintf (buf, sizeof(buf), "%s-c%d%s", base.c_str(), channel, ext.c_str());
} else {
snprintf (buf, sizeof(buf), "%s-%d-c%d%s", base.c_str(), cnt, channel, ext.c_str());
}
if (cnt == 1) {
snprintf (buf, sizeof(buf), "%s-c%d%s", base.c_str(), channel, ext.c_str());
} else {
snprintf (buf, sizeof(buf), "%s-%d-c%d%s", base.c_str(), cnt, channel, ext.c_str());
}
} else {
if (cnt == 1) {
snprintf (buf, sizeof(buf), "%s%s", base.c_str(), ext.c_str());
} else {
snprintf (buf, sizeof(buf), "%s-%d%s", base.c_str(), cnt, ext.c_str());
}
if (cnt == 1) {
snprintf (buf, sizeof(buf), "%s%s", base.c_str(), ext.c_str());
} else {
snprintf (buf, sizeof(buf), "%s-%d%s", base.c_str(), cnt, ext.c_str());
}
}
string tempname = destdir + "/" + buf;
if (!allow_replacing && Glib::file_test (tempname, Glib::FILE_TEST_EXISTS)) {
cnt++;
cnt++;
} else {
@ -184,10 +183,10 @@ get_paths_for_new_sources (HeaderFormat hf, const bool allow_replacing, const st
const DataType type = SMFSource::safe_midi_file_extension (import_file_path) ? DataType::MIDI : DataType::AUDIO;
std::string filepath = (type == DataType::MIDI)
? sdir.midi_path().to_string() : sdir.sound_path().to_string();
? sdir.midi_path().to_string() : sdir.sound_path().to_string();
filepath = Glib::build_filename (filepath,
get_non_existent_filename (hf, type, allow_replacing, filepath, basename, n, channels));
filepath = Glib::build_filename (filepath,
get_non_existent_filename (hf, type, allow_replacing, filepath, basename, n, channels));
new_paths.push_back (filepath);
}
@ -196,10 +195,10 @@ get_paths_for_new_sources (HeaderFormat hf, const bool allow_replacing, const st
static bool
map_existing_mono_sources (const vector<string>& new_paths, Session& /*sess*/,
uint /*samplerate*/, vector<boost::shared_ptr<Source> >& newfiles, Session *session)
uint /*samplerate*/, vector<boost::shared_ptr<Source> >& newfiles, Session *session)
{
for (vector<string>::const_iterator i = new_paths.begin();
i != new_paths.end(); ++i)
i != new_paths.end(); ++i)
{
boost::shared_ptr<Source> source = session->source_by_path_and_channel(*i, 0);
@ -215,10 +214,10 @@ map_existing_mono_sources (const vector<string>& new_paths, Session& /*sess*/,
static bool
create_mono_sources_for_writing (const string& origin,
const vector<string>& new_paths,
Session& sess, uint samplerate,
const vector<string>& new_paths,
Session& sess, uint samplerate,
vector<boost::shared_ptr<Source> >& newfiles,
framepos_t timeline_position)
framepos_t timeline_position)
{
for (vector<string>::const_iterator i = new_paths.begin(); i != new_paths.end(); ++i) {
@ -228,10 +227,10 @@ create_mono_sources_for_writing (const string& origin,
const DataType type = SMFSource::safe_midi_file_extension (*i) ? DataType::MIDI : DataType::AUDIO;
source = SourceFactory::createWritable (type, sess,
i->c_str(),
origin,
false, // destructive
samplerate);
i->c_str(),
origin,
false, // destructive
samplerate);
}
catch (const failed_constructor& err) {
@ -241,38 +240,38 @@ create_mono_sources_for_writing (const string& origin,
newfiles.push_back(boost::dynamic_pointer_cast<Source>(source));
/* for audio files, reset the timeline position so that any BWF-ish
information in the original files we are importing from is maintained.
*/
/* for audio files, reset the timeline position so that any BWF-ish
information in the original files we are importing from is maintained.
*/
boost::shared_ptr<AudioFileSource> afs;
if ((afs = boost::dynamic_pointer_cast<AudioFileSource>(source)) != 0) {
afs->set_timeline_position(timeline_position);
}
boost::shared_ptr<AudioFileSource> afs;
if ((afs = boost::dynamic_pointer_cast<AudioFileSource>(source)) != 0) {
afs->set_timeline_position(timeline_position);
}
}
return true;
}
static string
compose_status_message (const string& path,
uint file_samplerate,
uint session_samplerate,
uint /* current_file */,
uint /* total_files */)
uint file_samplerate,
uint session_samplerate,
uint /* current_file */,
uint /* total_files */)
{
if (file_samplerate != session_samplerate) {
return string_compose (_("Resampling %1 from %2kHz to %3kHz"),
Glib::path_get_basename (path),
file_samplerate/1000.0f,
session_samplerate/1000.0f);
Glib::path_get_basename (path),
file_samplerate/1000.0f,
session_samplerate/1000.0f);
}
return string_compose (_("Copying %1"), Glib::path_get_basename (path));
}
static void
write_audio_data_to_new_files (ImportableSource* source, ImportStatus& status,
vector<boost::shared_ptr<Source> >& newfiles)
vector<boost::shared_ptr<Source> >& newfiles)
{
const framecnt_t nframes = ResampledImportableSource::blocksize;
boost::shared_ptr<AudioFileSource> afs;
@ -300,10 +299,10 @@ write_audio_data_to_new_files (ImportableSource* source, ImportStatus& status,
and the file we are writing the imported data to cannot handle such values. Compute the gain
factor required to normalize the input sources to have a magnitude of less than 1.
*/
float peak = 0;
uint read_count = 0;
while (!status.cancel) {
framecnt_t const nread = source->read (data.get(), nframes);
if (nread == 0) {
@ -320,7 +319,7 @@ write_audio_data_to_new_files (ImportableSource* source, ImportStatus& status,
/* we are out of range: compute a gain to fix it */
gain = (1 - FLT_EPSILON) / peak;
}
source->seek (0);
progress_multiplier = 0.5;
progress_base = 0.5;
@ -342,7 +341,7 @@ write_audio_data_to_new_files (ImportableSource* source, ImportStatus& status,
/* here is the gain fix for out-of-range sample values that we computed earlier */
apply_gain_to_buffer (data.get(), nread, gain);
}
nfread = nread / channels;
/* de-interleave */
@ -377,86 +376,86 @@ write_midi_data_to_new_files (Evoral::SMF* source, ImportStatus& status,
status.progress = 0.0f;
assert (newfiles.size() == source->num_tracks());
assert (newfiles.size() == source->num_tracks());
try {
vector<boost::shared_ptr<Source> >::iterator s = newfiles.begin();
for (unsigned i = 1; i <= source->num_tracks(); ++i) {
vector<boost::shared_ptr<Source> >::iterator s = newfiles.begin();
boost::shared_ptr<SMFSource> smfs = boost::dynamic_pointer_cast<SMFSource> (*s);
for (unsigned i = 1; i <= source->num_tracks(); ++i) {
smfs->drop_model ();
source->seek_to_track (i);
uint64_t t = 0;
uint32_t delta_t = 0;
uint32_t size = 0;
bool first = true;
while (!status.cancel) {
gint note_id_ignored; // imported files either don't have NoteID's or we ignore them.
size = buf_size;
int ret = source->read_event (&delta_t, &size, &buf, &note_id_ignored);
if (size > buf_size) {
buf_size = size;
}
if (ret < 0) { // EOT
break;
}
t += delta_t;
if (ret == 0) { // Meta
continue;
}
if (first) {
smfs->mark_streaming_write_started ();
first = false;
}
smfs->append_event_unlocked_beats(Evoral::Event<double>(0,
(double)t / (double)source->ppqn(),
size,
buf));
if (status.progress < 0.99) {
status.progress += 0.01;
}
}
if (!first) {
/* we wrote something */
const framepos_t pos = 0;
const double length_beats = ceil(t / (double)source->ppqn());
BeatsFramesConverter converter(smfs->session().tempo_map(), pos);
smfs->update_length(pos, converter.to(length_beats));
smfs->mark_streaming_write_completed ();
if (status.cancel) {
break;
}
} else {
warning << string_compose (_("Track %1 of %2 contained no usable MIDI data"), i, source->file_path()) << endmsg;
}
++s; // next source
}
boost::shared_ptr<SMFSource> smfs = boost::dynamic_pointer_cast<SMFSource> (*s);
smfs->drop_model ();
source->seek_to_track (i);
uint64_t t = 0;
uint32_t delta_t = 0;
uint32_t size = 0;
bool first = true;
while (!status.cancel) {
gint note_id_ignored; // imported files either don't have NoteID's or we ignore them.
size = buf_size;
int ret = source->read_event (&delta_t, &size, &buf, &note_id_ignored);
if (size > buf_size) {
buf_size = size;
}
if (ret < 0) { // EOT
break;
}
t += delta_t;
if (ret == 0) { // Meta
continue;
}
if (first) {
smfs->mark_streaming_write_started ();
first = false;
}
smfs->append_event_unlocked_beats(Evoral::Event<double>(0,
(double)t / (double)source->ppqn(),
size,
buf));
if (status.progress < 0.99) {
status.progress += 0.01;
}
}
if (!first) {
/* we wrote something */
const framepos_t pos = 0;
const double length_beats = ceil(t / (double)source->ppqn());
BeatsFramesConverter converter(smfs->session().tempo_map(), pos);
smfs->update_length(pos, converter.to(length_beats));
smfs->mark_streaming_write_completed ();
if (status.cancel) {
break;
}
} else {
warning << string_compose (_("Track %1 of %2 contained no usable MIDI data"), i, source->file_path()) << endmsg;
}
++s; // next source
}
} catch (...) {
error << string_compose (_("MIDI file %1 was not readable (no reason available"), source->file_path()) << endmsg;
}
if (buf) {
free (buf);
}
if (buf) {
free (buf);
}
}
static void
@ -511,9 +510,9 @@ Session::import_audiofiles (ImportStatus& status)
}
vector<string> new_paths = get_paths_for_new_sources (config.get_native_file_header_format(),
status.replace_existing_source, *p,
get_best_session_directory_for_new_source (),
channels);
status.replace_existing_source, *p,
get_best_session_directory_for_new_source (),
channels);
Sources newfiles;
framepos_t natural_position = source ? source->natural_position() : 0;
@ -522,7 +521,7 @@ Session::import_audiofiles (ImportStatus& status)
fatal << "THIS IS NOT IMPLEMENTED YET, IT SHOULD NEVER GET CALLED!!! DYING!" << endmsg;
status.cancel = !map_existing_mono_sources (new_paths, *this, frame_rate(), newfiles, this);
} else {
status.cancel = !create_mono_sources_for_writing (*p, new_paths, *this, frame_rate(), newfiles, natural_position);
status.cancel = !create_mono_sources_for_writing (*p, new_paths, *this, frame_rate(), newfiles, natural_position);
}
// copy on cancel/failure so that any files that were created will be removed below
@ -540,7 +539,7 @@ Session::import_audiofiles (ImportStatus& status)
if (source) { // audio
status.doing_what = compose_status_message (*p, source->samplerate(),
frame_rate(), status.current, status.total);
frame_rate(), status.current, status.total);
write_audio_data_to_new_files (source.get(), status, newfiles);
} else if (smf_reader.get()) { // midi
status.doing_what = string_compose(_("Loading MIDI file %1"), *p);
@ -562,7 +561,7 @@ Session::import_audiofiles (ImportStatus& status)
for (Sources::iterator x = all_new_sources.begin(); x != all_new_sources.end(); ) {
if ((afs = boost::dynamic_pointer_cast<AudioFileSource>(*x)) != 0) {
afs->update_header((*x)->natural_position(), *now, xnow);
afs->update_header((*x)->natural_position(), *now, xnow);
afs->done_with_peakfile_writes ();
/* now that there is data there, requeue the file for analysis */

View File

@ -57,7 +57,7 @@ CubicInterpolation::interpolate (int channel, framecnt_t nframes, Sample *input,
if (_speed != _target_speed) {
acceleration = _target_speed - _speed;
} else {
acceleration = 0.0;
acceleration = 0.0;
}
distance = phase[channel];

View File

@ -45,7 +45,7 @@ PeakMeter::run (BufferSet& bufs, framepos_t /*start_frame*/, framepos_t /*end_fr
return;
}
// cerr << "meter " << name() << " runs with " << bufs.available() << " inputs\n";
// cerr << "meter " << name() << " runs with " << bufs.available() << " inputs\n";
const uint32_t n_audio = min (current_meters.n_audio(), bufs.count().n_audio());
const uint32_t n_midi = min (current_meters.n_midi(), bufs.count().n_midi());
@ -117,7 +117,7 @@ PeakMeter::configure_io (ChanCount in, ChanCount out)
current_meters = in;
reset_max_channels (in);
reset_max_channels (in);
return Processor::configure_io (in, out);
}

View File

@ -101,13 +101,14 @@ struct RegionSortByLastLayerOp {
void
Playlist::make_property_quarks ()
{
Properties::regions.property_id = g_quark_from_static_string (X_("regions"));
DEBUG_TRACE (DEBUG::Properties, string_compose ("quark for regions = %1\n", Properties::regions.property_id));
Properties::regions.property_id = g_quark_from_static_string (X_("regions"));
DEBUG_TRACE (DEBUG::Properties, string_compose ("quark for regions = %1\n",
Properties::regions.property_id));
}
RegionListProperty::RegionListProperty (Playlist& pl)
: SequenceProperty<std::list<boost::shared_ptr<Region> > > (Properties::regions.property_id, boost::bind (&Playlist::update, &pl, _1))
, _playlist (pl)
: SequenceProperty<std::list<boost::shared_ptr<Region> > > (Properties::regions.property_id, boost::bind (&Playlist::update, &pl, _1))
, _playlist (pl)
{
}
@ -149,32 +150,30 @@ RegionListProperty::get_content_from_xml (XMLNode const & node) const
PBD::ID id (prop->value ());
boost::shared_ptr<Region> ret = _playlist.region_by_id (id);
boost::shared_ptr<Region> ret = _playlist.region_by_id (id);
if (!ret) {
ret = RegionFactory::region_by_id (id);
}
if (!ret) {
ret = RegionFactory::region_by_id (id);
}
return ret;
return ret;
}
Playlist::Playlist (Session& sess, string nom, DataType type, bool hide)
: SessionObject(sess, nom)
, regions (*this)
, regions (*this)
, _type(type)
{
init (hide);
first_set_state = false;
_name = nom;
_set_sort_id ();
_set_sort_id ();
}
Playlist::Playlist (Session& sess, const XMLNode& node, DataType type, bool hide)
: SessionObject(sess, "unnamed playlist")
, regions (*this)
, _type(type)
, regions (*this)
, _type(type)
{
#ifndef NDEBUG
const XMLProperty* prop = node.property("type");
@ -183,14 +182,14 @@ Playlist::Playlist (Session& sess, const XMLNode& node, DataType type, bool hide
init (hide);
_name = "unnamed"; /* reset by set_state */
_set_sort_id ();
_set_sort_id ();
/* set state called by derived class */
}
Playlist::Playlist (boost::shared_ptr<const Playlist> other, string namestr, bool hide)
: SessionObject(other->_session, namestr)
, regions (*this)
, regions (*this)
, _type(other->_type)
, _orig_diskstream_id (other->_orig_diskstream_id)
{
@ -225,7 +224,7 @@ Playlist::Playlist (boost::shared_ptr<const Playlist> other, string namestr, boo
Playlist::Playlist (boost::shared_ptr<const Playlist> other, framepos_t start, framecnt_t cnt, string str, bool hide)
: SessionObject(other->_session, str)
, regions (*this)
, regions (*this)
, _type(other->_type)
, _orig_diskstream_id (other->_orig_diskstream_id)
{
@ -332,8 +331,8 @@ Playlist::copy_regions (RegionList& newlist) const
void
Playlist::init (bool hide)
{
add_property (regions);
_xml_node_name = X_("Playlist");
add_property (regions);
_xml_node_name = X_("Playlist");
g_atomic_int_set (&block_notifications, 0);
g_atomic_int_set (&ignore_state_changes, 0);
@ -347,7 +346,7 @@ Playlist::init (bool hide)
_shuffling = false;
_nudging = false;
in_set_state = 0;
in_update = false;
in_update = false;
_edit_mode = Config->get_edit_mode();
in_flush = false;
in_partition = false;
@ -382,27 +381,27 @@ Playlist::~Playlist ()
void
Playlist::_set_sort_id ()
{
/*
Playlists are given names like <track name>.<id>
or <track name>.<edit group name>.<id> where id
is an integer. We extract the id and sort by that.
*/
/*
Playlists are given names like <track name>.<id>
or <track name>.<edit group name>.<id> where id
is an integer. We extract the id and sort by that.
*/
size_t dot_position = _name.val().find_last_of(".");
size_t dot_position = _name.val().find_last_of(".");
if (dot_position == string::npos) {
_sort_id = 0;
} else {
string t = _name.val().substr(dot_position + 1);
if (dot_position == string::npos) {
_sort_id = 0;
} else {
string t = _name.val().substr(dot_position + 1);
try {
_sort_id = boost::lexical_cast<int>(t);
}
try {
_sort_id = boost::lexical_cast<int>(t);
}
catch (boost::bad_lexical_cast e) {
_sort_id = 0;
}
}
catch (boost::bad_lexical_cast e) {
_sort_id = 0;
}
}
}
bool
@ -418,11 +417,11 @@ Playlist::set_name (const string& str)
return false;
}
bool ret = SessionObject::set_name(str);
if (ret) {
_set_sort_id ();
}
return ret;
bool ret = SessionObject::set_name(str);
if (ret) {
_set_sort_id ();
}
return ret;
}
/***********************************************************************
@ -436,7 +435,7 @@ Playlist::set_name (const string& str)
void
Playlist::begin_undo ()
{
in_update = true;
in_update = true;
freeze ();
}
@ -444,7 +443,7 @@ void
Playlist::end_undo ()
{
thaw (true);
in_update = false;
in_update = false;
}
void
@ -476,8 +475,7 @@ Playlist::release_notifications (bool from_undo)
{
if (g_atomic_int_dec_and_test (&block_notifications)) {
flush_notifications (from_undo);
}
}
}
void
@ -596,7 +594,7 @@ Playlist::notify_region_added (boost::shared_ptr<Region> r)
pending_contents_change = true;
pending_length = true;
} else {
r->clear_changes ();
r->clear_changes ();
pending_length = false;
LengthChanged (); /* EMIT SIGNAL */
pending_contents_change = false;
@ -666,10 +664,10 @@ Playlist::flush_notifications (bool from_undo)
for (s = pending_adds.begin(); s != pending_adds.end(); ++s) {
// cerr << _name << " sends RegionAdded\n";
/* don't emit RegionAdded signal until relayering is done,
so that the region is fully setup by the time
anyone hear's that its been added
*/
/* don't emit RegionAdded signal until relayering is done,
so that the region is fully setup by the time
anyone hear's that its been added
*/
dependent_checks_needed.insert (*s);
}
@ -697,9 +695,9 @@ Playlist::flush_notifications (bool from_undo)
}
for (s = pending_adds.begin(); s != pending_adds.end(); ++s) {
(*s)->clear_changes ();
(*s)->clear_changes ();
RegionAdded (boost::weak_ptr<Region> (*s)); /* EMIT SIGNAL */
}
}
for (s = dependent_checks_needed.begin(); s != dependent_checks_needed.end(); ++s) {
check_dependents (*s, false);
@ -904,7 +902,7 @@ Playlist::remove_region_internal (boost::shared_ptr<Region> region)
possibly_splice_unlocked (pos, -distance);
if (!holding_state ()) {
relayer ();
relayer ();
remove_dependents (region);
if (old_length != _get_extent().second) {
@ -1583,10 +1581,10 @@ Playlist::region_bounds_changed (const PropertyChange& what_changed, boost::shar
RegionList::iterator i = find (regions.begin(), regions.end(), region);
if (i == regions.end()) {
/* the region bounds are being modified but its not currently
in the region list. we will use its bounds correctly when/if
it is added
*/
/* the region bounds are being modified but its not currently
in the region list. we will use its bounds correctly when/if
it is added
*/
return;
}
@ -1703,11 +1701,11 @@ Playlist::sync_all_regions_with_regions ()
{
RegionLock rl (this);
all_regions.clear ();
all_regions.clear ();
for (RegionList::iterator i = regions.begin(); i != regions.end(); ++i) {
all_regions.insert (*i);
}
for (RegionList::iterator i = regions.begin(); i != regions.end(); ++i) {
all_regions.insert (*i);
}
}
void
@ -1724,18 +1722,18 @@ Playlist::clear (bool with_signals)
regions.clear ();
for (set<boost::shared_ptr<Region> >::iterator s = pending_removes.begin(); s != pending_removes.end(); ++s) {
remove_dependents (*s);
}
for (set<boost::shared_ptr<Region> >::iterator s = pending_removes.begin(); s != pending_removes.end(); ++s) {
remove_dependents (*s);
}
}
if (with_signals) {
for (set<boost::shared_ptr<Region> >::iterator s = pending_removes.begin(); s != pending_removes.end(); ++s) {
RegionRemoved (boost::weak_ptr<Region> (*s)); /* EMIT SIGNAL */
}
for (set<boost::shared_ptr<Region> >::iterator s = pending_removes.begin(); s != pending_removes.end(); ++s) {
RegionRemoved (boost::weak_ptr<Region> (*s)); /* EMIT SIGNAL */
}
pending_removes.clear ();
pending_removes.clear ();
pending_length = false;
LengthChanged ();
pending_contents_change = false;
@ -1832,7 +1830,7 @@ Playlist::regions_to_read (framepos_t start, framepos_t end)
to_check.insert (start);
to_check.insert (end);
DEBUG_TRACE (DEBUG::AudioPlayback, ">>>>> REGIONS TO READ\n");
DEBUG_TRACE (DEBUG::AudioPlayback, ">>>>> REGIONS TO READ\n");
for (RegionList::iterator i = regions.begin(); i != regions.end(); ++i) {
@ -1844,38 +1842,38 @@ Playlist::regions_to_read (framepos_t start, framepos_t end)
case OverlapInternal:
covering.push_back (*i);
DEBUG_TRACE (DEBUG::AudioPlayback, string_compose ("toread: will cover %1 (OInternal)\n", (*i)->name()));
DEBUG_TRACE (DEBUG::AudioPlayback, string_compose ("toread: will cover %1 (OInternal)\n", (*i)->name()));
break;
case OverlapStart:
to_check.insert ((*i)->position());
if ((*i)->position() != 0) {
to_check.insert ((*i)->position()-1);
}
DEBUG_TRACE (DEBUG::AudioPlayback, string_compose ("toread: will check %1 for %2\n", (*i)->position(), (*i)->name()));
if ((*i)->position() != 0) {
to_check.insert ((*i)->position()-1);
}
DEBUG_TRACE (DEBUG::AudioPlayback, string_compose ("toread: will check %1 for %2\n", (*i)->position(), (*i)->name()));
covering.push_back (*i);
break;
case OverlapEnd:
to_check.insert ((*i)->last_frame());
to_check.insert ((*i)->last_frame()+1);
DEBUG_TRACE (DEBUG::AudioPlayback, string_compose ("toread: will cover %1 (OEnd)\n", (*i)->name()));
DEBUG_TRACE (DEBUG::AudioPlayback, string_compose ("\ttoread: will check %1 for %2\n", (*i)->last_frame(), (*i)->name()));
DEBUG_TRACE (DEBUG::AudioPlayback, string_compose ("\ttoread: will check %1 for %2\n", (*i)->last_frame(), (*i)->name()));
DEBUG_TRACE (DEBUG::AudioPlayback, string_compose ("toread: will cover %1 (OEnd)\n", (*i)->name()));
DEBUG_TRACE (DEBUG::AudioPlayback, string_compose ("\ttoread: will check %1 for %2\n", (*i)->last_frame(), (*i)->name()));
DEBUG_TRACE (DEBUG::AudioPlayback, string_compose ("\ttoread: will check %1 for %2\n", (*i)->last_frame(), (*i)->name()));
covering.push_back (*i);
break;
case OverlapExternal:
covering.push_back (*i);
to_check.insert ((*i)->position());
if ((*i)->position() != 0) {
to_check.insert ((*i)->position()-1);
}
if ((*i)->position() != 0) {
to_check.insert ((*i)->position()-1);
}
to_check.insert ((*i)->last_frame());
to_check.insert ((*i)->last_frame()+1);
DEBUG_TRACE (DEBUG::AudioPlayback, string_compose ("toread: will cover %1 (OExt)\n", (*i)->name()));
DEBUG_TRACE (DEBUG::AudioPlayback, string_compose ("\ttoread: will check %1 for %2\n", (*i)->position(), (*i)->name()));
DEBUG_TRACE (DEBUG::AudioPlayback, string_compose ("\ttoread: will check %1 for %2\n", (*i)->last_frame(), (*i)->name()));
DEBUG_TRACE (DEBUG::AudioPlayback, string_compose ("toread: will cover %1 (OExt)\n", (*i)->name()));
DEBUG_TRACE (DEBUG::AudioPlayback, string_compose ("\ttoread: will check %1 for %2\n", (*i)->position(), (*i)->name()));
DEBUG_TRACE (DEBUG::AudioPlayback, string_compose ("\ttoread: will check %1 for %2\n", (*i)->last_frame(), (*i)->name()));
break;
}
@ -1893,7 +1891,7 @@ Playlist::regions_to_read (framepos_t start, framepos_t end)
if (covering.size() == 1) {
rlist->push_back (covering.front());
DEBUG_TRACE (DEBUG::AudioPlayback, string_compose ("Just one covering region (%1)\n", covering.front()->name()));
DEBUG_TRACE (DEBUG::AudioPlayback, string_compose ("Just one covering region (%1)\n", covering.front()->name()));
} else {
@ -1902,20 +1900,20 @@ Playlist::regions_to_read (framepos_t start, framepos_t end)
here.clear ();
DEBUG_TRACE (DEBUG::AudioPlayback, string_compose ("++++ Considering %1\n", *t));
DEBUG_TRACE (DEBUG::AudioPlayback, string_compose ("++++ Considering %1\n", *t));
for (RegionList::iterator x = covering.begin(); x != covering.end(); ++x) {
if ((*x)->covers (*t)) {
here.push_back (*x);
DEBUG_TRACE (DEBUG::AudioPlayback, string_compose ("region %1 covers %2\n",
(*x)->name(),
(*t)));
DEBUG_TRACE (DEBUG::AudioPlayback, string_compose ("region %1 covers %2\n",
(*x)->name(),
(*t)));
} else {
DEBUG_TRACE (DEBUG::AudioPlayback, string_compose ("region %1 does NOT covers %2\n",
(*x)->name(),
(*t)));
}
DEBUG_TRACE (DEBUG::AudioPlayback, string_compose ("region %1 does NOT covers %2\n",
(*x)->name(),
(*t)));
}
}
@ -1931,8 +1929,8 @@ Playlist::regions_to_read (framepos_t start, framepos_t end)
if ((*c)->opaque()) {
/* the other regions at this position are hidden by this one */
DEBUG_TRACE (DEBUG::AudioPlayback, string_compose ("%1 is opaque, ignore all others\n",
(*c)->name()));
DEBUG_TRACE (DEBUG::AudioPlayback, string_compose ("%1 is opaque, ignore all others\n",
(*c)->name()));
break;
}
}
@ -1950,7 +1948,7 @@ Playlist::regions_to_read (framepos_t start, framepos_t end)
}
}
DEBUG_TRACE (DEBUG::AudioPlayback, string_compose ("<<<<< REGIONS TO READ returns %1\n", rlist->size()));
DEBUG_TRACE (DEBUG::AudioPlayback, string_compose ("<<<<< REGIONS TO READ returns %1\n", rlist->size()));
return rlist;
}
@ -2206,20 +2204,20 @@ Playlist::clear_owned_changes ()
void
Playlist::update (const RegionListProperty::ChangeRecord& change)
{
DEBUG_TRACE (DEBUG::Properties, string_compose ("Playlist %1 updates from a change record with %2 adds %3 removes\n",
name(), change.added.size(), change.removed.size()));
DEBUG_TRACE (DEBUG::Properties, string_compose ("Playlist %1 updates from a change record with %2 adds %3 removes\n",
name(), change.added.size(), change.removed.size()));
freeze ();
/* add the added regions */
for (RegionListProperty::ChangeContainer::iterator i = change.added.begin(); i != change.added.end(); ++i) {
add_region ((*i), (*i)->position());
}
/* remove the removed regions */
for (RegionListProperty::ChangeContainer::iterator i = change.removed.begin(); i != change.removed.end(); ++i) {
remove_region (*i);
}
freeze ();
/* add the added regions */
for (RegionListProperty::ChangeContainer::iterator i = change.added.begin(); i != change.added.end(); ++i) {
add_region ((*i), (*i)->position());
}
/* remove the removed regions */
for (RegionListProperty::ChangeContainer::iterator i = change.removed.begin(); i != change.removed.end(); ++i) {
remove_region (*i);
}
thaw ();
thaw ();
}
int
@ -2251,9 +2249,9 @@ Playlist::set_state (const XMLNode& node, int version)
if (prop->name() == X_("name")) {
_name = prop->value();
_set_sort_id ();
_set_sort_id ();
} else if (prop->name() == X_("id")) {
_id = prop->value();
_id = prop->value();
} else if (prop->name() == X_("orig_diskstream_id")) {
_orig_diskstream_id = prop->value ();
} else if (prop->name() == X_("frozen")) {
@ -2439,11 +2437,11 @@ Playlist::set_edit_mode (EditMode mode)
void
Playlist::relayer ()
{
/* never compute layers when changing state for undo/redo or setting from XML */
/* never compute layers when changing state for undo/redo or setting from XML */
if (in_update || in_set_state) {
return;
}
if (in_update || in_set_state) {
return;
}
bool changed = false;
@ -2693,7 +2691,7 @@ Playlist::move_region_to_layer (layer_t target_layer, boost::shared_ptr<Region>
}
}
freeze ();
freeze ();
/* now reset the layers without holding the region lock */
@ -2703,16 +2701,16 @@ Playlist::move_region_to_layer (layer_t target_layer, boost::shared_ptr<Region>
region->set_layer (target_layer);
/* now check all dependents, since we changed the layering */
/* now check all dependents, since we changed the layering */
for (list<LayerInfo>::iterator x = layerinfo.begin(); x != layerinfo.end(); ++x) {
check_dependents (x->first, false);
}
check_dependents (region, false);
notify_layering_changed ();
notify_layering_changed ();
thaw ();
thaw ();
return 0;
}
@ -2769,13 +2767,13 @@ Playlist::uses_source (boost::shared_ptr<const Source> src) const
{
RegionLock rlock (const_cast<Playlist*> (this));
for (set<boost::shared_ptr<Region> >::iterator r = all_regions.begin(); r != all_regions.end(); ++r) {
if ((*r)->uses_source (src)) {
return true;
}
}
for (set<boost::shared_ptr<Region> >::iterator r = all_regions.begin(); r != all_regions.end(); ++r) {
if ((*r)->uses_source (src)) {
return true;
}
}
return false;
return false;
}
boost::shared_ptr<Region>
@ -2798,11 +2796,11 @@ uint32_t
Playlist::region_use_count (boost::shared_ptr<Region> r) const
{
RegionLock rlock (const_cast<Playlist*> (this));
uint32_t cnt = 0;
uint32_t cnt = 0;
for (RegionList::const_iterator i = regions.begin(); i != regions.end(); ++i) {
if ((*i) == r) {
cnt++;
cnt++;
}
}

View File

@ -34,41 +34,41 @@ PortSet::PortSet()
static bool sort_ports_by_name (Port* a, Port* b)
{
string aname (a->name());
string bname (b->name());
string aname (a->name());
string bname (b->name());
string::size_type last_digit_position_a = aname.size();
string::reverse_iterator r_iterator = aname.rbegin();
string::size_type last_digit_position_a = aname.size();
string::reverse_iterator r_iterator = aname.rbegin();
while (r_iterator!= aname.rend() && Glib::Unicode::isdigit(*r_iterator)) {
r_iterator++;
last_digit_position_a--;
}
while (r_iterator!= aname.rend() && Glib::Unicode::isdigit(*r_iterator)) {
r_iterator++;
last_digit_position_a--;
}
string::size_type last_digit_position_b = bname.size();
r_iterator = bname.rbegin();
string::size_type last_digit_position_b = bname.size();
r_iterator = bname.rbegin();
while (r_iterator != bname.rend() && Glib::Unicode::isdigit(*r_iterator)) {
r_iterator++;
last_digit_position_b--;
}
while (r_iterator != bname.rend() && Glib::Unicode::isdigit(*r_iterator)) {
r_iterator++;
last_digit_position_b--;
}
// if some of the names don't have a number as posfix, compare as strings
// if some of the names don't have a number as posfix, compare as strings
if (last_digit_position_a == aname.size() or last_digit_position_b == bname.size()) {
return aname < bname;
}
if (last_digit_position_a == aname.size() or last_digit_position_b == bname.size()) {
return aname < bname;
}
const std::string prefix_a = aname.substr(0, last_digit_position_a - 1);
const unsigned int posfix_a = std::atoi(aname.substr(last_digit_position_a, aname.size() - last_digit_position_a).c_str());
const std::string prefix_b = bname.substr(0, last_digit_position_b - 1);
const unsigned int posfix_b = std::atoi(bname.substr(last_digit_position_b, bname.size() - last_digit_position_b).c_str());
const std::string prefix_a = aname.substr(0, last_digit_position_a - 1);
const unsigned int posfix_a = std::atoi(aname.substr(last_digit_position_a, aname.size() - last_digit_position_a).c_str());
const std::string prefix_b = bname.substr(0, last_digit_position_b - 1);
const unsigned int posfix_b = std::atoi(bname.substr(last_digit_position_b, bname.size() - last_digit_position_b).c_str());
if (prefix_a != prefix_b) {
return aname < bname;
} else {
return posfix_a < posfix_b;
}
if (prefix_a != prefix_b) {
return aname < bname;
} else {
return posfix_a < posfix_b;
}
}
void

View File

@ -77,10 +77,10 @@ SessionEvent::operator delete (void *ptr, size_t /*size*/)
Pool* p = pool->per_thread_pool ();
SessionEvent* ev = static_cast<SessionEvent*> (ptr);
DEBUG_TRACE (DEBUG::SessionEvents, string_compose (
"%1 Deleting SessionEvent @ %2 ev thread pool = %3 ev pool = %4\n",
pthread_self(), ev, p->name(), ev->own_pool->name()
));
DEBUG_TRACE (DEBUG::SessionEvents, string_compose (
"%1 Deleting SessionEvent @ %2 ev thread pool = %3 ev pool = %4\n",
pthread_self(), ev, p->name(), ev->own_pool->name()
));
#ifndef NDEBUG
if (DEBUG::SessionEvents & PBD::debug_bits) {
@ -133,7 +133,7 @@ SessionEventManager::dump_events () const
}
cerr << "Next event: ";
if ((Events::const_iterator) next_event == events.end()) {
if ((Events::const_iterator) next_event == events.end()) {
cerr << "none" << endl;
} else {
cerr << "at " << (*next_event)->action_frame << ' '

View File

@ -107,26 +107,26 @@ Session::no_roll (pframes_t nframes)
_click_io->silence (nframes);
}
if (route_graph->threads_in_use() > 0) {
DEBUG_TRACE(DEBUG::ProcessThreads,"calling graph/no-roll\n");
route_graph->routes_no_roll( nframes, _transport_frame, end_frame, non_realtime_work_pending(), actively_recording(), declick);
} else {
for (RouteList::iterator i = r->begin(); i != r->end(); ++i) {
if ((*i)->is_hidden()) {
continue;
}
(*i)->set_pending_declick (declick);
if ((*i)->no_roll (nframes, _transport_frame, end_frame, non_realtime_work_pending(),
actively_recording(), declick)) {
error << string_compose(_("Session: error in no roll for %1"), (*i)->name()) << endmsg;
ret = -1;
break;
}
}
}
if (route_graph->threads_in_use() > 0) {
DEBUG_TRACE(DEBUG::ProcessThreads,"calling graph/no-roll\n");
route_graph->routes_no_roll( nframes, _transport_frame, end_frame, non_realtime_work_pending(), actively_recording(), declick);
} else {
for (RouteList::iterator i = r->begin(); i != r->end(); ++i) {
if ((*i)->is_hidden()) {
continue;
}
(*i)->set_pending_declick (declick);
if ((*i)->no_roll (nframes, _transport_frame, end_frame, non_realtime_work_pending(),
actively_recording(), declick)) {
error << string_compose(_("Session: error in no roll for %1"), (*i)->name()) << endmsg;
ret = -1;
break;
}
}
}
return ret;
}
@ -134,46 +134,46 @@ Session::no_roll (pframes_t nframes)
int
Session::process_routes (pframes_t nframes, bool& need_butler)
{
bool record_active;
int declick = get_transport_declick_required();
bool rec_monitors = get_rec_monitors_input();
boost::shared_ptr<RouteList> r = routes.reader ();
bool record_active;
int declick = get_transport_declick_required();
bool rec_monitors = get_rec_monitors_input();
boost::shared_ptr<RouteList> r = routes.reader ();
if (transport_sub_state & StopPendingCapture) {
/* force a declick out */
declick = -1;
}
record_active = actively_recording(); // || (get_record_enabled() && get_punch_in());
const framepos_t start_frame = _transport_frame;
const framepos_t end_frame = _transport_frame + floor (nframes * _transport_speed);
/* XXX this is hack to force use of the graph even if we are only
using 1 thread. its needed because otherwise when we remove
tracks, the graph never gets updated.
*/
if (1 || route_graph->threads_in_use() > 0) {
DEBUG_TRACE(DEBUG::ProcessThreads,"calling graph/process-routes\n");
route_graph->process_routes( nframes, start_frame, end_frame, declick, record_active, rec_monitors, need_butler);
} else {
if (transport_sub_state & StopPendingCapture) {
/* force a declick out */
declick = -1;
}
for (RouteList::iterator i = r->begin(); i != r->end(); ++i) {
int ret;
if ((*i)->is_hidden()) {
continue;
}
(*i)->set_pending_declick (declick);
if ((ret = (*i)->roll (nframes, start_frame, end_frame, declick, record_active, rec_monitors, need_butler)) < 0) {
stop_transport ();
return -1;
}
}
}
record_active = actively_recording(); // || (get_record_enabled() && get_punch_in());
const framepos_t start_frame = _transport_frame;
const framepos_t end_frame = _transport_frame + floor (nframes * _transport_speed);
/* XXX this is hack to force use of the graph even if we are only
using 1 thread. its needed because otherwise when we remove
tracks, the graph never gets updated.
*/
if (1 || route_graph->threads_in_use() > 0) {
DEBUG_TRACE(DEBUG::ProcessThreads,"calling graph/process-routes\n");
route_graph->process_routes( nframes, start_frame, end_frame, declick, record_active, rec_monitors, need_butler);
} else {
for (RouteList::iterator i = r->begin(); i != r->end(); ++i) {
int ret;
if ((*i)->is_hidden()) {
continue;
}
(*i)->set_pending_declick (declick);
if ((ret = (*i)->roll (nframes, start_frame, end_frame, declick, record_active, rec_monitors, need_butler)) < 0) {
stop_transport ();
return -1;
}
}
}
return 0;
}
@ -194,27 +194,27 @@ Session::silent_process_routes (pframes_t nframes, bool& need_butler)
const framepos_t start_frame = _transport_frame;
const framepos_t end_frame = _transport_frame + lrintf(nframes * _transport_speed);
/* XXX this is hack to force use of the graph even if we are only
using 1 thread. its needed because otherwise when we remove
tracks, the graph never gets updated.
*/
if (1 || route_graph->threads_in_use() > 0) {
route_graph->silent_process_routes( nframes, start_frame, end_frame, record_active, rec_monitors, need_butler);
} else {
for (RouteList::iterator i = r->begin(); i != r->end(); ++i) {
int ret;
if ((*i)->is_hidden()) {
continue;
}
if ((ret = (*i)->silent_roll (nframes, start_frame, end_frame, record_active, rec_monitors, need_butler)) < 0) {
stop_transport ();
return -1;
}
}
}
/* XXX this is hack to force use of the graph even if we are only
using 1 thread. its needed because otherwise when we remove
tracks, the graph never gets updated.
*/
if (1 || route_graph->threads_in_use() > 0) {
route_graph->silent_process_routes( nframes, start_frame, end_frame, record_active, rec_monitors, need_butler);
} else {
for (RouteList::iterator i = r->begin(); i != r->end(); ++i) {
int ret;
if ((*i)->is_hidden()) {
continue;
}
if ((ret = (*i)->silent_roll (nframes, start_frame, end_frame, record_active, rec_monitors, need_butler)) < 0) {
stop_transport ();
return -1;
}
}
}
return 0;
}
@ -291,12 +291,12 @@ Session::process_with_events (pframes_t nframes)
_transport_speed >= (1 - tolerance) &&
_transport_speed <= (1 + tolerance)
);
if (_send_qf_mtc && !was_sending_qf_mtc) {
/* we will re-start quarter-frame MTC this cycle, so send a full update to set things up */
_send_timecode_update = true;
}
if (Config->get_send_mtc() && !_send_qf_mtc && _pframes_since_last_mtc > (frame_rate () / 4)) {
/* we're sending MTC, but we're not sending QF MTC at the moment, and it's been
a quarter of a second since we sent anything at all, so send a full MTC update
@ -304,10 +304,10 @@ Session::process_with_events (pframes_t nframes)
*/
_send_timecode_update = true;
}
_pframes_since_last_mtc += nframes;
}
/* Events caused a transport change (or we re-started sending
* MTC), so send an MTC Full Frame (Timecode) message. This
* is sent whether rolling or not, to give slaves an idea of
@ -406,7 +406,7 @@ Session::process_with_events (pframes_t nframes)
fail_roll (nframes);
return;
}
get_track_statistics ();
nframes -= this_nframes;
@ -538,7 +538,7 @@ Session::follow_slave (pframes_t nframes)
DEBUG_TRACE (DEBUG::Slave, string_compose ("slave state %1 @ %2 speed %3 cur delta %4 avg delta %5\n",
_slave_state, slave_transport_frame, slave_speed, this_delta, average_slave_delta));
if (_slave_state == Running && !_slave->is_always_synced() && !config.get_timecode_source_is_synced()) {
@ -565,11 +565,11 @@ Session::follow_slave (pframes_t nframes)
slave_speed,
_transport_speed,
_transport_frame,
slave_transport_frame,
slave_transport_frame,
average_slave_delta));
}
#endif
if (_slave->give_slave_full_control_over_transport_speed()) {
set_transport_speed (slave_speed, false, false);
//std::cout << "set speed = " << slave_speed << "\n";
@ -580,7 +580,7 @@ Session::follow_slave (pframes_t nframes)
delta, adjusted_speed, adjusted_speed/slave_speed, _transport_speed,
slave_speed));
}
#if 1
if ((framecnt_t) abs(average_slave_delta) > _slave->resolution()) {
cerr << "average slave delta greater than slave resolution (" << _slave->resolution() << "), going to silent motion\n";
@ -768,7 +768,7 @@ Session::follow_slave_silently (pframes_t nframes, float slave_speed)
} else {
increment_transport_position (frames_moved);
}
framepos_t stop_limit;
if (actively_recording()) {
@ -815,7 +815,7 @@ Session::process_without_events (pframes_t nframes)
interpolation.set_speed (fabs(_transport_speed));
frames_moved = (framecnt_t) interpolation.interpolate (0, nframes, 0, 0);
}
if (!_exporting && !timecode_transmission_suspended()) {
send_midi_time_code_for_cycle (_transport_frame, _transport_frame + frames_moved, nframes);
}
@ -855,9 +855,9 @@ Session::process_without_events (pframes_t nframes)
reverse. It seems a bit wrong that we're not using the
interpolator to compute this.
*/
frames_moved = (framecnt_t) floor (_transport_speed * nframes);
if (frames_moved < 0) {
decrement_transport_position (-frames_moved);
} else {
@ -893,12 +893,12 @@ Session::process_audition (pframes_t nframes)
_butler->summon ();
}
/* if using a monitor section, run it because otherwise we don't hear anything */
/* if using a monitor section, run it because otherwise we don't hear anything */
if (auditioner->needs_monitor()) {
_monitor_out->passthru (_transport_frame, _transport_frame + nframes, nframes, false);
}
if (auditioner->needs_monitor()) {
_monitor_out->passthru (_transport_frame, _transport_frame + nframes, nframes, false);
}
/* handle pending events */
while (pending_events.read (&ev, 1) == 1) {
@ -1147,13 +1147,13 @@ Session::process_event (SessionEvent* ev)
del = false; // other side of RT request needs to clean up
break;
case SessionEvent::AdjustPlaybackBuffering:
schedule_playback_buffering_adjustment ();
break;
case SessionEvent::AdjustPlaybackBuffering:
schedule_playback_buffering_adjustment ();
break;
case SessionEvent::AdjustCaptureBuffering:
schedule_capture_buffering_adjustment ();
break;
case SessionEvent::AdjustCaptureBuffering:
schedule_capture_buffering_adjustment ();
break;
case SessionEvent::SetTimecodeTransmission:
g_atomic_int_set (&_suspend_timecode_transmission, ev->yes_or_no ? 0 : 1);