The Be Book The Media Kit The Media Kit Index

BContinuousParameter

Derived from: BParameter
Declared in:  be/media/ParameterWeb.h
Library: libmedia.so
Allocation: Constructor only
Summary:  more...


The BContinuousParameter class represents parameters whose values can vary along a continuous range. Examples include gain or equalizer controls, turntable pitch controls, and the like.

The default system theme implements BContinuousParameters as BSlider controls.

Call BParameterGroup::MakeContinuousParameter() to create a BContinuousParameter control.


Constructor and Destructor

You never create or delete a BContinuousParameter object yourself. Use the appropriate BParameterGroup functions to create these objects and add them to groups.


Member Functions


GetResponse() , SetResponse()

void GetResponse(response *response, float *factor, float *offset)
void SetResponse(response response, float factor, float offset)

GetResponse() returns in response, factor, and offset the response type, factor, and offset currently in effect for the BContinuousParameter.

SetResponse() sets these values.

The response describes how the BContinuousParameter's value is displayed to me the user. For example, if your parameter is polynomial in scale, you may wish to record only the base value, and let the BContinuousParameter handle presenting the value to the user as a polynomial by raising the value to the power specified by factor before displaying the value on the screen.

Constant Description
B_LINEAR For every unit of change in the parameter's value, the displayed value also changes by 1. The factor should be 1.
B_POLYNOMIAL The factor is a power to which the control's value is raised before being displayed.
B_EXPONENTIAL The factor is the base; the displayed value is the factor raised to the power of the parameter's value.
B_LOGARITHMIC The factor is the base; the displayed value is the base factor logarithm of the parameter's value.

The offset is added to the value after the transformation specified by response is computed, but before displaying the value.

If you wish the displayed value to be v2+1, you would use the following call:

SetResponse(B_POLYNOMIAL, 2.0, 1.0);

The mapping specified by these functions is only used for controls that display the current value of the control. The default system theme doesn't currently display this information. Since this information is only used for display purposes, you will still have to handle (as appropriate for your needs) mapping between the value of the control and the parameter value it represents.

For example, a BContinuousParameter that selects a frequency between 20 Hz and 20,000 Hz might use a range from 0 to 3, with an exponent base of 10 and a multiplication factor of 20. In this case, the parameter will receive values from 0.0 to 3.0, which the UI control knows to map to the values 20 through 20,000 for display purposes.


MaxValue()

float MaxValue(void)

Returns the maximum possible value the BContinuousParameter can take, which was specified when the control was created. The value is in the units specified when the control was created, such as "dB" or "Hz."


MinValue()

float MinValue(void)

Returns the minimum possible value the BContinuousParameter can take, which was specified when the object was created. The value is in the units specified when the object was created, such as "dB" or "Hz."


SetResponse() see GetResponse()


ValueStep()

float ValueStep(void)

Returns the granularity of values between MinValue() and MaxValue() supported by the hardware.


ValueType()

virtual type_code ValueType(void)

Return a type_code indicating the data type of the control's value; by default, this is B_FLOAT_TYPE.


Constants

response

Declared in:  be/media/ParameterWeb.h

Constant Description
B_LINEAR For every unit of change in the parameter's value, the displayed value also changes by 1. The factor should be 1.
B_POLYNOMIAL The factor is a power to which the control's value is raised before being displayed.
B_EXPONENTIAL The factor is the base; the displayed value is the factor raised to the power of the parameter's value.
B_LOGARITHMIC The factor is the base; the displayed value is the base factor logarithm of the parameter's value.

These values define the response type for a BContinuousParameter.

B_LINEAR indicates that the user interface will display the parameter's value as-is.

B_POLYNOMIAL displays the parameter's value raised to the factor power. For instance, if factor is 2, the displayed value would be the parameter's value squared.

B_EXPONENTIAL displays the factor raised to the power of the parameter's value. If the parameter's value is 3 and the factor is 2, the displayed value would be 23 or 8.

B_LOGARITHMIC displays the base factor logarithm of the parameter's value; if the factor is 10 and the parameter's value is 3, the displayed value would be log10(3).


The Be Book The Media Kit The Media Kit Index

The Be Book,
...in lovely HTML...
for BeOS Release 5.

Copyright © 2000 Be, Inc. All rights reserved..