| @@ -124,25 +124,31 @@ Audio_Track::play ( sample_t *buf, nframes_t frame, nframes_t nframes, int chann | |||||
| sample_t *cbuf = new sample_t[ nframes ]; | sample_t *cbuf = new sample_t[ nframes ]; | ||||
| /* quick and dirty--let the regions figure out coverage for themselves */ | /* quick and dirty--let the regions figure out coverage for themselves */ | ||||
| for ( list <Track_Widget *>::const_iterator i = _widgets.begin(); i != _widgets.end(); ++i ) | |||||
| for ( list <Track_Widget *>::const_iterator i = _widgets.begin(); | |||||
| i != _widgets.end(); i++ ) | |||||
| { | { | ||||
| const Region *r = (Region*)(*i); | const Region *r = (Region*)(*i); | ||||
| for ( int i = channels; i--; ) | for ( int i = channels; i--; ) | ||||
| { | { | ||||
| memset( cbuf, 0, nframes * sizeof( sample_t ) ); | |||||
| // memset( cbuf, 0, nframes * sizeof( sample_t ) ); | |||||
| if ( ! r->read( cbuf, frame, nframes, i ) ) | if ( ! r->read( cbuf, frame, nframes, i ) ) | ||||
| /* error ? */; | |||||
| /* error ? */ | |||||
| continue; | |||||
| if ( channels == 1 ) | if ( channels == 1 ) | ||||
| memcpy( buf, cbuf, nframes * sizeof( sample_t ) ); | |||||
| { | |||||
| // memcpy( buf, cbuf, nframes * sizeof( sample_t ) ); | |||||
| for ( unsigned int j = 0; j < nframes; ++j ) | |||||
| buf[ j ] += cbuf[ j ]; | |||||
| } | |||||
| else | else | ||||
| { | { | ||||
| /* interleave */ | |||||
| /* mix and interleave */ | |||||
| int k = 0; | int k = 0; | ||||
| for ( unsigned int j = i; k < nframes; j += channels ) | for ( unsigned int j = i; k < nframes; j += channels ) | ||||
| buf[ j ] = cbuf[ k++ ]; | |||||
| buf[ j ] += cbuf[ k++ ]; | |||||
| } | } | ||||
| } | } | ||||
| } | } | ||||
| @@ -174,6 +174,8 @@ void | |||||
| Disk_Stream::read_block ( sample_t *buf, nframes_t nframes ) | Disk_Stream::read_block ( sample_t *buf, nframes_t nframes ) | ||||
| { | { | ||||
| memset( buf, 0, nframes * sizeof( sample_t ) * channels() ); | |||||
| /* stupid chicken/egg */ | /* stupid chicken/egg */ | ||||
| if ( ! timeline ) | if ( ! timeline ) | ||||
| return; | return; | ||||
| @@ -224,7 +226,7 @@ Disk_Stream::io_thread ( void ) | |||||
| { | { | ||||
| // printf( "IO: RT thread is ready for more data...\n" ); | // printf( "IO: RT thread is ready for more data...\n" ); | ||||
| printf( "IO: disk buffer is %3d%% full\r", output_buffer_percent() ); | |||||
| // printf( "IO: disk buffer is %3d%% full\r", output_buffer_percent() ); | |||||
| // lock(); // for seeking | // lock(); // for seeking | ||||
| @@ -105,6 +105,7 @@ Engine::process ( nframes_t nframes ) | |||||
| transport.poll(); | transport.poll(); | ||||
| if ( ! transport.rolling ) | if ( ! transport.rolling ) | ||||
| /* FIXME: fill all ports with silence */ | |||||
| return 0; | return 0; | ||||
| if ( ! trylock() ) | if ( ! trylock() ) | ||||
| @@ -94,15 +94,10 @@ Region::init ( void ) | |||||
| /* copy constructor */ | /* copy constructor */ | ||||
| Region::Region ( const Region & rhs ) | Region::Region ( const Region & rhs ) | ||||
| { | { | ||||
| _r->offset = rhs._r->offset; | |||||
| _track = rhs._track; | |||||
| // _track = NULL; | |||||
| *((Track_Widget*)this) = (Track_Widget &)rhs; | |||||
| _clip = rhs._clip; | _clip = rhs._clip; | ||||
| _r->start = rhs._r->start; | |||||
| _r->end = rhs._r->end; | |||||
| _scale = rhs._scale; | _scale = rhs._scale; | ||||
| _box_color = rhs._box_color; | |||||
| _color = rhs._color; | |||||
| log_create(); | log_create(); | ||||
| } | } | ||||
| @@ -553,7 +548,7 @@ Region::normalize ( void ) | |||||
| nframes_t | nframes_t | ||||
| Region::read ( sample_t *buf, nframes_t pos, nframes_t nframes, int channel ) const | Region::read ( sample_t *buf, nframes_t pos, nframes_t nframes, int channel ) const | ||||
| { | { | ||||
| const Range &r = _range; | |||||
| const Range r = _range; | |||||
| const nframes_t length = r.end - r.start; | const nframes_t length = r.end - r.start; | ||||
| @@ -61,6 +61,9 @@ class Track_Widget : public Loggable | |||||
| static Track_Widget * _original; /* the original of the /pushed/ widget */ | static Track_Widget * _original; /* the original of the /pushed/ widget */ | ||||
| static Track_Widget * _belowmouse; /* the widget below the mouse cursor */ | static Track_Widget * _belowmouse; /* the widget below the mouse cursor */ | ||||
| /* can't have this */ | |||||
| Track_Widget ( const Track_Widget &rhs ); | |||||
| protected: | protected: | ||||
| Track *_track; /* track this region belongs to */ | Track *_track; /* track this region belongs to */ | ||||
| @@ -99,13 +102,27 @@ public: | |||||
| _selection.remove( this ); | _selection.remove( this ); | ||||
| } | } | ||||
| Track_Widget ( const Track_Widget &rhs ) | |||||
| const Track_Widget & | |||||
| operator= ( const Track_Widget &rhs ) | |||||
| { | { | ||||
| *_r = *rhs._r; | |||||
| _track = rhs._track; | |||||
| if ( this == &rhs ) | |||||
| return *this; | |||||
| _r = &_range; | |||||
| _range = rhs._range; | |||||
| _track = rhs._track; | |||||
| _box_color = rhs._box_color; | |||||
| _color = rhs._color; | |||||
| return *this; | |||||
| } | } | ||||
| /* Track_Widget ( const Track_Widget &rhs ) */ | |||||
| /* { */ | |||||
| /* *this = rhs; */ | |||||
| /* } */ | |||||
| virtual Track_Widget *clone ( const Track_Widget *r ) = 0; | virtual Track_Widget *clone ( const Track_Widget *r ) = 0; | ||||
| bool selected ( void ) | bool selected ( void ) | ||||