Minor cleanup.

This commit is contained in:
Jonathan Moore Liles 2008-04-13 23:11:48 -05:00
parent f78ea62e70
commit eab284dddb
3 changed files with 11 additions and 6 deletions

View File

@ -123,6 +123,8 @@ Audio_Track::play ( sample_t *buf, nframes_t frame, nframes_t nframes, int chann
{
sample_t *cbuf = new sample_t[ nframes ];
memset( cbuf, 0, nframes * sizeof( sample_t ) );
/* quick and dirty--let the regions figure out coverage for themselves */
for ( list <Track_Widget *>::const_iterator i = _widgets.begin();
i != _widgets.end(); i++ )
@ -131,23 +133,23 @@ Audio_Track::play ( sample_t *buf, nframes_t frame, nframes_t nframes, int chann
for ( int i = channels; i--; )
{
// memset( cbuf, 0, nframes * sizeof( sample_t ) );
int nfr;
if ( ! r->read( cbuf, frame, nframes, i ) )
if ( ! ( nfr = r->read( cbuf, frame, nframes, i ) ) )
/* error ? */
continue;
if ( channels == 1 )
{
// memcpy( buf, cbuf, nframes * sizeof( sample_t ) );
for ( unsigned int j = 0; j < nframes; ++j )
for ( unsigned int j = 0; j < nfr; ++j )
buf[ j ] += cbuf[ j ];
}
else
{
/* mix and interleave */
int k = 0;
for ( unsigned int j = i; k < nframes; j += channels )
for ( unsigned int j = i; k < nfr; j += channels )
buf[ j ] += cbuf[ k++ ];
}
}

View File

@ -40,7 +40,7 @@
/* FIXME: needs error handling everywhere! */
/* TODO: handle capture too */
float Disk_Stream::seconds_to_buffer = 1.0f;
float Disk_Stream::seconds_to_buffer = 5.0f;
// size_t Disk_Stream::disk_block_frames = 2048;
Disk_Stream::Disk_Stream ( Track_Header *th, float frame_rate, nframes_t nframes, int channels ) : _th( th )

View File

@ -78,7 +78,10 @@ Engine::sync ( jack_transport_state_t state, jack_position_t *pos )
seeking = true;
}
int r = timeline->seek_pending();
int r = true;
if ( timeline )
r = timeline->seek_pending();
if ( ! r )
seeking = false;