View Single Post
Old 03-17-2015, 12:24 PM   #8
alex_
Human being with feelings
 
Join Date: Mar 2015
Posts: 29
Default

actually i meant the convertor code, which i donīt know how to use to extract the IR from an IR.wav file.

Code:
// Impulse response (extracted from ir.wav using the convertor code below)

const float IPlugConvoEngine::mIR[] =
{
	#include "ir.h"
};



#include <stdio.h>
#include "../../../wdlendian.h"

int main(int argc, char* argv[])
{
	FILE* f = fopen(argv[1], "rb");
	fseek(f, 12, SEEK_SET);

	unsigned int i, n;
	for (;;)
	{
		fread(&i, 1, 4, f);
		fread(&n, 1, 4, f);
		n = WDL_bswap32_if_be(n);
		if (i == WDL_bswap32_if_le('data')) break;
		fseek(f, n, SEEK_CUR);
	}

	while (n > 0)
	{
		n -= fread(&i, 1, 4, f);
		printf("%.8ef,\n", (float)WDL_bswapf_if_be(i));
	}

	fclose(f);
	return 0;
}
alex_ is offline   Reply With Quote