📄 waveplayer.h
字号:
/******************** (C) COPYRIGHT 2007 STMicroelectronics ********************
* File Name : waveplayer.h
* Author : MCD Application Team
* Version : V1.1
* Date : 11/26/2007
* Description : This file contains all the functions prototypes for the
* wave player firmware driver.
********************************************************************************
* THE PRESENT SOFTWARE WHICH IS FOR GUIDANCE ONLY AIMS AT PROVIDING CUSTOMERS
* WITH CODING INFORMATION REGARDING THEIR PRODUCTS IN ORDER FOR THEM TO SAVE TIME.
* AS A RESULT, STMICROELECTRONICS SHALL NOT BE HELD LIABLE FOR ANY DIRECT,
* INDIRECT OR CONSEQUENTIAL DAMAGES WITH RESPECT TO ANY CLAIMS ARISING FROM THE
* CONTENT OF SUCH SOFTWARE AND/OR THE USE MADE BY CUSTOMERS OF THE CODING
* INFORMATION CONTAINED HEREIN IN CONNECTION WITH THEIR PRODUCTS.
*******************************************************************************/
/* Define to prevent recursive inclusion ---------------------------------------*/
#ifndef __WAVEPLAYER_H
#define __WAVEPLAYER_H
/* .WAV file format :
Endian Offset Length Contents
big 0 4 bytes 'RIFF' // 0x52494646
little 4 4 bytes <file length - 8>
big 8 4 bytes 'WAVE' // 0x57415645
Next, the fmt chunk describes the sample format:
big 12 4 bytes 'fmt ' // 0x666D7420
little 16 4 bytes 0x00000010 // Length of the fmt data (16 bytes)
little 20 2 bytes 0x0001 // Format tag: 1 = PCM
little 22 2 bytes <channels> // Channels: 1 = mono, 2 = stereo
little 24 4 bytes <sample rate> // Samples per second: e.g., 22050
little 28 4 bytes <bytes/second> // sample rate * block align
little 32 2 bytes <block align> // channels * bits/sample / 8
little 34 2 bytes <bits/sample> // 8 or 16
Finally, the data chunk contains the sample data:
big 36 4 bytes 'data' // 0x64617461
little 40 4 bytes <length of the data block>
little 44 * <sample data>
*/
/* Includes --------------------------------------------------------------------*/
#include "stm32f10x_lib.h"
#include "spi_flash.h"
/* Exported types --------------------------------------------------------------*/
typedef struct
{
u32 RIFFchunksize;
u16 FormatTag;
u16 NumChannels;
u32 SampleRate;
u32 ByteRate;
u16 BlockAlign;
u16 BitsPerSample;
u32 DataSize;
} WAVE_FormatTypeDef;
typedef enum
{
Valid_WAVE_File = 0,
Unvalid_RIFF_ID,
Unvalid_WAVE_Format,
Unvalid_FormatChunk_ID,
Unsupporetd_FormatTag,
Unsupporetd_Number_Of_Channel,
Unsupporetd_Sample_Rate,
Unsupporetd_Bits_Per_Sample,
Unvalid_DataChunk_ID,
Unsupporetd_ExtraFormatBytes,
Unvalid_FactChunk_ID
} ErrorCode;
/* Exported constants ----------------------------------------------------------*/
#define SpeechReadAddr 0x0 /* Speech wave start read address */
/* Exported macro --------------------------------------------------------------*/
/* Exported functions ----------------------------------------------------------*/
void WavePlayer_Init(void);
void WavePlayer_Start(void);
void WavePlayer_RecStart(void);
void WavePlayer_Stop(void);
void WavePlayer_RePlay(void);
void WavePlayer_Pause(void);
u32 Decrement_WaveDataLength(void);
void Set_WaveDataLength(u32 value);
ErrorCode Get_WaveFileStatus(void);
#endif /*__WAVEPLAYER_H */
/******************* (C) COPYRIGHT 2007 STMicroelectronics *****END OF FILE******/
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -