summaryrefslogtreecommitdiff
path: root/libs/ardour/session_butler.cc
diff options
context:
space:
mode:
authorDavid Robillard <d@drobilla.net>2006-08-01 03:23:35 +0000
committerDavid Robillard <d@drobilla.net>2006-08-01 03:23:35 +0000
commit6f4a92f740b2fd75794489ce58f9348f8adf6bf4 (patch)
tree68ecd4d29bf7d1db00da9dfa9e14ac2e93ca1e42 /libs/ardour/session_butler.cc
parentba0c8bc2ef92a84b99040df46e76d8ac54d3d9da (diff)
Heavy-duty abstraction work to split type-specific classes into
specializations of (new, for the most part) generic bases. (eg. most everything from the MIDI branch except for actual MIDI things, so merges have a chance of succeeding). Also the new edit toolbar, and various other cleanup things I did along the way. Should be functionally equivalent (except the toolbar), this is just design work. She's a big'un.... git-svn-id: svn://localhost/ardour2/trunk@727 d708f5d6-7413-0410-9779-e7cbd77b26cf
Diffstat (limited to 'libs/ardour/session_butler.cc')
-rw-r--r--libs/ardour/session_butler.cc51
1 files changed, 21 insertions, 30 deletions
diff --git a/libs/ardour/session_butler.cc b/libs/ardour/session_butler.cc
index 4613bfccf9..6509a783bb 100644
--- a/libs/ardour/session_butler.cc
+++ b/libs/ardour/session_butler.cc
@@ -168,15 +168,9 @@ Session::butler_thread_work ()
struct timeval begin, end;
struct pollfd pfd[1];
bool disk_work_outstanding = false;
- AudioDiskstreamList::iterator i;
-
- butler_mixdown_buffer = new Sample[AudioDiskstream::disk_io_frames()];
- butler_gain_buffer = new gain_t[AudioDiskstream::disk_io_frames()];
- // this buffer is used for temp conversion purposes in filesources
- char * conv_buffer = conversion_buffer(ButlerContext);
+ DiskstreamList::iterator i;
while (true) {
-
pfd[0].fd = butler_request_pipe[0];
pfd[0].events = POLLIN|POLLERR|POLLHUP;
@@ -198,14 +192,13 @@ Session::butler_thread_work ()
}
if (pfd[0].revents & POLLIN) {
-
+
char req;
/* empty the pipe of all current requests */
while (1) {
size_t nread = ::read (butler_request_pipe[0], &req, sizeof (req));
-
if (nread == 1) {
switch ((ButlerRequest::Type) req) {
@@ -240,10 +233,10 @@ Session::butler_thread_work ()
}
}
}
-
- for (i = audio_diskstreams.begin(); i != audio_diskstreams.end(); ++i) {
+
+ //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 ();
@@ -257,16 +250,16 @@ Session::butler_thread_work ()
Glib::RWLock::ReaderLock dsm (diskstream_lock);
- for (i = audio_diskstreams.begin(); !transport_work_requested() && butler_should_run && i != audio_diskstreams.end(); ++i) {
-
- // cerr << "rah fondr " << (*i)->io()->name () << endl;
+ for (i = diskstreams.begin(); !transport_work_requested() && butler_should_run && i != diskstreams.end(); ++i) {
+
+ Diskstream* const ds = *i;
- switch ((*i)->do_refill (butler_mixdown_buffer, butler_gain_buffer, conv_buffer)) {
+ switch (ds->do_refill ()) {
case 0:
- bytes += (*i)->read_data_count();
+ bytes += ds->read_data_count();
break;
case 1:
- bytes += (*i)->read_data_count();
+ bytes += ds->read_data_count();
disk_work_outstanding = true;
break;
@@ -278,7 +271,7 @@ Session::butler_thread_work ()
}
- if (i != audio_diskstreams.end()) {
+ if (i != diskstreams.end()) {
/* we didn't get to all the streams */
disk_work_outstanding = true;
}
@@ -299,12 +292,11 @@ Session::butler_thread_work ()
bytes = 0;
compute_io = true;
gettimeofday (&begin, 0);
-
- for (i = audio_diskstreams.begin(); !transport_work_requested() && butler_should_run && i != audio_diskstreams.end(); ++i) {
-
+
+ for (i = diskstreams.begin(); !transport_work_requested() && butler_should_run && i != diskstreams.end(); ++i) {
// cerr << "write behind for " << (*i)->name () << endl;
- switch ((*i)->do_flush (conv_buffer)) {
+ switch ((*i)->do_flush (Session::ButlerContext)) {
case 0:
bytes += (*i)->write_data_count();
break;
@@ -330,7 +322,7 @@ Session::butler_thread_work ()
request_stop ();
}
- if (i != audio_diskstreams.end()) {
+ if (i != diskstreams.end()) {
/* we didn't get to all the streams */
disk_work_outstanding = true;
}
@@ -357,7 +349,7 @@ Session::butler_thread_work ()
Glib::Mutex::Lock lm (butler_request_lock);
if (butler_should_run && (disk_work_outstanding || transport_work_requested())) {
-// for (AudioDiskstreamList::iterator i = audio_diskstreams.begin(); i != audio_diskstreams.end(); ++i) {
+// for (DiskstreamList::iterator i = diskstreams.begin(); i != diskstreams.end(); ++i) {
// cerr << "AFTER " << (*i)->name() << ": pb = " << (*i)->playback_buffer_load() << " cp = " << (*i)->capture_buffer_load() << endl;
// }
@@ -375,18 +367,17 @@ Session::butler_thread_work ()
void
-Session::request_overwrite_buffer (AudioDiskstream* stream)
+Session::request_overwrite_buffer (Diskstream* stream)
{
Event *ev = new Event (Event::Overwrite, Event::Add, Event::Immediate, 0, 0, 0.0);
ev->set_ptr (stream);
queue_event (ev);
}
+/** Process thread. */
void
-Session::overwrite_some_buffers (AudioDiskstream* ds)
+Session::overwrite_some_buffers (Diskstream* ds)
{
- /* executed by the audio thread */
-
if (actively_recording()) {
return;
}
@@ -398,7 +389,7 @@ Session::overwrite_some_buffers (AudioDiskstream* ds)
} else {
Glib::RWLock::ReaderLock dm (diskstream_lock);
- for (AudioDiskstreamList::iterator i = audio_diskstreams.begin(); i != audio_diskstreams.end(); ++i) {
+ for (DiskstreamList::iterator i = diskstreams.begin(); i != diskstreams.end(); ++i) {
(*i)->set_pending_overwrite (true);
}
}