make big clock be on top ALWAYS; more design fixes for async peak building; fix up peakfile name screw up but WITHOUT back-compatibility

git-svn-id: svn://localhost/ardour2/branches/2.0-ongoing@2461 d708f5d6-7413-0410-9779-e7cbd77b26cf
This commit is contained in:
Paul Davis 2007-09-12 19:10:04 +00:00
parent 0a38cee852
commit 71df552f0a
14 changed files with 80 additions and 40 deletions

View File

@ -2,4 +2,4 @@
dir=`dirname "$0"`
. $dir/ardev_common.sh
LD_LIBRARY_PATH=/usr/local/lib:$LD_LIBRARY_PATH
exec gdb $EXECUTABLE $*
exec gdb $EXECUTABLE "$@"

View File

@ -1,4 +1,4 @@
#!/bin/sh
. `dirname "$0"`/ardev_common.sh
LD_LIBRARY_PATH=/usr/local/lib:$LD_LIBRARY_PATH
exec $EXECUTABLE $*
exec $EXECUTABLE "$@"

View File

@ -13,6 +13,6 @@ if [ "$MLOCK_LIMIT" != "unlimited" ]; then
fi
exec %INSTALL_PREFIX%/%LIBDIR%/ardour2/ardour-%VERSION% $*
exec %INSTALL_PREFIX%/%LIBDIR%/ardour2/ardour-%VERSION% "$@"

View File

@ -788,6 +788,7 @@ ARDOUR_UI::setup_clock ()
big_clock_window = new Window (WINDOW_TOPLEVEL);
big_clock_window->set_keep_above (true);
big_clock_window->set_border_width (0);
big_clock_window->add (big_clock);

View File

@ -6,4 +6,4 @@ if [ gprofhelper.c -nt gprofhelper.so ] ; then
fi
. ardev_common.sh
LDPRELOAD=./gprofhelper.so $EXECUTABLE $*
LDPRELOAD=./gprofhelper.so $EXECUTABLE "$@"

View File

@ -1,4 +1,4 @@
#!/bin/sh
. ardev_common.sh
export ARDOUR_RUNNING_UNDER_VALGRIND=TRUE
exec valgrind --num-callers=50 --tool=memcheck $EXECUTABLE --novst $*
exec valgrind --num-callers=50 --tool=memcheck $EXECUTABLE --novst "$@"

View File

@ -783,10 +783,14 @@ AudioRegionView::create_waves ()
wave_caches.push_back (WaveView::create_cache ());
if (wait_for_data) {
if (audio_region()->source(n)->peaks_ready (bind (mem_fun(*this, &AudioRegionView::peaks_ready_handler), n), data_ready_connection)) {
create_one_wave (n, true);
} else {
// we'll get a PeaksReady signal from the source in the future
// and will call create_one_wave(n) then.
}
} else {
create_one_wave (n, true);
}

View File

@ -19,6 +19,7 @@
#include <sys/types.h>
#include <sys/stat.h>
#include <sys/time.h>
#include <errno.h>
#include <unistd.h>
@ -589,8 +590,6 @@ Editor::add_sources (vector<Glib::ustring> paths, SourceList& sources, nframes64
region_name = region_name_from_path (afs->path(), false, true, sources.size(), n);
cerr << "got region name " << region_name << endl;
regions.push_back (boost::dynamic_pointer_cast<AudioRegion>
(RegionFactory::create (just_one, 0, (*x)->length(), region_name, 0,
Region::Flag (Region::DefaultFlags|Region::WholeFile|Region::External))));
@ -619,7 +618,7 @@ Editor::add_sources (vector<Glib::ustring> paths, SourceList& sources, nframes64
for (vector<boost::shared_ptr<AudioRegion> >::iterator r = regions.begin(); r != regions.end(); ++r, ++n) {
finish_bringing_in_audio (*r, input_chan, output_chan, pos, mode, track);
if (target_tracks != 1) {
track.reset ();
} else {
@ -627,6 +626,12 @@ Editor::add_sources (vector<Glib::ustring> paths, SourceList& sources, nframes64
}
}
/* setup peak file building in another thread */
for (SourceList::iterator x = sources.begin(); x != sources.end(); ++x) {
SourceFactory::setup_peakfile (*x, true);
}
return 0;
}
@ -634,7 +639,6 @@ int
Editor::finish_bringing_in_audio (boost::shared_ptr<AudioRegion> region, uint32_t in_chans, uint32_t out_chans, nframes64_t& pos,
ImportMode mode, boost::shared_ptr<AudioTrack>& existing_track)
{
switch (mode) {
case ImportAsRegion:
/* relax, its been done */

View File

@ -511,7 +511,7 @@ NewSessionDialog::session_folder() const
} else {
if (m_treeview->get_selection()->count_selected_rows() == 0) {
return Glib::filename_from_utf8(m_open_filechooser->get_current_folder());
return Glib::filename_from_utf8(m_open_filechooser->get_filename());
}
Gtk::TreeModel::iterator i = m_treeview->get_selection()->get_selected();
return (*i)[recent_columns.fullpath];

View File

@ -55,8 +55,6 @@ class SourceFactory {
static Glib::StaticMutex peak_building_lock;
static std::list<boost::weak_ptr<AudioSource> > files_with_peaks;
private:
static int setup_peakfile (boost::shared_ptr<Source>, bool async);
};

View File

@ -25,6 +25,8 @@
#include <fcntl.h>
#include <errno.h>
#include <pbd/convert.h>
#include <pbd/basename.h>
#include <pbd/mountpoint.h>
#include <pbd/pathscanner.h>
#include <pbd/stl_delete.h>
@ -153,7 +155,15 @@ AudioFileSource::init (ustring pathstr, bool must_exist)
ustring
AudioFileSource::peak_path (ustring audio_path)
{
return _session.peak_path_from_audio_path (audio_path);
ustring res;
res = _session.peak_dir ();
res += PBD::basename_nosuffix (audio_path);
res += '%';
res += (char) ('A' + _channel);
res += ".peak";
return res;
}
ustring

View File

@ -30,6 +30,8 @@
#include <algorithm>
#include <vector>
#include <glibmm/fileutils.h>
#include <pbd/xml++.h>
#include <pbd/pthread_utils.h>
@ -136,7 +138,7 @@ AudioSource::peaks_ready (sigc::slot<void> the_slot, sigc::connection& conn) con
if (!(ret = _peaks_built)) {
conn = PeaksReady.connect (the_slot);
}
return ret;
}
@ -187,7 +189,7 @@ AudioSource::initialize_peakfile (bool newfile, ustring audio_path)
used libsndfile for all audio files.
*/
if (!newfile && access (peakpath.c_str(), R_OK) != 0) {
if (!newfile && !Glib::file_test (peakpath.c_str(), Glib::FILE_TEST_EXISTS)) {
ustring str = old_peak_path (audio_path);
if (access (str.c_str(), R_OK) == 0) {
peakpath = str;

View File

@ -27,6 +27,7 @@
#include <cerrno>
#include <unistd.h>
#include <limits.h>
#include <sys/time.h>
#include <sigc++/bind.h>
#include <sigc++/retype.h>
@ -1736,7 +1737,7 @@ Session::new_audio_track (int input_channels, int output_channels, TrackMode mod
<< endmsg;
goto failed;
}
if (nphysical_in) {
for (uint32_t x = 0; x < track->n_inputs() && x < nphysical_in; ++x) {
@ -1779,6 +1780,7 @@ Session::new_audio_track (int input_channels, int output_channels, TrackMode mod
new_routes.push_back (track);
ret.push_back (track);
}
catch (failed_constructor &err) {

View File

@ -53,9 +53,11 @@ peak_thread_work ()
while (true) {
SourceFactory::peak_building_lock.lock ();
wait:
SourceFactory::PeaksToBuild->wait (SourceFactory::peak_building_lock);
if (SourceFactory::files_with_peaks.empty()) {
SourceFactory::PeaksToBuild->wait (SourceFactory::peak_building_lock);
}
if (SourceFactory::files_with_peaks.empty()) {
goto wait;
@ -94,7 +96,7 @@ SourceFactory::setup_peakfile (boost::shared_ptr<Source> s, bool async)
Glib::Mutex::Lock lm (peak_building_lock);
files_with_peaks.push_back (boost::weak_ptr<AudioSource> (as));
PeaksToBuild->signal ();
PeaksToBuild->broadcast ();
} else {
@ -118,12 +120,14 @@ SourceFactory::createSilent (Session& s, const XMLNode& node, nframes_t nframes,
#ifdef HAVE_COREAUDIO
boost::shared_ptr<Source>
SourceFactory::create (Session& s, const XMLNode& node, bool async)
SourceFactory::create (Session& s, const XMLNode& node, bool defer_peaks)
{
try {
boost::shared_ptr<Source> ret (new CoreAudioSource (s, node));
if (setup_peakfile (ret)) {
return boost::shared_ptr<Source>();
if (!defer_peaks) {
if (setup_peakfile (ret, false)) {
return boost::shared_ptr<Source>();
}
}
SourceCreated (ret);
return ret;
@ -135,8 +139,10 @@ SourceFactory::create (Session& s, const XMLNode& node, bool async)
/* this is allowed to throw */
boost::shared_ptr<Source> ret (new SndFileSource (s, node));
if (setup_peakfile (ret, async)) {
return boost::shared_ptr<Source>();
if (!defer_peaks) {
if (setup_peakfile (ret, false)) {
return boost::shared_ptr<Source>();
}
}
SourceCreated (ret);
return ret;
@ -148,14 +154,16 @@ SourceFactory::create (Session& s, const XMLNode& node, bool async)
#else
boost::shared_ptr<Source>
SourceFactory::create (Session& s, const XMLNode& node, bool async)
SourceFactory::create (Session& s, const XMLNode& node, bool defer_peaks)
{
/* this is allowed to throw */
boost::shared_ptr<Source> ret (new SndFileSource (s, node));
if (setup_peakfile (ret, async)) {
return boost::shared_ptr<Source>();
if (!defer_peaks) {
if (setup_peakfile (ret, false)) {
return boost::shared_ptr<Source>();
}
}
SourceCreated (ret);
@ -166,14 +174,16 @@ SourceFactory::create (Session& s, const XMLNode& node, bool async)
#ifdef HAVE_COREAUDIO
boost::shared_ptr<Source>
SourceFactory::createReadable (Session& s, string path, int chn, AudioFileSource::Flag flags, bool announce, bool async)
SourceFactory::createReadable (Session& s, string path, int chn, AudioFileSource::Flag flags, bool announce, bool defer_peaks)
{
if (!(flags & Destructive)) {
try {
boost::shared_ptr<Source> ret (new CoreAudioSource (s, path, chn, flags));
if (setup_peakfile (ret, async)) {
return boost::shared_ptr<Source>();
if (!defer_peaks) {
if (setup_peakfile (ret, false)) {
return boost::shared_ptr<Source>();
}
}
if (announce) {
SourceCreated (ret);
@ -186,8 +196,10 @@ SourceFactory::createReadable (Session& s, string path, int chn, AudioFileSource
/* this is allowed to throw */
boost::shared_ptr<Source> ret (new SndFileSource (s, path, chn, flags));
if (setup_peakfile (ret)) {
return boost::shared_ptr<Source>();
if (!defer_peaks) {
if (setup_peakfile (ret, false)) {
return boost::shared_ptr<Source>();
}
}
if (announce) {
SourceCreated (ret);
@ -198,8 +210,10 @@ SourceFactory::createReadable (Session& s, string path, int chn, AudioFileSource
} else {
boost::shared_ptr<Source> ret (new SndFileSource (s, path, chn, flags));
if (setup_peakfile (ret, async)) {
return boost::shared_ptr<Source>();
if (!defer_peaks) {
if (setup_peakfile (ret, false)) {
return boost::shared_ptr<Source>();
}
}
if (announce) {
SourceCreated (ret);
@ -213,12 +227,14 @@ SourceFactory::createReadable (Session& s, string path, int chn, AudioFileSource
#else
boost::shared_ptr<Source>
SourceFactory::createReadable (Session& s, string path, int chn, AudioFileSource::Flag flags, bool announce, bool async)
SourceFactory::createReadable (Session& s, string path, int chn, AudioFileSource::Flag flags, bool announce, bool defer_peaks)
{
boost::shared_ptr<Source> ret (new SndFileSource (s, path, chn, flags));
if (setup_peakfile (ret, async)) {
return boost::shared_ptr<Source>();
if (!defer_peaks) {
if (setup_peakfile (ret, false)) {
return boost::shared_ptr<Source>();
}
}
if (announce) {
@ -231,7 +247,7 @@ SourceFactory::createReadable (Session& s, string path, int chn, AudioFileSource
#endif // HAVE_COREAUDIO
boost::shared_ptr<Source>
SourceFactory::createWritable (Session& s, std::string path, bool destructive, nframes_t rate, bool announce, bool async)
SourceFactory::createWritable (Session& s, std::string path, bool destructive, nframes_t rate, bool announce, bool defer_peaks)
{
/* this might throw failed_constructor(), which is OK */
@ -243,9 +259,12 @@ SourceFactory::createWritable (Session& s, std::string path, bool destructive, n
(destructive ? AudioFileSource::Flag (SndFileSource::default_writable_flags | AudioFileSource::Destructive) :
SndFileSource::default_writable_flags)));
if (setup_peakfile (ret, async)) {
return boost::shared_ptr<Source>();
if (!defer_peaks) {
if (setup_peakfile (ret, false)) {
return boost::shared_ptr<Source>();
}
}
if (announce) {
SourceCreated (ret);
}