aboutsummaryrefslogtreecommitdiffstats
path: root/cmake/src/media/UAudioPlayback_Portaudio.pas
diff options
context:
space:
mode:
authortobigun <tobigun@b956fd51-792f-4845-bead-9b4dfca2ff2c>2010-05-23 09:07:15 +0000
committertobigun <tobigun@b956fd51-792f-4845-bead-9b4dfca2ff2c>2010-05-23 09:07:15 +0000
commit678cc132f942ff4d84a803550eedf96acc543bca (patch)
treeeb195abafaf69d55fa0f4b77323e517fcd2263cd /cmake/src/media/UAudioPlayback_Portaudio.pas
parent7e677fd5ebe60c3dd9df8954e1ed28c4afdf8660 (diff)
downloadusdx-678cc132f942ff4d84a803550eedf96acc543bca.tar.gz
usdx-678cc132f942ff4d84a803550eedf96acc543bca.tar.xz
usdx-678cc132f942ff4d84a803550eedf96acc543bca.zip
update to trunk rev. 2391
git-svn-id: svn://svn.code.sf.net/p/ultrastardx/svn/branches/experimental@2401 b956fd51-792f-4845-bead-9b4dfca2ff2c
Diffstat (limited to '')
-rw-r--r--cmake/src/media/UAudioPlayback_Portaudio.pas22
1 files changed, 11 insertions, 11 deletions
diff --git a/cmake/src/media/UAudioPlayback_Portaudio.pas b/cmake/src/media/UAudioPlayback_Portaudio.pas
index ddbd03d6..6fbae6e3 100644
--- a/cmake/src/media/UAudioPlayback_Portaudio.pas
+++ b/cmake/src/media/UAudioPlayback_Portaudio.pas
@@ -307,22 +307,16 @@ var
paApiIndex : TPaHostApiIndex;
paApiInfo : PPaHostApiInfo;
paOutDevice : TPaDeviceIndex;
- err: TPaError;
begin
Result := false;
-
AudioCore := TAudioCore_Portaudio.GetInstance();
// initialize portaudio
- err := Pa_Initialize();
- if(err <> paNoError) then
- begin
- Log.LogError(Pa_GetErrorText(err), 'TAudioInput_Portaudio.InitializeRecord');
+ if (not AudioCore.Initialize()) then
Exit;
- end;
paApiIndex := AudioCore.GetPreferredApiIndex();
- if(paApiIndex = -1) then
+ if (paApiIndex = -1) then
begin
Log.LogError('No working Audio-API found', 'TAudioPlayback_Portaudio.InitializeAudioPlaybackEngine');
Exit;
@@ -364,13 +358,19 @@ end;
procedure TAudioPlayback_Portaudio.StopAudioPlaybackEngine();
begin
if (paStream <> nil) then
- Pa_StopStream(paStream);
+ begin
+ Pa_CloseStream(paStream);
+ // wait until stream is closed, otherwise Terminate() might cause a segfault
+ while (Pa_IsStreamActive(paStream) = 1) do
+ ;
+ paStream := nil;
+ end;
end;
function TAudioPlayback_Portaudio.FinalizeAudioPlaybackEngine(): boolean;
begin
- Pa_Terminate();
- Result := true;
+ StopAudioPlaybackEngine();
+ Result := AudioCore.Terminate();
end;
function TAudioPlayback_Portaudio.GetLatency(): double;