Last active
January 10, 2019 18:03
-
-
Save Xenakios/09143c8fa512aefc041509fcb17f4258 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#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