* Rewrote ParameterWeb.h.
* Adapted and cleaned up ParameterWeb.cpp. * Fixed some copy&paste bugs in the BTextParameter. git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@30029 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
+372
-464
@@ -1,308 +1,253 @@
|
|||||||
/*******************************************************************************
|
/*
|
||||||
/
|
* Copyright 2009, Haiku, Inc. All Rights Reserved.
|
||||||
/ File: ParameterWeb.h
|
* Distributed under the terms of the MIT license.
|
||||||
/
|
*/
|
||||||
/ Description: A BParameterWeb is a description of media controls within a BControllable
|
#ifndef _CONTROL_WEB_H
|
||||||
/ Media Kit Node.
|
|
||||||
/ BParameter, BParameterGroup, BContinuousParameter, BDiscreteParameter and
|
|
||||||
/ BNullParameter are "data classes" used to describe the relation within a
|
|
||||||
/ BParameterWeb. These are NOT direct visible classes like BControls; just data
|
|
||||||
/ containers which applications can use to decide what kind of views to create.
|
|
||||||
/
|
|
||||||
/ Copyright 1997-98, Be Incorporated, All Rights Reserved
|
|
||||||
/
|
|
||||||
*******************************************************************************/
|
|
||||||
|
|
||||||
#if !defined(_CONTROL_WEB_H)
|
|
||||||
#define _CONTROL_WEB_H
|
#define _CONTROL_WEB_H
|
||||||
|
|
||||||
|
|
||||||
#include <Flattenable.h>
|
#include <Flattenable.h>
|
||||||
#include <MediaDefs.h>
|
#include <MediaDefs.h>
|
||||||
#include <MediaNode.h>
|
#include <MediaNode.h>
|
||||||
#include <TypeConstants.h>
|
#include <TypeConstants.h>
|
||||||
|
|
||||||
|
|
||||||
// It is highly unfortunate that a linker bug forces these symbols out
|
// Parameter Kinds
|
||||||
// from the BParameter class. Hope they don't collide with anything else.
|
|
||||||
|
|
||||||
/* These are control KINDs */
|
extern const char* const B_GENERIC;
|
||||||
/* kind used when you don't know or care */
|
|
||||||
extern const char * const B_GENERIC;
|
|
||||||
/* kinds used for sliders */
|
|
||||||
extern const char * const B_MASTER_GAIN; /* Main Volume */
|
|
||||||
extern const char * const B_GAIN;
|
|
||||||
extern const char * const B_BALANCE;
|
|
||||||
extern const char * const B_FREQUENCY; /* like a radio tuner */
|
|
||||||
extern const char * const B_LEVEL; /* like for effects */
|
|
||||||
extern const char * const B_SHUTTLE_SPEED; /* Play, SloMo, Scan 1.0 == regular */
|
|
||||||
extern const char * const B_CROSSFADE; /* 0 == first input, +100 == second input */
|
|
||||||
extern const char * const B_EQUALIZATION; /* depth (dB) */
|
|
||||||
|
|
||||||
/* kinds used for compressors */
|
// slider controls
|
||||||
extern const char * const B_COMPRESSION; /* 0% == no compression, 99% == 100:1 compression */
|
extern const char* const B_MASTER_GAIN;
|
||||||
extern const char * const B_QUALITY; /* 0% == full compression, 100% == no compression */
|
extern const char* const B_GAIN;
|
||||||
extern const char * const B_BITRATE; /* in bits/second */
|
extern const char* const B_BALANCE;
|
||||||
extern const char * const B_GOP_SIZE; /* Group Of Pictures. a k a "Keyframe every N frames" */
|
extern const char* const B_FREQUENCY;
|
||||||
/* kinds used for selectors */
|
extern const char* const B_LEVEL;
|
||||||
extern const char * const B_MUTE; /* 0 == thru, 1 == mute */
|
extern const char* const B_SHUTTLE_SPEED;
|
||||||
extern const char * const B_ENABLE; /* 0 == disable, 1 == enable */
|
extern const char* const B_CROSSFADE; // 0-100 (first - second)
|
||||||
extern const char * const B_INPUT_MUX; /* "value" 1-N == input selected */
|
extern const char* const B_EQUALIZATION; // dB
|
||||||
extern const char * const B_OUTPUT_MUX; /* "value" 1-N == output selected */
|
|
||||||
extern const char * const B_TUNER_CHANNEL; /* like cable TV */
|
|
||||||
extern const char * const B_TRACK; /* like a CD player; "value" should be 1-N */
|
|
||||||
extern const char * const B_RECSTATE; /* like mutitrack tape deck, 0 == silent, 1 == play, 2 == record */
|
|
||||||
extern const char * const B_SHUTTLE_MODE; /* -1 == backwards, 0 == stop, 1 == play, 2 == pause/cue */
|
|
||||||
extern const char * const B_RESOLUTION;
|
|
||||||
extern const char * const B_COLOR_SPACE; /* "value" should be color_space */
|
|
||||||
extern const char * const B_FRAME_RATE;
|
|
||||||
extern const char * const B_VIDEO_FORMAT; /* 1 == NTSC-M, 2 == NTSC-J, 3 == PAL-BDGHI, 4 == PAL-M, 5 == PAL-N, 6 == SECAM, 7 == MPEG-1, 8 == MPEG-2 */
|
|
||||||
/* kinds used for junctions */
|
|
||||||
// the prefix of "WEB" is to avoid collission with an enum in Defs.h
|
|
||||||
extern const char * const B_WEB_PHYSICAL_INPUT; /* a jack on the back of the card */
|
|
||||||
extern const char * const B_WEB_PHYSICAL_OUTPUT;
|
|
||||||
extern const char * const B_WEB_ADC_CONVERTER; /* from analog to digital signals */
|
|
||||||
extern const char * const B_WEB_DAC_CONVERTER; /* from digital to analog signals */
|
|
||||||
extern const char * const B_WEB_LOGICAL_INPUT; /* an "input" that may not be physical */
|
|
||||||
extern const char * const B_WEB_LOGICAL_OUTPUT;
|
|
||||||
extern const char * const B_WEB_LOGICAL_BUS; /* a logical connection point that is neither input nor output; auxilliary bus */
|
|
||||||
extern const char * const B_WEB_BUFFER_INPUT; /* an input that corresponds to a media_input */
|
|
||||||
extern const char * const B_WEB_BUFFER_OUTPUT;
|
|
||||||
|
|
||||||
// a simple transport control is a discrete parameter with five values (states):
|
// compression controls
|
||||||
// rewinding, stopped, playing, paused, and fast-forwarding
|
extern const char* const B_COMPRESSION;
|
||||||
extern const char * const B_SIMPLE_TRANSPORT;
|
extern const char* const B_QUALITY;
|
||||||
|
extern const char* const B_BITRATE; // bits/s
|
||||||
|
extern const char* const B_GOP_SIZE;
|
||||||
|
|
||||||
|
// selector controls
|
||||||
|
extern const char* const B_MUTE;
|
||||||
|
extern const char* const B_ENABLE;
|
||||||
|
extern const char* const B_INPUT_MUX;
|
||||||
|
extern const char* const B_OUTPUT_MUX;
|
||||||
|
extern const char* const B_TUNER_CHANNEL;
|
||||||
|
extern const char* const B_TRACK;
|
||||||
|
extern const char* const B_RECSTATE;
|
||||||
|
extern const char* const B_SHUTTLE_MODE;
|
||||||
|
extern const char* const B_RESOLUTION;
|
||||||
|
extern const char* const B_COLOR_SPACE;
|
||||||
|
extern const char* const B_FRAME_RATE;
|
||||||
|
extern const char* const B_VIDEO_FORMAT;
|
||||||
|
// 1 = NTSC-M, 2 = NTSC-J, 3 = PAL-BDGHI, 4 = PAL-M, 5 = PAL-N, 6 = SECAM,
|
||||||
|
// 7 = MPEG-1, 8 = MPEG-2
|
||||||
|
|
||||||
|
// junction controls
|
||||||
|
extern const char* const B_WEB_PHYSICAL_INPUT;
|
||||||
|
extern const char* const B_WEB_PHYSICAL_OUTPUT;
|
||||||
|
extern const char* const B_WEB_ADC_CONVERTER;
|
||||||
|
extern const char* const B_WEB_DAC_CONVERTER;
|
||||||
|
extern const char* const B_WEB_LOGICAL_INPUT;
|
||||||
|
extern const char* const B_WEB_LOGICAL_OUTPUT;
|
||||||
|
extern const char* const B_WEB_LOGICAL_BUS;
|
||||||
|
extern const char* const B_WEB_BUFFER_INPUT;
|
||||||
|
extern const char* const B_WEB_BUFFER_OUTPUT;
|
||||||
|
|
||||||
|
// transport control
|
||||||
|
extern const char* const B_SIMPLE_TRANSPORT;
|
||||||
|
// 0-4: rewind, stop, play, pause, fast-forward
|
||||||
|
|
||||||
class BList;
|
|
||||||
class BParameterGroup;
|
|
||||||
class BParameter;
|
|
||||||
class BNullParameter;
|
|
||||||
class BContinuousParameter;
|
class BContinuousParameter;
|
||||||
class BDiscreteParameter;
|
class BDiscreteParameter;
|
||||||
|
class BList;
|
||||||
|
class BNullParameter;
|
||||||
|
class BParameter;
|
||||||
|
class BParameterGroup;
|
||||||
class BTextParameter;
|
class BTextParameter;
|
||||||
|
|
||||||
|
// Parameter flags for influencing Media Themes
|
||||||
/* Set these flags on parameters and groups to control how a Theme will */
|
|
||||||
/* render the Web. Hidden means, generally, "don't show". Advanced means, */
|
|
||||||
/* generally, that you can show it or not depending on your whim. */
|
|
||||||
enum media_parameter_flags {
|
enum media_parameter_flags {
|
||||||
B_HIDDEN_PARAMETER = 0x1,
|
B_HIDDEN_PARAMETER = 1,
|
||||||
B_ADVANCED_PARAMETER = 0x2
|
B_ADVANCED_PARAMETER = 2
|
||||||
};
|
};
|
||||||
|
|
||||||
|
class BParameterWeb : public BFlattenable {
|
||||||
class BParameterWeb :
|
|
||||||
public BFlattenable
|
|
||||||
{
|
|
||||||
public:
|
public:
|
||||||
BParameterWeb();
|
BParameterWeb();
|
||||||
~BParameterWeb();
|
~BParameterWeb();
|
||||||
|
|
||||||
media_node Node();
|
media_node Node();
|
||||||
|
|
||||||
BParameterGroup * MakeGroup(
|
BParameterGroup* MakeGroup(const char* name);
|
||||||
const char * name);
|
int32 CountGroups();
|
||||||
|
BParameterGroup* GroupAt(int32 index);
|
||||||
|
|
||||||
int32 CountGroups();
|
int32 CountParameters();
|
||||||
BParameterGroup * GroupAt(
|
BParameter* ParameterAt(int32 index);
|
||||||
int32 index);
|
|
||||||
int32 CountParameters();
|
|
||||||
BParameter * ParameterAt(
|
|
||||||
int32 index);
|
|
||||||
|
|
||||||
virtual bool IsFixedSize() const;
|
// BFlattenable implementation
|
||||||
virtual type_code TypeCode() const;
|
virtual bool IsFixedSize() const;
|
||||||
virtual ssize_t FlattenedSize() const;
|
virtual type_code TypeCode() const;
|
||||||
virtual status_t Flatten(void *buffer, ssize_t size) const;
|
virtual ssize_t FlattenedSize() const;
|
||||||
virtual bool AllowsTypeCode(type_code code) const;
|
virtual status_t Flatten(void* buffer, ssize_t size) const;
|
||||||
virtual status_t Unflatten(type_code c, const void *buf, ssize_t size);
|
virtual bool AllowsTypeCode(type_code code) const;
|
||||||
|
virtual status_t Unflatten(type_code code, const void* buffer,
|
||||||
|
ssize_t size);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
|
||||||
friend class BParameterGroup;
|
friend class BParameterGroup;
|
||||||
friend class BControllable;
|
friend class BControllable;
|
||||||
|
|
||||||
BParameterWeb(
|
BParameterWeb(const BParameterWeb& other);
|
||||||
const BParameterWeb & clone);
|
BParameterWeb& operator=(const BParameterWeb& other);
|
||||||
BParameterWeb & operator=(
|
|
||||||
const BParameterWeb & clone);
|
|
||||||
|
|
||||||
/* Mmmh, stuffing! */
|
// reserved
|
||||||
virtual status_t _Reserved_ControlWeb_0(void *);
|
virtual status_t _Reserved_ControlWeb_0(void*);
|
||||||
virtual status_t _Reserved_ControlWeb_1(void *);
|
virtual status_t _Reserved_ControlWeb_1(void*);
|
||||||
virtual status_t _Reserved_ControlWeb_2(void *);
|
virtual status_t _Reserved_ControlWeb_2(void*);
|
||||||
virtual status_t _Reserved_ControlWeb_3(void *);
|
virtual status_t _Reserved_ControlWeb_3(void*);
|
||||||
virtual status_t _Reserved_ControlWeb_4(void *);
|
virtual status_t _Reserved_ControlWeb_4(void*);
|
||||||
virtual status_t _Reserved_ControlWeb_5(void *);
|
virtual status_t _Reserved_ControlWeb_5(void*);
|
||||||
virtual status_t _Reserved_ControlWeb_6(void *);
|
virtual status_t _Reserved_ControlWeb_6(void*);
|
||||||
virtual status_t _Reserved_ControlWeb_7(void *);
|
virtual status_t _Reserved_ControlWeb_7(void*);
|
||||||
|
|
||||||
BList * mGroups;
|
void AddRefFix(void* oldItem, void* newItem);
|
||||||
media_node mNode;
|
|
||||||
uint32 _reserved_control_web_[8];
|
|
||||||
|
|
||||||
BList * mOldRefs;
|
private:
|
||||||
BList * mNewRefs;
|
BList* fGroups;
|
||||||
|
media_node fNode;
|
||||||
void AddRefFix(
|
uint32 _reserved[8];
|
||||||
void * oldItem,
|
BList* fOldRefs;
|
||||||
void * newItem);
|
BList* fNewRefs;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
class BParameterGroup :
|
class BParameterGroup : public BFlattenable {
|
||||||
public BFlattenable
|
|
||||||
{
|
|
||||||
private:
|
private:
|
||||||
|
BParameterGroup(BParameterWeb* web,
|
||||||
BParameterGroup(
|
const char* name);
|
||||||
BParameterWeb * web,
|
virtual ~BParameterGroup();
|
||||||
const char * name);
|
|
||||||
virtual ~BParameterGroup();
|
|
||||||
|
|
||||||
public:
|
public:
|
||||||
|
BParameterWeb* Web() const;
|
||||||
|
const char* Name() const;
|
||||||
|
|
||||||
BParameterWeb * Web() const;
|
void SetFlags(uint32 flags);
|
||||||
const char * Name() const;
|
uint32 Flags() const;
|
||||||
|
|
||||||
void SetFlags(uint32 flags);
|
BNullParameter* MakeNullParameter(int32 id, media_type type,
|
||||||
uint32 Flags() const;
|
const char* name, const char* kind);
|
||||||
|
BContinuousParameter* MakeContinuousParameter(int32 id,
|
||||||
|
media_type type, const char* name,
|
||||||
|
const char* kind, const char* unit,
|
||||||
|
float min, float max, float step);
|
||||||
|
BDiscreteParameter* MakeDiscreteParameter(int32 id, media_type type,
|
||||||
|
const char* name, const char* kind);
|
||||||
|
BTextParameter* MakeTextParameter(int32 id, media_type type,
|
||||||
|
const char* name, const char* kind,
|
||||||
|
size_t maxBytes);
|
||||||
|
|
||||||
BNullParameter * MakeNullParameter(
|
BParameterGroup* MakeGroup(const char* name);
|
||||||
int32 id,
|
|
||||||
media_type m_type,
|
|
||||||
const char * name,
|
|
||||||
const char * kind);
|
|
||||||
BContinuousParameter * MakeContinuousParameter(
|
|
||||||
int32 id,
|
|
||||||
media_type m_type,
|
|
||||||
const char * name,
|
|
||||||
const char * kind,
|
|
||||||
const char * unit,
|
|
||||||
float minimum,
|
|
||||||
float maximum,
|
|
||||||
float stepping);
|
|
||||||
BDiscreteParameter * MakeDiscreteParameter(
|
|
||||||
int32 id,
|
|
||||||
media_type m_type,
|
|
||||||
const char * name,
|
|
||||||
const char * kind);
|
|
||||||
BTextParameter * MakeTextParameter(
|
|
||||||
int32 id,
|
|
||||||
media_type m_type,
|
|
||||||
const char * name,
|
|
||||||
const char * kind,
|
|
||||||
size_t max_bytes);
|
|
||||||
BParameterGroup * MakeGroup(
|
|
||||||
const char * name);
|
|
||||||
|
|
||||||
int32 CountParameters();
|
int32 CountParameters();
|
||||||
BParameter * ParameterAt(
|
BParameter* ParameterAt(int32 index);
|
||||||
int32 index);
|
|
||||||
int32 CountGroups();
|
|
||||||
BParameterGroup * GroupAt(
|
|
||||||
int32 index);
|
|
||||||
|
|
||||||
virtual bool IsFixedSize() const;
|
int32 CountGroups();
|
||||||
virtual type_code TypeCode() const;
|
BParameterGroup* GroupAt(int32 index);
|
||||||
virtual ssize_t FlattenedSize() const;
|
|
||||||
virtual status_t Flatten(void *buffer, ssize_t size) const;
|
// BFlattenable implementation
|
||||||
virtual bool AllowsTypeCode(type_code code) const;
|
virtual bool IsFixedSize() const;
|
||||||
virtual status_t Unflatten(type_code c, const void *buf, ssize_t size);
|
virtual type_code TypeCode() const;
|
||||||
|
virtual ssize_t FlattenedSize() const;
|
||||||
|
virtual status_t Flatten(void* buffer, ssize_t size) const;
|
||||||
|
virtual bool AllowsTypeCode(type_code code) const;
|
||||||
|
virtual status_t Unflatten(type_code code, const void* buffer,
|
||||||
|
ssize_t size);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
|
||||||
BParameterGroup(); /* private unimplemented */
|
|
||||||
BParameterGroup(
|
|
||||||
const BParameterGroup & clone);
|
|
||||||
BParameterGroup & operator=(
|
|
||||||
const BParameterGroup & clone);
|
|
||||||
|
|
||||||
/* Mmmh, stuffing! */
|
|
||||||
virtual status_t _Reserved_ControlGroup_0(void *);
|
|
||||||
virtual status_t _Reserved_ControlGroup_1(void *);
|
|
||||||
virtual status_t _Reserved_ControlGroup_2(void *);
|
|
||||||
virtual status_t _Reserved_ControlGroup_3(void *);
|
|
||||||
virtual status_t _Reserved_ControlGroup_4(void *);
|
|
||||||
virtual status_t _Reserved_ControlGroup_5(void *);
|
|
||||||
virtual status_t _Reserved_ControlGroup_6(void *);
|
|
||||||
virtual status_t _Reserved_ControlGroup_7(void *);
|
|
||||||
|
|
||||||
friend class BParameterWeb;
|
friend class BParameterWeb;
|
||||||
|
|
||||||
BParameterWeb * mWeb;
|
BParameterGroup();
|
||||||
BList * mControls;
|
BParameterGroup(const BParameterGroup& other);
|
||||||
BList * mGroups;
|
BParameterGroup& operator=(const BParameterGroup& other);
|
||||||
char * mName;
|
|
||||||
uint32 mFlags;
|
|
||||||
uint32 _reserved_control_group_[7];
|
|
||||||
|
|
||||||
BParameter * MakeControl(
|
BParameter* MakeControl(int32 type);
|
||||||
int32 type);
|
|
||||||
|
// reserved
|
||||||
|
virtual status_t _Reserved_ControlGroup_0(void*);
|
||||||
|
virtual status_t _Reserved_ControlGroup_1(void*);
|
||||||
|
virtual status_t _Reserved_ControlGroup_2(void*);
|
||||||
|
virtual status_t _Reserved_ControlGroup_3(void*);
|
||||||
|
virtual status_t _Reserved_ControlGroup_4(void*);
|
||||||
|
virtual status_t _Reserved_ControlGroup_5(void*);
|
||||||
|
virtual status_t _Reserved_ControlGroup_6(void*);
|
||||||
|
virtual status_t _Reserved_ControlGroup_7(void*);
|
||||||
|
|
||||||
|
private:
|
||||||
|
BParameterWeb* fWeb;
|
||||||
|
BList* fControls;
|
||||||
|
BList* fGroups;
|
||||||
|
char* fName;
|
||||||
|
uint32 fFlags;
|
||||||
|
uint32 _reserved[7];
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
/* After you create a BParameter, hook it up by calling AddInput() and/or AddOutput() */
|
class BParameter : public BFlattenable {
|
||||||
/* (which will call the reciprocal in the target) and optionally call SetChannelCount() and SetMediaType() */
|
|
||||||
class BParameter :
|
|
||||||
public BFlattenable
|
|
||||||
{
|
|
||||||
public:
|
public:
|
||||||
|
enum media_parameter_type {
|
||||||
|
B_NULL_PARAMETER,
|
||||||
|
B_DISCRETE_PARAMETER,
|
||||||
|
B_CONTINUOUS_PARAMETER,
|
||||||
|
B_TEXT_PARAMETER
|
||||||
|
};
|
||||||
|
|
||||||
/* This is a parameter TYPE */
|
media_parameter_type Type() const;
|
||||||
enum media_parameter_type
|
BParameterWeb* Web() const;
|
||||||
{
|
BParameterGroup* Group() const;
|
||||||
B_NULL_PARAMETER,
|
const char* Name() const;
|
||||||
B_DISCRETE_PARAMETER,
|
const char* Kind() const;
|
||||||
B_CONTINUOUS_PARAMETER,
|
const char* Unit() const;
|
||||||
B_TEXT_PARAMETER
|
int32 ID() const;
|
||||||
};
|
|
||||||
|
void SetFlags(uint32 flags);
|
||||||
|
uint32 Flags() const;
|
||||||
|
|
||||||
|
virtual type_code ValueType() = 0;
|
||||||
|
|
||||||
|
status_t GetValue(void* buffer, size_t* _size,
|
||||||
|
bigtime_t* _when);
|
||||||
|
status_t SetValue(const void* buffer, size_t size,
|
||||||
|
bigtime_t when);
|
||||||
|
|
||||||
media_parameter_type Type() const;
|
int32 CountChannels();
|
||||||
BParameterWeb * Web() const;
|
void SetChannelCount(int32 count);
|
||||||
BParameterGroup * Group() const;
|
|
||||||
const char * Name() const;
|
|
||||||
const char * Kind() const;
|
|
||||||
const char * Unit() const;
|
|
||||||
int32 ID() const;
|
|
||||||
|
|
||||||
void SetFlags(uint32 flags);
|
media_type MediaType();
|
||||||
uint32 Flags() const;
|
void SetMediaType(media_type type);
|
||||||
|
|
||||||
virtual type_code ValueType() = 0;
|
int32 CountInputs();
|
||||||
/* These functions are typically used by client apps; they will result in */
|
BParameter* InputAt(int32 index);
|
||||||
/* your BControllable getting called to read/write values. */
|
void AddInput(BParameter* input);
|
||||||
status_t GetValue(
|
|
||||||
void * buffer,
|
|
||||||
size_t * ioSize,
|
|
||||||
bigtime_t * when);
|
|
||||||
status_t SetValue(
|
|
||||||
const void * buffer,
|
|
||||||
size_t size,
|
|
||||||
bigtime_t when);
|
|
||||||
int32 CountChannels(); /* Number of ValueType() values; default is 1 */
|
|
||||||
void SetChannelCount( /* One value could still control e g a stereo pair */
|
|
||||||
int32 channel_count);
|
|
||||||
|
|
||||||
media_type MediaType(); /* Optional (default is B_MEDIA_NO_TYPE) */
|
int32 CountOutputs();
|
||||||
void SetMediaType(media_type m_type);
|
BParameter* OutputAt(int32 index);
|
||||||
|
void AddOutput(BParameter* output);
|
||||||
|
|
||||||
int32 CountInputs();
|
// BFlattenable implementation
|
||||||
BParameter * InputAt(
|
virtual bool IsFixedSize() const;
|
||||||
int32 index);
|
virtual type_code TypeCode() const;
|
||||||
void AddInput(
|
virtual ssize_t FlattenedSize() const;
|
||||||
BParameter * input);
|
virtual status_t Flatten(void* buffer, ssize_t size) const;
|
||||||
int32 CountOutputs();
|
virtual bool AllowsTypeCode(type_code code) const;
|
||||||
BParameter * OutputAt(
|
virtual status_t Unflatten(type_code code, const void* buffer,
|
||||||
int32 index);
|
ssize_t size);
|
||||||
void AddOutput(
|
|
||||||
BParameter * output);
|
|
||||||
|
|
||||||
virtual bool IsFixedSize() const;
|
|
||||||
virtual type_code TypeCode() const;
|
|
||||||
virtual ssize_t FlattenedSize() const;
|
|
||||||
virtual status_t Flatten(void *buffer, ssize_t size) const;
|
|
||||||
virtual bool AllowsTypeCode(type_code code) const;
|
|
||||||
virtual status_t Unflatten(type_code c, const void *buf, ssize_t size);
|
|
||||||
|
|
||||||
private:
|
private:
|
||||||
friend class BNullParameter;
|
friend class BNullParameter;
|
||||||
@@ -312,253 +257,216 @@ private:
|
|||||||
friend class BParameterGroup;
|
friend class BParameterGroup;
|
||||||
friend class BParameterWeb;
|
friend class BParameterWeb;
|
||||||
|
|
||||||
bool SwapOnUnflatten() { return mSwapDetected; }
|
BParameter(int32 id, media_type mediaType,
|
||||||
|
media_parameter_type type,
|
||||||
|
BParameterWeb* web, const char* name,
|
||||||
|
const char* kind, const char* unit);
|
||||||
|
~BParameter();
|
||||||
|
|
||||||
/* Mmmh, stuffing! */
|
// reserved
|
||||||
virtual status_t _Reserved_Control_0(void *);
|
virtual status_t _Reserved_Control_0(void*);
|
||||||
virtual status_t _Reserved_Control_1(void *);
|
virtual status_t _Reserved_Control_1(void*);
|
||||||
virtual status_t _Reserved_Control_2(void *);
|
virtual status_t _Reserved_Control_2(void*);
|
||||||
virtual status_t _Reserved_Control_3(void *);
|
virtual status_t _Reserved_Control_3(void*);
|
||||||
virtual status_t _Reserved_Control_4(void *);
|
virtual status_t _Reserved_Control_4(void*);
|
||||||
virtual status_t _Reserved_Control_5(void *);
|
virtual status_t _Reserved_Control_5(void*);
|
||||||
virtual status_t _Reserved_Control_6(void *);
|
virtual status_t _Reserved_Control_6(void*);
|
||||||
virtual status_t _Reserved_Control_7(void *);
|
virtual status_t _Reserved_Control_7(void*);
|
||||||
|
|
||||||
|
bool SwapOnUnflatten() { return fSwapDetected; }
|
||||||
BParameter(
|
virtual void FixRefs(BList& old, BList& updated);
|
||||||
int32 id,
|
|
||||||
media_type m_type,
|
|
||||||
media_parameter_type type,
|
|
||||||
BParameterWeb * web,
|
|
||||||
const char * name,
|
|
||||||
const char * kind,
|
|
||||||
const char * unit);
|
|
||||||
~BParameter();
|
|
||||||
|
|
||||||
int32 mID;
|
|
||||||
media_parameter_type mType;
|
|
||||||
BParameterWeb * mWeb;
|
|
||||||
BParameterGroup * mGroup;
|
|
||||||
char * mName;
|
|
||||||
char * mKind;
|
|
||||||
char * mUnit;
|
|
||||||
BList * mInputs;
|
|
||||||
BList * mOutputs;
|
|
||||||
bool mSwapDetected;
|
|
||||||
media_type mMediaType;
|
|
||||||
int32 mChannels;
|
|
||||||
uint32 mFlags;
|
|
||||||
uint32 _reserved_control_[7];
|
|
||||||
|
|
||||||
virtual void FixRefs(
|
|
||||||
BList & old,
|
|
||||||
BList & updated);
|
|
||||||
};
|
|
||||||
|
|
||||||
|
|
||||||
class BContinuousParameter :
|
|
||||||
public BParameter
|
|
||||||
{
|
|
||||||
public:
|
|
||||||
|
|
||||||
virtual type_code ValueType();
|
|
||||||
|
|
||||||
float MinValue();
|
|
||||||
float MaxValue();
|
|
||||||
float ValueStep();
|
|
||||||
|
|
||||||
/* The "response" specifies what value to display to the user. */
|
|
||||||
/* Thus, if response is B_POLYNOMIAL with factor 2, an actual */
|
|
||||||
/* control value of 10 would be displayed to the user as 100, and */
|
|
||||||
/* if response was B_EXPONENTIAL and factor was 2, an actual */
|
|
||||||
/* value of 3 would display 8 (two to the third). The ValueStep() */
|
|
||||||
/* is given in actual control values, before the transformation for */
|
|
||||||
/* display is done. Thus, with min 0, max 4 and value step 1, and an */
|
|
||||||
/* exponential response with factor 10, you will get the displayed */
|
|
||||||
/* values 1, 10, 100, 1000 and 10000 equally spaced across a slider */
|
|
||||||
/* (or whatever UI the app puts to the parameter). */
|
|
||||||
/* The "offset" is added to the value after transformation, before display. */
|
|
||||||
/* If "resp" is negative, the resulting value/display relation is turned upside down. */
|
|
||||||
enum response {
|
|
||||||
B_UNKNOWN = 0,
|
|
||||||
B_LINEAR = 1, /* factor is direct multiplier >= 0 */
|
|
||||||
B_POLYNOMIAL, /* factor should be power; typically "2" for squared or "-1" for inverse */
|
|
||||||
B_EXPONENTIAL, /* factor should be base, typically 2 or 10 */
|
|
||||||
B_LOGARITHMIC /* factor should be base, typically 2 or 10 */
|
|
||||||
};
|
|
||||||
void SetResponse(
|
|
||||||
int resp,
|
|
||||||
float factor,
|
|
||||||
float offset);
|
|
||||||
void GetResponse(
|
|
||||||
int * resp,
|
|
||||||
float * factor,
|
|
||||||
float * offset);
|
|
||||||
|
|
||||||
virtual ssize_t FlattenedSize() const;
|
|
||||||
virtual status_t Flatten(void *buffer, ssize_t size) const;
|
|
||||||
virtual status_t Unflatten(type_code c, const void *buf, ssize_t size);
|
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
int32 fID;
|
||||||
|
media_parameter_type fType;
|
||||||
|
BParameterWeb* fWeb;
|
||||||
|
BParameterGroup* fGroup;
|
||||||
|
char* fName;
|
||||||
|
char* fKind;
|
||||||
|
char* fUnit;
|
||||||
|
BList* fInputs;
|
||||||
|
BList* fOutputs;
|
||||||
|
bool fSwapDetected;
|
||||||
|
media_type fMediaType;
|
||||||
|
int32 fChannels;
|
||||||
|
uint32 fFlags;
|
||||||
|
|
||||||
/* Mmmh, stuffing! */
|
uint32 _reserved[7];
|
||||||
virtual status_t _Reserved_ContinuousParameter_0(void *);
|
|
||||||
virtual status_t _Reserved_ContinuousParameter_1(void *);
|
|
||||||
virtual status_t _Reserved_ContinuousParameter_2(void *);
|
|
||||||
virtual status_t _Reserved_ContinuousParameter_3(void *);
|
|
||||||
virtual status_t _Reserved_ContinuousParameter_4(void *);
|
|
||||||
virtual status_t _Reserved_ContinuousParameter_5(void *);
|
|
||||||
virtual status_t _Reserved_ContinuousParameter_6(void *);
|
|
||||||
virtual status_t _Reserved_ContinuousParameter_7(void *);
|
|
||||||
friend class BParameterGroup;
|
|
||||||
|
|
||||||
BContinuousParameter(
|
|
||||||
int32 id,
|
|
||||||
media_type m_type,
|
|
||||||
BParameterWeb * web,
|
|
||||||
const char * name,
|
|
||||||
const char * kind,
|
|
||||||
const char * unit,
|
|
||||||
float minimum,
|
|
||||||
float maximum,
|
|
||||||
float stepping);
|
|
||||||
~BContinuousParameter();
|
|
||||||
|
|
||||||
float mMinimum;
|
|
||||||
float mMaximum;
|
|
||||||
float mStepping;
|
|
||||||
response mResponse;
|
|
||||||
float mFactor;
|
|
||||||
float mOffset;
|
|
||||||
uint32 _reserved_control_slider_[8];
|
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
class BDiscreteParameter :
|
class BContinuousParameter : public BParameter {
|
||||||
public BParameter
|
|
||||||
{
|
|
||||||
public:
|
public:
|
||||||
|
enum response {
|
||||||
|
B_UNKNOWN = 0,
|
||||||
|
B_LINEAR,
|
||||||
|
B_POLYNOMIAL,
|
||||||
|
B_EXPONENTIAL,
|
||||||
|
B_LOGARITHMIC
|
||||||
|
};
|
||||||
|
|
||||||
virtual type_code ValueType();
|
virtual type_code ValueType();
|
||||||
|
|
||||||
int32 CountItems();
|
float MinValue();
|
||||||
const char * ItemNameAt(
|
float MaxValue();
|
||||||
int32 index);
|
float ValueStep();
|
||||||
int32 ItemValueAt(
|
|
||||||
int32 index);
|
|
||||||
status_t AddItem(
|
|
||||||
int32 value,
|
|
||||||
const char * name);
|
|
||||||
status_t MakeItemsFromInputs();
|
|
||||||
status_t MakeItemsFromOutputs();
|
|
||||||
void MakeEmpty();
|
|
||||||
|
|
||||||
virtual ssize_t FlattenedSize() const;
|
void SetResponse(int response, float factor,
|
||||||
virtual status_t Flatten(void *buffer, ssize_t size) const;
|
float offset);
|
||||||
virtual status_t Unflatten(type_code c, const void *buf, ssize_t size);
|
void GetResponse(int* _response, float* factor,
|
||||||
|
float* offset);
|
||||||
|
|
||||||
|
virtual ssize_t FlattenedSize() const;
|
||||||
|
virtual status_t Flatten(void* buffer, ssize_t size) const;
|
||||||
|
virtual status_t Unflatten(type_code code, const void* buffer,
|
||||||
|
ssize_t size);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
/* Mmmh, stuffing! */
|
|
||||||
virtual status_t _Reserved_DiscreteParameter_0(void *);
|
|
||||||
virtual status_t _Reserved_DiscreteParameter_1(void *);
|
|
||||||
virtual status_t _Reserved_DiscreteParameter_2(void *);
|
|
||||||
virtual status_t _Reserved_DiscreteParameter_3(void *);
|
|
||||||
virtual status_t _Reserved_DiscreteParameter_4(void *);
|
|
||||||
virtual status_t _Reserved_DiscreteParameter_5(void *);
|
|
||||||
virtual status_t _Reserved_DiscreteParameter_6(void *);
|
|
||||||
virtual status_t _Reserved_DiscreteParameter_7(void *);
|
|
||||||
|
|
||||||
friend class BParameterGroup;
|
friend class BParameterGroup;
|
||||||
|
|
||||||
BList * mSelections;
|
BContinuousParameter(int32 id,
|
||||||
BList * mValues;
|
media_type mediaType,
|
||||||
uint32 _reserved_control_selector_[8];
|
BParameterWeb* web, const char* name,
|
||||||
|
const char* kind, const char* unit,
|
||||||
|
float min, float max, float step);
|
||||||
|
~BContinuousParameter();
|
||||||
|
|
||||||
BDiscreteParameter(
|
// reserved
|
||||||
int32 id,
|
virtual status_t _Reserved_ContinuousParameter_0(void*);
|
||||||
media_type m_type,
|
virtual status_t _Reserved_ContinuousParameter_1(void*);
|
||||||
BParameterWeb * web,
|
virtual status_t _Reserved_ContinuousParameter_2(void*);
|
||||||
const char * name,
|
virtual status_t _Reserved_ContinuousParameter_3(void*);
|
||||||
const char * kind);
|
virtual status_t _Reserved_ContinuousParameter_4(void*);
|
||||||
~BDiscreteParameter();
|
virtual status_t _Reserved_ContinuousParameter_5(void*);
|
||||||
};
|
virtual status_t _Reserved_ContinuousParameter_6(void*);
|
||||||
|
virtual status_t _Reserved_ContinuousParameter_7(void*);
|
||||||
|
|
||||||
class BNullParameter :
|
|
||||||
public BParameter
|
|
||||||
{
|
|
||||||
public:
|
|
||||||
|
|
||||||
virtual type_code ValueType();
|
|
||||||
|
|
||||||
virtual ssize_t FlattenedSize() const;
|
|
||||||
virtual status_t Flatten(void *buffer, ssize_t size) const;
|
|
||||||
virtual status_t Unflatten(type_code c, const void *buf, ssize_t size);
|
|
||||||
|
|
||||||
private:
|
private:
|
||||||
/* Mmmh, stuffing! */
|
float fMinimum;
|
||||||
virtual status_t _Reserved_NullParameter_0(void *);
|
float fMaximum;
|
||||||
virtual status_t _Reserved_NullParameter_1(void *);
|
float fStepping;
|
||||||
virtual status_t _Reserved_NullParameter_2(void *);
|
response fResponse;
|
||||||
virtual status_t _Reserved_NullParameter_3(void *);
|
float fFactor;
|
||||||
virtual status_t _Reserved_NullParameter_4(void *);
|
float fOffset;
|
||||||
virtual status_t _Reserved_NullParameter_5(void *);
|
|
||||||
virtual status_t _Reserved_NullParameter_6(void *);
|
uint32 _reserved[8];
|
||||||
virtual status_t _Reserved_NullParameter_7(void *);
|
|
||||||
|
|
||||||
friend class BParameterGroup;
|
|
||||||
|
|
||||||
uint32 _reserved_control_junction_[8];
|
|
||||||
|
|
||||||
BNullParameter(
|
|
||||||
int32 id,
|
|
||||||
media_type m_type,
|
|
||||||
BParameterWeb * web,
|
|
||||||
const char * name,
|
|
||||||
const char * kind);
|
|
||||||
~BNullParameter();
|
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
class BTextParameter :
|
class BDiscreteParameter : public BParameter {
|
||||||
public BParameter
|
|
||||||
{
|
|
||||||
public:
|
public:
|
||||||
|
virtual type_code ValueType();
|
||||||
|
|
||||||
size_t MaxBytes() const;
|
int32 CountItems();
|
||||||
virtual type_code ValueType();
|
const char* ItemNameAt(int32 index);
|
||||||
|
int32 ItemValueAt(int32 index);
|
||||||
|
status_t AddItem(int32 value, const char* name);
|
||||||
|
|
||||||
virtual ssize_t FlattenedSize() const;
|
status_t MakeItemsFromInputs();
|
||||||
virtual status_t Flatten(void *buffer, ssize_t size) const;
|
status_t MakeItemsFromOutputs();
|
||||||
virtual status_t Unflatten(type_code c, const void *buf, ssize_t size);
|
|
||||||
|
void MakeEmpty();
|
||||||
|
|
||||||
|
virtual ssize_t FlattenedSize() const;
|
||||||
|
virtual status_t Flatten(void* buffer, ssize_t size) const;
|
||||||
|
virtual status_t Unflatten(type_code code, const void* buffer,
|
||||||
|
ssize_t size);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
/* Mmmh, stuffing! */
|
|
||||||
virtual status_t _Reserved_TextParameter_0(void *);
|
|
||||||
virtual status_t _Reserved_TextParameter_1(void *);
|
|
||||||
virtual status_t _Reserved_TextParameter_2(void *);
|
|
||||||
virtual status_t _Reserved_TextParameter_3(void *);
|
|
||||||
virtual status_t _Reserved_TextParameter_4(void *);
|
|
||||||
virtual status_t _Reserved_TextParameter_5(void *);
|
|
||||||
virtual status_t _Reserved_TextParameter_6(void *);
|
|
||||||
virtual status_t _Reserved_TextParameter_7(void *);
|
|
||||||
|
|
||||||
friend class BParameterGroup;
|
friend class BParameterGroup;
|
||||||
|
|
||||||
uint32 mMaxBytes;
|
BDiscreteParameter(int32 id,
|
||||||
uint32 _reserved_control_junction_[8];
|
media_type mediaType,
|
||||||
|
BParameterWeb* web, const char* name,
|
||||||
|
const char* kind);
|
||||||
|
~BDiscreteParameter();
|
||||||
|
|
||||||
BTextParameter(
|
// reserved
|
||||||
int32 id,
|
virtual status_t _Reserved_DiscreteParameter_0(void*);
|
||||||
media_type m_type,
|
virtual status_t _Reserved_DiscreteParameter_1(void*);
|
||||||
BParameterWeb * web,
|
virtual status_t _Reserved_DiscreteParameter_2(void*);
|
||||||
const char * name,
|
virtual status_t _Reserved_DiscreteParameter_3(void*);
|
||||||
const char * kind,
|
virtual status_t _Reserved_DiscreteParameter_4(void*);
|
||||||
size_t max_bytes);
|
virtual status_t _Reserved_DiscreteParameter_5(void*);
|
||||||
~BTextParameter();
|
virtual status_t _Reserved_DiscreteParameter_6(void*);
|
||||||
|
virtual status_t _Reserved_DiscreteParameter_7(void*);
|
||||||
|
|
||||||
|
private:
|
||||||
|
BList* fSelections;
|
||||||
|
BList* fValues;
|
||||||
|
|
||||||
|
uint32 _reserved[8];
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif /* _CONTROL_WEB_H */
|
|
||||||
|
class BTextParameter : public BParameter {
|
||||||
|
public:
|
||||||
|
virtual type_code ValueType();
|
||||||
|
|
||||||
|
size_t MaxBytes() const;
|
||||||
|
|
||||||
|
virtual ssize_t FlattenedSize() const;
|
||||||
|
virtual status_t Flatten(void* buffer, ssize_t size) const;
|
||||||
|
virtual status_t Unflatten(type_code code, const void* buffer,
|
||||||
|
ssize_t size);
|
||||||
|
|
||||||
|
private:
|
||||||
|
friend class BParameterGroup;
|
||||||
|
|
||||||
|
BTextParameter(int32 id,
|
||||||
|
media_type mediaType,
|
||||||
|
BParameterWeb* web, const char* name,
|
||||||
|
const char* kind, size_t maxBytes);
|
||||||
|
~BTextParameter();
|
||||||
|
|
||||||
|
// reserved
|
||||||
|
virtual status_t _Reserved_TextParameter_0(void*);
|
||||||
|
virtual status_t _Reserved_TextParameter_1(void*);
|
||||||
|
virtual status_t _Reserved_TextParameter_2(void*);
|
||||||
|
virtual status_t _Reserved_TextParameter_3(void*);
|
||||||
|
virtual status_t _Reserved_TextParameter_4(void*);
|
||||||
|
virtual status_t _Reserved_TextParameter_5(void*);
|
||||||
|
virtual status_t _Reserved_TextParameter_6(void*);
|
||||||
|
virtual status_t _Reserved_TextParameter_7(void*);
|
||||||
|
|
||||||
|
private:
|
||||||
|
uint32 fMaxBytes;
|
||||||
|
|
||||||
|
uint32 _reserved[8];
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
|
class BNullParameter : public BParameter {
|
||||||
|
public:
|
||||||
|
virtual type_code ValueType();
|
||||||
|
|
||||||
|
virtual ssize_t FlattenedSize() const;
|
||||||
|
virtual status_t Flatten(void* buffer, ssize_t size) const;
|
||||||
|
virtual status_t Unflatten(type_code code, const void* buffer,
|
||||||
|
ssize_t size);
|
||||||
|
|
||||||
|
private:
|
||||||
|
friend class BParameterGroup;
|
||||||
|
|
||||||
|
BNullParameter(int32 id,
|
||||||
|
media_type mediaType,
|
||||||
|
BParameterWeb* web, const char* name,
|
||||||
|
const char* kind);
|
||||||
|
~BNullParameter();
|
||||||
|
|
||||||
|
// reserved
|
||||||
|
virtual status_t _Reserved_NullParameter_0(void*);
|
||||||
|
virtual status_t _Reserved_NullParameter_1(void*);
|
||||||
|
virtual status_t _Reserved_NullParameter_2(void*);
|
||||||
|
virtual status_t _Reserved_NullParameter_3(void*);
|
||||||
|
virtual status_t _Reserved_NullParameter_4(void*);
|
||||||
|
virtual status_t _Reserved_NullParameter_5(void*);
|
||||||
|
virtual status_t _Reserved_NullParameter_6(void*);
|
||||||
|
virtual status_t _Reserved_NullParameter_7(void*);
|
||||||
|
|
||||||
|
private:
|
||||||
|
uint32 _reserved[8];
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
|
#endif // _CONTROL_WEB_H
|
||||||
|
|||||||
@@ -116,13 +116,12 @@ BControllable::SetParameterWeb(BParameterWeb *web)
|
|||||||
fWeb = web;
|
fWeb = web;
|
||||||
|
|
||||||
if (fWeb)
|
if (fWeb)
|
||||||
fWeb->mNode = Node(); // initialize BParameterWeb member variable
|
fWeb->fNode = Node(); // initialize BParameterWeb member variable
|
||||||
|
|
||||||
UnlockParameterWeb();
|
UnlockParameterWeb();
|
||||||
if (old != web && web != 0)
|
if (old != web && web != 0)
|
||||||
BPrivate::media::notifications::WebChanged(Node());
|
BPrivate::media::notifications::WebChanged(Node());
|
||||||
if (old)
|
delete old;
|
||||||
delete old;
|
|
||||||
return B_OK;
|
return B_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
+618
-760
File diff suppressed because it is too large
Load Diff
Reference in New Issue
Block a user