@@ -867,14 +867,12 @@ Audio_Region::finalize ( nframes_t frame ) | |||||
{ | { | ||||
log_end(); | log_end(); | ||||
_clip->finalize(); | |||||
_clip->close(); | _clip->close(); | ||||
_clip->open(); | _clip->open(); | ||||
/* FIXME: should we attempt to truncate the file? */ | /* FIXME: should we attempt to truncate the file? */ | ||||
_range.length = frame - _range.start - _range.offset; | |||||
_range.length = frame - _range.start; | |||||
redraw(); | redraw(); | ||||
@@ -568,11 +568,10 @@ Peaks::prepare_for_writing ( void ) | |||||
void | void | ||||
Peaks::finish_writing ( void ) | Peaks::finish_writing ( void ) | ||||
{ | { | ||||
if ( _peak_writer ) | |||||
{ | |||||
delete _peak_writer; | |||||
_peak_writer = NULL; | |||||
} | |||||
assert( _peak_writer ); | |||||
delete _peak_writer; | |||||
_peak_writer = NULL; | |||||
/* now fill in the rest of the cache */ | /* now fill in the rest of the cache */ | ||||
make_peaks_mipmap(); | make_peaks_mipmap(); | ||||
@@ -769,12 +769,14 @@ uuid ( void ) | |||||
void | void | ||||
Track::record ( nframes_t frame ) | Track::record ( nframes_t frame ) | ||||
{ | { | ||||
assert( _capture == NULL ); | |||||
assert( ! _capture ); | |||||
assert( ! _capture_af ); | |||||
char pat[256]; | char pat[256]; | ||||
snprintf( pat, sizeof( pat ), "%s-%llu", name(), uuid() ); | snprintf( pat, sizeof( pat ), "%s-%llu", name(), uuid() ); | ||||
_capture_af = Audio_File_SF::create( pat, engine->sample_rate(), input.size(), Track::capture_format ); | _capture_af = Audio_File_SF::create( pat, engine->sample_rate(), input.size(), Track::capture_format ); | ||||
if ( ! _capture_af ) | if ( ! _capture_af ) | ||||
@@ -810,4 +812,9 @@ Track::stop ( nframes_t frame ) | |||||
_capture->finalize( frame ); | _capture->finalize( frame ); | ||||
_capture = NULL; | _capture = NULL; | ||||
_capture_af->finalize(); | |||||
delete _capture_af; | |||||
_capture_af = NULL; | |||||
} | } |