diff --git a/Timeline/Audio_Track.C b/Timeline/Audio_Track.C index 8af936f..0904d33 100644 --- a/Timeline/Audio_Track.C +++ b/Timeline/Audio_Track.C @@ -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 ::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++ ]; } } diff --git a/Timeline/Disk_Stream.C b/Timeline/Disk_Stream.C index f21b2e9..167c758 100644 --- a/Timeline/Disk_Stream.C +++ b/Timeline/Disk_Stream.C @@ -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 ) diff --git a/Timeline/Engine.C b/Timeline/Engine.C index 5e0f035..09bd348 100644 --- a/Timeline/Engine.C +++ b/Timeline/Engine.C @@ -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;