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

📄 ac48drlo.c

📁 Audiocodes old vision DSP driver
💻 C
📖 第 1 页 / 共 4 页
字号:
#if AC48_SIGNALING_MODE == AC48_BASIC_SIGNALING_MODE

/*======================================================================*/
/* Name    :        Ac48xxTonePairsCommand                              */
/*======================================================================*/
/* Purpose :    Assigns Tone Pairs Parameters to all channels in the    */
/*              device by sending AC48 TONE PAIRS command.              */
/*                                                                      */
/* Inputs  :    int DeviceIndex:                                        */
/*                  An integer, performing the device index.            */
/*                                                                      */
/*              TTonePairs *TonePairs  	                                */
/*                  Array of all Tone Pairs structure.                  */
/*              int PairQuantity  	                                    */
/*                  0<PairQuantity<MAX_TONE_PAIRS_QUANTITY (probably 8) */
/*              TDebugMode DebugMode	                                */
/*                  Debug mode, to use (see: AC48xxDebugCommand).       */
/*              TWaitMode WaitMode:                                     */
/*               	Wait / don't wait for the AC48 to be                */
/*                  ready to deal with a new Command,                   */
/*                  which uses the 'AC48xxTransmitPacket'               */
/*                  function.                                           */
/*                                                                      */
/* Output  :    int:                                                    */
/*                  ( 0) "AC_OK" for successful operation.              */
/*                  (-1) "PACKET-FULL" detection in                     */
/*                          "DONT_WAIT_PACKET_EMPTY" mode.              */
/*                          AC48 is not ready to transmit a new packet  */
/*                          (suitable mode for polling).                */
/*                  ( 2) "STATUS_ERROR" detected by the AC48.           */
/*======================================================================*/
int Ac48xxTonePairsCommand(int DeviceIndex, const TTonePair *TonePair, 
						   int PairQuantity, TDebugingData DebugingData, 
						   TWaitMode WaitMode)
{
	int i;
	TTonePairsCommand TonePairsCommand;
	if(PairQuantity>MAX_TONE_PAIRS_QUANTITY || PairQuantity<0 || !TonePair)
        return AC_ERROR;
	TonePairsCommand.Header.ConstAA=0xAA;
	TonePairsCommand.Header.Const_0_0_8=0;
	TonePairsCommand.Header.InitCommandOpCode = TONE_PAIRS_COMMAND_OP_CODE;
	TonePairsCommand.Header.InitCommandLength = 4+8*PairQuantity;

	for(i=0; i<MAX_TONE_PAIRS_QUANTITY; i++)
	    TonePairsCommand.TonePair[i] = TonePair[i];
	return Ac48xxTransmitPacket(DeviceIndex, (char*)&TonePairsCommand, 
												DebugingData, WaitMode);
}
#endif /* AC48_SIGNALING_MODE */

/*======================================================================*/
/* Name    :        Ac48xxDefaultCommand                                */
/*======================================================================*/
/* Purpose :    This function sends the Default Command to a specific   */
/*              channel in the AC48 device.                             */
/*                                                                      */
/* Inputs  :    int DeviceIndex:                                        */
/*                  An integer, performing the device index.            */
/*              int ChannelIndex: 	                                    */
/*                  An integer, performing the channel index.           */
/*              TDebugMode DebugMode	                                */
/*                  Debug mode, to use (see: AC48xxDebugCommand).       */
/*              TWaitMode WaitMode:                                     */
/*               	Wait / don't wait for the AC48 to be                */
/*                  ready to deal with a new Command,                   */
/*                  which uses the 'AC48xxTransmitPacket'               */
/*                  function.                                           */
/*                                                                      */
/* Output  :    int:                                                    */
/*                  ( 0) "AC_OK" for successful operation.              */
/*                  (-1) "PACKET-FULL" detection in                     */
/*                          "DONT_WAIT_PACKET_EMPTY" mode.              */
/*                          AC48 is not ready to transmit a new packet  */
/*                          (suitable mode for polling).                */
/*                  ( 2) "STATUS_ERROR" detected by the AC48.           */
/*======================================================================*/
int Ac48xxDefaultCommand(int DeviceIndex, int ChannelIndex, 
						 TDebugingData DebugingData, TWaitMode WaitMode)
{
	TDefaultCommand DefaultCommand;
	DefaultCommand.Header.ConstAA=0xAA;
	DefaultCommand.Header.Id=ChannelIndex;
	DefaultCommand.Header.Const_0_0_10=0;
	DefaultCommand.Header.IdleCommandOpCode = DEFAULT_COMMAND_OP_CODE;
	DefaultCommand.Header.IdleCommandLength=0x04;
	return Ac48xxTransmitPacket(DeviceIndex, (char*)&DefaultCommand, 
												DebugingData, WaitMode);
}

/*======================================================================*/
/* Name    :        Ac48xxPcmSlotCommand                                */
/*======================================================================*/
/* Purpose :    Assign PCM slot to a specific channel in the AC48       */
/*                                                                      */
/* Inputs  :    int DeviceIndex:                                        */
/*                  An integer, performing the device index.            */
/*              int ChannelIndex: 	                                    */
/*                  An integer, performing the channel index.           */
/*              Char PcmSlot	                                        */
/*                  (0 to 31 or 0 to 23)                                */
/*              TDebugMode DebugMode	                                */
/*                  Debug mode, to use (see: AC48xxDebugCommand).       */
/*              TWaitMode WaitMode:                                     */
/*               	Wait / don't wait for the AC48 to be                */
/*                  ready to deal with a new Command,                   */
/*                  which uses the 'AC48xxTransmitPacket'               */
/*                  function.                                           */
/*                                                                      */
/* Output  :    int:                                                    */
/*                  ( 0) "AC_OK" for successful operation.              */
/*                  (-1) "PACKET-FULL" detection in                     */
/*                          "DONT_WAIT_PACKET_EMPTY" mode.              */
/*                          AC48 is not ready to transmit a new packet  */
/*                          (suitable mode for polling).                */
/*                  ( 2) "STATUS_ERROR" detected by the AC48.           */
/*======================================================================*/
int Ac48xxPcmSlotCommand(int DeviceIndex, int ChannelIndex, int PcmSlot, 
						 TDebugingData DebugingData, TWaitMode WaitMode)
{
	TPcmSlotCommand PcmSlotCommand;
	PcmSlotCommand.Header.ConstAA=0xAA;
    PcmSlotCommand.Header.Id=ChannelIndex;
	PcmSlotCommand.Header.Const_0_0_10=0;
	PcmSlotCommand.Header.IdleCommandOpCode = PCM_SLOT_COMMAND_OP_CODE;
	PcmSlotCommand.Header.IdleCommandLength=0x06;
	PcmSlotCommand.Slot=PcmSlot; 
	PcmSlotCommand.Const_0_2_5=0;
	PcmSlotCommand.Const_0_2_8=0;
	return Ac48xxTransmitPacket(DeviceIndex, (char*)&PcmSlotCommand, 
												DebugingData, WaitMode);
}

/*======================================================================*/
/* Name    :        Ac48xxVoiceCommand                                  */
/*======================================================================*/
/* Purpose :    Assigns Voice Parameters to a specific channel in the   */
/*              AC48 device by sending the AC48 Voice command.          */
/*                                                                      */
/* Inputs  :    int DeviceIndex:                                        */
/*                  An integer, performing the device index.            */
/*              int ChannelIndex: 	                                    */
/*                  An integer, performing the channel index.           */
/*              TVoice *Voice	                                        */
/*                  Voice attributes structure                          */
/*              TDebugMode DebugMode	                                */
/*                  Debug mode, to use (see: AC48xxDebugCommand).       */
/*              TWaitMode WaitMode:                                     */
/*               	Wait / don't wait for the AC48 to be                */
/*                  ready to deal with a new Command,                   */
/*                  which uses the 'AC48xxTransmitPacket'               */
/*                  function.                                           */
/*                                                                      */
/* Output  :    int:                                                    */
/*                  ( 0) "AC_OK" for successful operation.              */
/*                  (-1) "PACKET-FULL" detection in                     */
/*                          "DONT_WAIT_PACKET_EMPTY" mode.              */
/*                          AC48 is not ready to transmit a new packet  */
/*                          (suitable mode for polling).                */
/*                  ( 2) "STATUS_ERROR" detected by the AC48.           */
/*======================================================================*/
int Ac48xxVoiceCommand(int DeviceIndex, int ChannelIndex, 
					   const TVoiceAttributes *VoiceAttributes, 
					   TDebugingData DebugingData, TWaitMode WaitMode)
{
  	TVoiceCommand VoiceCommand;
	VoiceCommand.Header.ConstAA = 0xAA;
    VoiceCommand.Header.Id = ChannelIndex;
	VoiceCommand.Header.Const_0_0_10 = 0;
	VoiceCommand.Header.IdleCommandOpCode = VOICE_COMMAND_OP_CODE;
	VoiceCommand.Header.IdleCommandLength = 0x06;
	VoiceCommand.Coder				      = VoiceAttributes->Coder;
	VoiceCommand.EchoCanselerEnable       = VoiceAttributes->EchoCanselerEnable;
	VoiceCommand.SilenceCompressionEnable = VoiceAttributes->SilenceCompressionEnable;
	VoiceCommand.PostFilterEnable         = VoiceAttributes->PostFilterEnable;
	VoiceCommand.HighPassFilterEnable     = VoiceAttributes->HighPassFilterEnable;
   	VoiceCommand.PayloadFormat		      = VoiceAttributes->PayloadFormat;
	VoiceCommand.NumberOfBlocks		      = VoiceAttributes->NumberOfBlocks;
	VoiceCommand.HybridLoss		          = VoiceAttributes->HybridLoss;
	VoiceCommand.NonLinearProcessorMode   = VoiceAttributes->NonLinearProcessorMode;
#ifdef VOICE_COMMAND_TEST_MODE
	VoiceCommand.Header.IdleCommandLength = 0x08;
    VoiceCommand.TestParameter1           = VoiceAttributes->TestParameter1;
    VoiceCommand.Const_0_3_4 = 0;
    VoiceCommand.TestParameter2           = VoiceAttributes->TestParameter2;
    VoiceCommand.LowSidRate               = VoiceAttributes->LowSidRate;
    VoiceCommand.Const_0_3_9 = 0;
#endif /* VOICE_COMMAND_TEST_MODE */       
    return Ac48xxTransmitPacket(DeviceIndex, (char*)&VoiceCommand, 
												DebugingData, WaitMode);
}

/*======================================================================*/
/* Name    :        Ac48xxInputGainCommand                              */
/*======================================================================*/
/* Purpose :    This command sets the input gain of a specific channel  */
/*              in the range of Mute to +31dB in steps of 1 dB.         */
/*                                                                      */
/* Inputs  :    int DeviceIndex:                                        */
/*                  An integer, performing the device index.            */
/*              int ChannelIndex: 	                                    */
/*                  An integer, performing the channel index.           */
/*              int Gain 	                                            */

⌨️ 快捷键说明

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