HVScrollView
HVScrollView copied to clipboard
博主可以去看看 “饿了么”的文章
Hi Marc,
Thanks for getting in touch. I will perhaps update this for the next version, or maybe with some example code. But for now, here is what I would do at step 4 to fill a buffer with a sine wave... (i've added some extra variables for clarity):
int numChannels = 2;
int numSamplesPerChannel = 100000;
float sampleRate = 44100.f;
float frequency = 440;
for (int i = 0; i < numSamplesPerChannel; i++)
{
float sample = sinf (2. * M_PI * ((float) i / sampleRate) * frequency) ;
for (int channel = 0; channel < numChannels; channel++)
buffer[channel][i] = sample * 0.5;
}
I haven't tested this - just wrote it here, but it should work. Hope this helps.
Adam
Thank you so much for your quick response. This worked.
I've now added this to the main documentation in the new version