From 7d92b0609093a047ce4b113d77ccd3cc78325e8f Mon Sep 17 00:00:00 2001 From: Simon Glass Date: Thu, 15 Nov 2018 19:56:13 -0700 Subject: 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 --- include/sound.h | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) (limited to 'include') diff --git a/include/sound.h b/include/sound.h index 3269f2371c3..77bfe6a93b2 100644 --- a/include/sound.h +++ b/include/sound.h @@ -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 -- cgit v1.2.3