Style cleanup. 80 character line limit.
This commit is contained in:
@@ -1,5 +1,6 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright 2012, Gerasim Troeglazov (3dEyes**), [email protected]. All rights reserved.
|
* Copyright 2012, Gerasim Troeglazov (3dEyes**), [email protected].
|
||||||
|
* All rights reserved.
|
||||||
* Distributed under the terms of the MIT License.
|
* Distributed under the terms of the MIT License.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
|||||||
@@ -1,5 +1,6 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright 2012, Gerasim Troeglazov (3dEyes**), [email protected]. All rights reserved.
|
* Copyright 2012, Gerasim Troeglazov (3dEyes**), [email protected].
|
||||||
|
* All rights reserved.
|
||||||
* Distributed under the terms of the MIT License.
|
* Distributed under the terms of the MIT License.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
|||||||
@@ -1,5 +1,6 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright 2012, Gerasim Troeglazov (3dEyes**), [email protected]. All rights reserved.
|
* Copyright 2012, Gerasim Troeglazov (3dEyes**), [email protected].
|
||||||
|
* All rights reserved.
|
||||||
* Distributed under the terms of the MIT License.
|
* Distributed under the terms of the MIT License.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
@@ -92,4 +93,3 @@ EqualizerAddOn::AutoStart(int count, BMediaNode **node, int32 *id, bool *more)
|
|||||||
{
|
{
|
||||||
return B_OK;
|
return B_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -1,5 +1,6 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright 2012, Gerasim Troeglazov (3dEyes**), [email protected]. All rights reserved.
|
* Copyright 2012, Gerasim Troeglazov (3dEyes**), [email protected].
|
||||||
|
* All rights reserved.
|
||||||
* Distributed under the terms of the MIT License.
|
* Distributed under the terms of the MIT License.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
|||||||
@@ -1,5 +1,6 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright 2012, Gerasim Troeglazov (3dEyes**), [email protected]. All rights reserved.
|
* Copyright 2012, Gerasim Troeglazov (3dEyes**), [email protected].
|
||||||
|
* All rights reserved.
|
||||||
* Distributed under the terms of the MIT License.
|
* Distributed under the terms of the MIT License.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
|||||||
@@ -1,5 +1,6 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright 2012, Gerasim Troeglazov (3dEyes**), [email protected]. All rights reserved.
|
* Copyright 2012, Gerasim Troeglazov (3dEyes**), [email protected].
|
||||||
|
* All rights reserved.
|
||||||
* Distributed under the terms of the MIT License.
|
* Distributed under the terms of the MIT License.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
@@ -52,7 +53,8 @@ VSTAddOn::CountFlavors()
|
|||||||
return fPluginsList.CountItems();
|
return fPluginsList.CountItems();
|
||||||
}
|
}
|
||||||
|
|
||||||
status_t VSTAddOn::GetFlavorAt( int32 idx, const flavor_info **info)
|
status_t
|
||||||
|
VSTAddOn::GetFlavorAt(int32 idx, const flavor_info** info)
|
||||||
{
|
{
|
||||||
if (idx < 0 || idx >= fPluginsList.CountItems())
|
if (idx < 0 || idx >= fPluginsList.CountItems())
|
||||||
return B_ERROR;
|
return B_ERROR;
|
||||||
|
|||||||
@@ -1,5 +1,6 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright 2012, Gerasim Troeglazov (3dEyes**), [email protected]. All rights reserved.
|
* Copyright 2012, Gerasim Troeglazov (3dEyes**), [email protected].
|
||||||
|
* All rights reserved.
|
||||||
* Distributed under the terms of the MIT License.
|
* Distributed under the terms of the MIT License.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
|||||||
@@ -1,5 +1,6 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright 2012, Gerasim Troeglazov (3dEyes**), [email protected]. All rights reserved.
|
* Copyright 2012, Gerasim Troeglazov (3dEyes**), [email protected].
|
||||||
|
* All rights reserved.
|
||||||
* Distributed under the terms of the MIT License.
|
* Distributed under the terms of the MIT License.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
@@ -88,7 +89,8 @@ VSTParameter::VSTParameter(VSTPlugin *plugin, int index)
|
|||||||
}
|
}
|
||||||
if (valtest == false) {
|
if (valtest == false) {
|
||||||
test_values[test_cnt] = new_value;
|
test_values[test_cnt] = new_value;
|
||||||
fEffect->dispatcher(fEffect, VST_GET_PARAM_STR, index, 0, test_disp[test_cnt], 0);
|
fEffect->dispatcher(fEffect, VST_GET_PARAM_STR, index,
|
||||||
|
0, test_disp[test_cnt], 0);
|
||||||
test_cnt++;
|
test_cnt++;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -316,7 +318,8 @@ VSTPlugin::LoadModule(const char *path)
|
|||||||
return VST_ERR_NOT_LOADED;
|
return VST_ERR_NOT_LOADED;
|
||||||
}
|
}
|
||||||
|
|
||||||
if(get_image_symbol(fModule, "main_plugin", B_SYMBOL_TYPE_TEXT, (void**)&VSTMainProc) != B_OK) {
|
if (get_image_symbol(fModule, "main_plugin", B_SYMBOL_TYPE_TEXT,
|
||||||
|
(void**)&VSTMainProc) != B_OK) {
|
||||||
unload_add_on(fModule);
|
unload_add_on(fModule);
|
||||||
return VST_ERR_NO_MAINPROC;
|
return VST_ERR_NO_MAINPROC;
|
||||||
}
|
}
|
||||||
@@ -546,7 +549,8 @@ VSTPlugin::Process(float *buffer, int samples, int channels)
|
|||||||
}
|
}
|
||||||
|
|
||||||
static int32
|
static int32
|
||||||
VHostCallback(VSTEffect* effect, int32 opcode, int32 index, int32 value, void* ptr, float opt)
|
VHostCallback(VSTEffect* effect, int32 opcode, int32 index, int32 value,
|
||||||
|
void* ptr, float opt)
|
||||||
{
|
{
|
||||||
intptr_t result = 0;
|
intptr_t result = 0;
|
||||||
|
|
||||||
|
|||||||
@@ -1,5 +1,6 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright 2012, Gerasim Troeglazov (3dEyes**), [email protected]. All rights reserved.
|
* Copyright 2012, Gerasim Troeglazov (3dEyes**), [email protected].
|
||||||
|
* All rights reserved.
|
||||||
* Distributed under the terms of the MIT License.
|
* Distributed under the terms of the MIT License.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
@@ -60,8 +61,10 @@
|
|||||||
struct VSTEffect
|
struct VSTEffect
|
||||||
{
|
{
|
||||||
int cookie;
|
int cookie;
|
||||||
int32 (*dispatcher)(struct VSTEffect*, int32, int32, int32, void*, float);
|
int32 (*dispatcher)(struct VSTEffect*, int32,
|
||||||
void (*process)(struct VSTEffect*, float**, float**, int32);
|
int32, int32, void*, float);
|
||||||
|
void (*process)(struct VSTEffect*, float**,
|
||||||
|
float**, int32);
|
||||||
void (*setParameter)(struct VSTEffect*, int32, float);
|
void (*setParameter)(struct VSTEffect*, int32, float);
|
||||||
float (*getParameter)(struct VSTEffect*, int32);
|
float (*getParameter)(struct VSTEffect*, int32);
|
||||||
int32 numPrograms;
|
int32 numPrograms;
|
||||||
@@ -77,7 +80,8 @@ struct VSTEffect
|
|||||||
void* _notused_pointer4;
|
void* _notused_pointer4;
|
||||||
int32 ID;
|
int32 ID;
|
||||||
char _notused_block2[4];
|
char _notused_block2[4];
|
||||||
void (*processReplacing)(struct VSTEffect*, float**, float**, int);
|
void (*processReplacing)(struct VSTEffect*,
|
||||||
|
float**, float**, int);
|
||||||
};
|
};
|
||||||
|
|
||||||
//typedefs
|
//typedefs
|
||||||
|
|||||||
@@ -1,5 +1,6 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright 2012, Gerasim Troeglazov (3dEyes**), [email protected]. All rights reserved.
|
* Copyright 2012, Gerasim Troeglazov (3dEyes**), [email protected].
|
||||||
|
* All rights reserved.
|
||||||
* Distributed under the terms of the MIT License.
|
* Distributed under the terms of the MIT License.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
@@ -16,11 +17,13 @@
|
|||||||
#include "VSTNode.h"
|
#include "VSTNode.h"
|
||||||
|
|
||||||
//VSTNode
|
//VSTNode
|
||||||
VSTNode::~VSTNode() {
|
VSTNode::~VSTNode()
|
||||||
|
{
|
||||||
Quit();
|
Quit();
|
||||||
}
|
}
|
||||||
|
|
||||||
VSTNode::VSTNode(BMediaAddOn* addon, const char *name, const char* path) : BMediaNode(name),
|
VSTNode::VSTNode(BMediaAddOn* addon, const char* name, const char* path)
|
||||||
|
: BMediaNode(name),
|
||||||
BBufferConsumer(B_MEDIA_RAW_AUDIO),
|
BBufferConsumer(B_MEDIA_RAW_AUDIO),
|
||||||
BBufferProducer(B_MEDIA_RAW_AUDIO),
|
BBufferProducer(B_MEDIA_RAW_AUDIO),
|
||||||
BControllable(),
|
BControllable(),
|
||||||
@@ -35,7 +38,8 @@ VSTNode::VSTNode(BMediaAddOn* addon, const char *name, const char* path) : BMedi
|
|||||||
}
|
}
|
||||||
|
|
||||||
//BMediaNode
|
//BMediaNode
|
||||||
BMediaAddOn* VSTNode::AddOn(int32 *id) const
|
BMediaAddOn*
|
||||||
|
VSTNode::AddOn(int32* id) const
|
||||||
{
|
{
|
||||||
if(fAddOn) {
|
if(fAddOn) {
|
||||||
*id = 0;
|
*id = 0;
|
||||||
@@ -52,11 +56,10 @@ VSTNode::HandleMessage(int32 message, const void *data, size_t size)
|
|||||||
(BControllable::HandleMessage(message, data, size) != B_OK) ) {
|
(BControllable::HandleMessage(message, data, size) != B_OK) ) {
|
||||||
BMediaNode::HandleMessage(message, data, size);
|
BMediaNode::HandleMessage(message, data, size);
|
||||||
return B_OK;
|
return B_OK;
|
||||||
} else {
|
}
|
||||||
BMediaNode::HandleBadMessage(message, data, size);
|
BMediaNode::HandleBadMessage(message, data, size);
|
||||||
return B_ERROR;
|
return B_ERROR;
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
void
|
void
|
||||||
VSTNode::NodeRegistered()
|
VSTNode::NodeRegistered()
|
||||||
@@ -67,7 +70,8 @@ VSTNode::NodeRegistered()
|
|||||||
fPreferredFormat.type = B_MEDIA_RAW_AUDIO;
|
fPreferredFormat.type = B_MEDIA_RAW_AUDIO;
|
||||||
fPreferredFormat.u.raw_audio.buffer_size = BUFF_SIZE;
|
fPreferredFormat.u.raw_audio.buffer_size = BUFF_SIZE;
|
||||||
fPreferredFormat.u.raw_audio = media_raw_audio_format::wildcard;
|
fPreferredFormat.u.raw_audio = media_raw_audio_format::wildcard;
|
||||||
fPreferredFormat.u.raw_audio.channel_count = media_raw_audio_format::wildcard.channel_count;
|
fPreferredFormat.u.raw_audio.channel_count =
|
||||||
|
media_raw_audio_format::wildcard.channel_count;
|
||||||
fPreferredFormat.u.raw_audio.format = media_raw_audio_format::B_AUDIO_FLOAT;
|
fPreferredFormat.u.raw_audio.format = media_raw_audio_format::B_AUDIO_FLOAT;
|
||||||
|
|
||||||
fFormat.type = B_MEDIA_RAW_AUDIO;
|
fFormat.type = B_MEDIA_RAW_AUDIO;
|
||||||
@@ -93,7 +97,8 @@ VSTNode::NodeRegistered()
|
|||||||
|
|
||||||
//BControllable
|
//BControllable
|
||||||
status_t
|
status_t
|
||||||
VSTNode::GetParameterValue(int32 id, bigtime_t *lastChangeTime, void *value, size_t *size)
|
VSTNode::GetParameterValue(int32 id, bigtime_t* lastChangeTime, void* value,
|
||||||
|
size_t *size)
|
||||||
{
|
{
|
||||||
if (*size < sizeof(float) ||
|
if (*size < sizeof(float) ||
|
||||||
*size < sizeof(int32)) {
|
*size < sizeof(int32)) {
|
||||||
@@ -139,13 +144,16 @@ VSTNode::GetParameterValue(int32 id, bigtime_t *lastChangeTime, void *value, siz
|
|||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
VSTNode::SetParameterValue(int32 id, bigtime_t time, const void *value, size_t size)
|
VSTNode::SetParameterValue(int32 id, bigtime_t time, const void* value,
|
||||||
|
size_t size)
|
||||||
{
|
{
|
||||||
int32 idx = id - P_PARAM;
|
int32 idx = id - P_PARAM;
|
||||||
if((idx >= 0 && idx < fPlugin->ParametersCount()) || id == P_MUTE || id == P_BYPASS) {
|
if ((idx >= 0 && idx < fPlugin->ParametersCount()) || id == P_MUTE ||
|
||||||
|
id == P_BYPASS) {
|
||||||
media_timed_event ev(time, BTimedEventQueue::B_PARAMETER, (void*)value,
|
media_timed_event ev(time, BTimedEventQueue::B_PARAMETER, (void*)value,
|
||||||
BTimedEventQueue::B_NO_CLEANUP, size, id, "VSTParam");
|
BTimedEventQueue::B_NO_CLEANUP, size, id, "VSTParam");
|
||||||
ParameterEventProcessing(&ev); //dirty hack for parameter processing (mediakit bug????)
|
//dirty hack for parameter processing (mediakit bug????)
|
||||||
|
ParameterEventProcessing(&ev);
|
||||||
EventQueue()->AddEvent(ev);
|
EventQueue()->AddEvent(ev);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -159,14 +167,17 @@ VSTNode::BufferReceived(BBuffer *buffer)
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if(fOutputMedia.destination == media_destination::null || !fOutputMediaEnabled) {
|
if (fOutputMedia.destination == media_destination::null ||
|
||||||
|
!fOutputMediaEnabled) {
|
||||||
buffer->Recycle();
|
buffer->Recycle();
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
FilterBuffer(buffer);
|
FilterBuffer(buffer);
|
||||||
|
|
||||||
status_t err = SendBuffer(buffer, fOutputMedia.source, fOutputMedia.destination);
|
status_t err = SendBuffer(buffer, fOutputMedia.source,
|
||||||
|
fOutputMedia.destination);
|
||||||
|
|
||||||
if (err < B_OK) {
|
if (err < B_OK) {
|
||||||
buffer->Recycle();
|
buffer->Recycle();
|
||||||
}
|
}
|
||||||
@@ -182,7 +193,8 @@ VSTNode::AcceptFormat(const media_destination &dst, media_format *format)
|
|||||||
return B_MEDIA_BAD_FORMAT;
|
return B_MEDIA_BAD_FORMAT;
|
||||||
}
|
}
|
||||||
|
|
||||||
ValidateFormat((fFormat.u.raw_audio.format != media_raw_audio_format::wildcard.format) ?
|
ValidateFormat(
|
||||||
|
(fFormat.u.raw_audio.format != media_raw_audio_format::wildcard.format) ?
|
||||||
fFormat : fPreferredFormat, *format);
|
fFormat : fPreferredFormat, *format);
|
||||||
|
|
||||||
return B_OK;
|
return B_OK;
|
||||||
@@ -212,7 +224,8 @@ VSTNode::FormatChanged(const media_source &src, const media_destination &dst,
|
|||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
VSTNode::ProducerDataStatus(const media_destination &dst, int32 status, bigtime_t when)
|
VSTNode::ProducerDataStatus(const media_destination &dst, int32 status,
|
||||||
|
bigtime_t when)
|
||||||
{
|
{
|
||||||
if (fOutputMedia.destination != media_destination::null) {
|
if (fOutputMedia.destination != media_destination::null) {
|
||||||
SendDataStatus(status, fOutputMedia.destination, when);
|
SendDataStatus(status, fOutputMedia.destination, when);
|
||||||
@@ -223,7 +236,6 @@ status_t
|
|||||||
VSTNode::GetLatencyFor( const media_destination &dst, bigtime_t* latency,
|
VSTNode::GetLatencyFor( const media_destination &dst, bigtime_t* latency,
|
||||||
media_node_id* outTimeSource)
|
media_node_id* outTimeSource)
|
||||||
{
|
{
|
||||||
|
|
||||||
if (dst != fInputMedia.destination) {
|
if (dst != fInputMedia.destination) {
|
||||||
return B_MEDIA_BAD_DESTINATION;
|
return B_MEDIA_BAD_DESTINATION;
|
||||||
}
|
}
|
||||||
@@ -236,7 +248,7 @@ VSTNode::GetLatencyFor( const media_destination &dst, bigtime_t *latency,
|
|||||||
status_t
|
status_t
|
||||||
VSTNode::Connected(const media_source& source,
|
VSTNode::Connected(const media_source& source,
|
||||||
const media_destination& destination, const media_format& format,
|
const media_destination& destination, const media_format& format,
|
||||||
media_input* poInput)
|
media_input* input)
|
||||||
{
|
{
|
||||||
if (destination != fInputMedia.destination) {
|
if (destination != fInputMedia.destination) {
|
||||||
return B_MEDIA_BAD_DESTINATION;
|
return B_MEDIA_BAD_DESTINATION;
|
||||||
@@ -247,7 +259,7 @@ VSTNode::Connected(const media_source& source,
|
|||||||
|
|
||||||
fInputMedia.source = source;
|
fInputMedia.source = source;
|
||||||
fInputMedia.format = format;
|
fInputMedia.format = format;
|
||||||
*poInput = fInputMedia;
|
*input = fInputMedia;
|
||||||
fFormat = format;
|
fFormat = format;
|
||||||
|
|
||||||
return B_OK;
|
return B_OK;
|
||||||
@@ -268,7 +280,8 @@ VSTNode::Disconnected(const media_source &src, const media_destination &dst)
|
|||||||
|
|
||||||
//BBufferProducer
|
//BBufferProducer
|
||||||
status_t
|
status_t
|
||||||
VSTNode::FormatSuggestionRequested(media_type type, int32 quality, media_format *format)
|
VSTNode::FormatSuggestionRequested(media_type type, int32 quality,
|
||||||
|
media_format* format)
|
||||||
{
|
{
|
||||||
if (type != B_MEDIA_RAW_AUDIO) {
|
if (type != B_MEDIA_RAW_AUDIO) {
|
||||||
return B_MEDIA_BAD_FORMAT;
|
return B_MEDIA_BAD_FORMAT;
|
||||||
@@ -293,21 +306,23 @@ VSTNode::FormatProposal(const media_source &src, media_format* format)
|
|||||||
return B_MEDIA_BAD_FORMAT;
|
return B_MEDIA_BAD_FORMAT;
|
||||||
}
|
}
|
||||||
|
|
||||||
ValidateFormat((fFormat.u.raw_audio.format != media_raw_audio_format::wildcard.format) ?
|
ValidateFormat(
|
||||||
|
(fFormat.u.raw_audio.format != media_raw_audio_format::wildcard.format) ?
|
||||||
fFormat : fPreferredFormat, *format);
|
fFormat : fPreferredFormat, *format);
|
||||||
|
|
||||||
return B_OK;
|
return B_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
status_t
|
status_t
|
||||||
VSTNode::FormatChangeRequested(const media_source &src, const media_destination &dst,
|
VSTNode::FormatChangeRequested(const media_source &src,
|
||||||
media_format* format, int32* _deprecated_)
|
const media_destination &dst, media_format* format, int32* _deprecated_)
|
||||||
{
|
{
|
||||||
return B_MEDIA_BAD_FORMAT;
|
return B_MEDIA_BAD_FORMAT;
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
VSTNode::LateNoticeReceived(const media_source &src, bigtime_t late, bigtime_t when)
|
VSTNode::LateNoticeReceived(const media_source &src,
|
||||||
|
bigtime_t late, bigtime_t when)
|
||||||
{
|
{
|
||||||
if (src != fOutputMedia.source || fInputMedia.source == media_source::null) {
|
if (src != fOutputMedia.source || fInputMedia.source == media_source::null) {
|
||||||
return;
|
return;
|
||||||
@@ -335,6 +350,7 @@ VSTNode::DisposeOutputCookie(int32 cookie)
|
|||||||
status_t
|
status_t
|
||||||
VSTNode::SetBufferGroup(const media_source &src, BBufferGroup* group)
|
VSTNode::SetBufferGroup(const media_source &src, BBufferGroup* group)
|
||||||
{
|
{
|
||||||
|
status_t ret;
|
||||||
int32 changeTag;
|
int32 changeTag;
|
||||||
|
|
||||||
if (src != fOutputMedia.source) {
|
if (src != fOutputMedia.source) {
|
||||||
@@ -343,14 +359,18 @@ VSTNode::SetBufferGroup(const media_source &src, BBufferGroup *group)
|
|||||||
if (fInputMedia.source == media_source::null) {
|
if (fInputMedia.source == media_source::null) {
|
||||||
return B_ERROR;
|
return B_ERROR;
|
||||||
}
|
}
|
||||||
|
ret = SetOutputBuffersFor(fInputMedia.source, fInputMedia.destination,
|
||||||
|
group, 0, &changeTag);
|
||||||
|
|
||||||
return SetOutputBuffersFor(fInputMedia.source, fInputMedia.destination, group, 0, &changeTag);
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
status_t
|
status_t
|
||||||
VSTNode::PrepareToConnect( const media_source &src, const media_destination &dst,
|
VSTNode::PrepareToConnect( const media_source &src, const media_destination &dst,
|
||||||
media_format* format, media_source* out_source, char* name)
|
media_format* format, media_source* out_source, char* name)
|
||||||
{
|
{
|
||||||
|
status_t ret = B_OK;
|
||||||
|
|
||||||
if (src != fOutputMedia.source) {
|
if (src != fOutputMedia.source) {
|
||||||
return B_MEDIA_BAD_SOURCE;
|
return B_MEDIA_BAD_SOURCE;
|
||||||
}
|
}
|
||||||
@@ -363,11 +383,12 @@ VSTNode::PrepareToConnect( const media_source &src, const media_destination &dst
|
|||||||
return B_MEDIA_ALREADY_CONNECTED;
|
return B_MEDIA_ALREADY_CONNECTED;
|
||||||
}
|
}
|
||||||
|
|
||||||
status_t err = ValidateFormat((fFormat.u.raw_audio.format != media_raw_audio_format::wildcard.format) ?
|
ret = ValidateFormat(
|
||||||
|
(fFormat.u.raw_audio.format != media_raw_audio_format::wildcard.format) ?
|
||||||
fFormat : fPreferredFormat, *format);
|
fFormat : fPreferredFormat, *format);
|
||||||
|
|
||||||
if(err < B_OK) {
|
if (ret < B_OK) {
|
||||||
return err;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
SetOutputFormat(*format);
|
SetOutputFormat(*format);
|
||||||
@@ -382,10 +403,9 @@ VSTNode::PrepareToConnect( const media_source &src, const media_destination &dst
|
|||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
VSTNode::Connect(status_t status, const media_source &src, const media_destination &dst,
|
VSTNode::Connect(status_t status, const media_source &src,
|
||||||
const media_format &format, char *name)
|
const media_destination &dst, const media_format &format, char* name)
|
||||||
{
|
{
|
||||||
status_t err;
|
|
||||||
if (status < B_OK) {
|
if (status < B_OK) {
|
||||||
fOutputMedia.destination = media_destination::null;
|
fOutputMedia.destination = media_destination::null;
|
||||||
return;
|
return;
|
||||||
@@ -396,7 +416,7 @@ VSTNode::Connect(status_t status, const media_source &src, const media_destinati
|
|||||||
fFormat = format;
|
fFormat = format;
|
||||||
|
|
||||||
media_node_id timeSource;
|
media_node_id timeSource;
|
||||||
err = FindLatencyFor(fOutputMedia.destination, &fDownstreamLatency, &timeSource);
|
FindLatencyFor(fOutputMedia.destination, &fDownstreamLatency, &timeSource);
|
||||||
|
|
||||||
InitFilter();
|
InitFilter();
|
||||||
|
|
||||||
@@ -484,7 +504,8 @@ VSTNode::OfflineTime()
|
|||||||
|
|
||||||
//VSTNode
|
//VSTNode
|
||||||
void
|
void
|
||||||
VSTNode::HandleEvent(const media_timed_event *event, bigtime_t late, bool realTime)
|
VSTNode::HandleEvent(const media_timed_event *event, bigtime_t late,
|
||||||
|
bool realTime)
|
||||||
{
|
{
|
||||||
if(event->type == BTimedEventQueue::B_PARAMETER) {
|
if(event->type == BTimedEventQueue::B_PARAMETER) {
|
||||||
ParameterEventProcessing(event);
|
ParameterEventProcessing(event);
|
||||||
@@ -559,7 +580,8 @@ VSTNode::ValidateFormat(const media_format &preferredFormat,
|
|||||||
f.frame_rate = pref.frame_rate;
|
f.frame_rate = pref.frame_rate;
|
||||||
}
|
}
|
||||||
|
|
||||||
if(pref.channel_count != wild.channel_count && f.channel_count != pref.channel_count) {
|
if(pref.channel_count != wild.channel_count &&
|
||||||
|
f.channel_count != pref.channel_count) {
|
||||||
if(f.channel_count != wild.channel_count) {
|
if(f.channel_count != wild.channel_count) {
|
||||||
ret = B_MEDIA_BAD_FORMAT;
|
ret = B_MEDIA_BAD_FORMAT;
|
||||||
}
|
}
|
||||||
@@ -573,14 +595,16 @@ VSTNode::ValidateFormat(const media_format &preferredFormat,
|
|||||||
f.format = pref.format;
|
f.format = pref.format;
|
||||||
}
|
}
|
||||||
|
|
||||||
if(pref.byte_order != wild.byte_order && f.byte_order != pref.byte_order) {
|
if(pref.byte_order != wild.byte_order &&
|
||||||
|
f.byte_order != pref.byte_order) {
|
||||||
if(f.byte_order != wild.byte_order) {
|
if(f.byte_order != wild.byte_order) {
|
||||||
ret = B_MEDIA_BAD_FORMAT;
|
ret = B_MEDIA_BAD_FORMAT;
|
||||||
}
|
}
|
||||||
f.byte_order = pref.byte_order;
|
f.byte_order = pref.byte_order;
|
||||||
}
|
}
|
||||||
|
|
||||||
if(pref.buffer_size != wild.buffer_size && f.buffer_size != pref.buffer_size) {
|
if(pref.buffer_size != wild.buffer_size &&
|
||||||
|
f.buffer_size != pref.buffer_size) {
|
||||||
if(f.buffer_size != wild.buffer_size) {
|
if(f.buffer_size != wild.buffer_size) {
|
||||||
ret = B_MEDIA_BAD_FORMAT;
|
ret = B_MEDIA_BAD_FORMAT;
|
||||||
}
|
}
|
||||||
@@ -611,7 +635,8 @@ VSTNode::SetOutputFormat(media_format &format)
|
|||||||
f.format = media_raw_audio_format::B_AUDIO_FLOAT;
|
f.format = media_raw_audio_format::B_AUDIO_FLOAT;
|
||||||
}
|
}
|
||||||
if (f.byte_order == w.format) {
|
if (f.byte_order == w.format) {
|
||||||
f.byte_order = (B_HOST_IS_BENDIAN)?B_MEDIA_BIG_ENDIAN:B_MEDIA_LITTLE_ENDIAN;
|
f.byte_order = (B_HOST_IS_BENDIAN) ?
|
||||||
|
B_MEDIA_BIG_ENDIAN : B_MEDIA_LITTLE_ENDIAN;
|
||||||
}
|
}
|
||||||
if (f.buffer_size == w.buffer_size) {
|
if (f.buffer_size == w.buffer_size) {
|
||||||
f.buffer_size = BUFF_SIZE;
|
f.buffer_size = BUFF_SIZE;
|
||||||
@@ -643,7 +668,8 @@ VSTNode::InitParameterWeb()
|
|||||||
}
|
}
|
||||||
|
|
||||||
BParameterGroup* fParamGroup = fWeb->MakeGroup("Parameters");
|
BParameterGroup* fParamGroup = fWeb->MakeGroup("Parameters");
|
||||||
BParameterGroup *fSwitchesGroup = switch_group_needed?fWeb->MakeGroup("Switches"):NULL;
|
BParameterGroup* fSwitchesGroup = switch_group_needed ?
|
||||||
|
fWeb->MakeGroup("Switches") : NULL;
|
||||||
BParameterGroup* fAboutGroup = fWeb->MakeGroup("About");
|
BParameterGroup* fAboutGroup = fWeb->MakeGroup("About");
|
||||||
|
|
||||||
BParameter* value;
|
BParameter* value;
|
||||||
@@ -651,11 +677,15 @@ VSTNode::InitParameterWeb()
|
|||||||
BParameterGroup* group;
|
BParameterGroup* group;
|
||||||
|
|
||||||
BParameterGroup* fFControlGroup = fParamGroup->MakeGroup("FilterControl");
|
BParameterGroup* fFControlGroup = fParamGroup->MakeGroup("FilterControl");
|
||||||
BParameterGroup *fCheckBoxGroup = switch_group_needed?fSwitchesGroup->MakeGroup("CheckBoxes") : NULL;
|
BParameterGroup* fCheckBoxGroup = switch_group_needed ?
|
||||||
BParameterGroup *fSelectorsGroup = switch_group_needed?fSwitchesGroup->MakeGroup("Selectors") : NULL;
|
fSwitchesGroup->MakeGroup("CheckBoxes") : NULL;
|
||||||
|
BParameterGroup* fSelectorsGroup = switch_group_needed ?
|
||||||
|
fSwitchesGroup->MakeGroup("Selectors") : NULL;
|
||||||
|
|
||||||
fFControlGroup->MakeDiscreteParameter(P_MUTE, B_MEDIA_NO_TYPE,"Mute", B_ENABLE);
|
fFControlGroup->MakeDiscreteParameter(P_MUTE,
|
||||||
fFControlGroup->MakeDiscreteParameter(P_BYPASS, B_MEDIA_NO_TYPE,"ByPass", B_ENABLE);
|
B_MEDIA_NO_TYPE,"Mute", B_ENABLE);
|
||||||
|
fFControlGroup->MakeDiscreteParameter(P_BYPASS,
|
||||||
|
B_MEDIA_NO_TYPE,"ByPass", B_ENABLE);
|
||||||
|
|
||||||
for(int i = 0; i < fPlugin->ParametersCount(); i++) {
|
for(int i = 0; i < fPlugin->ParametersCount(); i++) {
|
||||||
VSTParameter *param = fPlugin->Parameter(i);
|
VSTParameter *param = fPlugin->Parameter(i);
|
||||||
@@ -663,17 +693,21 @@ VSTNode::InitParameterWeb()
|
|||||||
case VST_PARAM_CHECKBOX:
|
case VST_PARAM_CHECKBOX:
|
||||||
{
|
{
|
||||||
BString str;
|
BString str;
|
||||||
str << param->Name() << " (" << param->MinimumValue() << "/" << param->MaximumValue() << ")";
|
str << param->Name() << " (" << param->MinimumValue()
|
||||||
value = fCheckBoxGroup->MakeDiscreteParameter(P_PARAM + param->Index(),
|
<< "/" << param->MaximumValue() << ")";
|
||||||
B_MEDIA_NO_TYPE, str.String(), B_ENABLE);
|
value = fCheckBoxGroup->MakeDiscreteParameter(
|
||||||
|
P_PARAM + param->Index(), B_MEDIA_NO_TYPE,
|
||||||
|
str.String(), B_ENABLE);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case VST_PARAM_DROPLIST:
|
case VST_PARAM_DROPLIST:
|
||||||
{
|
{
|
||||||
BDiscreteParameter *dvalue = fSelectorsGroup->MakeDiscreteParameter(P_PARAM + param->Index(),
|
BDiscreteParameter *dvalue =
|
||||||
|
fSelectorsGroup->MakeDiscreteParameter(P_PARAM + param->Index(),
|
||||||
B_MEDIA_NO_TYPE, param->Name(), B_OUTPUT_MUX);
|
B_MEDIA_NO_TYPE, param->Name(), B_OUTPUT_MUX);
|
||||||
for(int j = 0; j < param->ListCount(); j++) {
|
for(int j = 0; j < param->ListCount(); j++) {
|
||||||
dvalue->AddItem( param->ListItemAt(j)->Index, param->ListItemAt(j)->Name.String());
|
dvalue->AddItem( param->ListItemAt(j)->Index,
|
||||||
|
param->ListItemAt(j)->Name.String());
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
@@ -766,9 +800,11 @@ VSTNode::GetFilterLatency()
|
|||||||
return 0LL;
|
return 0LL;
|
||||||
}
|
}
|
||||||
|
|
||||||
BBufferGroup *temp_group = new BBufferGroup(fOutputMedia.format.u.raw_audio.buffer_size, 1);
|
BBufferGroup* temp_group =
|
||||||
|
new BBufferGroup(fOutputMedia.format.u.raw_audio.buffer_size, 1);
|
||||||
|
|
||||||
BBuffer *buffer = temp_group->RequestBuffer(fOutputMedia.format.u.raw_audio.buffer_size);
|
BBuffer *buffer =
|
||||||
|
temp_group->RequestBuffer(fOutputMedia.format.u.raw_audio.buffer_size);
|
||||||
buffer->Header()->type = B_MEDIA_RAW_AUDIO;
|
buffer->Header()->type = B_MEDIA_RAW_AUDIO;
|
||||||
buffer->Header()->size_used = fOutputMedia.format.u.raw_audio.buffer_size;
|
buffer->Header()->size_used = fOutputMedia.format.u.raw_audio.buffer_size;
|
||||||
|
|
||||||
|
|||||||
@@ -1,5 +1,6 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright 2012, Gerasim Troeglazov (3dEyes**), [email protected]. All rights reserved.
|
* Copyright 2012, Gerasim Troeglazov (3dEyes**), [email protected].
|
||||||
|
* All rights reserved.
|
||||||
* Distributed under the terms of the MIT License.
|
* Distributed under the terms of the MIT License.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
@@ -40,7 +41,8 @@ class VSTNode : public BBufferConsumer,
|
|||||||
public BMediaEventLooper {
|
public BMediaEventLooper {
|
||||||
public:
|
public:
|
||||||
virtual ~VSTNode();
|
virtual ~VSTNode();
|
||||||
VSTNode(BMediaAddOn *addon, const char *name, const char* path);
|
VSTNode(BMediaAddOn *addon, const char *name,
|
||||||
|
const char* path);
|
||||||
//BMediaNode
|
//BMediaNode
|
||||||
public:
|
public:
|
||||||
virtual BMediaAddOn *AddOn(int32 *id) const;
|
virtual BMediaAddOn *AddOn(int32 *id) const;
|
||||||
|
|||||||
Reference in New Issue
Block a user