I've got a bunch of stuff working in my mixer program. More specifically though, I have a wav file that I need to double time. What I mean by double time is this:
Double Time
This effect slows down the sound so that it takes twice as long to play. This means you’ll end up with an array that’s double the size, with every sample put in twice.
When you iterate over the samples array you know exactly where you should put the sample values in the temp array. These are positions 2 * i and 2 * i + 1, so you don't need any ifs in your code:
That did the trick. My only concern now is getting it to work like my Half() method. It seems that what I'm doing in the Double() method copies it to a new array and positions everything correctly but for the life of me, I can't seem to get it to play like the Half() method does. What I do know is the reason the Half() method works is I'm writing the values to the out.wav file so when its done writing, it plays. It'd be cool if I could figure out how to do the same for the Double() method. I think what's stopping me from doing that is the fact that the data members I'm passing in are certain sizes and I'd need to change them to manage it correctly.
Grr. Wall of friggin' text.
Half() method works by writing every other value to the samples pointer array. So with that idea, The Double() method needs to take the samples pointer array, double the size, then write the new values, copying every samples[ i ] value into the new array. Anyways, that's all. I'll keep working on my code.