Well, just look at a sine wave:
If x runs from 0 to 2 * pi, you get one complete wave. Now multiply by 2 * pi:
Now the full wave goes from 0 to 1. Now assume x is our time in seconds, and you want a 440 Hz tone:
y = sin(x * 2 * pi * 440);
Now each seconds there is 440 complete sine waves.
Now, instead of having the time in seconds, x is a sample position, 48000 samples make up one second:
y = sin(x * 2 * pi * 440 / 48000);
In your code, a_nFrequency is the 48000. So a_nDuration/samples is your tone's frequency. I'm a bit unsure about those variable names, I'd say you can simplify that function a lot and still have it do the same thing.