The "GR-PEACH_Audio_Playback_Sample" is a sample code that can provides high-resolution audio playback of FLAC format files. It also allows the user to audio-playback control functions such as play, pause, and stop by manipulating key switches.

Dependencies:   R_BSP TLV320_RBSP USBHost_custom

Note

For a sample program of with LCD Board,
please refer to GR-PEACH_Audio_Playback_7InchLCD_Sample.

Introduction

The "GR-PEACH_Audio_Playback_Sample" is a sample code that can provides high-resolution audio playback of FLAC format files. It also allows the user to audio-playback control functions such as play, pause, and stop by manipulating key switches.

1. Overview of the Sample Code

1.1 Software Block Diagram

Figure 1.1 shows the software block diagram.

/media/uploads/dkato/audioplayback_figure1_1x.png

1.2 Pin Definitions

Table 1.1 shows the pins that this sample code are to use.

/media/uploads/dkato/audioplayback_table1_1.png

2. Sample Code Operating Environment

This sample code runs in GR-PEACH + the Audio/Camera shield for the GR-PEACH environment. This section explains the functions of the ports that are used by this sample code.

2.1 Operating Environment

Figure 2.1 shows the configuration of the operating environment for running this sample code.

/media/uploads/dkato/audioplayback_figure2_1.png /media/uploads/1050186/figure2_2.png /media/uploads/dkato/audioplayback_figure2_3.png

2.2 List of User Operations

A list of user operations on the command line, TFT touch keys, and switch key that the user can perform for this sample code is shown in. Table 2.1.

/media/uploads/dkato/audioplayback_table2_1x.png

3. Function Outline

The functions of this sample code are summarized in Table 3.1 to Table 3.3.

/media/uploads/dkato/audioplayback_table3_1.png /media/uploads/dkato/audioplayback_table3_2.png /media/uploads/dkato/audioplayback_table3_3.png /media/uploads/dkato/audioplayback_figure3_1.png

3.1 Playback Control

The playback control that the sample code supports include play, pause, stop, skip to next, and skip to previous.

3.2 Trick Play Control

Manipulating "Repeat" alternates between "Repeat mode On" and "Repeat mode Off". The default mode is "Repeat mode On". When the repeat mode is on, the playback of the first song starts after the playback of the last song is finished. When the repeat mode is off, the sample code enters the stopped state after the playback of the last song is finished.

3.3 Acquisition of the Song Information

The information of the song being played is obtained by operating the "Play info" during the playback of the song. Table 3.4 lists the items of information that can be obtained by the "Play info" operation.

/media/uploads/dkato/audioplayback_table3_4.png

3.4 How the Folder Structure is Analyzed

The sample coded analyzes the folder structure in the breadth-first search order. The order in which files are numbered is illustrated in Table 3.5. The sample code does not sort the files by file or folder name.

/media/uploads/dkato/audioplayback_table3_5.png

4.Others

The default setting of serial communication (baud rate etc.) in mbed is shown the following link.
Please refer to the link and change the settings of your PC terminal software.
The default value of baud rate in mbed is 9600, and this application uses baud rate 9600.
https://developer.mbed.org/teams/Renesas/wiki/GR-PEACH-Getting-Started#install-the-usb-serial-communication

Committer:
dkato
Date:
Fri Oct 16 04:28:07 2015 +0000
Revision:
0:ee40da884cfc
first commit

Who changed what in which revision?

UserRevisionLine numberNew contents of line
dkato 0:ee40da884cfc 1 /* libFLAC - Free Lossless Audio Codec library
dkato 0:ee40da884cfc 2 * Copyright (C) 2001-2009 Josh Coalson
dkato 0:ee40da884cfc 3 * Copyright (C) 2011-2014 Xiph.Org Foundation
dkato 0:ee40da884cfc 4 *
dkato 0:ee40da884cfc 5 * Redistribution and use in source and binary forms, with or without
dkato 0:ee40da884cfc 6 * modification, are permitted provided that the following conditions
dkato 0:ee40da884cfc 7 * are met:
dkato 0:ee40da884cfc 8 *
dkato 0:ee40da884cfc 9 * - Redistributions of source code must retain the above copyright
dkato 0:ee40da884cfc 10 * notice, this list of conditions and the following disclaimer.
dkato 0:ee40da884cfc 11 *
dkato 0:ee40da884cfc 12 * - Redistributions in binary form must reproduce the above copyright
dkato 0:ee40da884cfc 13 * notice, this list of conditions and the following disclaimer in the
dkato 0:ee40da884cfc 14 * documentation and/or other materials provided with the distribution.
dkato 0:ee40da884cfc 15 *
dkato 0:ee40da884cfc 16 * - Neither the name of the Xiph.org Foundation nor the names of its
dkato 0:ee40da884cfc 17 * contributors may be used to endorse or promote products derived from
dkato 0:ee40da884cfc 18 * this software without specific prior written permission.
dkato 0:ee40da884cfc 19 *
dkato 0:ee40da884cfc 20 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
dkato 0:ee40da884cfc 21 * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
dkato 0:ee40da884cfc 22 * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
dkato 0:ee40da884cfc 23 * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR
dkato 0:ee40da884cfc 24 * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
dkato 0:ee40da884cfc 25 * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
dkato 0:ee40da884cfc 26 * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
dkato 0:ee40da884cfc 27 * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
dkato 0:ee40da884cfc 28 * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
dkato 0:ee40da884cfc 29 * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
dkato 0:ee40da884cfc 30 * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
dkato 0:ee40da884cfc 31 */
dkato 0:ee40da884cfc 32
dkato 0:ee40da884cfc 33 #ifndef FLAC__PRIVATE__CPU_H
dkato 0:ee40da884cfc 34 #define FLAC__PRIVATE__CPU_H
dkato 0:ee40da884cfc 35
dkato 0:ee40da884cfc 36 #include "FLAC/ordinals.h"
dkato 0:ee40da884cfc 37
dkato 0:ee40da884cfc 38 #ifdef HAVE_CONFIG_H
dkato 0:ee40da884cfc 39 #include <config.h>
dkato 0:ee40da884cfc 40 #endif
dkato 0:ee40da884cfc 41
dkato 0:ee40da884cfc 42 #if defined FLAC__HAS_X86INTRIN
dkato 0:ee40da884cfc 43 /* SSE intrinsics support by ICC/MSVC/GCC */
dkato 0:ee40da884cfc 44 #if defined __INTEL_COMPILER
dkato 0:ee40da884cfc 45 #define FLAC__SSE_TARGET(x)
dkato 0:ee40da884cfc 46 #define FLAC__SSE_SUPPORTED 1
dkato 0:ee40da884cfc 47 #define FLAC__SSE2_SUPPORTED 1
dkato 0:ee40da884cfc 48 #if (__INTEL_COMPILER >= 1000) /* Intel C++ Compiler 10.0 */
dkato 0:ee40da884cfc 49 #define FLAC__SSSE3_SUPPORTED 1
dkato 0:ee40da884cfc 50 #define FLAC__SSE4_1_SUPPORTED 1
dkato 0:ee40da884cfc 51 #endif
dkato 0:ee40da884cfc 52 #if (__INTEL_COMPILER >= 1110) /* Intel C++ Compiler 11.1 */
dkato 0:ee40da884cfc 53 #define FLAC__AVX_SUPPORTED 1
dkato 0:ee40da884cfc 54 #endif
dkato 0:ee40da884cfc 55 #if (__INTEL_COMPILER >= 1300) /* Intel C++ Compiler 13.0 */
dkato 0:ee40da884cfc 56 #define FLAC__AVX2_SUPPORTED 1
dkato 0:ee40da884cfc 57 #define FLAC__FMA_SUPPORTED 1
dkato 0:ee40da884cfc 58 #endif
dkato 0:ee40da884cfc 59 #elif defined _MSC_VER
dkato 0:ee40da884cfc 60 #define FLAC__SSE_TARGET(x)
dkato 0:ee40da884cfc 61 #define FLAC__SSE_SUPPORTED 1
dkato 0:ee40da884cfc 62 #define FLAC__SSE2_SUPPORTED 1
dkato 0:ee40da884cfc 63 #if (_MSC_VER >= 1500) /* MS Visual Studio 2008 */
dkato 0:ee40da884cfc 64 #define FLAC__SSSE3_SUPPORTED 1
dkato 0:ee40da884cfc 65 #define FLAC__SSE4_1_SUPPORTED 1
dkato 0:ee40da884cfc 66 #endif
dkato 0:ee40da884cfc 67 #if (_MSC_FULL_VER >= 160040219) /* MS Visual Studio 2010 SP1 */
dkato 0:ee40da884cfc 68 #define FLAC__AVX_SUPPORTED 1
dkato 0:ee40da884cfc 69 #endif
dkato 0:ee40da884cfc 70 #if (_MSC_VER >= 1700) /* MS Visual Studio 2012 */
dkato 0:ee40da884cfc 71 #define FLAC__AVX2_SUPPORTED 1
dkato 0:ee40da884cfc 72 #define FLAC__FMA_SUPPORTED 1
dkato 0:ee40da884cfc 73 #endif
dkato 0:ee40da884cfc 74 #elif defined __GNUC__
dkato 0:ee40da884cfc 75 #if (__GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 9)) /* since GCC 4.9 -msse.. compiler options aren't necessary */
dkato 0:ee40da884cfc 76 #define FLAC__SSE_TARGET(x) __attribute__ ((__target__ (x)))
dkato 0:ee40da884cfc 77 #define FLAC__SSE_SUPPORTED 1
dkato 0:ee40da884cfc 78 #define FLAC__SSE2_SUPPORTED 1
dkato 0:ee40da884cfc 79 #define FLAC__SSSE3_SUPPORTED 1
dkato 0:ee40da884cfc 80 #define FLAC__SSE4_1_SUPPORTED 1
dkato 0:ee40da884cfc 81 #define FLAC__AVX_SUPPORTED 1
dkato 0:ee40da884cfc 82 #define FLAC__AVX2_SUPPORTED 1
dkato 0:ee40da884cfc 83 #define FLAC__FMA_SUPPORTED 1
dkato 0:ee40da884cfc 84 #else /* for GCC older than 4.9 */
dkato 0:ee40da884cfc 85 #define FLAC__SSE_TARGET(x)
dkato 0:ee40da884cfc 86 #ifdef __SSE__
dkato 0:ee40da884cfc 87 #define FLAC__SSE_SUPPORTED 1
dkato 0:ee40da884cfc 88 #endif
dkato 0:ee40da884cfc 89 #ifdef __SSE2__
dkato 0:ee40da884cfc 90 #define FLAC__SSE2_SUPPORTED 1
dkato 0:ee40da884cfc 91 #endif
dkato 0:ee40da884cfc 92 #ifdef __SSSE3__
dkato 0:ee40da884cfc 93 #define FLAC__SSSE3_SUPPORTED 1
dkato 0:ee40da884cfc 94 #endif
dkato 0:ee40da884cfc 95 #ifdef __SSE4_1__
dkato 0:ee40da884cfc 96 #define FLAC__SSE4_1_SUPPORTED 1
dkato 0:ee40da884cfc 97 #endif
dkato 0:ee40da884cfc 98 #ifdef __AVX__
dkato 0:ee40da884cfc 99 #define FLAC__AVX_SUPPORTED 1
dkato 0:ee40da884cfc 100 #endif
dkato 0:ee40da884cfc 101 #ifdef __AVX2__
dkato 0:ee40da884cfc 102 #define FLAC__AVX2_SUPPORTED 1
dkato 0:ee40da884cfc 103 #endif
dkato 0:ee40da884cfc 104 #ifdef __FMA__
dkato 0:ee40da884cfc 105 #define FLAC__FMA_SUPPORTED 1
dkato 0:ee40da884cfc 106 #endif
dkato 0:ee40da884cfc 107 #endif /* GCC version */
dkato 0:ee40da884cfc 108 #endif /* compiler version */
dkato 0:ee40da884cfc 109 #endif /* intrinsics support */
dkato 0:ee40da884cfc 110
dkato 0:ee40da884cfc 111 typedef enum {
dkato 0:ee40da884cfc 112 FLAC__CPUINFO_TYPE_IA32,
dkato 0:ee40da884cfc 113 FLAC__CPUINFO_TYPE_X86_64,
dkato 0:ee40da884cfc 114 FLAC__CPUINFO_TYPE_UNKNOWN
dkato 0:ee40da884cfc 115 } FLAC__CPUInfo_Type;
dkato 0:ee40da884cfc 116
dkato 0:ee40da884cfc 117 #if defined FLAC__CPU_IA32
dkato 0:ee40da884cfc 118 typedef struct {
dkato 0:ee40da884cfc 119 FLAC__bool cmov;
dkato 0:ee40da884cfc 120 FLAC__bool mmx;
dkato 0:ee40da884cfc 121 FLAC__bool sse;
dkato 0:ee40da884cfc 122 FLAC__bool sse2;
dkato 0:ee40da884cfc 123
dkato 0:ee40da884cfc 124 FLAC__bool sse3;
dkato 0:ee40da884cfc 125 FLAC__bool ssse3;
dkato 0:ee40da884cfc 126 FLAC__bool sse41;
dkato 0:ee40da884cfc 127 FLAC__bool sse42;
dkato 0:ee40da884cfc 128 FLAC__bool avx;
dkato 0:ee40da884cfc 129 FLAC__bool avx2;
dkato 0:ee40da884cfc 130 FLAC__bool fma;
dkato 0:ee40da884cfc 131 } FLAC__CPUInfo_IA32;
dkato 0:ee40da884cfc 132 #elif defined FLAC__CPU_X86_64
dkato 0:ee40da884cfc 133 typedef struct {
dkato 0:ee40da884cfc 134 FLAC__bool sse3;
dkato 0:ee40da884cfc 135 FLAC__bool ssse3;
dkato 0:ee40da884cfc 136 FLAC__bool sse41;
dkato 0:ee40da884cfc 137 FLAC__bool sse42;
dkato 0:ee40da884cfc 138 FLAC__bool avx;
dkato 0:ee40da884cfc 139 FLAC__bool avx2;
dkato 0:ee40da884cfc 140 FLAC__bool fma;
dkato 0:ee40da884cfc 141 } FLAC__CPUInfo_x86;
dkato 0:ee40da884cfc 142 #endif
dkato 0:ee40da884cfc 143
dkato 0:ee40da884cfc 144 typedef struct {
dkato 0:ee40da884cfc 145 FLAC__bool use_asm;
dkato 0:ee40da884cfc 146 FLAC__CPUInfo_Type type;
dkato 0:ee40da884cfc 147 #if defined FLAC__CPU_IA32
dkato 0:ee40da884cfc 148 FLAC__CPUInfo_IA32 ia32;
dkato 0:ee40da884cfc 149 #elif defined FLAC__CPU_X86_64
dkato 0:ee40da884cfc 150 FLAC__CPUInfo_x86 x86;
dkato 0:ee40da884cfc 151 #endif
dkato 0:ee40da884cfc 152 } FLAC__CPUInfo;
dkato 0:ee40da884cfc 153
dkato 0:ee40da884cfc 154 void FLAC__cpu_info(FLAC__CPUInfo *info);
dkato 0:ee40da884cfc 155
dkato 0:ee40da884cfc 156 #ifndef FLAC__NO_ASM
dkato 0:ee40da884cfc 157 # if defined FLAC__CPU_IA32 && defined FLAC__HAS_NASM
dkato 0:ee40da884cfc 158 FLAC__uint32 FLAC__cpu_have_cpuid_asm_ia32(void);
dkato 0:ee40da884cfc 159 void FLAC__cpu_info_asm_ia32(FLAC__uint32 *flags_edx, FLAC__uint32 *flags_ecx);
dkato 0:ee40da884cfc 160 # endif
dkato 0:ee40da884cfc 161 # if (defined FLAC__CPU_IA32 || defined FLAC__CPU_X86_64) && defined FLAC__HAS_X86INTRIN
dkato 0:ee40da884cfc 162 FLAC__uint32 FLAC__cpu_have_cpuid_x86(void);
dkato 0:ee40da884cfc 163 void FLAC__cpu_info_x86(FLAC__uint32 level, FLAC__uint32 *eax, FLAC__uint32 *ebx, FLAC__uint32 *ecx, FLAC__uint32 *edx);
dkato 0:ee40da884cfc 164 FLAC__uint32 FLAC__cpu_xgetbv_x86(void);
dkato 0:ee40da884cfc 165 # endif
dkato 0:ee40da884cfc 166 #endif
dkato 0:ee40da884cfc 167
dkato 0:ee40da884cfc 168 #endif