日韩性视频-久久久蜜桃-www中文字幕-在线中文字幕av-亚洲欧美一区二区三区四区-撸久久-香蕉视频一区-久久无码精品丰满人妻-国产高潮av-激情福利社-日韩av网址大全-国产精品久久999-日本五十路在线-性欧美在线-久久99精品波多结衣一区-男女午夜免费视频-黑人极品ⅴideos精品欧美棵-人人妻人人澡人人爽精品欧美一区-日韩一区在线看-欧美a级在线免费观看

歡迎訪問(wèn) 生活随笔!

生活随笔

當(dāng)前位置: 首頁(yè) > 编程资源 > 编程问答 >内容正文

编程问答

Cisco IP电话软件的WINRTP

發(fā)布時(shí)間:2024/1/1 编程问答 33 豆豆
生活随笔 收集整理的這篇文章主要介紹了 Cisco IP电话软件的WINRTP 小編覺(jué)得挺不錯(cuò)的,現(xiàn)在分享給大家,幫大家做個(gè)參考.

?

縱覽Overview of this Document

介紹Introduction

更新What's New

功能Features

組件及安裝Components and Installation

源碼發(fā)布Source Code Distribution

二進(jìn)制發(fā)布Binary Distribution

安裝Installation

測(cè)試程序Test Program

接口描述/程序員指南Interface Description/Programmer’s Guide

WINRTP COM?接口WINRTP COM Interface

WINRTP接口詳解(ICCNMediaDetails of WINRTP Interface (Interface ICCNMediaTerm)

COMGUID?COM GUIDs, etc

可選參數(shù)?Configurable Parameters

靜態(tài)/動(dòng)態(tài) 抖動(dòng)緩沖器?Static/Dynamic Jitter Buffer

抖動(dòng)緩沖區(qū)大小Jitter Buffer Length

接收的RTP音頻流放大等級(jí)?Level of Auto-Amplification of incoming RTP audio streams

發(fā)送的RTP包的TOSType of Service Value (DiffServ Byte) of Outgoing RTP Packets

指定UDP傳輸端口Fixed Transmit Port for UDP Packets

發(fā)送音頻的預(yù)加重Pre-emphasis of transmitted audio

接受音頻的后加重Post-emphasis of received audio

音量限制Volume Limiting

示例代碼Sample Code

未來(lái)的改進(jìn)Future Improvements

?

This document describes the?WinRTP?for the Cisco IP?SoftPhone?from a programmer’s point of view. It discusses the COM interface it provides, installation, and configuration of the component.

?此文檔以程序員的視角描述了用于Cisco IP電話軟件的WINRTP。它論述了WINRTPCOM接口、安裝以及各組件的配置。

介紹

The?WinRTP?(WINRTP) was developed as part of the Cisco IP?SoftPhone?product. Cisco IP?SoftPhone?is a PC based telephone integrated with AVVID, and works with the Cisco Call Manager. The primary focus of the WINRTP is to ensure that it works well with other products in AVVID including desktop IP Phones,?gateways,?etc.It?can also be used as an independent component.

·????????It?is written in C++

·????????It?is a COM component. (Not an ActiveX control). This makes it easy to use using any programming language like C/C++/Java (using J/Direct) etc.???

?開(kāi)發(fā)WinRTP是作為Cisco IP?SoftPhone產(chǎn)品的一部分。Cisco IP?SoftPhone是基于個(gè)人電腦的集成AVVID的電話,它和Cisco Call Manager一起工作。WINRTP的主要目的是確保此產(chǎn)品同AVVID(語(yǔ)音、視頻和集成數(shù)據(jù)體系架構(gòu))良好的工作,包括桌面IP電話、網(wǎng)關(guān)等等。當(dāng)然,它也可以作為單獨(dú)組件使用。

The basic job of the WINRTP is to source and sink audio streams to/from the network.?So if an application needs the ability to do audio?endpointing?for real time voice (especially one that is integrated with Cisco’s AVVID), it can use this component.

?WINRTP基礎(chǔ)的工作是發(fā)起和接收網(wǎng)絡(luò)上的音頻流。如果一個(gè)應(yīng)用軟件需要實(shí)時(shí)語(yǔ)音的支持(特別是當(dāng)它集成了CiscoAVVID),它可以使用WINRTP組件。

?更新

Here are the improvements since the last version

這里是新版本的改進(jìn):

  • Completely standalone package – Compatible with all flavors of desktop Windows starting from Windows 95. Uses standard .DLL files that come with all Windows flavors?完全獨(dú)立的包—兼容所有從windows95以來(lái)的版本,使用標(biāo)準(zhǔn)DLL適用所有windows
  • Simple distribution: just two DLL's, no more .ax files. Also, the whole software is less than 300 Kbytes?簡(jiǎn)單的發(fā)布:只有兩個(gè)DLL,再無(wú).ax文件,整個(gè)軟件小于300K字節(jié)
  • Support for multiple sound cards?支持多聲卡
  • Dynamic jitter buffer algorithm option: it is very simple, but it works most of the time?動(dòng)態(tài)抖動(dòng)緩沖設(shè)置:簡(jiǎn)單而有效
  • Audio quality enhancements: including pre-emphasis and post-emphasis of audio to make it sound sharper, automatic amplification of the incoming RTP audio stream?聲音質(zhì)量改善:添加音頻預(yù)增強(qiáng)和后增強(qiáng),使聲音清晰?。自動(dòng)增大RTP音頻流。
  • Others: Volume limiter algorithm in case you want to use it.?其它:需要時(shí)可以音量限制
  • Comes with pre-built binaries for your convenience??帶有預(yù)先編譯好的二進(jìn)制文件,便于用戶使用
  • Ability to play any wav file. Previous format restrictions removed. Also, now you can play as many files at the same time as you want??取消先前格式限制支持播放任何wav?文件。并且,可以同時(shí)播放多個(gè)文件。

?功能

WINRTP consists of two independent parts. One part has the ability to capture the user’s voice (using the system’s microphone), encode it, and send the voice as an RTP (Real Time Protocol) stream to a configurable destination. The other part listens for an RTP stream from the network, extracts the audio from it, and plays it using the PC’s speaker. When both parts are used together, then WINRTP acts like an IP based voice endpoint. Here are the features in short

WINRTP?包含獨(dú)立的兩部分。其一提供捕捉用戶聲音、編碼及以RTP流形式發(fā)送語(yǔ)音的功能,另一部分在網(wǎng)絡(luò)上監(jiān)聽(tīng)RTP流,從中解出音頻并播放。當(dāng)這兩者在一起使用的時(shí)候,可以扮演一個(gè)基于IP的語(yǔ)音終端,下面是簡(jiǎn)要的功能介紹:

  • Support for multiple sound devices:?This version of?WinRTP?supports multiple sound devices. This means you can independently choose which audio device to use for transmit and receive if there are multiple audio devices in your PC (for e.g. you have a sound card as well as an USB headset)?????????????

支持多個(gè)音頻設(shè)備:?此版本W(wǎng)inRTP支持多音頻設(shè)備。這樣,如果你的PC上有多個(gè)音頻設(shè)備,你可以自由地選擇使用那個(gè)設(shè)備去發(fā)送和接收。

  • Number of streams:?currently, only one incoming audio stream and one outgoing audio stream are supported. This is because WINRTP uses the sound card, and only one application can use the system’s speaker or microphone at a time.

流數(shù)量:現(xiàn)在只支持一個(gè)輸入音頻流和一個(gè)輸出音頻流。這是因?yàn)閃INRTP聲卡,同時(shí)只有一個(gè)應(yīng)用程序可以使用系統(tǒng)揚(yáng)聲器或麥克風(fēng)。

  • Codec Support:?G.711 64kbps (both?ALaw?and?ULaw). The version used in Cisco IP?SoftPhone?comes with support for G.723 and G.729. However, due to licensing restrictions, that support has been removed from the open source version of?WinRTP. This explains some of the parameters (like G723BitRate) in some of the calls in the interface

Codec支持:G.711 64kbpsALawULaw)。在Cisco IP?SoftPhone中使用的版本支持G.723??G.729。然而,由于許可限制,這些支持從開(kāi)源版本的Winrtp中移除了。這說(shuō)明了在接口調(diào)用中存在某些像G723BitRate這樣參數(shù)的原因。

  • Support for Audio Mixing:?WINRTP allows the mixing of other audio streams (from WAV files) to be mixed with the incoming and outgoing audio streams.

混音支持:?WINRTP允許輸入或輸出音頻流混合其它來(lái)自WAV文件的音頻流。

  • Volume Control Support:?WINRTP supports setting the volume level for the Microphone, Speaker, and each file that is being mixed in the audio streams.

音量調(diào)節(jié)支持:WINRTP支持設(shè)置麥克風(fēng)、揚(yáng)聲器以及被混音的音頻流的音量。

  • Silence Suppression:?WINRTP supports silence suppression (Voice Activity Detection - VAD) of the outgoing streams. This means that if it detects silence (user is not speaking) then it stops sending outgoing RTP packets to conserve network bandwidth.

靜音抑制:WINRTP支持輸出流的靜音抑制(聲音活動(dòng)性檢查VAD)。這就是說(shuō),如果發(fā)現(xiàn)靜音(用戶沒(méi)說(shuō)話),它可以停止輸出RTP包,以節(jié)省網(wǎng)絡(luò)帶寬。

  • QoS?Support:?WINRTP supports?DiffServ?(IP Type of Service-TOS) packet tagging for outgoing RTP packets.

Qos支持:WINRTP支持在輸出RTP包中標(biāo)示DiffServ?

  • RTP Implementation:?Encoding and decoding of RTP packets.
    • WINRTP does not support RTCP, but it does sink RTCP packets sent by the other end to prevent ICMP messages due to discarded packets.

RTP?實(shí)現(xiàn):編碼和解碼RTP包。

????????????WINRTP不支持RTCP,但是它可以接收其它端發(fā)來(lái)的RTCP包,以免ICMP消息導(dǎo)致的丟包。

  • Independence?of transmit/receive sides:?The transmit and receive sides are independent, and that means
    • Different?codecs?may be used for transmit and receive
    • User can choose to do only one of the two operations

發(fā)送和接收端的獨(dú)立性:發(fā)送和接收端是獨(dú)立的,這就是說(shuō):

??????發(fā)送和接收可以使用不同的codecs(多媒體數(shù)字信號(hào)編解碼器)

??????用戶可以選擇只做其中某項(xiàng)操作。

  • Operating Systems Supported:?All flavors of windows Windows95 and later, including Windows NT (Service Pack 3 onwards), Windows ME and Windows 2000/XP

操作系統(tǒng)支持:支持Windows95以后的版本,包括WindowsNTWindowsME?及Windows2000/XP

  • Configurable/Dynamic Jitter Buffer:?The depth of the jitter buffer can be specified, or a dynamic jitter buffer can also be used

可配置動(dòng)態(tài)的抖動(dòng)緩沖:可以設(shè)置抖動(dòng)緩沖的深度值,也可以使用動(dòng)態(tài)抖動(dòng)。

  • DSP algorithms:?like pre-emphasis and post-emphasis to make the audio sound sharper. Volume limiting to control the max volume, and auto-amplification of incoming RTP audio streams

DSP算法:?如預(yù)加重及后加重使聲音更清晰,音量限制控制最大音量,自動(dòng)放大輸入的RTP音頻流。

?組件及安裝

The distribution comes with both source code and binaries. Extract the ZIP file to obtain everything. It will create a directory calledWinRTP, which will contain everything.

發(fā)行版同時(shí)包含了源代碼及二進(jìn)制文件。解開(kāi)ZIP文件,可以得到所有文件。

?源代碼發(fā)布

Build Order?編譯?順序

  • TracerServer??
  • Tracer
  • CCNMediaTerm
  • This will create TraceServer.dll and CCNSMT.dll. Build these projects either in Debug or Release mode.

    ?這將建立TraceServer.dll?CCNSMT.dll?兩個(gè)文件,請(qǐng)?jiān)?span lang="EN-US">Debug和Release兩個(gè)模式下都編譯。

    ?二進(jìn)制發(fā)布

    WINRTP binary distribution consists of two DLL files under the?WinRTP?directory. The main COM DLL (CCNSMT.dll) that exposes the WINRTP interface is about 200Kbytes while the other (TraceServer.dll) DLL (used for tracing) is 28Kbytes

    WINRTP的二進(jìn)制發(fā)布在WinRTP目錄下包含了兩個(gè)DLL文件。主要的COM?動(dòng)態(tài)鏈接庫(kù)(CCNSMT.dll)提供給我們WINRTOP的接口,大概200K字節(jié)大小。TraceServer.dll?28K字節(jié)。

    安裝

    Third Party Dependencies?第三方依賴

    ????????????None?無(wú)

    Location of Distributed Files?文件位置:

    • TraceServer.dll: Put TraceServer.dll in the SYSTEM directory of windows (i.e. /WINDOWS/SYSTEM of win95/98/ME or /WINNT/SYSTEM32 on win nt/2000??

    TraceServer.dll:?TraceServer.dll?放到windows的系統(tǒng)目錄(如?win95/98/ME??下的/WINDOWS/SYSTEM??winNT/200下的?/WINNT/SYSTEM32?

    • CCNSMT.dll: This is a COM component, so its location is not important as long as it is registered with the system. It is recommended that it be kept all together in a separate directory or in the directory of the application that is using the?WinRTP.

    CCNSMT.dll:?這是一個(gè)COM組件,當(dāng)它被系統(tǒng)注冊(cè)以后它的位置已經(jīng)不重要。推薦將它保存在一個(gè)單獨(dú)的目錄中或使用WINRTP的應(yīng)用程序目錄。

    Final Install Steps?最后一步:

    ????????????All COM objects must be registered before WINRTP can be used. For this, use the regsvr32 program that comes with windows (it may be found in the system directory)

    ????????????所有COM對(duì)象在使用前必須進(jìn)行注冊(cè),對(duì)于WINRTP,我們可以使用windows自帶的regsvr32程序完成,命令如下:

    • Regsvr32 CCNSMT.dll

    ?

    ?測(cè)試程序

    There is also a test program (both source code and binary) that is available. It is a simple program that does not exercise all the features. It just connects your default microphone to your default speaker for 5 seconds so that you can hear yourself, and then exits. The source code is in the “WinRTP/TestWinRTP” folder and the binary is WinRTP/TestWinRTP.exe

    ?

    這里還包含一個(gè)供測(cè)試用的程序(源代碼及二進(jìn)制)。它是一個(gè)簡(jiǎn)單的程序,并沒(méi)有調(diào)用所有的功能,它只是連接你默認(rèn)的麥克風(fēng)到你默認(rèn)的揚(yáng)聲器5秒鐘時(shí)間,這期間,你可以從揚(yáng)聲器中聽(tīng)到你自己的聲音。源代碼在“WinRTP/TestWinRTP”目錄下,二進(jìn)制文件為“TestWinRTP.exe”。

    s Guide?接口描述及程序員指南

    The?WinRTP?main DLL is CCNSMT.dll which exposes a COM interface that can be used to make calls to the WINRTP.

    WinRTP主要的DLLCCNSMT.dll,它提供了我們一個(gè)COM接口用于調(diào)用WINRTP

    ?WINRTP COM?接口

    The interface of WINRTP (ICCNMediaTerm) consists of the following functions

    WINRTP接口包含下面的函數(shù):

    • HRESULT Initialize()
    • HRESULT?UnInitialize()
    • HRESULT?StartMicrophone() - not implemented/needed in this version.?
    • HRESULT?StopMicrophone() - not implemented/needed in this version.?
    • HRESULT?StartAudioReceive() - not implemented/needed in this version.?
    • HRESULT?StopAudioReceive() - not implemented/needed in this version.?
    • HRESULT?SetAudioCodecRX(
      ?????????????????????????????????????????????????[in] long?CompressionType,
      ?????????????????????????????????????????????????[in] long?MillisecPacketSize,?
      ?????????????????????????????????????????????????[in] long?EchoCancellationValue,
      ?????????????????????????????????????????????????[in] long G723BitRate
      ?????????????????????????????????????????????????)
    • HRESULT?SetAudioCodecTX(
      ????????????????????????????????????????????????[in] long?CompressionType,
      ????????????????????????????????????????????????[in] long?MillisecPacketSize,
      ????????????????????????????????????????????????[in] long?PrecedenceValue,
      ????????????????????????????????????????????????[in] long?SilenceSuppression,
      ????????????????????????????????????????????????[in] unsigned short?MaxFramesPerPacket,
      ????????????????????????????????????????????????[in] long G723BitRate
      ????????????????????????????????????????????????)
    • HRESULT?SetAudioDestination(
      ?????????????????????????????????????????????????[in] BSTR?strHostName,
      ?????????????????????????????????????????????????[in] long?nUDPortNumber
      ?????????????????????????????????????????????????)
    • HRESULT?SetAudioReceivePort(
      ???????????????????????????????????????????????????[in] long?nUDPPortNumber
      ???????????????????????????????????????????????????)
    • HRESULT?StartPlayingFileTX(
      ???????????????????????????????????????????????[in] BSTR Filename,
      ???????????????????????????????????????????????[in] unsigned long Mode,
      ???????????????????????????????????????????????[in] unsigned long?StartPosition,
      ???????????????????????????????????????????????[in] unsigned long?StopPosition,
      ???????????????????????????????????????????????[in, out] long * Cookie
      ???????????????????????????????????????????????)
    • HRESULT?StartPlayingFileRX(
      ???????????????????????????????????????????????[in] BSTR Filename,
      ???????????????????????????????????????????????[in] unsigned long Mode,
      ???????????????????????????????????????????????[in] unsigned long?StartPosition,
      ???????????????????????????????????????????????[in] unsigned long?StopPosition,
      ?????????????????????????????????????????????? [in] unsigned long?waveoutDeviceID,
      ???????????????????????????????????????????????[in, out] long * Cookie
      ???????????????????????????????????????????????)
    • HRESULT?StopPlayingFileTX(
      ???????????????????????????????????????????????[in] unsigned long Cookie
      ???????????????????????????????????????????????)
    • HRESULT?StopPlayingFileRX(
      ???????????????????????????????????????????????[in] unsigned long Cookie
      ???????????????????????????????????????????????)
    • HRESULT?StartTX(unsigned long?waveinDeviceID)
    • HRESULT?StopTX()
    • HRESULT?StartRX(unsigned long?waveoutDeviceID)
    • HRESULT?StopRX()
    • HRESULT?SetSpeakerVolume(
      ????????????????????????????????????????????????[in] unsigned long volume
      ????????????????????????????????????????????????)
    • HRESULT?SetMicrophoneVolume(
      ?????????????????????????????????????????????????????[in] unsigned long volume
      ?????????????????????????????????????????????????????)
    • HRESULT?SetFilePlayVolume(
      ???????????????????????????????????????????????[in] unsigned long cookie,
      ???????????????????????????????????????????????[in] unsigned long volume
      ???????????????????????????????????????????????)

    Events?From?WINRTP

    WINRTP not only exposes a COM interface, it also has the ability to fire events to the component that using WINRTP. This is done through the standard Connection Point mechanism. For information on connection points read a book on COM and ATL (Active Template Library). The basic idea is that WINRTP describes a COM interface for receiving events. If a component implements that COM interface, then it can subscribe itself as a listener of events generated by the WINRTP.

    ?WINRTP?不只提供給我們一個(gè)COM接口,它還具有發(fā)送事件給組件的功能。它從頭至尾完成了標(biāo)準(zhǔn)的連接點(diǎn)機(jī)制(要了解關(guān)于connection points的信息,請(qǐng)查看關(guān)于COMATL的書(shū)籍)。基本的想法是WINRTP?給出一個(gè)COM?接口用于接收事件。如果一個(gè)組件實(shí)現(xiàn)了這個(gè)接口,則它可以把自己作為WINRTP事件的監(jiān)聽(tīng)者。?PS:不太懂COM,瞎翻譯的

    ?

    The events interface (ICCNMediaTermEvents) is as follows

    ·????????HRESULT?EndOfFileEventRX(
    ????????????????????????????????????????????????[in] long Cookie
    ????????????????????????????????????????????????)

    ·????????HRESULT?EndOfFileEventTX(
    ????????????????????????????????????????????????[in] long Cookie
    ????????????????????????????????????????????????)

    ?

    ICCNMediaTerm)??WINRTP接口詳解

    All methods in the interface return an HRESULT value. If the method succeeds, they return 0, otherwise a negative number for failure. The return values are changing?L?so the recommended way to debug any?function??failures?is to use the trace mechanism (i.e. turn on tracing for the WINRTP, and look at the trace file which includes a description of the error that caused the negative return value. If problems persist, contact the developer of WINRTP for details/help.In?some cases, some of the important return values may be discussed for a function, but not for all functions

    ?所有的方法都返回一個(gè)HRESULT值。如果方法成功,返回0,否則,返回一個(gè)負(fù)數(shù)表示失敗。返回值是變化的,所以推薦的調(diào)試函數(shù)返回失敗的方法是使用trace機(jī)制。(如,打開(kāi)WINRTPtracting,查看包含負(fù)值返回的錯(cuò)誤描述的trace文件。如果問(wèn)題無(wú)法解決請(qǐng)聯(lián)系WINRTP開(kāi)發(fā)者得到詳細(xì)資料或幫助。有些情況下,函數(shù)的一些重要返回值可能需要討論,但不是所有都這樣)

    ?

    HRESULT?Initialize()

    ?

    Description:

    Initializes the WINRTP.?Instantiates all components.?Also sets up default?codecs?using the following calls

    初始化WINRTP,初始化所有組件,并且使用下面調(diào)用設(shè)置默認(rèn)codecs

    • SetAudioCodecTX(Codec = G711 Ulaw 64kbps, 20, 0, 0, 1, 0)
    • SetAudioCodecRX(Codec = G711 Ulaw 64kbps, 20, 0, 0)

    This function must be called before any other calls to WINRTP

    調(diào)用所有其它WINRTP函數(shù)前必須調(diào)用該函數(shù)。

    ?

    Parameters:

    None?無(wú)參數(shù)

    ?

    ?

    HRESULT?UnInitialize()

    ?

    Description:

    Uninitializes?the WINRTP and releases all allocated resources. This must be the last call made to the WINRTP

    銷(xiāo)毀WINRTP,釋放所有分配的資源。這必須是WINRTP的最后一個(gè)調(diào)用。

    ?

    Parameters:

    None?無(wú)參數(shù)

    ?

    ?

    HRESULT?StartMicrophone()

    ?

    Description:

    No implemented/needed in this version

    沒(méi)有在此版本中實(shí)現(xiàn)

    ?

    Parameters:

    None

    ?

    ?

    ?

    HRESULT?StopMicrophone()

    ?

    Description:

    No implemented/needed in this version

    沒(méi)有在此版本中實(shí)現(xiàn)

    ?

    Parameters:

    None

    ?

    ?

    HRESULT?StartAudioReceive()

    ?

    Description:

    No implemented/needed in this version

    沒(méi)有在此版本中實(shí)現(xiàn)

    ?

    Parameters:

    None

    ?

    HRESULT?StopAudioReceive()

    ?

    Description:

    No implemented/needed in this version

    沒(méi)有在此版本中實(shí)現(xiàn)

    ?

    Parameters:

    None

    ?

    ?

    HRESULT?SetAudioCodecRX

    ?

    Description:

    Call this function to inform WINRTP of the audio codec used to encode the incoming RTP stream. This function may be called before?StartRX?is called. (so?you may need to call?StopRX?before making this call). If called before?StartRX?is called, it sets the codec for the next invocation of?StartRX. If it is called while receiving audio (i.e. after?StartRX) it may return an error.

    調(diào)用這個(gè)函數(shù)通知WINRTP對(duì)輸入RTP流使用那個(gè)編碼。此函數(shù)可能在StartRX之前調(diào)用(所以,你可能需要此函數(shù)前調(diào)用StopRX)。如果StartRX已經(jīng)調(diào)用了,它將設(shè)置下一個(gè)StartRX,如果調(diào)用時(shí)正在接收數(shù)據(jù),它返回一個(gè)錯(cuò)誤。

    ?

    Parameters:

    [in] long?CompressionType:?The following values are supported

    ·????????2 :?G.711?Alaw?64kbps

    ·????????4 :?G.711?Ulaw?64kbps


    [in] long?MillisecPacketSize:
    ?Specifies the length of audio in each incoming RTP audio packets


    [in] long?EchoCancellationValue:
    ?Ignored. Put any value here. Echo cancellation is not supported in the WINRTP


    [in] long G723BitRate:
    ?Ignored

    ?

    ?

    HRESULT?SetAudioCodecTX

    ?

    Description:

    Sets the audio codec for the transmit stream (outgoing stream). Should be called while NOT streaming (i.e. before?StartTX/after?StopTX)

    設(shè)置輸出流的codecs,需要在沒(méi)有流傳輸時(shí)調(diào)用(如,StartTX之前,StopTX之后)

    ?

    Parameters:

    [in] long?CompressionType:?See?SetAudioCodecRX

    ?

    [in] long?MillisecPacketSize:?See?SetAudioCodecRX

    ?

    [in] long?PrecedenceValue:?Ignored


    [in] long?SilenceSuppression:?Specifies whether to do silence suppression in the transmit stream

    0 :?Silence suppression is turned OFF

    1 :?Silence suppression is turned ON

    ?

    [in] unsigned short?MaxFramesPerPacket:?Ignored

    ?

    [in] long G723BitRate:?See?SetAudioCodecRX

    ?

    HRESULT?SetAudioDestination

    ?

    Description:

    Sets the destination [IP Address,?UDP?Port] where the send side audio stream should be transmitted.?Must be called while not streaming (i.e. Before?StartTX/after?StopTX).

    設(shè)置發(fā)送端傳輸音頻流的目的地[IP地址,UDP端口]?。必須在無(wú)流傳輸時(shí)調(diào)用(如,StartTX之前,StopTX之后)

    ?

    Parameters:

    [in] BSTR?strHostName:?IP address of the destination. E.g. “171.69.12.34
    [in] long?nUDPortNumber:
    ?UDP port number where to send the stream

    ?

    ?

    HRESULT?SetAudioReceivePort

    ?

    Description:

    Informs the WINRTP of the UDP port number where it should listen for the incoming RTP audio stream. Note:?StartAudioReceive?must be called before any audio from the incoming stream is played to the speaker.

    告知WINRTP用于監(jiān)聽(tīng)輸入RTP音頻流的UDP地址。注:StartAudioReceive必須在輸入流已經(jīng)播放之前。

    ?

    Parameters:

    [in] long?nUDPPortNumber:?UDP port number

    ?

    ?

    HRESULT?StartPlayingFileTX

    ?

    Description:

    This method should be used when a WAV file needs to be transmitted. The audio from the file is mixed in with the outgoing audio stream (user’s voice). The WINRTP fires an event to let the caller know when the file has finished playing, so that another file may be played. If the file finished playing, the WINRTP automatically calls?StopPlayingFileTX?so the caller need not call it. Only one file may be playing at a time. If this function is called while another file is playing already, an error is returned and the original file keeps playing. The function returns?an?unique identifier (cookie) that may be used in later calls related to this file play (to set the volume, or stop it from playing any more). This method can also play the file in a loop continuously without stopping. By default, files start playing at 25% volume.

    此方法用于WAV文件需要傳輸時(shí)。文件的音頻將同輸出流混音WINRTP發(fā)送一個(gè)事件讓調(diào)用者知道文件已經(jīng)播放完畢,這時(shí)其它文件可以播放。當(dāng)文件播放完畢,WINRTP自動(dòng)調(diào)用StopPlayingFileTX?,調(diào)用者不必再調(diào)用。同一時(shí)刻只能播放一個(gè)文件。如果此函數(shù)調(diào)用時(shí)已經(jīng)有文件在播放,此調(diào)用將返回一個(gè)錯(cuò)誤,原來(lái)的文件將繼續(xù)播放。函數(shù)返回一個(gè)唯一標(biāo)示,可以被用于之后的函數(shù)調(diào)用(設(shè)置音量、停止播放等)。此方法也可以無(wú)間斷地重復(fù)播放一個(gè)文件。默認(rèn)情況下,文件以25%的音量大小播放。

    ?

    Parameters:

    [in] BSTR Filename:?the location (path) of the file to be played??待播放文件的位置(路徑)


    [in] unsigned long Mode:
    ?specifies whether to play the file once or in a loop?制定播放一次或循環(huán)

    ·????????0 :?play the file continuously in a loop

    ·????????1 :?play the file once

    ?

    [in] unsigned long?StartPosition:?unimplemented/ignored

    [in] unsigned long?StopPosition:?unimplemented/ignored

    [in, out] long * Cookie:?WINRTP returns a unique ID for this instance of the file being played. This cookie should be used in later calls pertaining to the instance of the file playing

    ?

    HRESULT?StartPlayingFileRX

    ?

    Description:

    This function starts mixing audio from the specified file to the received audio stream, so that the user hears audio from both the incoming audio stream and the file. The only difference is that we can have two files playing simultaneously in the receive side instead of one. By default, files start playing at 25% volume.

    此函數(shù)開(kāi)始對(duì)接收音頻流和制定的文件進(jìn)行混音。用戶將同時(shí)聽(tīng)到輸入音頻流和文件音頻,唯一的不同點(diǎn)是我們可以在接收端同時(shí)播放兩個(gè)文件。默認(rèn)音量為25%

    ?

    Parameters:

    Exactly the same as?StartPlayingFileTX, but with another extra parameter

    [in] unsigned long?waveoutDeviceID:?specifies which speaker device to play the file to.?WinRTP?now allows you to play the file using the wave/speaker device opened for audio (with?StartRX) or to another wave/speaker device. sometimes it may be useful to play a file locally to another audio device (for e.g. if you are using a USB headset for speech, you may want to play ring tones for incoming calls through? the speakers connected to the sound card so that it is heard loudly). See?StartRX?for a discussion on?waveoutDeviceID

    ?

    ?

    HRESULT?StartTX

    ?

    Description:

    Starts streaming on the transmit side. This method must be called before?StartPlayingFileTX?is called. Calling this method starts transmitting the user’s voice

    在傳輸端開(kāi)始流。此函數(shù)必須在StartPlayingFileTX函數(shù)調(diào)用前。調(diào)用此方法開(kāi)發(fā)傳輸用戶語(yǔ)音。

    ?

    Parameters:

    unsigned?long?waveinDeviceID:?specifies which audio device to use for audio capture/recording.?device?ID's are numbered 0...(#of recording audio devices-1), and -1 means use default audio device for windows. Check out?waveInOpen() and?waveInGetDevCaps() in the windows API. If you are confused, -1 actually means (unsigned long) –1.

    ?

    ?

    HRESULT?StartRX

    ?

    Description:

    Sets up WINRTP to start the receive side. It also starts playing the received audio to the speaker.

    設(shè)置接收端開(kāi)始WINRTP,它也開(kāi)始播放接收到的音頻。

    ?

    Parameters:

    unsigned?long?waveoutDeviceID:?specifies which audio device to use for playback/speaker. These device ID's are numbered 0 ... (# of playback devices - 1), and -1 means use the default playback device. Check out?waveOutOpen() and?waveOutGetDevCaps() functions in the windows API.. If you are confused, -1 actually means (unsigned long) –1.

    ?

    ?

    HRESULT?StopTX

    ?

    Description:

    Stops transmitting audio.?Stops transmitting the user’s voice and files.

    停止傳輸語(yǔ)音。停止傳輸用戶語(yǔ)音及文件。

    ?

    Parameters:

    None

    ?

    ?

    HRESULT?StopRX

    ?

    Description:

    Stops receiving and playing audio.?Stops playing the received audio stream and the files

    停止接收和播放音頻。停止播放接收的音頻流及文件。

    ?

    Parameters:

    None

    ?

    ?

    HRESULT?SetSpeakerVolume

    ?

    Description:

    Sets the speaker volume on the PC.?This setting sets the WAVEOUT volume of the system (not the master volume).

    設(shè)置PC揚(yáng)聲器音量。此調(diào)用設(shè)置系統(tǒng)的WAVEOUT音量(不是主音量)。

    ?

    Parameters:

    [in] unsigned long volume:?value between 0 and 100 where 0 = silence, and 100 = max volume. The scale is linear, so 50 = half volume

    ?

    HRESULT?SetMicrophoneVolume

    ?

    Description:

    Sets the microphone volume.?This setting changes the PC’s microphone volume or audio capture volume.

    設(shè)置麥克風(fēng)音量。此調(diào)用改變麥克風(fēng)音量或音頻捕捉音量。

    ?

    Parameters:

    [in] unsigned long volume:?value between 0 and 100 where 0 = silence, and 100 = max volume. The scale is linear, so 50 = half volume

    ?

    ?

    ?

    ?

    HRESULT?SetFilePlayVolume

    ?

    Description:

    Sets the volume of a file being played by the WINRTP.

    設(shè)置WINRTP正在播放的文件的音量

    ?

    Parameters:

    [in] unsigned long cookie:?the cookie that pertains to this instance of the file play. The cookie is obtained when?StartPlayingFileTX(or RX) is called


    [in] unsigned long volume:?
    Volume setting. Starts from 0 (silence) to 100 (max volume)

    ?

    HRESULT?StopPlayingFileTX

    ?

    Description:

    Stops a file being played in the transmit side

    在傳輸端停止當(dāng)前文件播放

    ?

    Parameters:

    [in] unsigned long Cookie:?Cookie that was returned when the file started playing.

    ?

    ?

    HRESULT?StopPlayingFileRX

    ?

    Description:

    Stops a file being played in the receive side

    在接收端停止當(dāng)前文件播放。

    ?

    Parameters:

    [in] unsigned long Cookie:?Cookie that was returned when the file started playing.

    ?

    ?

    GUIDs, etc

    The important?GUIDs?are??最主要的GUID為:

    • WinRTP?COM object (CCNMediaTerm?class) :?94221C4E-00F1-11D4-9D59-0060B0FC246C
    • WinRTP?COM?Inteface?(ICCNMediaTerm) :?94221C4D-00F1-11D4-9D59-0060B0FC246C
    • WinRTP?Events Interface (_ICCNMediaTermEvents) :?94221C4F-00F1-11D4-9D59-0060B0FC246C

    ?

    The following code snippet may be useful for more information?下面的小代碼斷可能會(huì)提供更多信息:

    ?

    WINRTP Interface

    //?CCNSMT.idl?:?IDL source for CCNSMT.dll
    //

    // This file will be processed by the MIDL tool to
    // produce the type library (CCNSMT.tlb) and marshalling code.

    import "oaidl.idl";
    import "ocidl.idl";
    [
    object,
    uuid(94221C4D-00F1-11D4-9D59-0060B0FC246C),

    helpstring("ICCNMediaTerm?Interface"),
    pointer_default(unique)
    ]
    interface?ICCNMediaTerm?:?IUnknown
    {
    [helpstring("method Initialize")]
    HRESULT Initialize();
    [helpstring("method?UnInitialize")]
    HRESULT?UnInitialize();
    [helpstring("method?StartMicrophone")]?
    HRESULT?StartMicrophone();
    [helpstring("method?StopMicrophone")]?
    HRESULT?StopMicrophone();
    [helpstring("method?StartAudioReceive")]?
    HRESULT?StartAudioReceive();
    [helpstring("method?StopAudioReceive")]?
    HRESULT?StopAudioReceive();
    [helpstring("method?StopDtmfTone")]?
    HRESULT?StopDtmfTone();
    [helpstring("method?SetAudioCodecRX")]?
    HRESULT?SetAudioCodecRX([in] long?CompressionType, [in] long?MillisecPacketSize, [in] long?EchoCancellationValue, [in] long G723BitRate);
    [helpstring("method?SetAudioCodecTX")]?
    HRESULT?SetAudioCodecTX([in] long?CompressionType, [in] long?MillisecPacketSize, [in] long?PrecedenceValue, [in] long?SilenceSuppression, [in] unsigned short?MaxFramesPerPacket, [in] long G723BitRate);
    [helpstring("method?SetAudioDestination")]?
    HRESULT?SetAudioDestination([in] BSTR?strHostName, [in] long?nUDPortNumber);
    [helpstring("method?SetAudioReceivePort")]?
    HRESULT?SetAudioReceivePort([in] long?nUDPPortNumber);
    [helpstring("method?StartDtmfTone")]?
    HRESULT?StartDtmfTone([in] long?cToneAsChar, [in] long?OnTime, [in] long?OffTime);
    [helpstring("method?StartPlayingFileTX")]?
    HRESULT?StartPlayingFileTX([in] BSTR Filename, [in] unsigned long Mode, [in, out] long * Cookie);
    [helpstring("method?StartPlayingFileRX")]?
    HRESULT?StartPlayingFileRX([in] BSTR Filename, [in] unsigned long Mode, [in] unsigned long?waveoutDeviceID, [in, out] long * Cookie);
    [helpstring("method?StopPlayingFileTX")]?
    HRESULT?StopPlayingFileTX([in] unsigned long Cookie);
    [helpstring("method?StopPlayingFileRX")]?
    HRESULT?StopPlayingFileRX([in] unsigned long Cookie);
    [helpstring("method?StartTX")]?
    HRESULT?StartTX([in] unsigned long?waveinDeviceID);
    [helpstring("method?StopTX")]?
    HRESULT?StopTX();
    [helpstring("method?StartRX")]?
    HRESULT?StartRX([in] unsigned long?waveoutDeviceID);
    [helpstring("method?StopRX")]?
    HRESULT?StopRX();
    [helpstring("method?SetSpeakerVolume")]?
    HRESULT?SetSpeakerVolume([in] unsigned long?deviceID, [in] unsigned long volume);
    [helpstring("method?SetMicrophoneVolume")]?
    HRESULT?SetMicrophoneVolume([in] unsigned long?deviceID, [in] unsigned long volume);
    [helpstring("method?SetFilePlayVolume")]?
    HRESULT?SetFilePlayVolume([in] unsigned long cookie, [in] unsigned long volume);
    [helpstring("method?NetworkMonitor")]?
    HRESULT?NetworkMonitor([in] unsigned long Enable, [in] unsigned long?DurationMillisec);
    };


    [
    uuid(94221C4F-00F1-11D4-9D59-0060B0FC246C),
    helpstring("_ICCNMediaTermEvents?Interface")
    ]
    interface _ICCNMediaTermEvents?:?IUnknown
    {
    [helpstring("method?EndOfFileEventRX")]?
    HRESULT?EndOfFileEventRX([in] long Cookie);
    [helpstring("method?EndOfFileEventTX")]?
    HRESULT?EndOfFileEventTX([in] long Cookie);
    [helpstring("method?NetworkMonitorEventRX")]?
    HRESULT?NetworkMonitorEventRX([in] double?RXMean, [in] double?RXVariance);
    [helpstring("method?NetworkMonitorEventTX")]?
    HRESULT?NetworkMonitorEventTX([in] double?TXMean, [in] double?TXVariance);
    };


    [
    uuid(94221C40-00F1-11D4-9D59-0060B0FC246C),
    version(1.0),
    helpstring("CCNSMT 1.0 Type Library")
    ]
    library?CCNSMTLib
    {
    importlib("stdole32.tlb");
    importlib("stdole2.tlb");

    [
    uuid(94221C4E-00F1-11D4-9D59-0060B0FC246C),
    helpstring("CCNMediaTerm?Class")
    ]
    coclass?CCNMediaTerm
    {
    [default] interface?ICCNMediaTerm;
    [default, source] interface _ICCNMediaTermEvents;
    };
    };

    ?

    Type Library

    [

    ????????????uuid(94221C40-00F1-11D4-9D59-0060B0FC246C),

    ????????????version(1.0),

    ????????????helpstring("CCNSMT 1.0 Type Library")

    ]

    library?CCNSMTLib

    {

    ????????????importlib("stdole32.tlb");

    ????????????importlib("stdole2.tlb");

    ?

    ????????????[

    ????????????????????????uuid(94221C4E-00F1-11D4-9D59-0060B0FC246C),

    ????????????????????????helpstring("CCNMediaTerm?Class")

    ????????????]

    ????????????coclass?CCNMediaTerm

    ????????????{

    ????????????????????????[default] interface?ICCNMediaTerm;

    ????????????????????????[default, source] interface _ICCNMediaTermEvents;

    ????????????};

    };

    Sample C++ Code?示例C++代碼:

    Using the type library generated while compiling?WinRTP?(CCNSMT.tlb) one can easily?use?WinRTP?in code. Visual C++ 6.0 allows importing a type library in the #import command, as the following sample code shows. Note that you cannot import?WinRTP?as a COM object into your project because it is NOT and ActiveX control nor does it support?IDispatch.

    使用編譯WINRTP時(shí)得到的類型庫(kù)文件,可以在編碼時(shí)很容易的使用WinRTP。就像下面代碼顯示的那樣,VC 6.0?允許使用#import?命令導(dǎo)入一個(gè)類型庫(kù)。注意,你不可以把WINRTP當(dāng)作一個(gè)COM?對(duì)象導(dǎo)入你的工程,因?yàn)樗皇恰6?span lang="EN-US">ActiveX?控件也不支持IDispatch

    ?

    #import "../CCNMediaTerm/CCNSMT/CCNSMT.tlb"?no_namespace,?raw_interfaces_only

    int?main()
    {
    HRESULT hr;

    // Initialize COM
    hr =?CoInitialize(NULL);

    // Get Interface?ICCNMediaTerm?from the?WinRTP?COM Object using smart pointer defined by the #import command above.?
    // Automatically calls?IUnknown::AddRef();
    ICCNMediaTermPtr?pICCNMediaTerm(__uuidof(CCNMediaTerm));

    // Initialize?WinRTP. Must be the first call
    pICCNMediaTerm->Initialize();

    // Set parameters for receive side
    pICCNMediaTerm->SetAudioCodecRX(4, 20, 0, 0);
    pICCNMediaTerm->SetAudioReceivePort(8500);

    // Set parameters for transmit side
    pICCNMediaTerm->SetAudioCodecTX(4, 20, 0, 0, 0, 0);
    pICCNMediaTerm->SetAudioDestination(L"127.0.0.1", 8500);

    // Start reception side.?we?will use the default (-1) playback device
    pICCNMediaTerm->StartRX(-1);

    // Start transmit side. we will use the default (-1) recording device
    pICCNMediaTerm->StartTX(-1);

    // Set the speaker volume to 50%
    pICCNMediaTerm->SetSpeakerVolume(-1, 50);

    // Set the microphone volume to 50%
    pICCNMediaTerm->SetMicrophoneVolume(-1, 50);

    // Hear yourself for 5 seconds
    Sleep(5000);

    // Stop reception & transmission
    pICCNMediaTerm->StopRX();
    pICCNMediaTerm->StopTX();

    //?Unitialize?WinRTP. Must be the last call
    pICCNMediaTerm->UnInitialize();
    // Let go of the reference to the?ICCNMediaTerm?interface. Automatically calls?IUnknown::Release()
    pICCNMediaTerm?= 0;

    //?Uninitialize?COM
    CoUninitialize();

    return 0;
    }

    ?可選參數(shù)

    The configurable parameters of WINRTP are mostly set using the registry. The registry key for these settings is HKEY_CURRENT_USER/Software/Cisco Systems/CCNMediaTerm/1.0. If these entries do not exist in the registry, then the WINRTP creates them automatically with the default values the first time it needs to use them.

    大部分WINRTP的可選參數(shù)使用注冊(cè)表。這些設(shè)置的鍵值為HKEY_CURRENT_USER/Software/Cisco Systems/CCNMediaTerm/1.0?。如果這個(gè)鍵值不存在,WINRTP將在第一次需要使用它們時(shí)建立它。

    ?靜態(tài)/動(dòng)態(tài)?抖動(dòng)緩沖

    Set the?UseDynamicJitterBuffer?registry entry to “true” to use dynamic jitter buffer algorithm for audio reception. Set it to “false” to use static jitter buffer (like the old version of?winrtp)

    設(shè)置?UseDynamicJitterBuffer?條目為?“true”?則在音頻接收時(shí)使用動(dòng)態(tài)抖動(dòng)緩沖算法。設(shè)置為“false”?則使用靜態(tài)抖動(dòng)緩沖(就像上的版本一樣)

    ?抖動(dòng)緩沖長(zhǎng)度

    This value is relevant only if static jitter buffer is being used. The length of the jitter buffer can be specified using the?JitterBufferTime?registry setting. This setting is in milliseconds. The default value is 180, but lower values work on most computers. At the beginning of each talk spurt, the WINRTP fills x milliseconds of audio in the jitter buffer (where x is the value of the?JitterBufferTime?registry setting) before it starts playing it to the speaker. Higher jitter buffer length provides smoother audio and immunity to network problems, but increases the latency in a two-way conversation. But lowering this value too much can lead to bad quality audio (stuttering or jittery audio) in which case the user should try to increase this setting. The optimal value is very dependent on the configuration of the PC (sound card and drivers, operating system, etc.), so it should be set on a per-computer basis. The default value of 180 works on majority of computers (lower values may work too).

    此值只有在使用靜態(tài)抖動(dòng)緩沖時(shí)才有效。使用JitterBufferTime?鍵值來(lái)設(shè)置抖動(dòng)緩沖的長(zhǎng)度。此設(shè)置單位為毫秒。默認(rèn)值為180,但是大多數(shù)計(jì)算機(jī)使用更低的值。話音突發(fā)(talk spurt)開(kāi)始時(shí),WINRTP在播放之前填充?x?毫秒到抖動(dòng)緩沖(x?JitterBufferTime?鍵值)。更高的抖動(dòng)緩沖長(zhǎng)度提供了更平滑的音頻及更好的網(wǎng)絡(luò)故障免疫性,但是增加了雙向交談的反應(yīng)時(shí)間。降低太多此值,會(huì)帶來(lái)劣質(zhì)的語(yǔ)音(間斷的,抖動(dòng)的聲音),這時(shí)就需要增加這個(gè)值。最佳的值依賴于PC的配置(聲卡、驅(qū)動(dòng)及操作系統(tǒng)等),所以它對(duì)于每個(gè)電腦是不同的。默認(rèn)的180,可以適用于大部分電腦。

    Try the following (Windows 2000/XP :?60ms, WinNT 4.0 : 120ms, Win 95/98/ME : 180ms

    按照操作系統(tǒng)不同,可嘗試下面的設(shè)置:Windows 2000/XP :?60ms, WinNT 4.0 : 120ms, Win 95/98/ME : 180ms

    ?接收的RTP音頻流自動(dòng)放大等級(jí)

    WinRTP?can automatically amplify the volume of the incoming audio streams. It is needed because frequently the volume level in the incoming packets is pretty low, so they sound much faint compared to other sounds on the PC. We could increase the volume sliders on the PC, but that would make every other sound extremely loud so it is not a satisfactory solution. The real fix is to amplify the incoming audio to a level that is comparable to other system sounds.?WinRTP?2.1 onwards has that ability. Note that increasing the level of the incoming signal can cause distortion (due to clipping) so?WinRTP?employs a novel technique that gives the user complete control. It has amplification that is governed by two parameters, a max-gain (the maximum gain that will be applied if possible), and a distortion-free-percentile (percentage of audio samples that should not be distorted due to this amplification). It is best explained with an example. Say max gain is 5, and distortion-free-percentile is 95%. Then given an RTP packet with audio samples,?WinRTP?will calculate how much gain it can apply so the samples so that 95% of the samples will NOT be distorted. If this value (say x) is less than max-gain, then the packet will be amplified x times. If x is more that max-gain, then the packet will be amplified max-gain times. To ensure that no distortion occurs, set the percentile to 100% and max-gain to a high value. That way,?WinRTP?will always amplify the packet without distorting any sample. However, during quiet periods, x might be large which will increase the loudness of the background noise. This is where setting max-gain to?a?optimal value helps, because it is the max amplification that will ever be applied. I have seen that?max-gain values between 5-10 and percentile of 95% produces?a good balance. To turn off this feature altogether, set max-gain to 1, so that no amplification will be done. The following registry keys control this feature

    WINRTP可以自動(dòng)放大輸入的音頻流音量。這是很必要的,因?yàn)檩斎氚囊袅砍36己苄?#xff0c;于PC的其它聲音比起來(lái)很微弱。我們可以去增加PC的音量調(diào)節(jié),但是它也將其它聲音放的很大,這不是令人滿意的解決辦法。真正的解決辦法是放大輸入音頻的等級(jí)和系統(tǒng)的其它聲音相當(dāng)。WINRTP2.1首先具有這個(gè)功能。注意,增大輸入信號(hào)的等級(jí)可能會(huì)導(dǎo)致失真(由于clipping)?,所以WINRTP給用戶完全的控制權(quán)。我們通過(guò)兩個(gè)參數(shù)來(lái)進(jìn)行設(shè)置,一個(gè)max-gain(可能的最大限度的增大)和一個(gè)distortion-free-percentile(最小保真率)。最好的闡述是通過(guò)一個(gè)例子:說(shuō),max gain設(shè)置為5?distortion-free-percentile設(shè)置為95%?。這時(shí),給出一個(gè)RTP包,WINRTP將計(jì)算多大的增加可以保證原始包中95%的語(yǔ)音沒(méi)有失真。如果這個(gè)值(x)小于?max-gain5)?,這個(gè)包將放大x。如果這個(gè)值大于?max-gain5),它將放大max-gain。要保證沒(méi)有失真出現(xiàn),設(shè)置百分點(diǎn)為100%,?max-gain為一個(gè)很大值,這樣,WINRTP將在不失真的情況下放大音頻包。當(dāng)靜音階段,x?可能會(huì)很大,這將導(dǎo)致環(huán)境雜音被放大。這就是為什么要設(shè)置max-gain為一個(gè)最佳值,因?yàn)檫@將是可以接收的最大放大倍數(shù)。我認(rèn)為max-gain?510之間,distortion-free-percentile95%?,可以達(dá)到一個(gè)比較好的平衡。關(guān)閉此功能,設(shè)置max-gain?1?,這樣不會(huì)有任何放大。下面的鍵值控制此功能:


    VolumeMaximizeMaxGain?(floating point number >= 1.0 e.g.?8.0 )

    VolumeMaximizePercentile?(floating point number between 0.0 and?100.0 )

    ?

    DiffServ?Byte) of Outgoing RTP Packets?輸出RTP包的TOS

    The WINRTP can stamp outgoing RTP packets with an IP TOS (type of service) value in the IP header. This is important for?QoS?purposes where packets of a certain TOS may be given priority in the network to reduce delay. To do this, you need to change the value in the?RtpOut?filter project (RtpOut.cpp)

    ?WINRTP可以為輸出RTP包在IP頭標(biāo)示IP TOS?值,對(duì)于Qos來(lái)說(shuō)這很重要,不同的TOS將給與不同的優(yōu)先級(jí)來(lái)減少延遲。你需要修改這個(gè)值在RtpOut?filter?項(xiàng)目中(RtpOut.cpp

    ?指定UDP?傳輸端口

    If you want to use a particular local UDP port to transmit RTP streams, set the?UseFixedTransmitPort?to “true” and set the?TransmitPort?registry entry to the port number you want to use. Otherwise, set?UseFixedTransmitPort?to “false”. Note?the receive?and transmit port cannot be the same. Make sure transmit?port != receive port, and transmit port != (receive port + 1)

    ?如果你想使用一個(gè)確定的本地UDP端口在傳輸RTP流,可以設(shè)置?UseFixedTransmitPort?鍵值為?“true”?并?設(shè)置?TransmitPort?鍵值為你想使用的端口。否則,設(shè)置UseFixedTransmitPort?為?“false”?。注意:接收和發(fā)送端口不能為一個(gè),請(qǐng)確保transmit port != receive port,?并且?transmit port != (receive port + 1)

    ?發(fā)送音頻的預(yù)加重

    To do pre-emphasis of transmitted audio to make it sound sharper, set the?MicrophonePreprocess?registry entry to “true” (“false” otherwise) and then set the?TxFIRFilter?registry entry to either “1”?or “2”. This chooses between a set of parameters to set up an FIR filter to do pre-emphasis of the audio. Experiment to see which setting sounds best

    預(yù)加重使聲音?sharper。設(shè)置?MicrophonePreprocess?鍵值為“true”?,并設(shè)置?TxFIRFilter?鍵值為??“1”??“2”?。這些參數(shù)被FIR過(guò)濾器用來(lái)進(jìn)行預(yù)加重(pre-emphasis),你可以自己實(shí)驗(yàn)得到最好的效果。

    ?

    ?接收音頻的后加重

    To do post-emphasis of received audio to make it sound sharper, set the?SpeakerPostprocess?registry entry to “true” (“false” otherwise) and then set the?RxFIRFilter?registry entry to either “1”?or “2”. This chooses between a set of parameters to set up an FIR filter to do post-emphasis of the audio. Experiment to see which setting sounds best

    ?后加重使接收到的聲音sharper。設(shè)置?SpeakerPostprocess?鍵值為“true”?,并設(shè)置?鍵值?RxFIRFilter?“1”??“2”?。這些參數(shù)將傳給FIR過(guò)濾器用來(lái)后加重(post-emphasis),你可以自己實(shí)驗(yàn)得到最好的效果。

    ?音量限制

    Sometimes the received audio may be too loud and you may want to do volume limiting to reduce the max volume. In that case, set the?LimitVolume?registry entry to “true” (“false” otherwise). This will turn on the volume limiting feature. To control the behavior of the limiter, there are three registry settings:?LimiterThreshold?(default –8.0),?LimiterLossIncrement?(default 0.075),?LimiterLossDecrement?(default –0.00075). Setting the threshold lower (for e.g. to –25.0 instead of –8.0) will limit audio to a lower volume. I recommend against playing around with the other parameters.

    ?某些接收到的音頻可能聲音太大,你想限制音量的最大值。這時(shí)候,設(shè)置?LimitVolume?鍵值為??“true”?。這將打開(kāi)音量限制功能,控制限制器的行為,有三個(gè)鍵值:LimiterThreshold?(默認(rèn)-8.0),LimiterLossIncrement?(默認(rèn)0.075),?LimiterLossDecrement?(默認(rèn)–0.00075)。降低threshold?的值將會(huì)限制聲音,另外的鍵值我建議大家不要修改。

    ?示例代碼

    The following?sections describes?through an example how to use the Media Term component. Here are the basic steps

    下面的段落敘述了一個(gè)使用Media Term組件的例子。下面是步驟:

  • Initialize COM (CoInitializeEx)??初始化COM,使用(CoInitializeEx
  • Instantiate the Media Term Component and get the?ICCNMediaTerm?COM interface (Say the variable is?CCNMediaTerm) using?CoCreateInstance
  • 初始化Media Term?組件,使用CoCreateInstance得到ICCNMediaTerm接口 (CCNMediaTerm

  • Initialize the WINRTP???初始化WINRTP
  • ·????????Initialize();

  • Transmit Side??發(fā)送端:
  • ·????????Set?the startup parameters for transmit: Use G.711?Ulaw?Codec, 30ms packet size, No silence suppression. Transmit to?localhost?(127.0.0.1) to port 21243??設(shè)置傳輸?shù)膮?shù):

    o???????SetAudioCodecTX(4, 30, 0, 0, 1, 0);

    o???????SetAudioDestination(“127.0.0.1”, 21243);

    ·????????Start transmission using the default audio capture device?開(kāi)始發(fā)送音頻流

    o???????StartTX(-1);

    ·????????Mix the file “foo.wav” along with the transmitted stream. Play the file once.?音文件foo.wav及傳輸流?,并播放。

    o???????StartPlayingFileTX(“foo.wav”, 1, 0, 0, &sendFileCookie)

    ·????????Set the volume of the “foo.wav” file to 50%??設(shè)置音量為50%

    o???????SetFilePlayVolume(sendFileCookie, 50)

    ·????????Change the codec from G.711?Ulaw?to G.723 at 5.3kbps and turn on silence suppression?改變codecs,打開(kāi)靜音抑制

    o???????SetAudioCodecTX(9, 30, 0, 1, 1, 0)

    ·????????Stop Transmitting (everything, including voice and files)?停止傳輸

    o???????StopTX()

  • Receive Side??接收端
  • ·????????Set?the startup parameters for receive: Use G.711?Ulaw?Codec, 30ms packet size. Receiving from local port 8000?設(shè)置接收參數(shù)

    o???????SetAudioCodecRX(4, 30, 0, 0);

    o???????SetAudioReceivePort(8000);

    ·????????Start receive side using the default audio playback device?使用默認(rèn)的回放設(shè)備開(kāi)始接收

    o???????StartRX(-1);

    ·????????Mix the file “foo.wav” along with the received stream. Play the file continuously in a loop. Also play another file “foobar.wav” just once. Mix both files along with the received audio?音文件foo.wav及接收流 ,循環(huán)播放文件,播放另一個(gè)文件foobar.wav一次。混音所有輸出。

    o???????StartPlayingFileRX(“foo.wav”, 0, 0, 0, -1, &receiveFileCookie1);

    o???????StartPlayingFileRX(“foobar.wav”, 1, 0, 0. –1, &receiveFileCookie2);

    ·????????Set the volume of the “foobar.wav” file to 25%??設(shè)置音量25%

    o???????SetFilePlayVolume(receiveFileCookie2, 25)

    ·????????Stop playing the “foo.wav” file that was playing in a loop?停止foo.wav播放

    o???????StopPlayingFileRX(receiveFileCookie1);

    ·????????Change the codec from G.711?Ulaw?to G.729 (30ms packet size), and also change the port to receive audio from 8000 to 9999?改變codecs和端口

    o???????SetAudioCodecRX(11, 30, 0, 0)

    o???????SetAudioReceivePort(9999)

    ·????????Stop receiving (everything, including voice and files). This method releases the speaker停止接收

    o???????StopRX()

  • Uninitialize?the WINRTP and release all resources??銷(xiāo)毀WINRTP?,釋放所有資源
    • Uninitialize()
  • Uninitialize?COM if needed using?CoUninitialize??銷(xiāo)毀COM
  • ?

    I plan to release some sample C++ code to show how to use this component soon

    我計(jì)劃不久后發(fā)布一些C++代碼來(lái)展示如何使用這些組件。

    ?未來(lái)的改進(jìn)

    Some of the future improvements that are being considered are?一些未來(lái)需要做的改進(jìn):

    • Using the same local UDP port to do transmit and receive??使用相同的端口完成接受和傳輸

    總結(jié)

    以上是生活随笔為你收集整理的Cisco IP电话软件的WINRTP的全部?jī)?nèi)容,希望文章能夠幫你解決所遇到的問(wèn)題。

    如果覺(jué)得生活随笔網(wǎng)站內(nèi)容還不錯(cuò),歡迎將生活随笔推薦給好友。