Skip to content

Instantly share code, notes, and snippets.

@diplojocus
Last active August 29, 2015 14:14
Show Gist options
  • Save diplojocus/0bee67c1d078a5a9ef9b to your computer and use it in GitHub Desktop.
Save diplojocus/0bee67c1d078a5a9ef9b to your computer and use it in GitHub Desktop.
Heavy - Processing Inline Buffers
#include <mm_malloc.h>
#include "Heavy_heavy.h"
int main(int argc, const char *argv[]) {
double sampleRate = 44100.0;
Hv_heavy *context = hv_heavy_new(sampleRate);
int numOutputChannels = hv_getNumOutputChannels(context);
int numIterations = 100;
int blockSize = 256; // should be a multiple of 8
// sample buffers should be (ideally 32) byte-aligned
float *outBuffers = (float *) _mm_malloc(numOutputChannels * blockSize * sizeof(float), 32);
for (int i = 0; i < numIterations; ++i) {
hv_heavy_process_inline(context, NULL, outBuffers, blockSize);
// do something with output here
}
hv_heavy_free(context);
return 0;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment