I'm new to to DSP in general and have been trying my hand at making some very simple VST's just for practice purposes.
I am trying to convert the stereo channels into Mid (in the left channel) and Side (in the right) without using a placeholder to store output. Here is a very basic version of the code I am currently trying:
*LeftSample = (*LeftSample + *RightSample) * 0.5;
*RightSample = (((*LeftSample * 2) - *RightSample) - *RightSample) * 0.5;
The first line assigns the mid output to the left channel, but in the second line I am trying to reverse the mid conversion so that I can use the left channel's original output when performing the L-R operation to create the side channel in the right output.
Am I missing something in thinking that this should be achievable? Is there some reason that
(*LeftSample * 2) - *RightSample
does not reverse the mid conversion, (L+R) * 0.5? Is it not possible to derive the original left channel using the mid signal and the right signal?
Again, I'm new to this, so I apologize for any errors in terminology I have made, and for anything that has been poorly communicated. I appreciate all feedback and criticism (please, tear any errors I've made to pieces). I've looked around quite a bit, and haven't had any luck; if anyone has any resources or directions to point me in, I would greatly, greatly appreciate it!