I'm playing around doing some audio synthesis in real time with C# .Net.
I've got a VCO class that updates it's output waveform whenever the output waveform is read. In order to play a sound, I want to feed it into the DirectSound secondary buffer. I've played around doing this using a byte array not populated in real time.
However, in order to play my VCO in real time, I presume I need to read the output at the same rate as the sample rate specified for the direct sound object.
Is there a way I can have a timer or callback type function that raises an event at 1/sample rate so that the real time vco output can be matched to the direct sound sample rate ?
I suppose I can have a loop and interogate StopWatch.Ticks, but is there a neater way of having an event automatically raised, with no processor load in between ?