Browse Source

Mixer: Cleanup.

tags/non-daw-v1.1.0
Jonathan Moore Liles 15 years ago
parent
commit
fc31233d70
5 changed files with 23 additions and 49 deletions
  1. +2
    -1
      mixer/src/DPM.C
  2. +0
    -30
      mixer/src/Meter.H
  3. +18
    -13
      mixer/src/Meter_Indicator_Module.C
  4. +1
    -3
      mixer/src/Meter_Indicator_Module.H
  5. +2
    -2
      mixer/src/Module.C

+ 2
- 1
mixer/src/DPM.C View File

@@ -47,7 +47,7 @@ DPM::DPM ( int X, int Y, int W, int H, const char *L ) :


type( FL_VERTICAL ); type( FL_VERTICAL );


resize( X, Y, W, H );
// resize( X, Y, W, H );


dim( 0.70f ); dim( 0.70f );


@@ -113,6 +113,7 @@ DPM::resize ( int X, int Y, int W, int H )
void void
DPM::draw ( void ) DPM::draw ( void )
{ {

snprintf( peak_string, sizeof( peak_string ), "%.1f", peak() ); snprintf( peak_string, sizeof( peak_string ), "%.1f", peak() );
tooltip( peak_string ); tooltip( peak_string );




+ 0
- 30
mixer/src/Meter.H View File

@@ -97,33 +97,3 @@ public:
void reset ( void ) { _peak = -80.0f; redraw(); } void reset ( void ) { _peak = -80.0f; redraw(); }


}; };

#include <FL/Fl_Group.H>
#include <stdio.h>


/* ... Extension methods for any group containing only meters. Access
* via a cast to (Meter_Pack *) */

class Meter_Pack : public Fl_Group
{

public:

/** return a pointer to the meter for channel /c/ in group of meters /g/ */
Meter *
channel ( int c )
{
if ( c > children() )
{
fprintf( stderr, "no such channel\n" );
return NULL;
}

return (Meter *)child( c );
}

int
channels ( void ) const { return children(); }

};

+ 18
- 13
mixer/src/Meter_Indicator_Module.C View File

@@ -1,6 +1,6 @@


/*******************************************************************************/ /*******************************************************************************/
/* Copyright (C) 2009 Jonathan Moore Liles */
/* Copyright (C) 2010 Jonathan Moore Liles */
/* */ /* */
/* This program is free software; you can redistribute it and/or modify it */ /* This program is free software; you can redistribute it and/or modify it */
/* under the terms of the GNU General Public License as published by the */ /* under the terms of the GNU General Public License as published by the */
@@ -48,10 +48,10 @@ const float CONTROL_UPDATE_FREQ = 0.1f;
Meter_Indicator_Module::Meter_Indicator_Module ( bool is_default ) Meter_Indicator_Module::Meter_Indicator_Module ( bool is_default )
: Module ( is_default, 50, 100, name() ) : Module ( is_default, 50, 100, name() )
{ {
box( FL_NO_BOX );
box( FL_FLAT_BOX );
color( FL_GREEN );


_pad = true; _pad = true;
control = 0;
control_value = 0; control_value = 0;


add_port( Port( this, Port::INPUT, Port::CONTROL ) ); add_port( Port( this, Port::INPUT, Port::CONTROL ) );
@@ -59,10 +59,12 @@ Meter_Indicator_Module::Meter_Indicator_Module ( bool is_default )
dpm_pack = new Fl_Scalepack( x(), y(), w(), h() ); dpm_pack = new Fl_Scalepack( x(), y(), w(), h() );
dpm_pack->type( FL_HORIZONTAL ); dpm_pack->type( FL_HORIZONTAL );


end();

control_value = new float[1]; control_value = new float[1];
*control_value = -70.0f; *control_value = -70.0f;


end();
align( (Fl_Align)(FL_ALIGN_CENTER | FL_ALIGN_INSIDE ) );


clear_visible_focus(); clear_visible_focus();


@@ -163,7 +165,6 @@ Meter_Indicator_Module::update_cb ( void )


DPM *dpm = new DPM( x(), y(), w(), h() ); DPM *dpm = new DPM( x(), y(), w(), h() );
dpm->type( FL_VERTICAL ); dpm->type( FL_VERTICAL );
align( (Fl_Align)(FL_ALIGN_CENTER | FL_ALIGN_INSIDE ) );


dpm_pack->add( dpm ); dpm_pack->add( dpm );


@@ -171,6 +172,8 @@ Meter_Indicator_Module::update_cb ( void )
dpm->value( -70.0f ); dpm->value( -70.0f );
} }


// redraw();

/* engine->unlock(); */ /* engine->unlock(); */
} }
else else
@@ -181,8 +184,6 @@ Meter_Indicator_Module::update_cb ( void )
} }
} }
} }

// redraw();
} }


void void
@@ -190,11 +191,12 @@ Meter_Indicator_Module::connect_to ( Port *p )
{ {
control_input[0].connect_to( p ); control_input[0].connect_to( p );


DPM *o = new DPM( x(), y(), this->w(), h() );
o->type( FL_VERTICAL );
align( (Fl_Align)(FL_ALIGN_CENTER | FL_ALIGN_INSIDE ) );
/* DPM *o = new DPM( 10, 10, 10, 10 ); */
/* o->type( FL_VERTICAL ); */


dpm_pack->add( o );
/* dpm_pack->add( o ); */

redraw();
} }


@@ -206,7 +208,7 @@ Meter_Indicator_Module::handle ( int m )
{ {
case FL_PUSH: case FL_PUSH:
{ {
if ( test_press( FL_BUTTON1 ) )
if ( Fl::event_button1() )
{ {
/* don't let Module::handle eat our click */ /* don't let Module::handle eat our click */
return Fl_Group::handle( m ); return Fl_Group::handle( m );
@@ -214,7 +216,7 @@ Meter_Indicator_Module::handle ( int m )
} }
} }


return 0;
return Module::handle( m );
} }


@@ -244,10 +246,13 @@ Meter_Indicator_Module::handle_control_changed ( Port *p )
align( (Fl_Align)(FL_ALIGN_CENTER | FL_ALIGN_INSIDE ) ); align( (Fl_Align)(FL_ALIGN_CENTER | FL_ALIGN_INSIDE ) );


dpm_pack->add( dpm ); dpm_pack->add( dpm );
dpm_pack->redraw();


control_value[i] = -70.0f; control_value[i] = -70.0f;
dpm->value( -70.0f ); dpm->value( -70.0f );
} }

redraw();
} }
} }
} }


+ 1
- 3
mixer/src/Meter_Indicator_Module.H View File

@@ -67,7 +67,7 @@ protected:


virtual void draw ( void ) virtual void draw ( void )
{ {
draw_box();
// draw_box();
Fl_Group::draw(); Fl_Group::draw();
} }


@@ -75,6 +75,4 @@ protected:


private: private:


Fl_Valuator *control;

}; };

+ 2
- 2
mixer/src/Module.C View File

@@ -61,10 +61,11 @@ Module::Module ( bool is_default, int W, int H, const char *L ) : Fl_Group( 0, 0
log_create(); log_create();
} }


Module::Module ( ) : Fl_Group( 0, 0, 0, 50, "Unnamed" )
Module::Module ( ) : Fl_Group( 0, 0, 50, 50, "Unnamed" )
{ {
init(); init();



log_create(); log_create();
} }


@@ -186,7 +187,6 @@ Module::paste_before ( void )
m->copy(); m->copy();
} }



void void
Module::set ( Log_Entry &e ) Module::set ( Log_Entry &e )
{ {


Loading…
Cancel
Save