2 Copyright (C) 1999-2002 Paul Davis
4 This program is free software; you can redistribute it and/or modify
5 it under the terms of the GNU General Public License as published by
6 the Free Software Foundation; either version 2 of the License, or
7 (at your option) any later version.
9 This program is distributed in the hope that it will be useful,
10 but WITHOUT ANY WARRANTY; without even the implied warranty of
11 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 GNU General Public License for more details.
14 You should have received a copy of the GNU General Public License
15 along with this program; if not, write to the Free Software
16 Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
28 #include <glibmm/thread.h>
30 #include "pbd/error.h"
31 #include "pbd/pthread_utils.h"
32 #include "pbd/stacktrace.h"
34 #include "ardour/audio_diskstream.h"
35 #include "ardour/audioengine.h"
36 #include "ardour/butler.h"
37 #include "ardour/configuration.h"
38 #include "ardour/crossfade.h"
39 #include "ardour/io.h"
40 #include "ardour/midi_diskstream.h"
41 #include "ardour/session.h"
42 #include "ardour/timestamps.h"
47 using namespace ARDOUR;
50 /* XXX put this in the right place */
52 static inline uint32_t next_power_of_two (uint32_t n)
64 /*---------------------------------------------------------------------------
66 ---------------------------------------------------------------------------*/
69 Session::schedule_curve_reallocation ()
71 add_post_transport_work (PostTransportCurveRealloc);
72 _butler->schedule_transport_work ();
76 Session::request_overwrite_buffer (Diskstream* stream)
78 SessionEvent *ev = new SessionEvent (SessionEvent::Overwrite, SessionEvent::Add, SessionEvent::Immediate, 0, 0, 0.0);
83 /** Process thread. */
85 Session::overwrite_some_buffers (Diskstream* ds)
87 if (actively_recording()) {
93 ds->set_pending_overwrite (true);
97 boost::shared_ptr<DiskstreamList> dsl = diskstreams.reader();
98 for (DiskstreamList::iterator i = dsl->begin(); i != dsl->end(); ++i) {
99 (*i)->set_pending_overwrite (true);
103 add_post_transport_work (PostTransportOverWrite);
104 _butler->schedule_transport_work ();
108 Session::playback_load ()
110 return (uint32_t) g_atomic_int_get (&_playback_load);
114 Session::capture_load ()
116 return (uint32_t) g_atomic_int_get (&_capture_load);
120 Session::playback_load_min ()
122 return (uint32_t) g_atomic_int_get (&_playback_load_min);
126 Session::capture_load_min ()
128 return (uint32_t) g_atomic_int_get (&_capture_load_min);
132 Session::reset_capture_load_min ()
134 g_atomic_int_set (&_capture_load_min, 100);
138 Session::reset_playback_load_min ()
140 g_atomic_int_set (&_playback_load_min, 100);