Finally nailed the mysterious fader update bug, thanks to Giso Grimm. Also move Strip::add out to controls.cc from surface.cc

git-svn-id: svn://localhost/ardour2/branches/2.0-ongoing@2282 d708f5d6-7413-0410-9779-e7cbd77b26cf
This commit is contained in:
John Anderson 2007-08-09 19:53:57 +00:00
parent f914f67036
commit f8b06e1f8d
4 changed files with 67 additions and 63 deletions

View file

@ -1,4 +1,3 @@
* fader problem (reported by Giso Grimm). Also with P4 (hyperthread)
* two bcf doesn't work
* remappable buttons
* 7/1 configurable to 8
@ -13,6 +12,9 @@ MCU
---
* if mackie wheel moves too fast, it's ignored.
* timecode displays
* gain/panner display in second line
* metering on second line
* per-strip signal led
* midi bandwidth?
Later

View file

@ -45,11 +45,72 @@ Strip::Strip( const std::string & name, int index )
{
}
/**
TODO could optimise this to use enum, but it's only
called during the protocol class instantiation.
generated using
irb -r controls.rb
sf=Surface.new
sf.parse
controls = sf.groups.find{|x| x[0] =~ /strip/}.each{|x| puts x[1]}
controls[1].each {|x| puts "\telse if ( control.name() == \"#{x.name}\" )\n\t{\n\t\t_#{x.name} = reinterpret_cast<#{x.class.name}*>(&control);\n\t}\n"}
*/
void Strip::add( Control & control )
{
Group::add( control );
if ( control.name() == "gain" )
{
_gain = reinterpret_cast<Fader*>(&control);
}
else if ( control.name() == "vpot" )
{
_vpot = reinterpret_cast<Pot*>(&control);
}
else if ( control.name() == "recenable" )
{
_recenable = reinterpret_cast<Button*>(&control);
}
else if ( control.name() == "solo" )
{
_solo = reinterpret_cast<Button*>(&control);
}
else if ( control.name() == "mute" )
{
_mute = reinterpret_cast<Button*>(&control);
}
else if ( control.name() == "select" )
{
_select = reinterpret_cast<Button*>(&control);
}
else if ( control.name() == "vselect" )
{
_vselect = reinterpret_cast<Button*>(&control);
}
else if ( control.name() == "fader_touch" )
{
_fader_touch = reinterpret_cast<Button*>(&control);
}
else if ( control.type() == Control::type_led || control.type() == Control::type_led_ring )
{
// do nothing
cout << "Strip::add not adding " << control << endl;
}
else
{
ostringstream os;
os << "Strip::add: unknown control type " << control;
throw MackieControlException( os.str() );
}
}
Control::Control( int id, int ordinal, std::string name, Group & group )
: _id( id )
, _ordinal( ordinal )
, _name( name )
, _group( group )
, _in_use( false )
, _in_use_timeout( 250 )
{
}

View file

@ -211,8 +211,7 @@ public:
virtual type_t type() const = 0;
/// Return true if this control is the one and only
/// Jog Wheel
/// Return true if this control is the one and only Jog Wheel
virtual bool is_jog() const { return false; }
/**

View file

@ -57,6 +57,8 @@ void Surface::init_strips( uint32_t max_strips, uint32_t unit_strips )
// shallow copy existing strip
// which works because the controls
// have the same ids across units
// TODO this needs to be a deep copy because
// controls hold state now - in_use
Strip * strip = new Strip( *strips[i % unit_strips] );
// update the relevant values
@ -69,63 +71,3 @@ void Surface::init_strips( uint32_t max_strips, uint32_t unit_strips )
}
}
}
/**
TODO could optimise this to use enum, but it's only
called during the protocol class instantiation.
generated using
irb -r controls.rb
sf=Surface.new
sf.parse
controls = sf.groups.find{|x| x[0] =~ /strip/}.each{|x| puts x[1]}
controls[1].each {|x| puts "\telse if ( control.name() == \"#{x.name}\" )\n\t{\n\t\t_#{x.name} = reinterpret_cast<#{x.class.name}*>(&control);\n\t}\n"}
*/
void Strip::add( Control & control )
{
Group::add( control );
if ( control.name() == "gain" )
{
_gain = reinterpret_cast<Fader*>(&control);
}
else if ( control.name() == "vpot" )
{
_vpot = reinterpret_cast<Pot*>(&control);
}
else if ( control.name() == "recenable" )
{
_recenable = reinterpret_cast<Button*>(&control);
}
else if ( control.name() == "solo" )
{
_solo = reinterpret_cast<Button*>(&control);
}
else if ( control.name() == "mute" )
{
_mute = reinterpret_cast<Button*>(&control);
}
else if ( control.name() == "select" )
{
_select = reinterpret_cast<Button*>(&control);
}
else if ( control.name() == "vselect" )
{
_vselect = reinterpret_cast<Button*>(&control);
}
else if ( control.name() == "fader_touch" )
{
_fader_touch = reinterpret_cast<Button*>(&control);
}
else if ( control.type() == Control::type_led || control.type() == Control::type_led_ring )
{
// do nothing
cout << "Strip::add not adding " << control << endl;
}
else
{
ostringstream os;
os << "Strip::add: unknown control type " << control;
throw MackieControlException( os.str() );
}
}