Last active
June 27, 2025 15:18
-
-
Save dromer/e29e1c39ce73b4787bd4957d3755593a to your computer and use it in GitHub Desktop.
LDSP Heavy wrapper
This file contains hidden or 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 "LDSP.h" | |
#include "Heavy_noise.h" | |
HeavyContextInterface *gHeavyContext; | |
float *gHvInputBuffers = NULL; | |
unsigned int gHvInputChannels = 0; | |
bool setup(LDSPcontext *context, void *userData) | |
{ | |
gHeavyContext = hv_noise_new_with_options(context->audioSampleRate, 10, 2, 0); | |
gHvInputChannels = hv_getNumInputChannels(gHeavyContext); | |
if(gHvInputChannels != 0) { | |
gHvInputBuffers = (float *)calloc(gHvInputChannels * context->audioFrames,sizeof(float)); | |
} | |
return true; | |
} | |
void render(LDSPcontext *context, void *userData) | |
{ | |
memcpy(gHvInputBuffers, context->audioIn, gHvInputChannels * context->audioFrames * sizeof(float)); | |
hv_processInline(gHeavyContext, gHvInputBuffers, context->audioOut, context->audioFrames); | |
} | |
void cleanup(LDSPcontext *context, void *userData) | |
{ | |
hv_noise_free(gHeavyContext); | |
free(gHvInputBuffers); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment