aboutsummaryrefslogtreecommitdiffstats
path: root/src/media
diff options
context:
space:
mode:
authortobigun <tobigun@b956fd51-792f-4845-bead-9b4dfca2ff2c>2010-12-27 11:57:53 +0000
committertobigun <tobigun@b956fd51-792f-4845-bead-9b4dfca2ff2c>2010-12-27 11:57:53 +0000
commit64e1acc9391e65b298f27ff0bdfa5f32128b94d1 (patch)
treedb20f92d6c8226f5cca8c79870529f35ed2fa801 /src/media
parente16fbb4681f1fdfe6c7bdf4345a46376ab030718 (diff)
downloadusdx-64e1acc9391e65b298f27ff0bdfa5f32128b94d1.tar.gz
usdx-64e1acc9391e65b298f27ff0bdfa5f32128b94d1.tar.xz
usdx-64e1acc9391e65b298f27ff0bdfa5f32128b94d1.zip
stretch mic-input to avoid buffer underruns with voice playback (audible as scratching)
git-svn-id: svn://svn.code.sf.net/p/ultrastardx/svn/trunk@2774 b956fd51-792f-4845-bead-9b4dfca2ff2c
Diffstat (limited to 'src/media')
-rw-r--r--src/media/UAudioPlayback_Bass.pas7
1 files changed, 6 insertions, 1 deletions
diff --git a/src/media/UAudioPlayback_Bass.pas b/src/media/UAudioPlayback_Bass.pas
index 1d7a44dc..a3c3bd30 100644
--- a/src/media/UAudioPlayback_Bass.pas
+++ b/src/media/UAudioPlayback_Bass.pas
@@ -572,6 +572,10 @@ end;
function TBassVoiceStream.Open(ChannelMap: integer; FormatInfo: TAudioFormatInfo): boolean;
var
Flags: DWORD;
+const
+ // prevent buffer underruns in BASS BASS_StreamPutData() sample output queue
+ // by stretching the input signal.
+ InputStretch = 0.01; // 1%
begin
Result := false;
@@ -592,7 +596,8 @@ begin
*)
// create the channel
- Handle := BASS_StreamCreate(Round(FormatInfo.SampleRate), 1, Flags, STREAMPROC_PUSH, nil);
+ Handle := BASS_StreamCreate(Round(FormatInfo.SampleRate * (1-InputStretch)),
+ 1, Flags, STREAMPROC_PUSH, nil);
// start the channel
BASS_ChannelPlay(Handle, true);