Skip to content

Instantly share code, notes, and snippets.

@Xenakios
Last active January 10, 2019 18:03
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save Xenakios/09143c8fa512aefc041509fcb17f4258 to your computer and use it in GitHub Desktop.
Save Xenakios/09143c8fa512aefc041509fcb17f4258 to your computer and use it in GitHub Desktop.
#include <stdio.h>
#include <stdlib.h>
#include "aeffect.h"
#include "aeffectx.h"
#define vst_export __declspec(dllexport)
// prototype for external function
vst_export struct AEffect* VSTPluginMain(audioMasterCallback audioMaster);
// constants
const VstInt32 plugversion = 1010;
// AuDioPlugin class
typedef struct AudioPlugin
{
VstInt32 samplerate;
VstInt32 left_channel;
VstInt32 right_channel;
} APlugin;
// Dispatcher function
VstIntPtr VSTCALLBACK Dispatcher(AEffect* effect, VstInt32 opcode, VstInt32 index, VstIntPtr value, void* ptr, float opt)
{
VstIntPtr result = 0;
FILE *fp;
switch (opcode)
{
case effClose:
// nothing to do here at the moment
result = 1;
break;
case effGetPlugCategory:
return kPlugCategEffect;
case effGetVendorString:
vst_strncpy(ptr, "Alex Longard", kVstMaxVendorStrLen);
case effGetVendorVersion:
return plugversion;
default:
break;
}
fp = fopen("log.txt", "w");
fprintf(fp, "worked! %d\n", ptr);
fclose(fp);
return result;
}
vst_export AEffect* VSTPluginMain(audioMasterCallback audioMaster)
{
AEffect* aef = (AEffect*)malloc(sizeof(AEffect));
memset(aef, 0, sizeof(AEffect));
aef->magic = kEffectMagic;
aef->dispatcher = &Dispatcher;
aef->numInputs = 2;
aef->numOutputs = 2;
aef->flags = effFlagsCanReplacing;
// aef->processReplacing = &ProcessProc;
aef->uniqueID = 4321;
aef->version = plugversion;
FILE *fp;
fp = fopen("data.txt", "w");
fprintf(fp, "i'am work %d\n", aef);
fclose(fp);
return aef;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment