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.
|
||||
*/
|
||||
|
||||
@@ -54,7 +55,7 @@ Equalizer::PreAmp(void)
|
||||
void
|
||||
Equalizer::SetBand(int band, double value)
|
||||
{
|
||||
if(band < 0 || band >= BandCount()) {
|
||||
if (band < 0 || band >= BandCount()) {
|
||||
return;
|
||||
}
|
||||
fBands[band] = value;
|
||||
@@ -64,7 +65,7 @@ Equalizer::SetBand(int band, double value)
|
||||
double
|
||||
Equalizer::Band(int band)
|
||||
{
|
||||
if(band < 0 || band >= BandCount()) {
|
||||
if (band < 0 || band >= BandCount()) {
|
||||
return 0.0;
|
||||
}
|
||||
return fBands[band];
|
||||
@@ -79,16 +80,16 @@ Equalizer::BandCount(void)
|
||||
float
|
||||
Equalizer::BandFrequency(int band)
|
||||
{
|
||||
if(band < 0 || band >= BandCount()) {
|
||||
if (band < 0 || band >= BandCount()) {
|
||||
return 0.0;
|
||||
}
|
||||
return fFrequency[band];
|
||||
}
|
||||
|
||||
void
|
||||
Equalizer::ProcessBuffer(float *buffer, int samples)
|
||||
Equalizer::ProcessBuffer(float* buffer, int samples)
|
||||
{
|
||||
if(!fActivated || samples <= 0) {
|
||||
if (!fActivated || samples <= 0) {
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
@@ -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.
|
||||
*/
|
||||
|
||||
@@ -33,12 +34,12 @@ EqualizerAddOn::CountFlavors()
|
||||
return 1;
|
||||
}
|
||||
|
||||
status_t EqualizerAddOn::GetFlavorAt(int32 idx, const flavor_info **info)
|
||||
status_t EqualizerAddOn::GetFlavorAt(int32 idx, const flavor_info** info)
|
||||
{
|
||||
if(idx < 0 || idx >= CountFlavors())
|
||||
if (idx < 0 || idx >= CountFlavors())
|
||||
return B_ERROR;
|
||||
|
||||
flavor_info *f_info = new flavor_info;
|
||||
flavor_info* f_info = new flavor_info;
|
||||
f_info->internal_id = idx;
|
||||
f_info->kinds = B_BUFFER_CONSUMER | B_BUFFER_PRODUCER | B_CONTROLLABLE;
|
||||
f_info->possible_count = 0;
|
||||
@@ -46,7 +47,7 @@ status_t EqualizerAddOn::GetFlavorAt(int32 idx, const flavor_info **info)
|
||||
f_info->info = (char *)"10 Band Equalizer.\nby 3dEyes**";
|
||||
f_info->name = (char *)"Equalizer (10 Band)";
|
||||
|
||||
media_format *format = new media_format;
|
||||
media_format* format = new media_format;
|
||||
format->type = B_MEDIA_RAW_AUDIO;
|
||||
format->u.raw_audio = media_raw_audio_format::wildcard;
|
||||
format->u.raw_audio.format = media_raw_audio_format::B_AUDIO_FLOAT;
|
||||
@@ -68,15 +69,15 @@ status_t EqualizerAddOn::GetFlavorAt(int32 idx, const flavor_info **info)
|
||||
}
|
||||
|
||||
BMediaNode*
|
||||
EqualizerAddOn::InstantiateNodeFor(const flavor_info *info, BMessage *config,
|
||||
status_t *err)
|
||||
EqualizerAddOn::InstantiateNodeFor(const flavor_info* info, BMessage* config,
|
||||
status_t* err)
|
||||
{
|
||||
EqualizerNode *node = new EqualizerNode(this);
|
||||
EqualizerNode* node = new EqualizerNode(this);
|
||||
return node;
|
||||
}
|
||||
|
||||
status_t
|
||||
EqualizerAddOn::GetConfigurationFor(BMediaNode *node, BMessage *message)
|
||||
EqualizerAddOn::GetConfigurationFor(BMediaNode* node, BMessage* message)
|
||||
{
|
||||
return B_OK;
|
||||
}
|
||||
@@ -88,8 +89,7 @@ EqualizerAddOn::WantsAutoStart()
|
||||
}
|
||||
|
||||
status_t
|
||||
EqualizerAddOn::AutoStart(int count, BMediaNode **node, int32 *id, bool *more)
|
||||
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.
|
||||
*/
|
||||
|
||||
@@ -13,14 +14,14 @@ class EqualizerAddOn : public BMediaAddOn
|
||||
public:
|
||||
virtual ~EqualizerAddOn();
|
||||
explicit EqualizerAddOn(image_id image);
|
||||
virtual status_t InitCheck(const char **text);
|
||||
virtual status_t InitCheck(const char** text);
|
||||
virtual int32 CountFlavors();
|
||||
virtual status_t GetFlavorAt(int32 idx, const flavor_info **info);
|
||||
virtual BMediaNode* InstantiateNodeFor(const flavor_info *info, BMessage *config,
|
||||
virtual status_t GetFlavorAt(int32 idx, const flavor_info** info);
|
||||
virtual BMediaNode* InstantiateNodeFor(const flavor_info* info, BMessage* config,
|
||||
status_t *err);
|
||||
virtual status_t GetConfigurationFor(BMediaNode *node, BMessage *message);
|
||||
virtual status_t GetConfigurationFor(BMediaNode* node, BMessage* message);
|
||||
virtual bool WantsAutoStart();
|
||||
virtual status_t AutoStart(int count, BMediaNode **node, int32 *id, bool *more);
|
||||
virtual status_t AutoStart(int count, BMediaNode** node, int32* id, bool* more);
|
||||
};
|
||||
|
||||
#endif //__EQUALIZER_ADDON_H__
|
||||
|
||||
@@ -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.
|
||||
*/
|
||||
|
||||
@@ -35,85 +36,85 @@ class EqualizerNode : public BBufferConsumer,
|
||||
{
|
||||
public:
|
||||
virtual ~EqualizerNode();
|
||||
EqualizerNode(BMediaAddOn *pAddOn=NULL);
|
||||
EqualizerNode(BMediaAddOn* pAddOn = NULL);
|
||||
//BMediaNode
|
||||
public:
|
||||
virtual BMediaAddOn *AddOn(int32 *id) const;
|
||||
virtual status_t HandleMessage(int32 code, const void *data, size_t size);
|
||||
virtual BMediaAddOn *AddOn(int32* id) const;
|
||||
virtual status_t HandleMessage(int32 code, const void* data, size_t size);
|
||||
protected:
|
||||
virtual void NodeRegistered();
|
||||
//BControllable
|
||||
public:
|
||||
virtual status_t GetParameterValue(int32 id, bigtime_t *lastChangeTime,
|
||||
void *value, size_t *size);
|
||||
virtual status_t GetParameterValue(int32 id, bigtime_t* lastChangeTime,
|
||||
void* value, size_t* size);
|
||||
virtual void SetParameterValue(int32 id, bigtime_t changeTime,
|
||||
const void *value, size_t size);
|
||||
const void* value, size_t size);
|
||||
//BBufferConsumer
|
||||
public:
|
||||
virtual void BufferReceived(BBuffer *buffer);
|
||||
virtual void BufferReceived(BBuffer* buffer);
|
||||
virtual status_t AcceptFormat(const media_destination &dst,
|
||||
media_format *format);
|
||||
virtual status_t GetNextInput(int32 *cookie, media_input *input);
|
||||
media_format* format);
|
||||
virtual status_t GetNextInput(int32* cookie, media_input* input);
|
||||
virtual void DisposeInputCookie(int32 cookie);
|
||||
virtual status_t FormatChanged(const media_source &src,
|
||||
const media_destination &dst,
|
||||
const media_destination &dst,
|
||||
int32 change_tag, const media_format &format);
|
||||
virtual void ProducerDataStatus(const media_destination &dst,
|
||||
int32 status,
|
||||
bigtime_t when);
|
||||
int32 status,
|
||||
bigtime_t when);
|
||||
virtual status_t GetLatencyFor(const media_destination &dst,
|
||||
bigtime_t *latency,
|
||||
media_node_id *time_src);
|
||||
bigtime_t* latency,
|
||||
media_node_id* time_src);
|
||||
virtual status_t Connected(const media_source &src,
|
||||
const media_destination &dst,
|
||||
const media_format &format,
|
||||
media_input *input);
|
||||
const media_destination &dst,
|
||||
const media_format &format,
|
||||
media_input* input);
|
||||
virtual void Disconnected(const media_source &src,
|
||||
const media_destination &dst);
|
||||
const media_destination &dst);
|
||||
//BBufferProducer
|
||||
public:
|
||||
virtual status_t FormatSuggestionRequested(media_type type,
|
||||
int32 quality, media_format *format);
|
||||
int32 quality, media_format* format);
|
||||
virtual status_t FormatProposal(const media_source &src,
|
||||
media_format *format);
|
||||
media_format* format);
|
||||
virtual status_t FormatChangeRequested(const media_source &src,
|
||||
const media_destination &dst,
|
||||
media_format *format,
|
||||
int32* _deprecated_);
|
||||
const media_destination &dst,
|
||||
media_format* format,
|
||||
int32* _deprecated_);
|
||||
virtual void LateNoticeReceived(const media_source &src,
|
||||
bigtime_t late, bigtime_t when);
|
||||
virtual status_t GetNextOutput(int32 *cookie, media_output *output);
|
||||
bigtime_t late, bigtime_t when);
|
||||
virtual status_t GetNextOutput(int32 *cookie, media_output* output);
|
||||
virtual status_t DisposeOutputCookie(int32 cookie);
|
||||
virtual status_t SetBufferGroup(const media_source &src,
|
||||
BBufferGroup *group);
|
||||
BBufferGroup* group);
|
||||
virtual status_t PrepareToConnect(const media_source &src,
|
||||
const media_destination &dst,
|
||||
media_format *format, media_source *source,
|
||||
char *name);
|
||||
const media_destination &dst,
|
||||
media_format* format, media_source* source,
|
||||
char* name);
|
||||
virtual void Connect(status_t status,
|
||||
const media_source &src,
|
||||
const media_destination &dst,
|
||||
const media_format &format,
|
||||
char* name);
|
||||
const media_source &src,
|
||||
const media_destination &dst,
|
||||
const media_format &format,
|
||||
char* name);
|
||||
virtual void Disconnect(const media_source &src,
|
||||
const media_destination &dst);
|
||||
const media_destination &dst);
|
||||
virtual void EnableOutput(const media_source &src,
|
||||
bool enabled, int32* _deprecated_);
|
||||
virtual status_t GetLatency(bigtime_t *outLatency);
|
||||
bool enabled, int32* _deprecated_);
|
||||
virtual status_t GetLatency(bigtime_t* outLatency);
|
||||
virtual void LatencyChanged( const media_source &src,
|
||||
const media_destination &dst,
|
||||
bigtime_t latency, uint32 flags);
|
||||
const media_destination &dst,
|
||||
bigtime_t latency, uint32 flags);
|
||||
//BMediaEventLooper
|
||||
protected:
|
||||
virtual bigtime_t OfflineTime();
|
||||
//EqualizerNode
|
||||
protected:
|
||||
virtual void HandleEvent(const media_timed_event *event,
|
||||
bigtime_t late,
|
||||
bool realTimeEvent=false);
|
||||
void ParameterEventProcessing(const media_timed_event *event);
|
||||
virtual void HandleEvent(const media_timed_event* event,
|
||||
bigtime_t late,
|
||||
bool realTimeEvent = false);
|
||||
void ParameterEventProcessing(const media_timed_event* event);
|
||||
status_t ValidateFormat(const media_format &preferredFormat,
|
||||
media_format &format);
|
||||
media_format &format);
|
||||
void SetOutputFormat(media_format &format);
|
||||
virtual void InitParameterValues(void);
|
||||
virtual void InitParameterWeb(void);
|
||||
@@ -122,8 +123,8 @@ protected:
|
||||
virtual void FilterBuffer(BBuffer* pBuffer);
|
||||
|
||||
private:
|
||||
BMediaAddOn *fAddOn;
|
||||
BParameterWeb *fWeb;
|
||||
BMediaAddOn* fAddOn;
|
||||
BParameterWeb* fWeb;
|
||||
|
||||
Equalizer fEqualizer;
|
||||
|
||||
|
||||
@@ -1,7 +1,8 @@
|
||||
/*
|
||||
* 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.
|
||||
*/
|
||||
*/
|
||||
|
||||
#include <Entry.h>
|
||||
#include <Directory.h>
|
||||
@@ -41,7 +42,7 @@ VSTAddOn::~VSTAddOn()
|
||||
}
|
||||
|
||||
status_t
|
||||
VSTAddOn::InitCheck(const char **text)
|
||||
VSTAddOn::InitCheck(const char** text)
|
||||
{
|
||||
return B_OK;
|
||||
}
|
||||
@@ -52,9 +53,10 @@ 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())
|
||||
if (idx < 0 || idx >= fPluginsList.CountItems())
|
||||
return B_ERROR;
|
||||
|
||||
VSTPlugin *plugin = (VSTPlugin*)fPluginsList.ItemAt(idx);
|
||||
@@ -89,33 +91,33 @@ status_t VSTAddOn::GetFlavorAt( int32 idx, const flavor_info **info)
|
||||
}
|
||||
|
||||
BMediaNode*
|
||||
VSTAddOn::InstantiateNodeFor(const flavor_info *info, BMessage *config,
|
||||
status_t *err)
|
||||
VSTAddOn::InstantiateNodeFor(const flavor_info* info, BMessage* config,
|
||||
status_t* err)
|
||||
{
|
||||
VSTPlugin *plugin = (VSTPlugin*)fPluginsList.ItemAt(info->internal_id);
|
||||
VSTNode *node = new VSTNode(this, plugin->ModuleName(), plugin->Path());
|
||||
VSTPlugin* plugin = (VSTPlugin*)fPluginsList.ItemAt(info->internal_id);
|
||||
VSTNode* node = new VSTNode(this, plugin->ModuleName(), plugin->Path());
|
||||
return node;
|
||||
}
|
||||
|
||||
int
|
||||
VSTAddOn::ScanPluginsFolders(const char *path, bool make_dir)
|
||||
VSTAddOn::ScanPluginsFolders(const char* path, bool make_dir)
|
||||
{
|
||||
BEntry ent;
|
||||
|
||||
BDirectory dir(path);
|
||||
if(dir.InitCheck() != B_OK) {
|
||||
if (dir.InitCheck() != B_OK) {
|
||||
create_directory(path, 0755);
|
||||
return 0;
|
||||
}
|
||||
|
||||
while(dir.GetNextEntry(&ent) == B_OK) {
|
||||
BPath p(&ent);
|
||||
if(ent.IsDirectory()) {
|
||||
if (ent.IsDirectory()) {
|
||||
ScanPluginsFolders(p.Path());
|
||||
} else {
|
||||
VSTPlugin *plugin = new VSTPlugin();
|
||||
VSTPlugin* plugin = new VSTPlugin();
|
||||
int ret = plugin->LoadModule(p.Path());
|
||||
if(ret == B_OK) {
|
||||
if (ret == B_OK) {
|
||||
plugin->UnLoadModule();
|
||||
fPluginsList.AddItem(plugin);
|
||||
} else {
|
||||
@@ -127,7 +129,7 @@ VSTAddOn::ScanPluginsFolders(const char *path, bool make_dir)
|
||||
}
|
||||
|
||||
status_t
|
||||
VSTAddOn::GetConfigurationFor(BMediaNode *node, BMessage *message)
|
||||
VSTAddOn::GetConfigurationFor(BMediaNode* node, BMessage* message)
|
||||
{
|
||||
return B_OK;
|
||||
}
|
||||
@@ -139,7 +141,7 @@ VSTAddOn::WantsAutoStart()
|
||||
}
|
||||
|
||||
status_t
|
||||
VSTAddOn::AutoStart(int count, BMediaNode **node, int32 *id, bool *more)
|
||||
VSTAddOn::AutoStart(int count, BMediaNode** node, int32* id, bool* more)
|
||||
{
|
||||
return B_OK;
|
||||
}
|
||||
|
||||
@@ -1,7 +1,8 @@
|
||||
/*
|
||||
* 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.
|
||||
*/
|
||||
*/
|
||||
|
||||
#ifndef __VST_ADDON_H__
|
||||
#define __VST_ADDON_H__
|
||||
@@ -14,16 +15,16 @@ class VSTAddOn : public BMediaAddOn
|
||||
public:
|
||||
virtual ~VSTAddOn();
|
||||
explicit VSTAddOn(image_id image);
|
||||
virtual status_t InitCheck(const char **text);
|
||||
virtual status_t InitCheck(const char** text);
|
||||
virtual int32 CountFlavors();
|
||||
virtual status_t GetFlavorAt(int32 idx, const flavor_info **info);
|
||||
virtual BMediaNode* InstantiateNodeFor(const flavor_info *info, BMessage *config,
|
||||
status_t *err);
|
||||
virtual status_t GetConfigurationFor(BMediaNode *node, BMessage *message);
|
||||
virtual status_t GetFlavorAt(int32 idx, const flavor_info** info);
|
||||
virtual BMediaNode* InstantiateNodeFor(const flavor_info* info, BMessage* config,
|
||||
status_t* err);
|
||||
virtual status_t GetConfigurationFor(BMediaNode* node, BMessage* message);
|
||||
virtual bool WantsAutoStart();
|
||||
virtual status_t AutoStart(int count, BMediaNode **node, int32 *id, bool *more);
|
||||
virtual status_t AutoStart(int count, BMediaNode** node, int32* id, bool* more);
|
||||
private:
|
||||
int ScanPluginsFolders(const char *path, bool make_dir=false);
|
||||
int ScanPluginsFolders(const char* path, bool make_dir = false);
|
||||
BList fPluginsList;
|
||||
};
|
||||
|
||||
|
||||
@@ -1,7 +1,8 @@
|
||||
/*
|
||||
* 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.
|
||||
*/
|
||||
*/
|
||||
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
@@ -12,12 +13,12 @@
|
||||
#include "VSTHost.h"
|
||||
|
||||
static int32 VHostCallback(VSTEffect* effect, int32 opcode, int32 index,
|
||||
int32 value, void* ptr, float opt);
|
||||
int32 value, void* ptr, float opt);
|
||||
|
||||
//Trim string
|
||||
static void
|
||||
TrimString(BString *string) {
|
||||
char *str = string->LockBuffer(256);
|
||||
char* str = string->LockBuffer(256);
|
||||
uint32 k = 0;
|
||||
uint32 i = 0;
|
||||
for(i=0; str[i]!='\0';) {
|
||||
@@ -36,7 +37,7 @@ TrimString(BString *string) {
|
||||
}
|
||||
|
||||
//VST Parameter class
|
||||
VSTParameter::VSTParameter(VSTPlugin *plugin, int index)
|
||||
VSTParameter::VSTParameter(VSTPlugin* plugin, int index)
|
||||
{
|
||||
fIndex = index;
|
||||
fEffect = plugin->Effect();
|
||||
@@ -74,21 +75,22 @@ VSTParameter::VSTParameter(VSTPlugin *plugin, int index)
|
||||
int test_cnt = 0;
|
||||
for(int tst_val = 0; tst_val < VST_PARAM_TEST_COUNT; tst_val++){
|
||||
float v = (float)tst_val / (float)VST_PARAM_TEST_COUNT;
|
||||
if(tst_val >= VST_PARAM_TEST_COUNT - 1) {
|
||||
v=1.0;
|
||||
if (tst_val >= VST_PARAM_TEST_COUNT - 1) {
|
||||
v = 1.0;
|
||||
}
|
||||
fEffect->setParameter(fEffect, index, v);
|
||||
float new_value = fEffect->getParameter(fEffect, index);
|
||||
bool valtest = false;
|
||||
bool valtest = false;
|
||||
for(int i = 0; i < test_cnt; i++) {
|
||||
if(fabs(test_values[i] - new_value) < delta) {
|
||||
if (fabs(test_values[i] - new_value) < delta) {
|
||||
valtest = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
if(valtest == false) {
|
||||
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++;
|
||||
}
|
||||
}
|
||||
@@ -97,25 +99,25 @@ VSTParameter::VSTParameter(VSTPlugin *plugin, int index)
|
||||
fEffect->setParameter(fEffect, index, val);
|
||||
|
||||
//detect param type
|
||||
if(test_cnt == 2) {
|
||||
if (test_cnt == 2) {
|
||||
fType = VST_PARAM_CHECKBOX;
|
||||
|
||||
DropListValue *min_item = new DropListValue();
|
||||
DropListValue* min_item = new DropListValue();
|
||||
min_item->Value = 0.0;
|
||||
min_item->Index = 0;
|
||||
min_item->Name = fMinValue;
|
||||
fDropList.AddItem(min_item);
|
||||
|
||||
DropListValue *max_item = new DropListValue();
|
||||
DropListValue* max_item = new DropListValue();
|
||||
max_item->Value = 1.0;
|
||||
max_item->Index = 1;
|
||||
max_item->Name = fMaxValue;
|
||||
fDropList.AddItem(max_item);
|
||||
} else if(test_cnt > 2 && test_cnt < VST_PARAM_TEST_COUNT / 2) {
|
||||
} else if (test_cnt > 2 && test_cnt < VST_PARAM_TEST_COUNT / 2) {
|
||||
fType = VST_PARAM_DROPLIST;
|
||||
|
||||
for(int i = 0; i < test_cnt; i++) {
|
||||
DropListValue *item = new DropListValue();
|
||||
DropListValue* item = new DropListValue();
|
||||
item->Value = test_values[i];
|
||||
item->Index = i;
|
||||
item->Name = test_disp[i];
|
||||
@@ -132,29 +134,29 @@ VSTParameter::~VSTParameter()
|
||||
}
|
||||
|
||||
BString*
|
||||
VSTParameter::ValidateValues(BString *string)
|
||||
VSTParameter::ValidateValues(BString* string)
|
||||
{
|
||||
if(string->Length() == 0) {
|
||||
if (string->Length() == 0) {
|
||||
return string;
|
||||
}
|
||||
|
||||
bool isNum = true;
|
||||
|
||||
const char *ptr = string->String();
|
||||
for(;*ptr!=0;ptr++) {
|
||||
for(; *ptr!=0; ptr++) {
|
||||
char ch = *ptr;
|
||||
if(!((ch >= '0' && ch <= '9') || ch == '.' || ch == '-')) {
|
||||
if (!((ch >= '0' && ch <= '9') || ch == '.' || ch == '-')) {
|
||||
isNum = false;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if(isNum) {
|
||||
if (isNum) {
|
||||
float val = atof(string->String());
|
||||
|
||||
if(val <= -pow(2, 31)) {
|
||||
if (val <= -pow(2, 31)) {
|
||||
string->SetTo("-∞");
|
||||
} else if(val >= pow(2, 31)) {
|
||||
} else if (val >= pow(2, 31)) {
|
||||
string->SetTo("∞");
|
||||
} else {
|
||||
char temp[256];
|
||||
@@ -163,9 +165,9 @@ VSTParameter::ValidateValues(BString *string)
|
||||
}
|
||||
} else {
|
||||
TrimString(string);
|
||||
if(*string == "oo" || *string == "inf")
|
||||
if (*string == "oo" || *string == "inf")
|
||||
string->SetTo("∞");
|
||||
if(*string == "-oo" || *string == "-inf")
|
||||
if (*string == "-oo" || *string == "-inf")
|
||||
string->SetTo("-∞");
|
||||
|
||||
}
|
||||
@@ -181,8 +183,8 @@ VSTParameter::ListCount(void)
|
||||
DropListValue*
|
||||
VSTParameter::ListItemAt(int index)
|
||||
{
|
||||
DropListValue *item = NULL;
|
||||
if(index >= 0 && index < fDropList.CountItems()) {
|
||||
DropListValue* item = NULL;
|
||||
if (index >= 0 && index < fDropList.CountItems()) {
|
||||
item = (DropListValue*)fDropList.ItemAt(index);
|
||||
}
|
||||
return item;
|
||||
@@ -193,14 +195,14 @@ float
|
||||
VSTParameter::Value()
|
||||
{
|
||||
float value = fEffect->getParameter(fEffect, fIndex);
|
||||
if(fType == VST_PARAM_DROPLIST) {
|
||||
if (fType == VST_PARAM_DROPLIST) {
|
||||
//scan for near value
|
||||
int min_index = 0;
|
||||
float min_delta = 1.0;
|
||||
for(int i = 0; i < fDropList.CountItems(); i++) {
|
||||
DropListValue *item = (DropListValue*)fDropList.ItemAt(i);
|
||||
DropListValue* item = (DropListValue*)fDropList.ItemAt(i);
|
||||
float delta = fabs(item->Value - value);
|
||||
if(delta <= min_delta) {
|
||||
if (delta <= min_delta) {
|
||||
min_delta = delta;
|
||||
min_index = i;
|
||||
}
|
||||
@@ -214,14 +216,14 @@ VSTParameter::Value()
|
||||
void
|
||||
VSTParameter::SetValue(float value)
|
||||
{
|
||||
if(value == fLastValue) {
|
||||
if (value == fLastValue) {
|
||||
return;
|
||||
}
|
||||
|
||||
if(fType == VST_PARAM_DROPLIST) {
|
||||
if (fType == VST_PARAM_DROPLIST) {
|
||||
//take value by index
|
||||
int index = (int)round(value);
|
||||
if(index >= 0 && index < fDropList.CountItems()) {
|
||||
if (index >= 0 && index < fDropList.CountItems()) {
|
||||
DropListValue *item = (DropListValue*)fDropList.ItemAt(index);
|
||||
value = item->Value;
|
||||
fLastValue = index;
|
||||
@@ -305,24 +307,25 @@ VSTPlugin::LoadModule(const char *path)
|
||||
char vendorString[256] = {0};
|
||||
char productString[256] = {0};
|
||||
|
||||
if(fActive) {
|
||||
if (fActive) {
|
||||
return VST_ERR_ALREADY_LOADED;
|
||||
}
|
||||
|
||||
fPath = BPath(path);
|
||||
|
||||
fModule = load_add_on(path);
|
||||
if(fModule <= 0) {
|
||||
if (fModule <= 0) {
|
||||
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;
|
||||
}
|
||||
|
||||
fEffect = VSTMainProc(VHostCallback);
|
||||
if(fEffect==NULL) {
|
||||
if (fEffect==NULL) {
|
||||
unload_add_on(fModule);
|
||||
return VST_ERR_NOT_LOADED;
|
||||
}
|
||||
@@ -363,7 +366,7 @@ VSTPlugin::LoadModule(const char *path)
|
||||
int
|
||||
VSTPlugin::UnLoadModule(void)
|
||||
{
|
||||
if(!fActive || fModule <= 0) {
|
||||
if (!fActive || fModule <= 0) {
|
||||
return VST_ERR_NOT_LOADED;
|
||||
}
|
||||
fEffect->dispatcher(fEffect, VST_STATE_CHANGED, 0, 0, 0, 0);
|
||||
@@ -419,27 +422,27 @@ VSTPlugin::Path(void)
|
||||
int
|
||||
VSTPlugin::ReAllocBuffers(void)
|
||||
{
|
||||
if(inputs!=NULL) {
|
||||
if (inputs != NULL) {
|
||||
for(int32 i = 0; i < fInputChannels; i++) {
|
||||
delete inputs[i];
|
||||
}
|
||||
}
|
||||
|
||||
if(outputs!=NULL) {
|
||||
if (outputs != NULL) {
|
||||
for(int32 i = 0; i < fOutputChannels; i++) {
|
||||
delete outputs[i];
|
||||
}
|
||||
}
|
||||
|
||||
if(fInputChannels > 0) {
|
||||
if (fInputChannels > 0) {
|
||||
inputs = new float*[fInputChannels];
|
||||
for(int32 i = 0; i < fInputChannels; i++) {
|
||||
inputs[i] = new float[fBlockSize];
|
||||
memset (inputs[i], 0, fBlockSize * sizeof(float));
|
||||
memset(inputs[i], 0, fBlockSize * sizeof(float));
|
||||
}
|
||||
}
|
||||
|
||||
if(fOutputChannels > 0) {
|
||||
if (fOutputChannels > 0) {
|
||||
outputs = new float*[fOutputChannels];
|
||||
for(int32_t i = 0; i < fOutputChannels; i++) {
|
||||
outputs[i] = new float[fBlockSize];
|
||||
@@ -464,9 +467,9 @@ VSTPlugin::ParametersCount(void)
|
||||
VSTParameter*
|
||||
VSTPlugin::Parameter(int index)
|
||||
{
|
||||
VSTParameter *param = NULL;
|
||||
VSTParameter* param = NULL;
|
||||
|
||||
if(index >= 0 && index < fParameters.CountItems()) {
|
||||
if (index >= 0 && index < fParameters.CountItems()) {
|
||||
param = (VSTParameter*)fParameters.ItemAt(index);
|
||||
}
|
||||
|
||||
@@ -508,15 +511,15 @@ void
|
||||
VSTPlugin::Process(float *buffer, int samples, int channels)
|
||||
{
|
||||
//todo: full channels remapping needed
|
||||
float *src = buffer;
|
||||
float* src = buffer;
|
||||
|
||||
if(channels == fInputChannels) { //channel to channel
|
||||
if (channels == fInputChannels) { //channel to channel
|
||||
for(int j = 0; j < samples; j++) {
|
||||
for(int c = 0; c < fInputChannels; c++) {
|
||||
inputs[c][j] = *src++;
|
||||
}
|
||||
}
|
||||
} else if( channels == 1) { //from mone to multichannel
|
||||
} else if ( channels == 1) { //from mone to multichannel
|
||||
for(int j = 0; j < samples; j++, src++) {
|
||||
for(int c = 0; c < fInputChannels; c++) {
|
||||
inputs[c][j] = *src;
|
||||
@@ -526,15 +529,15 @@ VSTPlugin::Process(float *buffer, int samples, int channels)
|
||||
|
||||
fEffect->processReplacing(fEffect, inputs, outputs, fBlockSize);
|
||||
|
||||
float *dst = buffer;
|
||||
float* dst = buffer;
|
||||
|
||||
if(channels == fOutputChannels) { //channel to channel
|
||||
if (channels == fOutputChannels) { //channel to channel
|
||||
for(int j = 0; j < samples; j++) {
|
||||
for(int c = 0; c < fOutputChannels; c++) {
|
||||
*dst++ = outputs[c][j];
|
||||
}
|
||||
}
|
||||
} else if(channels == 1) { //from multichannel to mono
|
||||
} else if (channels == 1) { //from multichannel to mono
|
||||
for(int j = 0; j < samples; j++, dst++) {
|
||||
float mix = 0;
|
||||
for(int c = 0; c < fOutputChannels; c++) {
|
||||
@@ -546,14 +549,15 @@ 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;
|
||||
|
||||
switch(opcode)
|
||||
{
|
||||
case VST_MASTER_PRODUCT:
|
||||
if(ptr) {
|
||||
if (ptr) {
|
||||
strcpy((char*)ptr, "VSTHost Media AddOn");
|
||||
result = 1;
|
||||
}
|
||||
|
||||
@@ -1,7 +1,8 @@
|
||||
/*
|
||||
* 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.
|
||||
*/
|
||||
*/
|
||||
|
||||
#ifndef __VST_HOST_H__
|
||||
#define __VST_HOST_H__
|
||||
@@ -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
|
||||
@@ -162,8 +166,8 @@ private:
|
||||
BString fVendorString;
|
||||
BString fProductString;
|
||||
BList fParameters;
|
||||
float **inputs;
|
||||
float **outputs;
|
||||
float** inputs;
|
||||
float** outputs;
|
||||
};
|
||||
|
||||
#endif //__VST_HOST_H__
|
||||
|
||||
@@ -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;
|
||||
@@ -44,18 +48,17 @@ BMediaAddOn* VSTNode::AddOn(int32 *id) const
|
||||
}
|
||||
|
||||
status_t
|
||||
VSTNode::HandleMessage(int32 message, const void *data, size_t size)
|
||||
VSTNode::HandleMessage(int32 message, const void* data, size_t size)
|
||||
{
|
||||
if((BControllable::HandleMessage(message, data, size)!=B_OK) &&
|
||||
if((BControllable::HandleMessage(message, data, size) != B_OK) &&
|
||||
(BBufferConsumer::HandleMessage(message, data, size) != B_OK) &&
|
||||
(BBufferProducer::HandleMessage(message, data, size) != B_OK) &&
|
||||
(BControllable::HandleMessage(message, data, size) != B_OK) ) {
|
||||
BMediaNode::HandleMessage(message, data, size);
|
||||
return B_OK;
|
||||
} else {
|
||||
BMediaNode::HandleBadMessage(message, data, size);
|
||||
return B_ERROR;
|
||||
}
|
||||
}
|
||||
BMediaNode::HandleBadMessage(message, data, size);
|
||||
return B_ERROR;
|
||||
}
|
||||
|
||||
void
|
||||
@@ -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,10 +97,11 @@ 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)) {
|
||||
if (*size < sizeof(float) ||
|
||||
*size < sizeof(int32)) {
|
||||
return B_NO_MEMORY;
|
||||
}
|
||||
|
||||
@@ -113,22 +118,22 @@ VSTNode::GetParameterValue(int32 id, bigtime_t *lastChangeTime, void *value, siz
|
||||
|
||||
*size = sizeof(float);
|
||||
|
||||
if(id == P_MUTE) {
|
||||
if (id == P_MUTE) {
|
||||
*(int32*)value = fMute;
|
||||
*lastChangeTime = fMuteLastChanged;
|
||||
return B_OK;
|
||||
} else if(id == P_BYPASS) {
|
||||
} else if (id == P_BYPASS) {
|
||||
*(int32*)value = fByPass;
|
||||
*lastChangeTime = fByPassLastChanged;
|
||||
return B_OK;
|
||||
} else {
|
||||
int32 idx = id - P_PARAM;
|
||||
if(idx >= 0 && idx < fPlugin->ParametersCount()) {
|
||||
if (idx >= 0 && idx < fPlugin->ParametersCount()) {
|
||||
VSTParameter *param = fPlugin->Parameter(idx);
|
||||
if(v_type == B_FLOAT_TYPE) {
|
||||
if (v_type == B_FLOAT_TYPE) {
|
||||
*(float*)value = param->Value();
|
||||
}
|
||||
if(v_type == B_INT32_TYPE) {
|
||||
if (v_type == B_INT32_TYPE) {
|
||||
*(int32*)value = (int32)ceil(param->Value());
|
||||
}
|
||||
*lastChangeTime = param->LastChangeTime();
|
||||
@@ -139,51 +144,58 @@ 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????)
|
||||
BTimedEventQueue::B_NO_CLEANUP, size, id, "VSTParam");
|
||||
//dirty hack for parameter processing (mediakit bug????)
|
||||
ParameterEventProcessing(&ev);
|
||||
EventQueue()->AddEvent(ev);
|
||||
}
|
||||
}
|
||||
|
||||
//BBufferConsumer
|
||||
void
|
||||
VSTNode::BufferReceived(BBuffer *buffer)
|
||||
VSTNode::BufferReceived(BBuffer* buffer)
|
||||
{
|
||||
if(buffer->Header()->destination != fInputMedia.destination.id) {
|
||||
if (buffer->Header()->destination != fInputMedia.destination.id) {
|
||||
buffer->Recycle();
|
||||
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();
|
||||
}
|
||||
}
|
||||
|
||||
status_t
|
||||
VSTNode::AcceptFormat(const media_destination &dst, media_format *format)
|
||||
VSTNode::AcceptFormat(const media_destination &dst, media_format* format)
|
||||
{
|
||||
if(dst != fInputMedia.destination) {
|
||||
if (dst != fInputMedia.destination) {
|
||||
return B_MEDIA_BAD_DESTINATION;
|
||||
}
|
||||
if(format->type != B_MEDIA_RAW_AUDIO) {
|
||||
if (format->type != B_MEDIA_RAW_AUDIO) {
|
||||
return B_MEDIA_BAD_FORMAT;
|
||||
}
|
||||
|
||||
ValidateFormat((fFormat.u.raw_audio.format != media_raw_audio_format::wildcard.format) ?
|
||||
fFormat : fPreferredFormat, *format);
|
||||
ValidateFormat(
|
||||
(fFormat.u.raw_audio.format != media_raw_audio_format::wildcard.format) ?
|
||||
fFormat : fPreferredFormat, *format);
|
||||
|
||||
return B_OK;
|
||||
}
|
||||
@@ -191,7 +203,7 @@ VSTNode::AcceptFormat(const media_destination &dst, media_format *format)
|
||||
status_t
|
||||
VSTNode::GetNextInput(int32* cookie, media_input* input)
|
||||
{
|
||||
if(*cookie) {
|
||||
if (*cookie) {
|
||||
return B_BAD_INDEX;
|
||||
}
|
||||
++*cookie;
|
||||
@@ -212,19 +224,19 @@ 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) {
|
||||
if (fOutputMedia.destination != media_destination::null) {
|
||||
SendDataStatus(status, fOutputMedia.destination, when);
|
||||
}
|
||||
}
|
||||
|
||||
status_t
|
||||
VSTNode::GetLatencyFor( const media_destination &dst, bigtime_t *latency,
|
||||
media_node_id* outTimeSource)
|
||||
VSTNode::GetLatencyFor( const media_destination &dst, bigtime_t* latency,
|
||||
media_node_id* outTimeSource)
|
||||
{
|
||||
|
||||
if(dst != fInputMedia.destination) {
|
||||
if (dst != fInputMedia.destination) {
|
||||
return B_MEDIA_BAD_DESTINATION;
|
||||
}
|
||||
|
||||
@@ -236,18 +248,18 @@ 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) {
|
||||
if (destination != fInputMedia.destination) {
|
||||
return B_MEDIA_BAD_DESTINATION;
|
||||
}
|
||||
if(fInputMedia.source != media_source::null) {
|
||||
if (fInputMedia.source != media_source::null) {
|
||||
return B_MEDIA_ALREADY_CONNECTED;
|
||||
}
|
||||
|
||||
fInputMedia.source = source;
|
||||
fInputMedia.format = format;
|
||||
*poInput = fInputMedia;
|
||||
*input = fInputMedia;
|
||||
fFormat = format;
|
||||
|
||||
return B_OK;
|
||||
@@ -268,13 +280,14 @@ 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) {
|
||||
if (type != B_MEDIA_RAW_AUDIO) {
|
||||
return B_MEDIA_BAD_FORMAT;
|
||||
}
|
||||
|
||||
if(fFormat.u.raw_audio.format != media_raw_audio_format::wildcard.format) {
|
||||
if (fFormat.u.raw_audio.format != media_raw_audio_format::wildcard.format) {
|
||||
*format = fFormat;
|
||||
} else {
|
||||
*format = fPreferredFormat;
|
||||
@@ -285,40 +298,42 @@ VSTNode::FormatSuggestionRequested(media_type type, int32 quality, media_format
|
||||
status_t
|
||||
VSTNode::FormatProposal(const media_source &src, media_format* format)
|
||||
{
|
||||
if(src != fOutputMedia.source) {
|
||||
if (src != fOutputMedia.source) {
|
||||
return B_MEDIA_BAD_SOURCE;
|
||||
}
|
||||
|
||||
if(format->type != B_MEDIA_RAW_AUDIO) {
|
||||
if (format->type != B_MEDIA_RAW_AUDIO) {
|
||||
return B_MEDIA_BAD_FORMAT;
|
||||
}
|
||||
|
||||
ValidateFormat((fFormat.u.raw_audio.format != media_raw_audio_format::wildcard.format) ?
|
||||
fFormat : fPreferredFormat, *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) {
|
||||
if (src != fOutputMedia.source || fInputMedia.source == media_source::null) {
|
||||
return;
|
||||
}
|
||||
NotifyLateProducer( fInputMedia.source, late, when);
|
||||
NotifyLateProducer(fInputMedia.source, late, when);
|
||||
}
|
||||
|
||||
status_t
|
||||
VSTNode::GetNextOutput(int32 *cookie, media_output* output)
|
||||
{
|
||||
if(*cookie) {
|
||||
if (*cookie) {
|
||||
return B_BAD_INDEX;
|
||||
}
|
||||
++*cookie;
|
||||
@@ -333,41 +348,47 @@ VSTNode::DisposeOutputCookie(int32 cookie)
|
||||
}
|
||||
|
||||
status_t
|
||||
VSTNode::SetBufferGroup(const media_source &src, BBufferGroup *group)
|
||||
VSTNode::SetBufferGroup(const media_source &src, BBufferGroup* group)
|
||||
{
|
||||
status_t ret;
|
||||
int32 changeTag;
|
||||
|
||||
if(src != fOutputMedia.source) {
|
||||
if (src != fOutputMedia.source) {
|
||||
return B_MEDIA_BAD_SOURCE;
|
||||
}
|
||||
if(fInputMedia.source == media_source::null) {
|
||||
if (fInputMedia.source == media_source::null) {
|
||||
return B_ERROR;
|
||||
}
|
||||
|
||||
return SetOutputBuffersFor(fInputMedia.source, fInputMedia.destination, group, 0, &changeTag);
|
||||
ret = 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)
|
||||
media_format* format, media_source* out_source, char* name)
|
||||
{
|
||||
if(src != fOutputMedia.source) {
|
||||
status_t ret = B_OK;
|
||||
|
||||
if (src != fOutputMedia.source) {
|
||||
return B_MEDIA_BAD_SOURCE;
|
||||
}
|
||||
|
||||
if(format->type != B_MEDIA_RAW_AUDIO) {
|
||||
if (format->type != B_MEDIA_RAW_AUDIO) {
|
||||
return B_MEDIA_BAD_FORMAT;
|
||||
}
|
||||
|
||||
if(fOutputMedia.destination != media_destination::null) {
|
||||
if (fOutputMedia.destination != media_destination::null) {
|
||||
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,11 +403,10 @@ 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) {
|
||||
if (status < B_OK) {
|
||||
fOutputMedia.destination = media_destination::null;
|
||||
return;
|
||||
}
|
||||
@@ -396,14 +416,14 @@ 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();
|
||||
|
||||
fProcessLatency = GetFilterLatency();
|
||||
SetEventLatency(fDownstreamLatency + fProcessLatency);
|
||||
|
||||
if(fInputMedia.source != media_source::null) {
|
||||
if (fInputMedia.source != media_source::null) {
|
||||
SendLatencyChange(fInputMedia.source, fInputMedia.destination,
|
||||
EventLatency()+SchedulingLatency());
|
||||
}
|
||||
@@ -412,11 +432,11 @@ VSTNode::Connect(status_t status, const media_source &src, const media_destinati
|
||||
|
||||
int sample_size = (fFormat.u.raw_audio.format & 0xf)*
|
||||
fFormat.u.raw_audio.channel_count;
|
||||
if(fFormat.u.raw_audio.buffer_size > 0 &&
|
||||
if (fFormat.u.raw_audio.buffer_size > 0 &&
|
||||
fFormat.u.raw_audio.frame_rate > 0 &&
|
||||
sample_size > 0) {
|
||||
duration = (bigtime_t)(((fFormat.u.raw_audio.buffer_size / sample_size) /
|
||||
fFormat.u.raw_audio.frame_rate) * 1000000.0);
|
||||
duration = (bigtime_t)(((fFormat.u.raw_audio.buffer_size / sample_size) /
|
||||
fFormat.u.raw_audio.frame_rate) * 1000000.0);
|
||||
}
|
||||
|
||||
SetBufferDuration(duration);
|
||||
@@ -425,17 +445,17 @@ VSTNode::Connect(status_t status, const media_source &src, const media_destinati
|
||||
void
|
||||
VSTNode::Disconnect(const media_source &src, const media_destination &dst)
|
||||
{
|
||||
if(src != fOutputMedia.source) {
|
||||
if (src != fOutputMedia.source) {
|
||||
return;
|
||||
}
|
||||
|
||||
if(dst != fOutputMedia.destination) {
|
||||
if (dst != fOutputMedia.destination) {
|
||||
return;
|
||||
}
|
||||
|
||||
fOutputMedia.destination = media_destination::null;
|
||||
|
||||
if(fInputMedia.source == media_source::null) {
|
||||
if (fInputMedia.source == media_source::null) {
|
||||
fFormat.u.raw_audio = media_raw_audio_format::wildcard;
|
||||
}
|
||||
|
||||
@@ -445,14 +465,14 @@ VSTNode::Disconnect(const media_source &src, const media_destination &dst)
|
||||
void
|
||||
VSTNode::EnableOutput(const media_source &src, bool enabled, int32* _deprecated_)
|
||||
{
|
||||
if(src != fOutputMedia.source) {
|
||||
if (src != fOutputMedia.source) {
|
||||
return;
|
||||
}
|
||||
fOutputMediaEnabled = enabled;
|
||||
}
|
||||
|
||||
status_t
|
||||
VSTNode::GetLatency(bigtime_t *latency)
|
||||
VSTNode::GetLatency(bigtime_t* latency)
|
||||
{
|
||||
*latency = EventLatency() + SchedulingLatency();
|
||||
return B_OK;
|
||||
@@ -460,16 +480,16 @@ VSTNode::GetLatency(bigtime_t *latency)
|
||||
|
||||
void
|
||||
VSTNode::LatencyChanged(const media_source &src, const media_destination &dst,
|
||||
bigtime_t latency, uint32 flags)
|
||||
bigtime_t latency, uint32 flags)
|
||||
{
|
||||
if(src != fOutputMedia.source || dst != fOutputMedia.destination) {
|
||||
if (src != fOutputMedia.source || dst != fOutputMedia.destination) {
|
||||
return;
|
||||
}
|
||||
|
||||
fDownstreamLatency = latency;
|
||||
SetEventLatency(fDownstreamLatency + fProcessLatency);
|
||||
|
||||
if(fInputMedia.source != media_source::null) {
|
||||
if (fInputMedia.source != media_source::null) {
|
||||
SendLatencyChange(fInputMedia.source,
|
||||
fInputMedia.destination,EventLatency() + SchedulingLatency());
|
||||
}
|
||||
@@ -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);
|
||||
@@ -503,33 +524,33 @@ VSTNode::ParameterEventProcessing(const media_timed_event* event)
|
||||
|
||||
type_code v_type = B_FLOAT_TYPE;
|
||||
|
||||
BParameter *web_param;
|
||||
BParameter* web_param;
|
||||
for(int i = 0; i < fWeb->CountParameters(); i++) {
|
||||
web_param = fWeb->ParameterAt(i);
|
||||
if(web_param->ID()==id) {
|
||||
v_type=web_param->ValueType();
|
||||
if(web_param->ID() == id) {
|
||||
v_type = web_param->ValueType();
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if(v_type == B_FLOAT_TYPE)
|
||||
if (v_type == B_FLOAT_TYPE)
|
||||
value = *((float*)event->pointer);
|
||||
if(v_type == B_INT32_TYPE) {
|
||||
if (v_type == B_INT32_TYPE) {
|
||||
value32 = *((int32*)event->pointer);
|
||||
value = (float)value32;
|
||||
}
|
||||
|
||||
if(id == P_MUTE) {
|
||||
if (id == P_MUTE) {
|
||||
fMute = value32;
|
||||
fMuteLastChanged = now;
|
||||
BroadcastNewParameterValue(now, id, event->pointer, size);
|
||||
} else if(id == P_BYPASS) {
|
||||
} else if (id == P_BYPASS) {
|
||||
fByPass = value32;
|
||||
fByPassLastChanged = now;
|
||||
BroadcastNewParameterValue(now, id, event->pointer, size);
|
||||
} else {
|
||||
int32 idx = id - P_PARAM;
|
||||
if(idx >= 0 && idx < fPlugin->ParametersCount()) {
|
||||
if (idx >= 0 && idx < fPlugin->ParametersCount()) {
|
||||
VSTParameter *param = fPlugin->Parameter(idx);
|
||||
param->SetValue(value);
|
||||
BroadcastNewParameterValue(now, id, &value, size);
|
||||
@@ -543,7 +564,7 @@ VSTNode::ValidateFormat(const media_format &preferredFormat,
|
||||
{
|
||||
status_t ret = B_OK;
|
||||
|
||||
if(proposedFormat.type != B_MEDIA_RAW_AUDIO) {
|
||||
if (proposedFormat.type != B_MEDIA_RAW_AUDIO) {
|
||||
proposedFormat = preferredFormat;
|
||||
return B_MEDIA_BAD_FORMAT;
|
||||
}
|
||||
@@ -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;
|
||||
}
|
||||
@@ -597,23 +621,24 @@ VSTNode::SetOutputFormat(media_format &format)
|
||||
media_raw_audio_format &f = format.u.raw_audio;
|
||||
media_raw_audio_format &w = media_raw_audio_format::wildcard;
|
||||
|
||||
if(f.frame_rate == w.frame_rate) {
|
||||
if (f.frame_rate == w.frame_rate) {
|
||||
f.frame_rate = 44100.0;
|
||||
}
|
||||
if(f.channel_count == w.channel_count) {
|
||||
if (f.channel_count == w.channel_count) {
|
||||
if(fInputMedia.source != media_source::null) {
|
||||
f.channel_count = fInputMedia.format.u.raw_audio.channel_count;
|
||||
} else {
|
||||
f.channel_count = fPlugin->Channels(VST_OUTPUT_CHANNELS);
|
||||
}
|
||||
}
|
||||
if(f.format == w.format) {
|
||||
if (f.format == w.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;
|
||||
if (f.byte_order == w.format) {
|
||||
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;
|
||||
}
|
||||
}
|
||||
@@ -634,28 +659,33 @@ VSTNode::InitParameterWeb()
|
||||
|
||||
bool switch_group_needed = false;
|
||||
for(int i = 0; i < fPlugin->ParametersCount(); i++) {
|
||||
VSTParameter *param = fPlugin->Parameter(i);
|
||||
if(param->Type() == VST_PARAM_CHECKBOX ||
|
||||
VSTParameter* param = fPlugin->Parameter(i);
|
||||
if (param->Type() == VST_PARAM_CHECKBOX ||
|
||||
param->Type() == VST_PARAM_DROPLIST) {
|
||||
switch_group_needed = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
BParameterGroup *fParamGroup = fWeb->MakeGroup("Parameters");
|
||||
BParameterGroup *fSwitchesGroup = switch_group_needed?fWeb->MakeGroup("Switches"):NULL;
|
||||
BParameterGroup *fAboutGroup = fWeb->MakeGroup("About");
|
||||
BParameterGroup* fParamGroup = fWeb->MakeGroup("Parameters");
|
||||
BParameterGroup* fSwitchesGroup = switch_group_needed ?
|
||||
fWeb->MakeGroup("Switches") : NULL;
|
||||
BParameterGroup* fAboutGroup = fWeb->MakeGroup("About");
|
||||
|
||||
BParameter *value;
|
||||
BNullParameter *label;
|
||||
BParameterGroup *group;
|
||||
BParameter* value;
|
||||
BNullParameter* label;
|
||||
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* fFControlGroup = fParamGroup->MakeGroup("FilterControl");
|
||||
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(),
|
||||
B_MEDIA_NO_TYPE, param->Name(), B_OUTPUT_MUX);
|
||||
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;
|
||||
}
|
||||
@@ -710,7 +744,7 @@ VSTNode::InitParameterWeb()
|
||||
B_MEDIA_NO_TYPE, str.String(), B_GENERIC);
|
||||
|
||||
str.SetTo("Effect name: ");
|
||||
if(strlen(fPlugin->EffectName()) != 0) {
|
||||
if (strlen(fPlugin->EffectName()) != 0) {
|
||||
str.Append(fPlugin->EffectName());
|
||||
} else {
|
||||
str.Append("not specified");
|
||||
@@ -719,7 +753,7 @@ VSTNode::InitParameterWeb()
|
||||
B_MEDIA_NO_TYPE, str.String(), B_GENERIC);
|
||||
|
||||
str.SetTo("Vendor: ");
|
||||
if(strlen(fPlugin->Vendor()) != 0) {
|
||||
if (strlen(fPlugin->Vendor()) != 0) {
|
||||
str.Append(fPlugin->Vendor());
|
||||
} else {
|
||||
str.Append("not specified");
|
||||
@@ -728,7 +762,7 @@ VSTNode::InitParameterWeb()
|
||||
B_MEDIA_NO_TYPE, str.String(), B_GENERIC);
|
||||
|
||||
str.SetTo("Product: ");
|
||||
if(strlen(fPlugin->Product()) != 0) {
|
||||
if (strlen(fPlugin->Product()) != 0) {
|
||||
str.Append(fPlugin->Product());
|
||||
} else {
|
||||
str.Append("not specified");
|
||||
@@ -762,13 +796,15 @@ VSTNode::InitFilter()
|
||||
bigtime_t
|
||||
VSTNode::GetFilterLatency()
|
||||
{
|
||||
if(fOutputMedia.destination == media_destination::null) {
|
||||
if (fOutputMedia.destination == media_destination::null) {
|
||||
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;
|
||||
|
||||
@@ -792,10 +828,10 @@ VSTNode::FilterBuffer(BBuffer* buffer)
|
||||
uint32 samples = buffer->Header()->size_used / m_frameSize;
|
||||
uint32 channels = fFormat.u.raw_audio.channel_count;
|
||||
|
||||
if(fMute != 0) {
|
||||
if (fMute != 0) {
|
||||
memset(buffer->Data(), 0, buffer->Header()->size_used);
|
||||
} else {
|
||||
if(fByPass == 0) {
|
||||
if (fByPass == 0) {
|
||||
fPlugin->Process((float*)buffer->Data(), samples, channels);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,7 +1,8 @@
|
||||
/*
|
||||
* 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.
|
||||
*/
|
||||
*/
|
||||
|
||||
#ifndef __VST_NODE_H__
|
||||
#define __VST_NODE_H__
|
||||
@@ -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;
|
||||
|
||||
Reference in New Issue
Block a user