Browse Source

Move region writing code into region class.

tags/non-daw-v1.1.0
Jonathan Moore Liles 17 years ago
parent
commit
24fe463579
3 changed files with 23 additions and 6 deletions
  1. +18
    -0
      Timeline/Region.C
  2. +2
    -0
      Timeline/Region.H
  3. +3
    -6
      Timeline/Track_Header.C

+ 18
- 0
Timeline/Region.C 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;
}

+ 2
- 0
Timeline/Region.H 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

+ 3
- 6
Timeline/Track_Header.C 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 );

/* FIXME: too much? */
_capture->redraw();
_capture->write( buf, nframes );
} }


/* THREAD: IO */ /* THREAD: IO */


Loading…
Cancel
Save