Mipmap peak building actually happens in the UI thread, not the IO thread.

Therefore, it is always necessary to fork when mipmapping peaks after capture.
This commit is contained in:
Jonathan Moore Liles 2008-05-22 18:12:51 -05:00
parent 33c646109f
commit 232d23915a
4 changed files with 6 additions and 16 deletions

View File

@ -209,7 +209,6 @@ Audio_Region::write ( nframes_t nframes )
return nframes; return nframes;
} }
/* THREAD: IO */
/** finalize region capture. Assumes that this *is* a captured region /** finalize region capture. Assumes that this *is* a captured region
and that no other regions refer to the same source */ and that no other regions refer to the same source */
bool bool

View File

@ -135,6 +135,7 @@ Disk_Stream::shutdown ( void )
pthread_join( _thread, NULL ); pthread_join( _thread, NULL );
_thread = 0; _thread = 0;
_terminate = false; _terminate = false;
} }

View File

@ -530,7 +530,6 @@ Peaks::prepare_for_writing ( void )
_peak_writer = new Peaks::Streamer( _clip->name(), _clip->channels(), cache_minimum ); _peak_writer = new Peaks::Streamer( _clip->name(), _clip->channels(), cache_minimum );
} }
/* THREAD: IO */
void void
Peaks::finish_writing ( void ) Peaks::finish_writing ( void )
{ {
@ -539,10 +538,9 @@ Peaks::finish_writing ( void )
delete _peak_writer; delete _peak_writer;
_peak_writer = NULL; _peak_writer = NULL;
/* now fill in the rest of the cache */ /* now fill in the rest of the cache */
make_peaks_mipmap(); if ( ! fork() )
/* if ( ! fork() ) */ exit( make_peaks_mipmap() );
/* exit( make_peaks_mipmap() ); */
} }

View File

@ -145,12 +145,11 @@ Record_DS::disk_thread ( void )
const nframes_t nframes = _nframes; const nframes_t nframes = _nframes;
const size_t block_size = _nframes * sizeof( sample_t ); const size_t block_size = _nframes * sizeof( sample_t );
#ifdef AVOID_UNNECESSARY_COPYING #ifdef AVOID_UNNECESSARY_COPYING
sample_t *cbuf = new sample_t[ nframes ]; sample_t *cbuf = new sample_t[ nframes ];
#endif #endif
while ( blocks_ready-- > 0 || ! sem_trywait( &_blocks ) && errno != EAGAIN ) while ( blocks_ready-- > 0 || ( ! sem_trywait( &_blocks ) && errno != EAGAIN ) )
{ {
for ( int i = channels(); i--; ) for ( int i = channels(); i--; )
@ -182,8 +181,6 @@ Record_DS::disk_thread ( void )
#ifndef AVOID_UNNECESSARY_COPYING #ifndef AVOID_UNNECESSARY_COPYING
delete[] cbuf; delete[] cbuf;
#endif #endif
_thread = NULL;
} }
@ -217,21 +214,16 @@ Record_DS::stop ( nframes_t frame )
{ {
if ( ! _recording ) if ( ! _recording )
{ {
printf( "programming error: attempt to stop recording when no recording is being made\n" ); WARNING( "programming error: attempt to stop recording when no recording is being made\n" );
return; return;
} }
_recording = false; _recording = false;
/* FIXME: we may still have data in the buffers waiting to be
* written to disk... We should flush it out before stopping... */
_stop_frame = frame; _stop_frame = frame;
shutdown(); shutdown();
/* FIXME: flush buffers here? */
track()->stop( frame ); track()->stop( frame );
DMESSAGE( "recording finished" ); DMESSAGE( "recording finished" );