Author Topic: Testing new OxygenBasicProgress of 4th Feb 2019  (Read 1195 times)

0 Members and 1 Guest are viewing this topic.

Aurel

  • Sr. Member
  • ****
  • Posts: 385
Re: Testing new OxygenBasicProgress of 4th Feb 2019
« Reply #15 on: April 24, 2019, 10:30:22 PM »
John ..
sorry my bad english..
not you....    mr.Roca
..he don't feel the charm of o2

anyway Jose is nice guy but he prefer other things  :)

Charles Pegge

  • Admin Support Member
  • *****
  • Posts: 4128
    • Oxygen Basic
Re: Testing new OxygenBasicProgress of 4th Feb 2019
« Reply #16 on: April 25, 2019, 04:42:54 PM »
The default is now #autodim off (20-05-2018). This is the safer option for programs of any significant size.

Alex_Longard

  • Newbie
  • *
  • Posts: 31
Re: Testing new OxygenBasicProgress of 4th Feb 2019
« Reply #17 on: April 26, 2019, 11:15:14 PM »
Hello Charles!
Help me please, i not know how to translate this codes in O2:

ps: C++ code
Code: [Select]
rtclass *runtime = (rtclass*)(basicstruct->instance);

basicstruct *b = (basicstruct*) malloc(sizeof(basicstruct));
memset(&b, 0, sizeof(basicstruct));

int** arrayptr;


Charles Pegge

  • Admin Support Member
  • *****
  • Posts: 4128
    • Oxygen Basic
Re: Testing new OxygenBasicProgress of 4th Feb 2019
« Reply #18 on: April 27, 2019, 02:32:49 AM »
Hi Alex,

I can't make sense of the first line without seeing definitions for rtclass and basicstruct, and how runtime is used.

but the others are:

Code: [Select]
'basicstruct *b = (basicstruct*) malloc(sizeof(basicstruct));
'memset(&b, 0, sizeof(basicstruct));
basicstruct *b : @b=getmemory(sizeof(basicstruct))

'int** arrayptr;
int** arrayptr

Alex_Longard

  • Newbie
  • *
  • Posts: 31
Re: Testing new OxygenBasicProgress of 4th Feb 2019
« Reply #19 on: April 27, 2019, 04:04:35 AM »
Hi Charles!
Thank you!

rtclass used as type for *runtime, which use in programm instance:

I upload all C++ code for Mingw compiler, i cand not translate some strange code, which i not seed in O2 examples(((

This basic code which i rewrite.
Code: [Select]
#include "pluginterfaces\vst2.x\aeffect.h"
#include "pluginterfaces\vst2.x\aeffectx.h"
#include <stdio.h>

typedef audioMasterCallback VSTHostCallback;
typedef AEffect VSTPlugin;

extern "C" {
extern AEffect *VSTPluginMain(audioMasterCallback audioMaster); }

const VstInt32 PLUGIN_VERSION = 1000;

class VSTPluginWrapper
{
public:
VSTPluginWrapper(VSTHostCallback vstHostCallback, VstInt32 vendorUniqueID, VstInt32 vendorVersion, VstInt32 numParams, VstInt32 numPrograms, VstInt32 numInputs, VstInt32 numOutputs);
~VSTPluginWrapper();

inline VSTPlugin *getVSTPlugin()
{
return &_vstPlugin;
}

inline VstInt32 getNumInputs() const
{
return _vstPlugin.numInputs;
}

inline VstInt32 getNumOutputs() const
{
return _vstPlugin.numOutputs;
}

private:
VSTHostCallback _vstHostCallback;
VSTPlugin _vstPlugin;
};

void VSTPluginProcessSamplesFloat32(VSTPlugin *vstPlugin, float **inputs, float **outputs, VstInt32 sampleFrames)
{
VSTPluginWrapper *wrapper = (VSTPluginWrapper*)(vstPlugin->object);
for(int i = 0; i < wrapper->getNumInputs(); i++)
{
auto inputSamples = inputs[i];
auto outputSamples = outputs[i];
for(int j = 0; j < sampleFrames; j++)
{
outputSamples[j] = inputSamples[j] * 0.5f;
} } }

void VSTPluginProcessSamplesFloat64(VSTPlugin *vstPlugin, double **inputs, double **outputs, VstInt32 sampleFrames)
{
VSTPluginWrapper *wrapper = (VSTPluginWrapper*)(vstPlugin->object);
for(int i = 0; i < wrapper->getNumInputs(); i++)
{
auto inputSamples = inputs[i];
auto outputSamples = outputs[i];
for(int j = 0; j < sampleFrames; j++)
{
outputSamples[j] = inputSamples[j] * 0.5;
} } }

VstIntPtr VSTPluginDispatcher(VSTPlugin *vstPlugin, VstInt32 opCode, VstInt32 index, VstIntPtr value, void *ptr, float opt)
{
VstIntPtr v = 0;
VSTPluginWrapper *wrapper = (VSTPluginWrapper*)(vstPlugin->object);
switch(opCode)
{
case effGetPlugCategory:
return kPlugCategSynth;
break;
case effClose:
delete wrapper;
break;

case effGetVendorString:
strncpy((char*)(ptr), "Alex Longard", kVstMaxVendorStrLen);
v = 1;
break;

case effGetVendorVersion:
return PLUGIN_VERSION;
break;
default:
// printf("Unknown opCode %d [ignored] \n", opCode);
break;
}
return v;
}

void VSTPluginSetParameter(VSTPlugin *vstPlugin, VstInt32 index, float parameter)
{
VSTPluginWrapper *wrapper = (VSTPluginWrapper*)(vstPlugin->object);
}

float VSTPluginGetParameter(VSTPlugin *vstPlugin, VstInt32 index)
{
VSTPluginWrapper *wrapper = (VSTPluginWrapper*)(vstPlugin->object);
return 0;
}

VSTPluginWrapper::VSTPluginWrapper(audioMasterCallback vstHostCallback, VstInt32 vendorUniqueID, VstInt32 vendorVersion, VstInt32 numParams, VstInt32 numPrograms, VstInt32 numInputs, VstInt32 numOutputs) : _vstHostCallback(vstHostCallback)
{
memset(&_vstPlugin, 0, sizeof(_vstPlugin));
_vstPlugin.magic = kEffectMagic;
_vstPlugin.object = this;
_vstPlugin.flags = effFlagsCanReplacing | effFlagsCanDoubleReplacing;
_vstPlugin.uniqueID = vendorUniqueID;
_vstPlugin.version = vendorVersion;
_vstPlugin.numParams = numParams;
_vstPlugin.numPrograms = numPrograms;
_vstPlugin.numInputs = numInputs;
_vstPlugin.numOutputs = numOutputs;
_vstPlugin.dispatcher = VSTPluginDispatcher;
_vstPlugin.getParameter = VSTPluginGetParameter;
_vstPlugin.setParameter = VSTPluginSetParameter;
_vstPlugin.processReplacing = VSTPluginProcessSamplesFloat32;
_vstPlugin.processDoubleReplacing = VSTPluginProcessSamplesFloat64;
}

VSTPluginWrapper::~VSTPluginWrapper()
{
}

VSTPlugin *VSTPluginMain(VSTHostCallback vstHostCallback)
{
VSTPluginWrapper *plugin = new VSTPluginWrapper(vstHostCallback, CCONST('u', 's', 'a', 'n'), PLUGIN_VERSION, 1111, 0, 2, 2);
return plugin->getVSTPlugin();
}
« Last Edit: April 27, 2019, 04:35:56 AM by Alex_Longard »

Charles Pegge

  • Admin Support Member
  • *****
  • Posts: 4128
    • Oxygen Basic
Re: Testing new OxygenBasicProgress of 4th Feb 2019
« Reply #20 on: April 27, 2019, 04:31:05 AM »
Code: [Select]
rtclass *runtime = (rtclass*)(basicstruct->instance);

This line does not make sense since (rtclass*)(basicstruct->instance) cannot produce a value. Perhaps it is a dim statement with strong typing, in which case the pointer value for runtime is assigned later:

rtclass*runtime
...
@runtime = @b.instance
« Last Edit: April 27, 2019, 04:54:29 AM by Charles Pegge »

Alex_Longard

  • Newbie
  • *
  • Posts: 31
Re: Testing new OxygenBasicProgress of 4th Feb 2019
« Reply #21 on: April 27, 2019, 04:39:39 AM »
I showed above all the code, so you will understand where I stumble for translation.

Charles Pegge

  • Admin Support Member
  • *****
  • Posts: 4128
    • Oxygen Basic
Re: Testing new OxygenBasicProgress of 4th Feb 2019
« Reply #22 on: April 27, 2019, 04:43:32 AM »
What is the structure of BasicStruct ?

Alex_Longard

  • Newbie
  • *
  • Posts: 31
Re: Testing new OxygenBasicProgress of 4th Feb 2019
« Reply #23 on: April 27, 2019, 04:54:18 AM »
basicstruct as AEffect structure in aeffect.h include file.

I rewrite all code for self.

Charles Pegge

  • Admin Support Member
  • *****
  • Posts: 4128
    • Oxygen Basic
Re: Testing new OxygenBasicProgress of 4th Feb 2019
« Reply #24 on: April 27, 2019, 04:56:15 AM »
How have you defined basicstruct->instance?

Alex_Longard

  • Newbie
  • *
  • Posts: 31
Re: Testing new OxygenBasicProgress of 4th Feb 2019
« Reply #25 on: April 27, 2019, 05:02:43 AM »
The first code that I showed was my mistake when I rewrote the code for myself which is now fully shown above. Instead of basicstruct, the code contains _vstplugin->object
Code: [Select]
VSTPluginWrapper *wrapper = (VSTPluginWrapper*)(vstPlugin->object);

I attached to the post an archive with full working code that is only for C++. This is a scary code that I rewrote to understand some things, but more confused.
« Last Edit: April 27, 2019, 05:12:13 AM by Alex_Longard »