Browse Source

Restart diskstreams when track I/O is reconfigured.

tags/non-daw-v1.1.0
Jonathan Moore Liles 17 years ago
parent
commit
8a0da04a4b
4 changed files with 42 additions and 3 deletions
  1. +7
    -1
      Timeline/Disk_Stream.C
  2. +1
    -1
      Timeline/Disk_Stream.H
  3. +4
    -1
      Timeline/Mutex.H
  4. +30
    -0
      Timeline/Track.C

+ 7
- 1
Timeline/Disk_Stream.C View File

@@ -96,7 +96,13 @@ void
Disk_Stream::shutdown ( void )
{
_terminate = true;
pthread_join( _thread, NULL );

/* try to wake the thread so it'll see that it's time to die */
block_processed();

if ( _thread )
pthread_join( _thread, NULL );

_terminate = false;
}



+ 1
- 1
Timeline/Disk_Stream.H View File

@@ -42,7 +42,7 @@ protected:

pthread_t _thread; /* io thread */

Track *_th; /* Track we belong to */
Track *_th; /* Track we belong to */

nframes_t _nframes; /* buffer size */



+ 4
- 1
Timeline/Mutex.H View File

@@ -21,6 +21,8 @@

#include <pthread.h>

const pthread_mutex_t _mutex_initializer = PTHREAD_RECURSIVE_MUTEX_INITIALIZER_NP;

class Mutex
{

@@ -30,7 +32,8 @@ public:

Mutex ( )
{
pthread_mutex_init( &_lock, NULL );
// pthread_mutex_init( &_lock, NULL );
_lock = _mutex_initializer;
}

virtual ~Mutex ( )


+ 30
- 0
Timeline/Track.C View File

@@ -423,6 +423,17 @@ Track::configure_outputs ( int n )
{
int on = output.size();

if ( n == on )
return true;

// engine->lock();

Playback_DS *ds = playback_ds;
playback_ds = NULL;

ds->shutdown();
delete ds;

if ( n > on )
{
for ( int i = on; i < n; ++i )
@@ -444,6 +455,10 @@ Track::configure_outputs ( int n )
}
}


playback_ds = new Playback_DS( this, engine->frame_rate(), engine->nframes(), output.size() );

// engine->unlock();
/* FIXME: bogus */
return true;
}
@@ -453,6 +468,17 @@ Track::configure_inputs ( int n )
{
int on = input.size();

if ( n == on )
return true;

// engine->lock();

Record_DS *ds = record_ds;
record_ds = NULL;

ds->shutdown();
delete ds;

if ( n > on )
{
for ( int i = on; i < n; ++i )
@@ -474,6 +500,10 @@ Track::configure_inputs ( int n )
}
}

record_ds = new Record_DS( this, engine->frame_rate(), engine->nframes(), input.size() );

// engine->unlock();

/* FIXME: bogus */
return true;
}


Loading…
Cancel
Save