本文整理汇总了C++中Port::control_value方法的典型用法代码示例。如果您正苦于以下问题:C++ Port::control_value方法的具体用法?C++ Port::control_value怎么用?C++ Port::control_value使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Port
的用法示例。
在下文中一共展示了Port::control_value方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: if
/** attempt to transform this controller into a spatialization
controller and connect to the given module's spatialization
control inputs. Returns true on success, false if given module
does not accept spatialization inputs. */
bool
Controller_Module::connect_spatializer_to ( Module *m )
{
connect_spatializer_radius_to( m );
/* these are for detecting related parameter groups which can be
better represented by a single control */
Port *azimuth_port = NULL;
float azimuth_value = 0.0f;
Port *elevation_port = NULL;
float elevation_value = 0.0f;
for ( unsigned int i = 0; i < m->control_input.size(); ++i )
{
Port *p = &m->control_input[i];
if ( !strcasecmp( "Azimuth", p->name() ) &&
180.0f == p->hints.maximum &&
-180.0f == p->hints.minimum )
{
azimuth_port = p;
azimuth_value = p->control_value();
continue;
}
else if ( !strcasecmp( "Elevation", p->name() ) &&
90.0f == p->hints.maximum &&
-90.0f == p->hints.minimum )
{
elevation_port = p;
elevation_value = p->control_value();
continue;
}
}
if ( ! ( azimuth_port && elevation_port ) )
return false;
if ( control_output.size() != 3 )
{
control_output.clear();
add_port( Port( this, Port::OUTPUT, Port::CONTROL ) );
add_port( Port( this, Port::OUTPUT, Port::CONTROL ) );
add_port( Port( this, Port::OUTPUT, Port::CONTROL ) );
}
control_output[0].connect_to( azimuth_port );
control_output[1].connect_to( elevation_port );
maybe_create_panner();
Panner *o = (Panner*)control;
o->point( 0 )->azimuth( azimuth_value );
o->point( 0 )->elevation( elevation_value );
if ( Mixer::spatialization_console )
Mixer::spatialization_console->update();
return true;
}
示例2: Port
bool
Controller_Module::connect_spatializer_radius_to ( Module *m )
{
Port *radius_port = NULL;
float radius_value = 0.0f;
for ( unsigned int i = 0; i < m->control_input.size(); ++i )
{
Port *p = &m->control_input[i];
if ( !strcasecmp( "Radius", p->name() ) )
/* 90.0f == p->hints.maximum && */
/* -90.0f == p->hints.minimum ) */
{
radius_port = p;
radius_value = p->control_value();
continue;
}
}
if ( ! radius_port )
return false;
if ( control_output.size() != 3 )
{
control_output.clear();
add_port( Port( this, Port::OUTPUT, Port::CONTROL ) );
add_port( Port( this, Port::OUTPUT, Port::CONTROL ) );
add_port( Port( this, Port::OUTPUT, Port::CONTROL ) );
}
control_output[2].connect_to( radius_port );
maybe_create_panner();
Panner *o = (Panner*)control;
o->point( 0 )->radius( radius_value );
if ( Mixer::spatialization_console )
Mixer::spatialization_console->update();
return true;
}
示例3: if
/** attempt to transform this controller into a spatialization
controller and connect to the given module's spatialization
control inputs. Returns true on success, false if given module
does not accept spatialization inputs. */
bool
Controller_Module::connect_spatializer_to ( Module *m )
{
/* these are for detecting related parameter groups which can be
better represented by a single control */
Port *azimuth_port = NULL;
float azimuth_value = 0.0f;
Port *elevation_port = NULL;
float elevation_value = 0.0f;
for ( unsigned int i = 0; i < m->control_input.size(); ++i )
{
Port *p = &m->control_input[i];
if ( !strcasecmp( "Azimuth", p->name() ) &&
180.0f == p->hints.maximum &&
-180.0f == p->hints.minimum )
{
azimuth_port = p;
azimuth_value = p->control_value();
continue;
}
else if ( !strcasecmp( "Elevation", p->name() ) &&
90.0f == p->hints.maximum &&
-90.0f == p->hints.minimum )
{
elevation_port = p;
elevation_value = p->control_value();
continue;
}
}
if ( ! ( azimuth_port && elevation_port ) )
return false;
control_output.clear();
add_port( Port( this, Port::OUTPUT, Port::CONTROL ) );
add_port( Port( this, Port::OUTPUT, Port::CONTROL ) );
control_output[0].connect_to( azimuth_port );
control_output[1].connect_to( elevation_port );
{
clear();
Panner *o = new Panner( 0,0, 100, 100 );
o->box(FL_THIN_UP_BOX);
o->color(FL_GRAY0);
o->selection_color(FL_BACKGROUND_COLOR);
o->labeltype(FL_NORMAL_LABEL);
o->labelfont(0);
o->labelcolor(FL_FOREGROUND_COLOR);
o->align(FL_ALIGN_TOP);
o->when(FL_WHEN_CHANGED);
label( "Spatialization" );
o->align(FL_ALIGN_TOP);
o->labelsize( 10 );
// o->callback( cb_panner_value_handle, new callback_data( this, azimuth_port_number, elevation_port_number ) );
o->point( 0 )->azimuth( azimuth_value );
o->point( 0 )->elevation( elevation_value );
o->callback( cb_spatializer_handle, this );
control = (Fl_Valuator*)o;
if ( _pad )
{
Fl_Labelpad_Group *flg = new Fl_Labelpad_Group( o );
flg->position( x(), y() );
flg->set_visible_focus();
size( flg->w(), flg->h() );
add( flg );
}
else
{
o->resize( x(), y(), w(), h() );
add( o );
resizable( o );
init_sizes();
}
_type = SPATIALIZATION;
return true;
}
}