2 * Copyright 2009, Haiku, Inc. All rights reserved.
3 * Distributed under the terms of the MIT License.
5 #ifndef _CONTROLLABLE_H
6 #define _CONTROLLABLE_H
15 class BControllable
: public virtual BMediaNode
{
17 virtual ~BControllable();
21 // Control change requests and notifications typically come in/go out in
22 // B_MEDIA_PARAMETERS type buffers (and a BControllable thus also needs
23 // to be a BBufferConsumer and/or a BBufferProducer).
24 // The format of these buffers is:
35 bool LockParameterWeb();
36 void UnlockParameterWeb();
42 // NOTE: Call SetParameterWeb() from your constructor!
43 status_t
SetParameterWeb(BParameterWeb
* web
);
45 virtual status_t
HandleMessage(int32 message
, const void* data
,
48 // Call when the actual control changes, NOT when the value changes.
49 // A typical case would be a CD with a Selector for Track when a new
51 status_t
BroadcastChangedParameter(int32 id
);
53 // Call this function when a value change takes effect, and
54 // you want people who are interested to stay in sync with you.
55 // Don't call this too densely, though, or you will flood the system
57 status_t
BroadcastNewParameterValue(
58 bigtime_t performanceTime
,
59 int32 parameterID
, void* newValue
,
62 // These are alternate methods of accomplishing the same thing as
63 // connecting to control information source/destinations would.
64 virtual status_t
GetParameterValue(int32 id
,
65 bigtime_t
* lastChange
,
66 void* value
, size_t* ioSize
) = 0;
68 virtual void SetParameterValue(int32 id
, bigtime_t when
,
69 const void* value
, size_t size
) = 0;
71 // The default implementation of StartControlPanel launches the add-on
72 // as an application (if the Node lives in an add-on). Thus, you can
73 // write your control panel as a "main()" in your add-on, and it'll
74 // automagically work! Your add-on needs to have multi-launch app flags
75 // for this to work right. The first argv argument to main() will be a
76 // string of the format "node=%d" with the node ID in question as "%d".
77 virtual status_t
StartControlPanel(BMessenger
* _messenger
);
79 // Call this from your BufferReceived() for control information buffers
80 // if you implement BBufferConsumer for that format (recommended!)
81 status_t
ApplyParameterData(const void* value
,
83 // If you want to generate control information for a set of controls, you
84 // can use this utility function.
85 status_t
MakeParameterData(const int32
* controls
,
86 int32 count
, void* buffer
, size_t* ioSize
);
88 // TODO: Needs a Perform() virtual method!
91 // FBC padding and forbidden methods
92 BControllable(const BControllable
& other
);
93 BControllable
& operator=(const BControllable
& other
);
95 virtual status_t
_Reserved_Controllable_0(void*);
96 virtual status_t
_Reserved_Controllable_1(void*);
97 virtual status_t
_Reserved_Controllable_2(void*);
98 virtual status_t
_Reserved_Controllable_3(void*);
99 virtual status_t
_Reserved_Controllable_4(void*);
100 virtual status_t
_Reserved_Controllable_5(void*);
101 virtual status_t
_Reserved_Controllable_6(void*);
102 virtual status_t
_Reserved_Controllable_7(void*);
103 virtual status_t
_Reserved_Controllable_8(void*);
104 virtual status_t
_Reserved_Controllable_9(void*);
105 virtual status_t
_Reserved_Controllable_10(void*);
106 virtual status_t
_Reserved_Controllable_11(void*);
107 virtual status_t
_Reserved_Controllable_12(void*);
108 virtual status_t
_Reserved_Controllable_13(void*);
109 virtual status_t
_Reserved_Controllable_14(void*);
110 virtual status_t
_Reserved_Controllable_15(void*);
113 friend class BMediaNode
;
119 uint32 _reserved_controllable_
[14];
123 #endif // _CONTROLLABLE_H