From 64e1acc9391e65b298f27ff0bdfa5f32128b94d1 Mon Sep 17 00:00:00 2001 From: tobigun Date: Mon, 27 Dec 2010 11:57:53 +0000 Subject: 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 --- src/media/UAudioPlayback_Bass.pas | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) (limited to 'src/media') 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); -- cgit v1.2.3