I've already managed to generate sine, saw and even square waves by transforming the other two. Now, I'm extremely frustrated with pulse waves.
The idea is, the frequency controls the pitch (leave at default for testing), shape controls the width of a pulse and volume controls the volume, where 255 is the largest char value, 0 and 256 is the lowest and considered the same thing. 128 is the max volume.
Oh, and 50 is the default shape, which should produce a square wave.
I don't understand, the value for volume is 128, 128*255 /128 = 255, the maximum value of a char. Oh, wait. It's because it's signed, isn't it? Never mind, unsigning it didn't do anything... Wait, changing the 128 to a 1 in the if statement got it producing a sqaure, but adjusting the shape does nothing. It's a start! Produces a square, and changing the shape to a radically high value adjusts the shape, thanks!
Yeah, Jibs got it. I like to stay away from more abstract C++ stuff and stick to C because it's cleaner. The only time I use C++ stuff is when it's necessary or would optimise my code.