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

📄 play.c

📁 ipt网关源码
💻 C
字号:
#include <srllib.h>
#include <dxxxlib.h>
#include <stdio.h>

//功能:播放语音文件
//输入:通道号、语音文件句柄
//输出:正常返回1。错误返回-1
int play(int chdev,int fh)
{

DX_IOTT prompt;
DV_TPT tpt[4];

	  	  // 清除原先的按键
       if (dx_clrdigbuf(chdev) == -1) {
          // process error
		   printf("Error in clearing digitals!\n");
		   return(-1);
       }
     // prepair the data structure to play!
      
      prompt.io_type = IO_DEV|IO_EOT; // play from file 
      prompt.io_bufp = 0;
      prompt.io_offset = 0;
      prompt.io_length = -1;          // play till end of file 
      prompt.io_nextp = NULL;
      prompt.io_fhandle = fh;         //语音文件句柄
	 
      // playing the vox  data
	  dx_clrtpt(&tpt,3);
      tpt[0].tp_type   = IO_CONT;            // two entry in the table 
      tpt[0].tp_termno = DX_MAXDTMF;        // Maximum digits 
      tpt[0].tp_length = 1;                 // terminate on the first digit 
      tpt[0].tp_flags  = TF_MAXDTMF;        // Use the default flags 

      tpt[1].tp_type   = IO_CONT;            // only entry in the table 
      tpt[1].tp_termno = DX_LCOFF;        // 环流下降 
      tpt[1].tp_length = 3;                 
      tpt[1].tp_flags  = TF_LCOFF|TF_10MS;
      
	  tpt[2].tp_type   = IO_CONT;            /* only entry in the table */
      tpt[2].tp_termno = DX_MAXSIL;          // 静音时间 为什么不管用??
      tpt[2].tp_length = 300;                 // unit is 100ms
      tpt[2].tp_flags  = TF_MAXSIL;

      tpt[3].tp_type   = IO_EOT;
      tpt[3].tp_termno = DX_MAXTIME;        /* Function Time */
      tpt[3].tp_length = 100;               /* 10 seconds (100 ms resolution* timer) */
      tpt[3].tp_flags  = TF_MAXTIME;        /* Edge triggered */

	  printf("playing the Vox File............\n");
      if (dx_play(chdev,&prompt,&tpt,EV_ASYNC) == -1) {
         // error
		 // printf(" Error in play vox file\n");
		  return(-1);
	  }
	  return(1);
	  	  
}

⌨️ 快捷键说明

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