Timeline: Defer creation of audio file for recording until blocks are ready to be written.

This prevents unnecessary file creation in punch mode.
This commit is contained in:
Jonathan Moore Liles 2013-10-05 20:58:41 -07:00
parent 45a33b8467
commit 7770610d32
1 changed files with 7 additions and 3 deletions

View File

@ -60,6 +60,11 @@ Record_DS::write_block ( sample_t *buf, nframes_t nframes )
if ( ! ( timeline && sequence() ) ) if ( ! ( timeline && sequence() ) )
return; return;
if ( ! _capture->audio_file )
/* create the file */
track()->record( _capture, _frame );
track()->write( _capture, buf, nframes ); track()->write( _capture, buf, nframes );
_frames_written += nframes; _frames_written += nframes;
@ -72,8 +77,6 @@ Record_DS::disk_thread ( void )
DMESSAGE( "capture thread running..." ); DMESSAGE( "capture thread running..." );
track()->record( _capture, _frame );
const nframes_t nframes = _nframes; const nframes_t nframes = _nframes;
/* buffer to hold the interleaved data returned by the track reader */ /* buffer to hold the interleaved data returned by the track reader */
@ -148,6 +151,7 @@ Record_DS::disk_thread ( void )
/* now finalize the recording */ /* now finalize the recording */
if ( c->audio_file )
track()->finalize( c, _stop_frame ); track()->finalize( c, _stop_frame );
delete c; delete c;