sound: Add sample rate as a parameter for square wave

At present this value is hard-coded in the function that generates a
square wave. Since sample rates vary between different hardware, it makes
more sense to have this as a parameter.

Update the function and its users.

Signed-off-by: Simon Glass <sjg@chromium.org>
This commit is contained in:
Simon Glass
2018-11-15 19:56:13 -07:00
parent 03f11e87a8
commit 7d92b06090
4 changed files with 9 additions and 6 deletions

View File

@@ -31,11 +31,13 @@ struct sound_codec_info {
/*
* Generates square wave sound data for 1 second
*
* @param sample_rate Sample rate in Hz
* @param data data buffer pointer
* @param size size of the buffer
* @param freq frequency of the wave
*/
void sound_create_square_wave(unsigned short *data, int size, uint32_t freq);
void sound_create_square_wave(uint sample_rate, unsigned short *data, int size,
uint freq);
/*
* Initialises audio sub system