Mixer: Share (reuse) buffers between all chains.
This commit is contained in:
parent
20530efd3d
commit
0d20f9da81
|
@ -73,6 +73,13 @@
|
||||||
|
|
||||||
#include <dsp.h>
|
#include <dsp.h>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
std::vector <Module::Port> Chain::port;
|
||||||
|
std::list <Chain*> Chain::chain;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
Chain::Chain ( int X, int Y, int W, int H, const char *L ) :
|
Chain::Chain ( int X, int Y, int W, int H, const char *L ) :
|
||||||
Fl_Group( X, Y, W, H, L)
|
Fl_Group( X, Y, W, H, L)
|
||||||
{
|
{
|
||||||
|
@ -118,6 +125,13 @@ Chain::Chain ( int X, int Y, int W, int H, const char *L ) :
|
||||||
}
|
}
|
||||||
|
|
||||||
end();
|
end();
|
||||||
|
|
||||||
|
chain.push_back( this );
|
||||||
|
}
|
||||||
|
|
||||||
|
Chain::~Chain ( )
|
||||||
|
{
|
||||||
|
chain.remove( this );
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Fill this chain with JACK I/O, Gain, and Meter modules. */
|
/* Fill this chain with JACK I/O, Gain, and Meter modules. */
|
||||||
|
@ -213,7 +227,7 @@ Chain::configure_ports ( void )
|
||||||
|
|
||||||
DMESSAGE( "required_buffers = %i", req_buffers );
|
DMESSAGE( "required_buffers = %i", req_buffers );
|
||||||
|
|
||||||
if ( port.size() != req_buffers )
|
if ( port.size() < req_buffers )
|
||||||
{
|
{
|
||||||
for ( unsigned int i = port.size(); i--; )
|
for ( unsigned int i = port.size(); i--; )
|
||||||
delete[] (sample_t*)port[i].buffer();
|
delete[] (sample_t*)port[i].buffer();
|
||||||
|
@ -230,6 +244,15 @@ Chain::configure_ports ( void )
|
||||||
|
|
||||||
build_process_queue();
|
build_process_queue();
|
||||||
|
|
||||||
|
/* let the other chains know we mess with their buffers */
|
||||||
|
for ( std::list<Chain*>::iterator i = chain.begin();
|
||||||
|
i != chain.end();
|
||||||
|
++i )
|
||||||
|
{
|
||||||
|
if ( *i != this )
|
||||||
|
(*i)->build_process_queue();
|
||||||
|
}
|
||||||
|
|
||||||
engine->unlock();
|
engine->unlock();
|
||||||
|
|
||||||
parent()->redraw();
|
parent()->redraw();
|
||||||
|
|
|
@ -56,9 +56,11 @@ class Chain : public Fl_Group {
|
||||||
void build_process_queue ( void );
|
void build_process_queue ( void );
|
||||||
void add_to_process_queue ( Module *m );
|
void add_to_process_queue ( Module *m );
|
||||||
|
|
||||||
|
static std::vector <Module::Port> port;
|
||||||
|
static std::list <Chain*> chain;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
|
|
||||||
std::vector <Module::Port> port;
|
|
||||||
|
|
||||||
const char *name ( void ) const { return _name; }
|
const char *name ( void ) const { return _name; }
|
||||||
void name ( const char *name );
|
void name ( const char *name );
|
||||||
|
@ -67,6 +69,7 @@ public:
|
||||||
int required_buffers ( void );
|
int required_buffers ( void );
|
||||||
|
|
||||||
Chain ( int X, int Y, int W, int H, const char *L = 0 );
|
Chain ( int X, int Y, int W, int H, const char *L = 0 );
|
||||||
|
virtual ~Chain ( );
|
||||||
|
|
||||||
bool can_support_input_channels ( int n );
|
bool can_support_input_channels ( int n );
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue