Bluetooth: Audio: Change samples and shell to use sinf
Change the samples and shell to use sinf instead of sin, as that return the expect float data type, instead of a double. Signed-off-by: Emil Gydesen <emil.gydesen@nordicsemi.no>
This commit is contained in:
parent
4e4a2e8d61
commit
515ef17915
3 changed files with 3 additions and 4 deletions
|
@ -98,7 +98,7 @@ static void fill_audio_buf_sin(int16_t *buf, int length_us, int frequency_hz, in
|
|||
const float step = 2 * 3.1415f / sine_period_samples;
|
||||
|
||||
for (unsigned int i = 0; i < num_samples; i++) {
|
||||
const float sample = sin(i * step);
|
||||
const float sample = sinf(i * step);
|
||||
|
||||
buf[i] = (int16_t)(AUDIO_VOLUME * sample);
|
||||
}
|
||||
|
|
|
@ -106,7 +106,6 @@ static int frame_duration_100us;
|
|||
static int frames_per_sdu;
|
||||
static int octets_per_frame;
|
||||
|
||||
|
||||
/**
|
||||
* Use the math lib to generate a sine-wave using 16 bit samples into a buffer.
|
||||
*
|
||||
|
@ -122,7 +121,7 @@ static void fill_audio_buf_sin(int16_t *buf, int length_us, int frequency_hz, in
|
|||
const float step = 2 * 3.1415f / sine_period_samples;
|
||||
|
||||
for (unsigned int i = 0; i < num_samples; i++) {
|
||||
const float sample = sin(i * step);
|
||||
const float sample = sinf(i * step);
|
||||
|
||||
buf[i] = (int16_t)(AUDIO_VOLUME * sample);
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue