⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 a2dp_sd_interface_analogue.c

📁 实现蓝牙 立体声传送
💻 C
字号:
/****************************************************************************
Copyright (C) Cambridge Silicon Radio Ltd. 2004-2006
Part of BlueLab 3.6.2-release

FILE NAME
    a2dp_sd_interface_analogue.c

DESCRIPTION
    Analogue I/P support code

NOTES
    
*/


/****************************************************************************
    Header files
*/
#include "a2dp_sd_private.h"
#include "a2dp_sd_interface.h"

#include <panic.h> 
#include <pcm.h> 
#include <sink.h>
#include <source.h>
#include <string.h>
#include <codec.h>


/****************************************************************************
NAME    
    initInterfaceTimeCritical
    
DESCRIPTION
    Not used

RETURNS
    void
*/
void initInterfaceTimeCritical(void)
{
}


/****************************************************************************
NAME    
    a2dpSdInitInterface
    
DESCRIPTION
    Not used

RETURNS
    void
*/
void a2dpSdInitInterface(a2dpSourceDongleTaskData *theApp)
{   
}


/****************************************************************************
NAME    
    a2dpSdHandleInterfaceEvent
    
DESCRIPTION
    Not used

RETURNS
    void
*/
void a2dpSdHandleInterfaceEvent(const a2dpSourceDongleTaskData *theApp)
{
}


/****************************************************************************
NAME    
    a2dpSdHandleButtons
    
DESCRIPTION
    Processes a received button press from the remote end

RETURNS
    void
*/
void a2dpSdHandleButtons(avc_operation_id opid, bool state)
{
	/* Act on the AVRCP event. Can only deal with pausing and restarting the audio. */
	if (!state)
	{
		a2dp_state a2dp_current_state = avSourceDongleRetrieveA2dpState();
  
		if (a2dp_current_state  == a2dp_state_connected)
		{
			if ((opid == opid_pause) || (opid == opid_play))
				MessageSend(getTheAppTask(), APP_START_STREAMING_REQ, 0);
		}
		else if (a2dp_current_state  == a2dp_state_streaming)
		{
			if ((opid == opid_pause) || (opid == opid_stop))
				MessageSend(getTheAppTask(), APP_SUSPEND_STREAMING_REQ, 0); 
		}
	}
}


/****************************************************************************
NAME    
	a2dpSdConnectInterfaceToKalimba
    
DESCRIPTION
	Connect Interface Source into Kalimba Sink

RETURNS
    void
*/
void a2dpSdConnectInterfaceToKalimba()
{
	/* plug Left ADC into port 0 */
	(void)StreamConnect(StreamPcmSource(0),StreamKalimbaSink(0));

	/* plug Right ADC into port 1 */
	(void)StreamConnect(StreamPcmSource(1),StreamKalimbaSink(1));
}

/****************************************************************************
NAME    
	a2dpSdHandleCodecSettingsInd
    
DESCRIPTION
	Set Pcm rates based on the codec settings passed up from the a2dp lib

RETURNS
    void
*/
void a2dpSdHandleCodecSettingsInd(const a2dpSourceDongleTaskData *theApp, uint32 rate)
{
	codec_config_params config;
    
	(void)PcmClearAllRouting();
#ifdef WOLFSON_CODEC
	/* configure slot 0 and 1 to be left and right channel
    and synchronise the offsets for stereo playback */
	(void)PcmRateAndRoute(0, PCM_NO_SYNC, (uint32) rate, (uint32) rate, VM_PCM_EXTERNAL_I2S);
	(void)PcmRateAndRoute(1, 0, (uint32) rate, (uint32) rate, VM_PCM_EXTERNAL_I2S);
#else
	/* configure slot 0 and 1 to be left and right channel
    and synchronise the offsets for stereo playback */
	(void)PcmRateAndRoute(0, PCM_NO_SYNC, (uint32) rate, (uint32) rate, VM_PCM_INTERNAL_A);
	(void)PcmRateAndRoute(1, 0, (uint32) rate, (uint32) rate, VM_PCM_INTERNAL_B);
#endif
 
	config.inputs = line_input;
	config.outputs = 0;
	config.dac_sample_rate = sampleNotUsed;
	config.adc_sample_rate = (sample_freq) rate;
	CodecConfigure(theApp->codec_task, &config);
}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -