Timeline: Don't die if punch-in frame is before first block of recorded audio.
This commit is contained in:
parent
60059f4005
commit
0047df03fe
|
@ -99,8 +99,8 @@ Record_DS::disk_thread ( void )
|
|||
bool punching_out = false;
|
||||
bool punched_in = false;
|
||||
|
||||
nframes_t bS = 0;
|
||||
nframes_t bE = 0;
|
||||
nframes_t bS = 0; /* block start */
|
||||
nframes_t bE = 0; /* block end */
|
||||
|
||||
again:
|
||||
|
||||
|
@ -109,8 +109,8 @@ again:
|
|||
punched_in = false;
|
||||
punching_out = false;
|
||||
|
||||
nframes_t pS = _frame;
|
||||
nframes_t pE = _stop_frame;
|
||||
nframes_t pS = _frame; /* punch start */
|
||||
nframes_t pE = _stop_frame; /* punch end */
|
||||
|
||||
if ( punching_in )
|
||||
{
|
||||
|
@ -148,6 +148,22 @@ again:
|
|||
|
||||
bE = _first_frame + frames_read;
|
||||
|
||||
if ( ! punched_in && bS > pS )
|
||||
{
|
||||
/* we're supposed to be punching in but don't have data
|
||||
until a later frame... write null data instead. FIXME:
|
||||
it would probably be better to just have the record
|
||||
threads running all the time so that there would always
|
||||
have some actual data to write here */
|
||||
sample_t nbuf[bS - pS];
|
||||
memset(nbuf,0,bS - pS);
|
||||
write_block(nbuf, pS - pS);
|
||||
write_block(buf,frames_to_read);
|
||||
punched_in = true;
|
||||
punching_in = false;
|
||||
}
|
||||
else
|
||||
{
|
||||
punching_in = ! punched_in && bE > pS;
|
||||
punching_out = punched_in && pE < bE;
|
||||
|
||||
|
@ -158,9 +174,11 @@ again:
|
|||
|
||||
break;
|
||||
}
|
||||
else
|
||||
if ( punching_in )
|
||||
else if ( punching_in )
|
||||
{
|
||||
assert( pS >= bS );
|
||||
assert( bE >= pS );
|
||||
|
||||
write_block( buf + ((pS - bS) * channels()),
|
||||
bE - pS );
|
||||
|
||||
|
@ -172,6 +190,7 @@ again:
|
|||
write_block( buf, bE - bS );
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// DMESSAGE( "capture thread terminating" );
|
||||
|
||||
|
|
Loading…
Reference in New Issue