From 7770610d32408065237537f412d7d89300e787c4 Mon Sep 17 00:00:00 2001 From: Jonathan Moore Liles Date: Sat, 5 Oct 2013 20:58:41 -0700 Subject: [PATCH] Timeline: Defer creation of audio file for recording until blocks are ready to be written. This prevents unnecessary file creation in punch mode. --- timeline/src/Engine/Record_DS.C | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/timeline/src/Engine/Record_DS.C b/timeline/src/Engine/Record_DS.C index 9c26bc7..d429f5f 100644 --- a/timeline/src/Engine/Record_DS.C +++ b/timeline/src/Engine/Record_DS.C @@ -60,6 +60,11 @@ Record_DS::write_block ( sample_t *buf, nframes_t nframes ) if ( ! ( timeline && sequence() ) ) return; + + if ( ! _capture->audio_file ) + /* create the file */ + track()->record( _capture, _frame ); + track()->write( _capture, buf, nframes ); _frames_written += nframes; @@ -72,8 +77,6 @@ Record_DS::disk_thread ( void ) DMESSAGE( "capture thread running..." ); - track()->record( _capture, _frame ); - const nframes_t nframes = _nframes; /* buffer to hold the interleaved data returned by the track reader */ @@ -148,7 +151,8 @@ Record_DS::disk_thread ( void ) /* now finalize the recording */ - track()->finalize( c, _stop_frame ); + if ( c->audio_file ) + track()->finalize( c, _stop_frame ); delete c;