eek! Don’t really understand what you’re trying to do there!
You can of course just reinterpret_cast a float* to an int*, but if you ever find yourself doing that, you should try to find a less hacky approach to whatever the problem is.
it was an idea for a VST bit crusher plugin, i got the idea for a Doepfer presentation. they showed a module for their ModularSYnth system, that did operations on bits, (xor or and and others) and it sounded very nice, so i thought that has to be easy in the DSP world, since what we deal with is numbers, but i can’t get around to doing this.
anyway, i need to get on with my reading (unions and stuff) and IEE float specification and i’ll get to it, i just thought BitArray could be of use here, cause it’s a much nice interface then all those weird BIT frownies that look like japaneese ads for sex toys.
it does not process only display bit representation of incoming samples (one sample per buffer cycle every 10th cycle, first channel only, so it doesn’t eat all your cpu)
i used a UNION just like jules did in his rountfloatoint conversion, now it’s a matter of the processing code for those bit operations, from what i remember bit operations are not very efficient performance wise, but i’m not sure.
You can definitely make some lovely nasty (?) noises this way!
You’ve probably already thought of this but you may need to check your samples for NaNs and INFs and set them to something sensible (zero?) before outputting them from the plugin after doing arbitrary bitwise ops on floats.
I’d bet they use a fixed point signal representation for their bit mangling operations. let us know if you manage to get the results you want using floating point.
or they scale the values, treating them as integers, so they will not have problem by XORing or ANDing two numbers with different exponent and mantissa length.
i have a question, is it a good idea to inline those methods that do bit operations ? will this help with performance, i saw this in roundfloatotin in juce but i don’t know what impact does this have, i’ve made some timing test on vc6 and i see no difference with inline and without, but maybe i’m missing something ?