RadioAction::Group denormal_group;
ActionManager::register_toggle_action (option_actions, X_("DenormalProtection"), _("Use DC bias"), mem_fun (*this, &ARDOUR_UI::toggle_denormal_protection));
-
- FPU fpu;
ActionManager::register_radio_action (option_actions, denormal_group, X_("DenormalNone"), _("No processor handling"), bind (mem_fun (*this, &ARDOUR_UI::set_denormal_model), DenormalNone));
- act = ActionManager::register_radio_action (option_actions, denormal_group, X_("DenormalFTZ"), _("Use FlushToZero"), bind (mem_fun (*this, &ARDOUR_UI::set_denormal_model), DenormalFTZ));
- if (!fpu.has_flush_to_zero()) {
+ // as of September 10th 2007, Valgrind cannot handle various FPU flag setting instructions
+ // so avoid them
+
+ if (getenv ("ARDOUR_RUNNING_UNDER_VALGRIND")) {
+
+ /* we still need these actions to exist, but make them all insensitive */
+
+ act = ActionManager::register_radio_action (option_actions, denormal_group, X_("DenormalFTZ"), _("Use FlushToZero"), bind (mem_fun (*this, &ARDOUR_UI::set_denormal_model), DenormalFTZ));
act->set_sensitive (false);
- }
- act = ActionManager::register_radio_action (option_actions, denormal_group, X_("DenormalDAZ"), _("Use DenormalsAreZero"), bind (mem_fun (*this, &ARDOUR_UI::set_denormal_model), DenormalDAZ));
- if (!fpu.has_denormals_are_zero()) {
+ act = ActionManager::register_radio_action (option_actions, denormal_group, X_("DenormalDAZ"), _("Use DenormalsAreZero"), bind (mem_fun (*this, &ARDOUR_UI::set_denormal_model), DenormalDAZ));
act->set_sensitive (false);
- }
- act = ActionManager::register_radio_action (option_actions, denormal_group, X_("DenormalFTZDAZ"), _("Use FlushToZero & DenormalsAreZero"), bind (mem_fun (*this, &ARDOUR_UI::set_denormal_model), DenormalFTZDAZ));
- if (!fpu.has_flush_to_zero() || !fpu.has_denormals_are_zero()) {
+ act = ActionManager::register_radio_action (option_actions, denormal_group, X_("DenormalFTZDAZ"), _("Use FlushToZero & DenormalsAreZero"), bind (mem_fun (*this, &ARDOUR_UI::set_denormal_model), DenormalFTZDAZ));
act->set_sensitive (false);
+
+ } else {
+
+ FPU fpu;
+
+ act = ActionManager::register_radio_action (option_actions, denormal_group, X_("DenormalFTZ"), _("Use FlushToZero"), bind (mem_fun (*this, &ARDOUR_UI::set_denormal_model), DenormalFTZ));
+ if (!fpu.has_flush_to_zero()) {
+ act->set_sensitive (false);
+ }
+
+ act = ActionManager::register_radio_action (option_actions, denormal_group, X_("DenormalDAZ"), _("Use DenormalsAreZero"), bind (mem_fun (*this, &ARDOUR_UI::set_denormal_model), DenormalDAZ));
+ if (!fpu.has_denormals_are_zero()) {
+ act->set_sensitive (false);
+ }
+
+ act = ActionManager::register_radio_action (option_actions, denormal_group, X_("DenormalFTZDAZ"), _("Use FlushToZero & DenormalsAreZero"), bind (mem_fun (*this, &ARDOUR_UI::set_denormal_model), DenormalFTZDAZ));
+ if (!fpu.has_flush_to_zero() || !fpu.has_denormals_are_zero()) {
+ act->set_sensitive (false);
+ }
}
act = ActionManager::register_toggle_action (option_actions, X_("DoNotRunPluginsWhileRecording"), _("Do not run plugins while recording"), mem_fun (*this, &ARDOUR_UI::toggle_DoNotRunPluginsWhileRecording));
}
if (response == RESPONSE_APPLY) {
+ sfbrowser->clear_selection ();
goto again;
}
}
{ "novst", 0, 0, 'V' },
{ "new", 1, 0, 'N' },
{ "no-hw-optimizations", 0, 0, 'O' },
- { "sync", 0, 0, 'O' },
+ { "sync", 0, 0, 'S' },
{ "curvetest", 1, 0, 'C' },
{ "sillyAppleUndocumentedFinderFeature", 1, 0, 'p' },
{ 0, 0, 0, 0 }
bool
SoundFileBox::setup_labels (const ustring& filename)
{
- if (path.empty()) {
+ if (!path.empty()) {
// save existing tags
tags_changed ();
}
persistent_folder = chooser.get_current_folder();
}
+void
+SoundFileBrowser::clear_selection ()
+{
+ chooser.unselect_all ();
+ found_list_view.get_selection()->unselect_all ();
+}
+
void
SoundFileBrowser::chooser_file_activated ()
{
if (n == 0) {
vector<ustring> filenames = chooser.get_filenames();
vector<ustring>::iterator i;
+
for (i = filenames.begin(); i != filenames.end(); ++i) {
struct stat buf;
if ((!stat((*i).c_str(), &buf)) && S_ISREG(buf.st_mode)) {
results.push_back (*i);
}
}
- return results;
} else {
results.push_back (str);
}
- return results;
}
+
+ return results;
}
void
virtual void set_session (ARDOUR::Session*);
std::vector<Glib::ustring> get_paths ();
+ void clear_selection ();
+
Gtk::FileChooserWidget chooser;
Gtk::TreeView found_list_view;
static bool _build_peakfiles;
bool _peaks_built;
- mutable Glib::RWLock _lock;
+ mutable Glib::Mutex _lock;
mutable Glib::Mutex _peaks_ready_lock;
nframes_t _length;
ustring peakpath;
but we must hold a solid lock on PeaksReady.
*/
- Glib::RWLock::WriterLock lm (_lock);
+ Glib::Mutex::Lock lm (_lock);
if (_peaks_built) {
PeaksReady (); /* EMIT SIGNAL */
int
AudioFileSource::set_name (ustring newname, bool destructive)
{
- Glib::RWLock::WriterLock lm (_lock);
+ Glib::Mutex::Lock lm (_lock);
ustring oldpath = _path;
ustring newpath = Session::change_audio_path_by_name (oldpath, _name, newname, destructive);
nframes_t
AudioSource::read (Sample *dst, nframes_t start, nframes_t cnt) const
{
- Glib::RWLock::ReaderLock lm (_lock);
+ Glib::Mutex::Lock lm (_lock);
return read_unlocked (dst, start, cnt);
}
nframes_t
AudioSource::write (Sample *dst, nframes_t cnt)
{
- Glib::RWLock::WriterLock lm (_lock);
+ Glib::Mutex::Lock lm (_lock);
return write_unlocked (dst, cnt);
}
int
AudioSource::read_peaks (PeakData *peaks, nframes_t npeaks, nframes_t start, nframes_t cnt, double samples_per_visual_peak) const
{
- Glib::RWLock::ReaderLock lm (_lock);
+ Glib::Mutex::Lock lm (_lock);
double scale;
double expected_peaks;
PeakData::PeakDatum xmax;
nframes_t cnt;
Sample* buf = 0;
nframes_t frames_read;
- nframes_t frames_to_read = 65536; // 256kB reads from disk, roughly ideal
+ nframes_t frames_to_read;
+ const nframes_t bufsize = 65536; // 256kB per disk read for mono data is about ideal
int ret = -1;
{
/* hold lock while building peaks */
- Glib::RWLock::ReaderLock lp (_lock);
+ Glib::Mutex::Lock lp (_lock);
if (prepare_for_peakfile_writes ()) {
goto out;
current_frame = 0;
cnt = _length;
_peaks_built = false;
- buf = new Sample[frames_to_read];
+ buf = new Sample[bufsize];
while (cnt) {
- frames_to_read = min (frames_per_peak, cnt);
+ frames_to_read = min (bufsize, cnt);
if ((frames_read = read_unlocked (buf, current_frame, frames_to_read)) != frames_to_read) {
error << string_compose(_("%1: could not write read raw data for peak computation (%2)"), _name, strerror (errno)) << endmsg;
done_with_peakfile_writes (false);
goto out;
}
-
+
if (compute_and_write_peaks (buf, current_frame, frames_read, true, false)) {
break;
}
if (cnt == 0) {
/* success */
truncate_peakfile();
- _peaks_built = true;
}
- done_with_peakfile_writes ();
+ done_with_peakfile_writes ((cnt == 0));
}
{
PeakRangeReady (peak_leftover_frame, peak_leftover_cnt); /* EMIT SIGNAL */
if (intermediate_peaks_ready) {
PeaksReady (); /* EMIT SIGNAL */
- } else {
- cerr << "Skip PR at A\n";
- }
+ }
}
/* left overs are done */
PeakRangeReady (first_frame, frames_done); /* EMIT SIGNAL */
if (intermediate_peaks_ready) {
PeaksReady (); /* EMIT SIGNAL */
- } else {
- cerr << "Skip PR at A\n";
}
-
}
ret = 0;
setup_hardware_optimization (bool try_optimization)
{
bool generic_mix_functions = true;
- FPU fpu;
if (try_optimization) {
+ FPU fpu;
+
#if defined (ARCH_X86) && defined (BUILD_SSE_OPTIMIZATIONS)
if (fpu.has_sse()) {
info << "Apple VecLib H/W specific optimizations in use" << endmsg;
}
#endif
+
+ /* consider FPU denormal handling to be "h/w optimization" */
+
+ setup_fpu ();
}
if (generic_mix_functions) {
info << "No H/W specific optimizations in use" << endmsg;
}
- setup_fpu ();
-
}
int
void
ARDOUR::setup_fpu ()
{
+ if (getenv ("ARDOUR_RUNNING_UNDER_VALGRIND")) {
+ // valgrind doesn't understand this assembler stuff
+ // September 10th, 2007
+ return;
+ }
+
#if defined(ARCH_X86) && defined(USE_XMMINTRIN)
int MXCSR;
#include <sys/stat.h>
#include <glibmm/miscutils.h>
+#include <pbd/stacktrace.h>
#include <ardour/sndfilesource.h>
#include <ardour/sndfile_helpers.h>
SourceFactory::peak_building_lock.lock ();
+ wait:
SourceFactory::PeaksToBuild->wait (SourceFactory::peak_building_lock);
if (SourceFactory::files_with_peaks.empty()) {
- continue;
+ goto wait;
}
boost::shared_ptr<AudioSource> as (SourceFactory::files_with_peaks.front().lock());
if (!as) {
continue;
}
-
+
as->setup_peakfile ();
}
}