/*******************************************************************
 File: audio.h
 Date: 9-September-2020
 Author: Peter Spindler
 ********************************************************************/

#ifndef _AUDIO_H_
#define _AUDIO_H_

#define OUTPUT_DEVICE_SPEAKER                 ((uint16_t)0x0001)
#define OUTPUT_DEVICE_HEADPHONE               ((uint16_t)0x0002)
#define OUTPUT_DEVICE_BOTH                    ((uint16_t)0x0003)
#define OUTPUT_DEVICE_AUTO                    ((uint16_t)0x0004)
#define INPUT_DEVICE_DIGITAL_MICROPHONE_1     ((uint16_t)0x0100)
#define INPUT_DEVICE_DIGITAL_MICROPHONE_2     ((uint16_t)0x0200)
#define INPUT_DEVICE_INPUT_LINE_1             ((uint16_t)0x0300)
#define INPUT_DEVICE_INPUT_LINE_2             ((uint16_t)0x0400)
#define INPUT_DEVICE_DIGITAL_MIC1_MIC2        ((uint16_t)0x0800)


#define CODEC_PDWN_HW                 1
#define CODEC_PDWN_SW                 2

#define AUDIO_MUTE_ON                 1
#define AUDIO_MUTE_OFF                0

#define AUDIO_FREQUENCY_192K          ((uint32_t)192000)
#define AUDIO_FREQUENCY_96K           ((uint32_t)96000)
#define AUDIO_FREQUENCY_48K           ((uint32_t)48000)
#define AUDIO_FREQUENCY_44K           ((uint32_t)44100)
#define AUDIO_FREQUENCY_32K           ((uint32_t)32000)
#define AUDIO_FREQUENCY_22K           ((uint32_t)22050)
#define AUDIO_FREQUENCY_16K           ((uint32_t)16000)
#define AUDIO_FREQUENCY_11K           ((uint32_t)11025)
#define AUDIO_FREQUENCY_8K            ((uint32_t)8000)

#define AUDIO_OK                            ((uint8_t)0)
#define AUDIO_ERROR                         ((uint8_t)1)
#define AUDIO_TIMEOUT                       ((uint8_t)2)

uint8_t Audio_Init(uint16_t OutputDevice, uint8_t Volume, uint32_t AudioFreq );
uint8_t Audio_SetFrequency( uint32_t AudioFreq );
uint8_t Audio_SetVolume( uint8_t Volume );
uint8_t Audio_Play( uint8_t *Buffer, uint32_t Size );
uint8_t Audio_Pause( void );
uint8_t Audio_Resume( void );
uint8_t Audio_Stop( void );

#endif
