2 * Copyright 2012, Gerasim Troeglazov (3dEyes**), 3dEyes@gmail.com.
4 * Distributed under the terms of the MIT License.
10 #include <Controllable.h>
11 #include <BufferProducer.h>
12 #include <BufferConsumer.h>
13 #include <MediaEventLooper.h>
20 #define BUFF_SIZE 0x2000
22 #define ID_AUDIO_INPUT 1
23 #define ID_AUDIO_OUTPUT 2
38 class VSTNode
: public BBufferConsumer
,
39 public BBufferProducer
,
41 public BMediaEventLooper
{
44 VSTNode(BMediaAddOn
*addon
, const char *name
,
48 virtual BMediaAddOn
*AddOn(int32
*id
) const;
49 virtual status_t
HandleMessage(int32 code
, const void *data
, size_t size
);
51 virtual void NodeRegistered();
54 virtual status_t
GetParameterValue(int32 id
, bigtime_t
*lastChangeTime
,
55 void *value
, size_t *size
);
56 virtual void SetParameterValue(int32 id
, bigtime_t changeTime
,
57 const void *value
, size_t size
);
60 virtual void BufferReceived(BBuffer
*buffer
);
61 virtual status_t
AcceptFormat(const media_destination
&dst
,
62 media_format
*format
);
63 virtual status_t
GetNextInput(int32
*cookie
, media_input
*input
);
64 virtual void DisposeInputCookie(int32 cookie
);
65 virtual status_t
FormatChanged(const media_source
&src
,
66 const media_destination
&dst
,
67 int32 change_tag
, const media_format
&format
);
68 virtual void ProducerDataStatus(const media_destination
&dst
,
71 virtual status_t
GetLatencyFor(const media_destination
&dst
,
73 media_node_id
*time_src
);
74 virtual status_t
Connected(const media_source
&src
,
75 const media_destination
&dst
,
76 const media_format
&format
,
78 virtual void Disconnected(const media_source
&src
,
79 const media_destination
&dst
);
82 virtual status_t
FormatSuggestionRequested(media_type type
,
83 int32 quality
, media_format
*format
);
84 virtual status_t
FormatProposal(const media_source
&src
,
85 media_format
*format
);
86 virtual status_t
FormatChangeRequested(const media_source
&src
,
87 const media_destination
&dst
,
90 virtual void LateNoticeReceived(const media_source
&src
,
91 bigtime_t late
, bigtime_t when
);
92 virtual status_t
GetNextOutput(int32
*cookie
, media_output
*output
);
93 virtual status_t
DisposeOutputCookie(int32 cookie
);
94 virtual status_t
SetBufferGroup(const media_source
&src
,
96 virtual status_t
PrepareToConnect(const media_source
&src
,
97 const media_destination
&dst
,
98 media_format
*format
, media_source
*out_source
,
100 virtual void Connect(status_t status
,
101 const media_source
&src
,
102 const media_destination
&dst
,
103 const media_format
&format
,
105 virtual void Disconnect(const media_source
&src
,
106 const media_destination
&dst
);
107 virtual void EnableOutput(const media_source
&src
,
108 bool enabled
, int32
* _deprecated_
);
109 virtual status_t
GetLatency(bigtime_t
*outLatency
);
110 virtual void LatencyChanged( const media_source
&src
,
111 const media_destination
&dst
,
112 bigtime_t latency
, uint32 flags
);
115 virtual bigtime_t
OfflineTime();
118 virtual void HandleEvent(const media_timed_event
*event
,
120 bool realTimeEvent
=false);
121 void ParameterEventProcessing(const media_timed_event
*event
);
122 status_t
ValidateFormat(const media_format
& preferredFormat
,
123 media_format
&proposedFormat
);
124 void SetOutputFormat(media_format
& ioFormat
);
125 virtual void InitParameterValues();
126 virtual void InitParameterWeb();
127 virtual void InitFilter();
128 virtual bigtime_t
GetFilterLatency();
129 virtual void FilterBuffer(BBuffer
* pBuffer
);
136 media_format fPreferredFormat
;
137 media_format fFormat
;
138 media_input fInputMedia
;
139 media_output fOutputMedia
;
140 bool fOutputMediaEnabled
;
141 bigtime_t fDownstreamLatency
;
142 bigtime_t fProcessLatency
;
147 bigtime_t fMuteLastChanged
;
148 bigtime_t fByPassLastChanged
;
151 #endif //__VST_NODE_H__