Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
Dependencies: GR-PEACH_video R_BSP TLV320_RBSP USBHost_custom
Fork of GR-PEACH_Audio_Playback_Sample by
audio_out.h
00001 /******************************************************************************* 00002 * DISCLAIMER 00003 * This software is supplied by Renesas Electronics Corporation and is only 00004 * intended for use with Renesas products. No other uses are authorized. This 00005 * software is owned by Renesas Electronics Corporation and is protected under 00006 * all applicable laws, including copyright laws. 00007 * THIS SOFTWARE IS PROVIDED "AS IS" AND RENESAS MAKES NO WARRANTIES REGARDING 00008 * THIS SOFTWARE, WHETHER EXPRESS, IMPLIED OR STATUTORY, INCLUDING BUT NOT 00009 * LIMITED TO WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE 00010 * AND NON-INFRINGEMENT. ALL SUCH WARRANTIES ARE EXPRESSLY DISCLAIMED. 00011 * TO THE MAXIMUM EXTENT PERMITTED NOT PROHIBITED BY LAW, NEITHER RENESAS 00012 * ELECTRONICS CORPORATION NOR ANY OF ITS AFFILIATED COMPANIES SHALL BE LIABLE 00013 * FOR ANY DIRECT, INDIRECT, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES FOR 00014 * ANY REASON RELATED TO THIS SOFTWARE, EVEN IF RENESAS OR ITS AFFILIATES HAVE 00015 * BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. 00016 * Renesas reserves the right, without notice, to make changes to this software 00017 * and to discontinue the availability of this software. By using this software, 00018 * you agree to the additional terms and conditions found by accessing the 00019 * following link: 00020 * http://www.renesas.com/disclaimer* 00021 * Copyright (C) 2015 Renesas Electronics Corporation. All rights reserved. 00022 *******************************************************************************/ 00023 00024 #ifndef AUDIO_OUT_H 00025 #define AUDIO_OUT_H 00026 00027 #include "r_typedefs.h" 00028 00029 /*--- Macro definition ---*/ 00030 #define AUD_STACK_SIZE (2048u) /* Stack size of Decode thread */ 00031 00032 /*--- User defined types ---*/ 00033 typedef void (*AUD_CbDataOut)(const bool result); 00034 typedef void (*AUD_CbAudioData)( const bool result, int16_t * const p_buf, 00035 const uint32_t buf_num, const int32_t * const p_audio, const uint32_t audio_num); 00036 00037 /** Audio Output Thread 00038 * 00039 * @param argument Pointer to the thread function as start argument. 00040 */ 00041 void aud_thread(void const *argument); 00042 00043 /** Requests the audio out thread to read the SCUX conversion results and output data. 00044 * 00045 * @param p_cb Callback function for notifying the completion of data output preparation 00046 * typedef void (*AUD_CbDataOut)( const bool result ); 00047 * When calling callback function specified in p_cb, specify the following 00048 * in the callback function argument result: 00049 * result : Execution result; true = Success; false = Failure 00050 * * Since the SCUX's asynchronous SRC function is used, an overflow error will occur 00051 * if the data read from the SCUX is delayed. For this reason, the callback function 00052 * must be set up to notify the completion of processing after making settings 00053 * for reading SCUX data. The decode thread starts writing data to the SCUX upon 00054 * receipt of the completion notification through the callback function. 00055 * 00056 * @returns 00057 * Returns true if the API is successful. Returns false if the API fails. 00058 * This function fails when: 00059 * The argument p_cb is set to NULL. 00060 * Failed to secure memory for mailbox communication. 00061 * Failed to perform transmit processing for mailbox communication. 00062 */ 00063 bool aud_req_data_out(const AUD_CbDataOut p_cb); 00064 00065 /** Requests the audio out thread to stop reading the SCUX conversion results and to generate silent output. 00066 * 00067 * @returns 00068 * Returns true if the API is successful. Returns false if the API fails. 00069 * This function fails when: 00070 * Failed to secure memory for mailbox communication. 00071 * Failed to perform transmit processing for mailbox communication. 00072 */ 00073 bool aud_req_zero_out(void); 00074 00075 /** Gets the audio data from the output thread. 00076 * 00077 * @param p_cb Callback function for notifying the completion of data acquisition 00078 * typedef void (*AUD_CbAudioData)( const bool result, 00079 * int16_t * const p_buf, const uint32_t buf_num, 00080 * const int32_t * const p_audio, const uint32_t audio_num); 00081 * When calling callback function specified in p_cb, specify the following 00082 * in the callback function arguments result, p_buf, buf_num, p_audio, and audio_num: 00083 * result : Execution result; true = Success; false = Failure 00084 * p_buf : Pointer to the buffer for storing audio data 00085 * * Although the audio data output is 24 bits long, 16 bits of the data 00086 * are used for display. 00087 * * The data that is specified in the second argument p_buf of this function 00088 * must be placed in p_buf of the callback function as is. 00089 * buf_num : Array size of the area pointed to by p_buf 00090 * * The data that is specified in the third argument buf_num of 00091 * this function must be placed in buf_num of the callback function as is. 00092 * p_audio : 10 ms equivalent of audio data (96000 Hz, 2ch, 24 bits) 00093 * audio_num : Array size of the area pointed to by p_audio 00094 * @param p_buf Pointer to the buffer for storing audio data 00095 * 00096 * @returns 00097 * Returns true if the API is successful. Returns false if the API fails. 00098 * This function fails when: 00099 * The argument p_cb is set to NULL. 00100 * The argument p_buf is set to NULL. 00101 * Failed to secure memory for mailbox communication. 00102 * Failed to perform transmit processing for mailbox communication. 00103 */ 00104 bool aud_get_audio_data(const AUD_CbAudioData p_cb, int16_t * const p_buf, const uint32_t buf_num); 00105 00106 #endif /* AUDIO_OUT_H */
Generated on Tue Jul 12 2022 19:32:28 by
