diff --git a/Timeline/Region.C b/Timeline/Region.C index 068ede8..55d76ba 100644 --- a/Timeline/Region.C +++ b/Timeline/Region.C @@ -913,3 +913,21 @@ Region::read ( sample_t *buf, nframes_t pos, nframes_t nframes, int channel ) co return cnt; } + + +/* THREAD: IO */ +/** write /nframes/ from /buf/ to source. /buf/ is interleaved and + must match the channel layout of the write source! */ +nframes_t +Region::write ( sample_t *buf, nframes_t nframes ) +{ + nframes_t l = _clip->write( buf, nframes ); + + _range.end += l; + + /* FIXME: too much? */ +// _track->damage( FL_DAMAGE_EXPOSE, x() + w(), y(), 10/* FIXME: guess */, h() ); + redraw(); + + return l; +} diff --git a/Timeline/Region.H b/Timeline/Region.H index 64b5a76..d8a9418 100644 --- a/Timeline/Region.H +++ b/Timeline/Region.H @@ -271,7 +271,9 @@ public: void normalize ( void ); + /* Engine */ nframes_t read ( sample_t *buf, nframes_t pos, nframes_t nframes, int channel ) const; + nframes_t write ( sample_t *buf, nframes_t nframes ); }; #endif diff --git a/Timeline/Track_Header.C b/Timeline/Track_Header.C index 2ac476e..85532bd 100644 --- a/Timeline/Track_Header.C +++ b/Timeline/Track_Header.C @@ -344,14 +344,14 @@ Track_Header::seek ( nframes_t frame ) /* THREAD: IO */ /** create capture region and prepare to record */ void -Track_Header::record ( nframes_t nframes ) +Track_Header::record ( nframes_t frame ) { assert( _capture == NULL ); /* FIXME: hack */ Audio_File *af = Audio_File_SF::create( "testing.wav", 48000, input.size(), "Wav/24" ); - _capture = new Region( af, track(), nframes ); + _capture = new Region( af, track(), frame ); /* FIXME: wrong place for this */ _capture->_r->end = 0; @@ -362,10 +362,7 @@ Track_Header::record ( nframes_t nframes ) void Track_Header::write ( sample_t *buf, nframes_t nframes ) { - _capture->_r->end +=_capture->_clip->write( buf, nframes ); - - /* FIXME: too much? */ - _capture->redraw(); + _capture->write( buf, nframes ); } /* THREAD: IO */