示例#1
0
void
Module::insert_menu_cb ( const Fl_Menu_ *m )
{
    if ( ! m->mvalue() || m->mvalue()->flags & FL_SUBMENU_POINTER || m->mvalue()->flags & FL_SUBMENU )
        return;

    void * v = m->mvalue()->user_data();

    if ( v )
    {
        unsigned long id = *((unsigned long *)v);

        Module *mod = NULL;

        switch ( id )
        {
            case 1:
                mod = new JACK_Module();
                break;
            case 2:
                mod = new Gain_Module();
                break;
            case 3:
                mod = new Meter_Module();
                break;
            case 4:
                mod = new Mono_Pan_Module();
                break;
            default:
            {
                Plugin_Module *m = new Plugin_Module();

                m->load( id );

                mod = m;
            }
        }

        if ( mod )
        {
            if ( !strcmp( mod->name(), "JACK" ) )
            {
                DMESSAGE( "Special casing JACK module" );
                JACK_Module *jm = (JACK_Module*)mod;
                jm->chain( chain() );
                jm->configure_inputs( ninputs() );
                jm->configure_outputs( ninputs() );
            }

            if ( ! chain()->insert( this, mod ) )
            {
                fl_alert( "Cannot insert this module at this point in the chain" );
                delete mod;
                return;
            }

            redraw();
        }
    }
}
示例#2
0
文件: Chain.C 项目: imv/non
/* Fill this chain with JACK I/O, Gain, and Meter modules. */
void
Chain::initialize_with_default ( void )
{

    { JACK_Module *m = new JACK_Module();
        m->is_default( true );
        m->chain( this );
        m->configure_outputs( 1 );
        m->initialize();
        add( m );
    }

    { Module *m = new Gain_Module();
        m->is_default( true );
        m->initialize();
        add( m );
    }

    { Module *m = new Meter_Module();
        m->is_default( true );
        add( m );
    }

    { JACK_Module *m = new JACK_Module();
        m->is_default( true );
        m->chain( this );
        m->initialize();
        add( m );
    }
}