I'm extremely new to this (gnuradio, usrp's, and radios in general) so I apologise if this question doesn't make sense or has obviously been answered else where ( I have up until now been trying to find answers without bothering anyone).
I have written my own gnuradio block as a source, i'm trying to replicate the signal source waveform generator to get a grasp on how it is done. My problem is that I don't know how to implement the Sampling Frequency. When I looked at the source of the block I'm trying to replicate I noticed it used a variable called nco to step along the wave it generates.
Currently I for my work method of my source block I have:
float *out = (float *) output_items;
for (int i = 0; i < noutput_items; i++)
d_count = d_count + 1;
out[i] = d_Amplitude * sin(2 * 3.14159 * d_WaveFreq * d_Count/5000000.0);
This produces a Sine and lets me control the amplitude and wave frequency nicely, but the purely depends on how fast samples are produced.My question is, how do I do this "properly"? How do I limit the amount of items produces/ how often the sine wave is sampled? I don't understand how the nco class does it in the provided block so I'm hoping for some clarification.
I thought of checking the time that each sample was produced and comparing that to the previous one, having a variable controlling allowed time between the two or something like that, but it really comes down to me not really understanding how the items/samples are produced.
Any help would be greatly appreciated, even if it's just a URL pointing me in the right direction.