Property: RecordBufferSize


Type:

 

Long

     

Properties:

 

ReadWrite. Available at both design time and run time.

     

Function:

 

Set or get the size of the record buffer.

     

Description:

 

VoiceAngel use three buffer alternatively to get wave samples recorded. RecordBufferSize is not in bytes but in samples. Waveform are formed by continual samples. A sample is formed by 1 or 2 bytes according to the format of the wave file. For example, a wave file with the format 8000hz, 16bit/sample, mono has 2 bytes samples, while a wave file with format 8000, 8bit/sample, mono has 1 byte samples. The size of the play buffer in bytes is PlayBufferSize * BytesPerSample.

Voice Modems use wave files with the format 8000hz,16bit, Voice boards usually use 11025hz, 8bit, mono or 8000hz, 8bit, mono. Thus if you set PlayBuffferSize 1024, with a voice modem, it will have three 2048 bytes buffer, with a voice board, it will have three 1024 bytes buffer.

 

If you set PlayBufferSize or RecordBufferSize at design time or before Initialize called, it will set the size of the record buffer for all the lines when the Initialize called.

If RecordBufferSize is set 0, lines will use default size, different type of lines may have different default values for PlayBufferSize and RecordBufferSize:
Default value for Voice modem:

PlayBufferSize 1024, RecordBufferSize 1024

Default value for Voice Board:

PlayBufferSize 10000,RecordBufferSize 4096

 

 

 

If set PlayBufferSize or RecordBufferSize at run time, it is set for the current line set byCurrentLineIndex, CurrentLineName.

 

Voice Boards usually have a parameter called "Receive Buffer Threshold" which is the buffer they used to receive wave data. It can be configured in the Wave Driver Property dialog provided by the TSP(See the screen shot below for Dialogic wave configuration).

If the size of play buffer in bytes (PlayBufferSize*BytesPerSample) is smaller than the threshold, voice played will become uncontinual. And the size of record buffer in bytes (RecordBufferSize*BytesPerSample) should not be much smaller than the threshold, otherwise voice recorded will not be continual. Default value of PlayBufferSize with voice boards is 10000 because threshold of Dialogic Cards are 8192Bytes.

 

 

 


     

See Also:

 

PlayBufferSize

Sample Code In Visual Basic:

'The following code shows how to set buffer size for all the line.

Sub Form_Load ()

VoiceAngel1.PlayBufferSize=1024

VoiceAngel1.RecordBufferSize=1024

 VoiceAngel1.Initialize

 

End sub

 

 

'The following code shows how to set buffer size for the current line.

Sub Form_Load()

VoiceAngel1.Initialize

End Sub

Sub SetBufferSize(LineIndex as integer)

VoiceAngel1.CurrentLineIndex = LineIndex

VoiceAngel1.PlayBufferSize=1024

VoiceAngel1.RecordBufferSize=1024

End sub

Sub cmdSetBufferSize_Click()

SetBufferSize(CLng(txtLineToSetBufferSize.Text))

End sub