Style cleanup. 80 character line limit.

This commit is contained in:
threedeyes
2012-10-14 11:01:17 +00:00
parent 56bc38cef0
commit 6c874a26fc
11 changed files with 342 additions and 289 deletions
@@ -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.
*/
@@ -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.
*/
@@ -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.
*/
@@ -92,4 +93,3 @@ EqualizerAddOn::AutoStart(int count, BMediaNode **node, int32 *id, bool *more)
{
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.
*/
@@ -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.
*/
@@ -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.
*/
@@ -52,7 +53,8 @@ VSTAddOn::CountFlavors()
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())
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.
*/
@@ -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.
*/
@@ -88,7 +89,8 @@ VSTParameter::VSTParameter(VSTPlugin *plugin, int index)
}
if (valtest == false) {
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++;
}
}
@@ -316,7 +318,8 @@ VSTPlugin::LoadModule(const char *path)
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);
return VST_ERR_NO_MAINPROC;
}
@@ -546,7 +549,8 @@ VSTPlugin::Process(float *buffer, int samples, int channels)
}
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;
@@ -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.
*/
@@ -60,8 +61,10 @@
struct VSTEffect
{
int cookie;
int32 (*dispatcher)(struct VSTEffect*, int32, int32, int32, void*, float);
void (*process)(struct VSTEffect*, float**, float**, int32);
int32 (*dispatcher)(struct VSTEffect*, int32,
int32, int32, void*, float);
void (*process)(struct VSTEffect*, float**,
float**, int32);
void (*setParameter)(struct VSTEffect*, int32, float);
float (*getParameter)(struct VSTEffect*, int32);
int32 numPrograms;
@@ -77,7 +80,8 @@ struct VSTEffect
void* _notused_pointer4;
int32 ID;
char _notused_block2[4];
void (*processReplacing)(struct VSTEffect*, float**, float**, int);
void (*processReplacing)(struct VSTEffect*,
float**, float**, int);
};
//typedefs
@@ -1,5 +1,6 @@
/*
* Copyright 2012, Gerasim Troeglazov (3dEyes**), 3dEyes@gmail.com. All rights reserved.
* Copyright 2012, Gerasim Troeglazov (3dEyes**), 3dEyes@gmail.com.
* All rights reserved.
* Distributed under the terms of the MIT License.
*/
@@ -16,11 +17,13 @@
#include "VSTNode.h"
//VSTNode
VSTNode::~VSTNode() {
VSTNode::~VSTNode()
{
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),
BBufferProducer(B_MEDIA_RAW_AUDIO),
BControllable(),
@@ -35,7 +38,8 @@ VSTNode::VSTNode(BMediaAddOn* addon, const char *name, const char* path) : BMedi
}
//BMediaNode
BMediaAddOn* VSTNode::AddOn(int32 *id) const
BMediaAddOn*
VSTNode::AddOn(int32* id) const
{
if(fAddOn) {
*id = 0;
@@ -52,11 +56,10 @@ VSTNode::HandleMessage(int32 message, const void *data, size_t size)
(BControllable::HandleMessage(message, data, size) != B_OK) ) {
BMediaNode::HandleMessage(message, data, size);
return B_OK;
} else {
}
BMediaNode::HandleBadMessage(message, data, size);
return B_ERROR;
}
}
void
VSTNode::NodeRegistered()
@@ -67,7 +70,8 @@ VSTNode::NodeRegistered()
fPreferredFormat.type = B_MEDIA_RAW_AUDIO;
fPreferredFormat.u.raw_audio.buffer_size = BUFF_SIZE;
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;
fFormat.type = B_MEDIA_RAW_AUDIO;
@@ -93,7 +97,8 @@ VSTNode::NodeRegistered()
//BControllable
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) ||
*size < sizeof(int32)) {
@@ -139,13 +144,16 @@ VSTNode::GetParameterValue(int32 id, bigtime_t *lastChangeTime, void *value, siz
}
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;
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,
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);
}
}
@@ -159,14 +167,17 @@ VSTNode::BufferReceived(BBuffer *buffer)
return;
}
if(fOutputMedia.destination == media_destination::null || !fOutputMediaEnabled) {
if (fOutputMedia.destination == media_destination::null ||
!fOutputMediaEnabled) {
buffer->Recycle();
return;
}
FilterBuffer(buffer);
status_t err = SendBuffer(buffer, fOutputMedia.source, fOutputMedia.destination);
status_t err = SendBuffer(buffer, fOutputMedia.source,
fOutputMedia.destination);
if (err < B_OK) {
buffer->Recycle();
}
@@ -182,7 +193,8 @@ VSTNode::AcceptFormat(const media_destination &dst, media_format *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);
return B_OK;
@@ -212,7 +224,8 @@ VSTNode::FormatChanged(const media_source &src, const media_destination &dst,
}
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) {
SendDataStatus(status, fOutputMedia.destination, when);
@@ -223,7 +236,6 @@ status_t
VSTNode::GetLatencyFor( const media_destination &dst, bigtime_t* latency,
media_node_id* outTimeSource)
{
if (dst != fInputMedia.destination) {
return B_MEDIA_BAD_DESTINATION;
}
@@ -236,7 +248,7 @@ VSTNode::GetLatencyFor( const media_destination &dst, bigtime_t *latency,
status_t
VSTNode::Connected(const media_source& source,
const media_destination& destination, const media_format& format,
media_input* poInput)
media_input* input)
{
if (destination != fInputMedia.destination) {
return B_MEDIA_BAD_DESTINATION;
@@ -247,7 +259,7 @@ VSTNode::Connected(const media_source& source,
fInputMedia.source = source;
fInputMedia.format = format;
*poInput = fInputMedia;
*input = fInputMedia;
fFormat = format;
return B_OK;
@@ -268,7 +280,8 @@ VSTNode::Disconnected(const media_source &src, const media_destination &dst)
//BBufferProducer
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) {
return B_MEDIA_BAD_FORMAT;
@@ -293,21 +306,23 @@ VSTNode::FormatProposal(const media_source &src, media_format* 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);
return B_OK;
}
status_t
VSTNode::FormatChangeRequested(const media_source &src, const media_destination &dst,
media_format* format, int32* _deprecated_)
VSTNode::FormatChangeRequested(const media_source &src,
const media_destination &dst, media_format* format, int32* _deprecated_)
{
return B_MEDIA_BAD_FORMAT;
}
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) {
return;
@@ -335,6 +350,7 @@ VSTNode::DisposeOutputCookie(int32 cookie)
status_t
VSTNode::SetBufferGroup(const media_source &src, BBufferGroup* group)
{
status_t ret;
int32 changeTag;
if (src != fOutputMedia.source) {
@@ -343,14 +359,18 @@ VSTNode::SetBufferGroup(const media_source &src, BBufferGroup *group)
if (fInputMedia.source == media_source::null) {
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
VSTNode::PrepareToConnect( const media_source &src, const media_destination &dst,
media_format* format, media_source* out_source, char* name)
{
status_t ret = B_OK;
if (src != fOutputMedia.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;
}
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);
if(err < B_OK) {
return err;
if (ret < B_OK) {
return ret;
}
SetOutputFormat(*format);
@@ -382,10 +403,9 @@ VSTNode::PrepareToConnect( const media_source &src, const media_destination &dst
}
void
VSTNode::Connect(status_t status, const media_source &src, const media_destination &dst,
const media_format &format, char *name)
VSTNode::Connect(status_t status, const media_source &src,
const media_destination &dst, const media_format &format, char* name)
{
status_t err;
if (status < B_OK) {
fOutputMedia.destination = media_destination::null;
return;
@@ -396,7 +416,7 @@ VSTNode::Connect(status_t status, const media_source &src, const media_destinati
fFormat = format;
media_node_id timeSource;
err = FindLatencyFor(fOutputMedia.destination, &fDownstreamLatency, &timeSource);
FindLatencyFor(fOutputMedia.destination, &fDownstreamLatency, &timeSource);
InitFilter();
@@ -484,7 +504,8 @@ VSTNode::OfflineTime()
//VSTNode
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) {
ParameterEventProcessing(event);
@@ -559,7 +580,8 @@ VSTNode::ValidateFormat(const media_format &preferredFormat,
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) {
ret = B_MEDIA_BAD_FORMAT;
}
@@ -573,14 +595,16 @@ VSTNode::ValidateFormat(const media_format &preferredFormat,
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) {
ret = B_MEDIA_BAD_FORMAT;
}
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) {
ret = B_MEDIA_BAD_FORMAT;
}
@@ -611,7 +635,8 @@ VSTNode::SetOutputFormat(media_format &format)
f.format = media_raw_audio_format::B_AUDIO_FLOAT;
}
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) {
f.buffer_size = BUFF_SIZE;
@@ -643,7 +668,8 @@ VSTNode::InitParameterWeb()
}
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");
BParameter* value;
@@ -651,11 +677,15 @@ VSTNode::InitParameterWeb()
BParameterGroup* group;
BParameterGroup* fFControlGroup = fParamGroup->MakeGroup("FilterControl");
BParameterGroup *fCheckBoxGroup = switch_group_needed?fSwitchesGroup->MakeGroup("CheckBoxes") : NULL;
BParameterGroup *fSelectorsGroup = switch_group_needed?fSwitchesGroup->MakeGroup("Selectors") : NULL;
BParameterGroup* fCheckBoxGroup = switch_group_needed ?
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_BYPASS, B_MEDIA_NO_TYPE,"ByPass", B_ENABLE);
fFControlGroup->MakeDiscreteParameter(P_MUTE,
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++) {
VSTParameter *param = fPlugin->Parameter(i);
@@ -663,17 +693,21 @@ VSTNode::InitParameterWeb()
case VST_PARAM_CHECKBOX:
{
BString str;
str << param->Name() << " (" << param->MinimumValue() << "/" << param->MaximumValue() << ")";
value = fCheckBoxGroup->MakeDiscreteParameter(P_PARAM + param->Index(),
B_MEDIA_NO_TYPE, str.String(), B_ENABLE);
str << param->Name() << " (" << param->MinimumValue()
<< "/" << param->MaximumValue() << ")";
value = fCheckBoxGroup->MakeDiscreteParameter(
P_PARAM + param->Index(), B_MEDIA_NO_TYPE,
str.String(), B_ENABLE);
break;
}
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);
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;
}
@@ -766,9 +800,11 @@ VSTNode::GetFilterLatency()
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()->size_used = fOutputMedia.format.u.raw_audio.buffer_size;
@@ -1,5 +1,6 @@
/*
* Copyright 2012, Gerasim Troeglazov (3dEyes**), 3dEyes@gmail.com. All rights reserved.
* Copyright 2012, Gerasim Troeglazov (3dEyes**), 3dEyes@gmail.com.
* All rights reserved.
* Distributed under the terms of the MIT License.
*/
@@ -40,7 +41,8 @@ class VSTNode : public BBufferConsumer,
public BMediaEventLooper {
public:
virtual ~VSTNode();
VSTNode(BMediaAddOn *addon, const char *name, const char* path);
VSTNode(BMediaAddOn *addon, const char *name,
const char* path);
//BMediaNode
public:
virtual BMediaAddOn *AddOn(int32 *id) const;