Move region writing code into region class.

This commit is contained in:
Jonathan Moore Liles 2008-04-17 22:44:19 -05:00
parent e7c2ac9ecd
commit 24fe463579
3 changed files with 23 additions and 6 deletions

View File

@ -913,3 +913,21 @@ Region::read ( sample_t *buf, nframes_t pos, nframes_t nframes, int channel ) co
return cnt; 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;
}

View File

@ -271,7 +271,9 @@ public:
void normalize ( void ); void normalize ( void );
/* Engine */
nframes_t read ( sample_t *buf, nframes_t pos, nframes_t nframes, int channel ) const; 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 #endif

View File

@ -344,14 +344,14 @@ Track_Header::seek ( nframes_t frame )
/* THREAD: IO */ /* THREAD: IO */
/** create capture region and prepare to record */ /** create capture region and prepare to record */
void void
Track_Header::record ( nframes_t nframes ) Track_Header::record ( nframes_t frame )
{ {
assert( _capture == NULL ); assert( _capture == NULL );
/* FIXME: hack */ /* FIXME: hack */
Audio_File *af = Audio_File_SF::create( "testing.wav", 48000, input.size(), "Wav/24" ); 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 */ /* FIXME: wrong place for this */
_capture->_r->end = 0; _capture->_r->end = 0;
@ -362,10 +362,7 @@ Track_Header::record ( nframes_t nframes )
void void
Track_Header::write ( sample_t *buf, nframes_t nframes ) Track_Header::write ( sample_t *buf, nframes_t nframes )
{ {
_capture->_r->end +=_capture->_clip->write( buf, nframes ); _capture->write( buf, nframes );
/* FIXME: too much? */
_capture->redraw();
} }
/* THREAD: IO */ /* THREAD: IO */