Hello,
I had a quick look at your code. Did you notice that waveIn array is defined as a short int? This is a 16-bit type and therefore is not able to store the 24 bits you desire. I imagine this results in some corruption of the buffer.
Please clarify which other functions you require coding.
Thanks
Chris