基本信息
源码名称:C# 来电录音系统源码
源码大小:0.05M
文件格式:.zip
开发语言:C#
更新时间:2018-02-22
   友情提示:(无需注册或充值,赞助后即可获取资源下载链接)

     嘿,亲!知识可是无价之宝呢,但咱这精心整理的资料也耗费了不少心血呀。小小地破费一下,绝对物超所值哦!如有下载和支付问题,请联系我们QQ(微信同号):78630559

本次赞助数额为: 2 元 
   源码介绍

using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Text;
using System.Windows.Forms;

using System.IO;

namespace Ex13_13
{
    public partial class Form1 : Form
    {
        bool open_close = false;
        public Form1()
        {
            InitializeComponent();
        }

        private void Form1_Load(object sender, EventArgs e)
        {
            //初始化驱动程序
            long load = DJ160API.LoadDRV();
            //检测通道总数,并为每个通道分配语音缓冲区
            short wuseCh = DJ160API.CheckValidCh();
            short wFileBufLen = 16 * 1024;
            long card = DJ160API.EnableCard(wuseCh, wFileBufLen);
            //设置表格-通道的行数
            dataGridView1.RowCount = wuseCh;
            //检测每个通道类型
            short chanelTpye = 0; //定义通道类型变量
            string strType = "";
            for (short i = 0; i < wuseCh; i  )
            {
                chanelTpye = DJ160API.CheckChType(i);
                dataGridView1[0, i].Value = i;
                switch (chanelTpye)
                {
                    case 0:
                        strType = "内线";
                        break;
                    case 1:
                        strType = "外线";
                        break;
                    case 2:
                        strType = "悬空";
                        break;
                }
                dataGridView1[1, i].Value = strType;
            }
            DJ160API.Sig_Init(0); 
        }

        private void timer1_Tick(object sender, EventArgs e)
        {
            //维持文件录音持续执行
            DJ160API.PUSH_PLAY();
            for (short i = 0; i < 8; i  )
            {
                DJ160API.StartSigCheck(i);
                if (open_close == false)
                    DJ160API.ResetCallerIDBuffer(i);
                if (DJ160API.RingDetect(i))
                {
                    open_close = true;
                    //摘机
                    DJ160API.OffHook(i);
                    DJ160API.StartSigCheck(i);
                    //是否挂机
                    if (DJ160API.ReadCheckResult(i, 2) != 33)
                    {
                        bool bl = DJ160API.StartRecordFile(i, Encoding.UTF8.GetBytes(@"D:\ly.001"), 600 * 1024);
                        dataGridView1[2, i].Value = "已接来电,开始录音";
                    }
                    else
                    {
                        DJ160API.StopRecordFile(i);
                        open_close = false;
                        DJ160API.Sig_ResetCheck(i);
                        dataGridView1[2, i].Value = "";
                    }
                    if (DJ160API.CheckRecordEnd(i)==1)
                    {
                        DJ160API.StopRecordFile(i);
                        open_close = false;
                        dataGridView1[2, i].Value = "";
                    }
                }
            }
        }

        private void button1_Click(object sender, EventArgs e)
        {
            DJ160API.FreeDRV();
            Application.Exit();
        }

    }
}