From 8cbb63b81afcd172697a65dc43871631e0c073ca Mon Sep 17 00:00:00 2001 From: tobigun Date: Wed, 5 Dec 2007 20:15:27 +0000 Subject: Added {$PACKRECORDS C} for correct structure alignment in Windows/Linux. Some cleanup done. git-svn-id: svn://svn.code.sf.net/p/ultrastardx/svn/trunk@661 b956fd51-792f-4845-bead-9b4dfca2ff2c --- Game/Code/lib/portmixer/delphi/portmixer.pas | 268 ++++++++++++++------------- 1 file changed, 136 insertions(+), 132 deletions(-) (limited to 'Game/Code/lib/portmixer') diff --git a/Game/Code/lib/portmixer/delphi/portmixer.pas b/Game/Code/lib/portmixer/delphi/portmixer.pas index f5854bb2..a9e27516 100644 --- a/Game/Code/lib/portmixer/delphi/portmixer.pas +++ b/Game/Code/lib/portmixer/delphi/portmixer.pas @@ -1,52 +1,56 @@ -{* - * PortMixer - * PortMixer API Header File - * - * Copyright (c) 2002, 2006 - * - * Written by Dominic Mazzoni - * and Leland Lucius - * - * PortMixer is intended to work side-by-side with PortAudio, - * the Portable Real-Time Audio Library by Ross Bencina and - * Phil Burk. - * - * Permission is hereby granted, free of charge, to any person obtaining - * a copy of this software and associated documentation files - * (the "Software"), to deal in the Software without restriction, - * including without limitation the rights to use, copy, modify, merge, - * publish, distribute, sublicense, and/or sell copies of the Software, - * and to permit persons to whom the Software is furnished to do so, - * subject to the following conditions: - * - * The above copyright notice and this permission notice shall be - * included in all copies or substantial portions of the Software. - * - * Any person wishing to distribute modifications to the Software is - * requested to send the modifications to the original developer so that - * they can be incorporated into the canonical version. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, - * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF - * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. - * IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR - * ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF - * CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION - * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. - * - *} -unit portmixer; - -interface - -{$IFDEF FPC} - {$MODE DELPHI} +{* + * PortMixer + * PortMixer API Header File + * + * Copyright (c) 2002, 2006 + * + * Written by Dominic Mazzoni + * and Leland Lucius + * + * PortMixer is intended to work side-by-side with PortAudio, + * the Portable Real-Time Audio Library by Ross Bencina and + * Phil Burk. + * + * Permission is hereby granted, free of charge, to any person obtaining + * a copy of this software and associated documentation files + * (the "Software"), to deal in the Software without restriction, + * including without limitation the rights to use, copy, modify, merge, + * publish, distribute, sublicense, and/or sell copies of the Software, + * and to permit persons to whom the Software is furnished to do so, + * subject to the following conditions: + * + * The above copyright notice and this permission notice shall be + * included in all copies or substantial portions of the Software. + * + * Any person wishing to distribute modifications to the Software is + * requested to send the modifications to the original developer so that + * they can be incorporated into the canonical version. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, + * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF + * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. + * IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR + * ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF + * CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION + * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + * + *} +unit portmixer; + +{$IFDEF FPC} + {$IFNDEF win32} + {$LINKLIB libportaudio} + {$ENDIF} + {$PACKRECORDS C} (* GCC/Visual C/C++ compatible record packing *) + {$MODE DELPHI } {$ENDIF} - -uses - portaudio; - -const + +interface + +uses + portaudio; + +const {$IFDEF WIN32} LibName = 'portmixer.dll'; {$ENDIF} @@ -56,93 +60,93 @@ const {$IFDEF MACOS} LibName = 'libportmixer.dylib'; {$ENDIF} - -type - PPxMixer = Pointer; - TPxVolume = Single; {* 0.0 (min) --> 1.0 (max) *} - TPxBalance = Single; {* -1.0 (left) --> 1.0 (right) *} - -{* - Px_OpenMixer() returns a mixer which will work with the given PortAudio - audio device. Pass 0 as the index for the first (default) mixer. -*} - -function Px_OpenMixer( pa_stream: Pointer; i: Integer ): PPxMixer; cdecl ; external LibName; - -{* - Px_CloseMixer() closes a mixer opened using Px_OpenMixer and frees any - memory associated with it. -*} - -procedure Px_CloseMixer( mixer: PPxMixer ); cdecl ; external LibName; - -{* - Px_GetNumMixers returns the number of mixers which could be + +type + PPxMixer = Pointer; + TPxVolume = Single; {* 0.0 (min) --> 1.0 (max) *} + TPxBalance = Single; {* -1.0 (left) --> 1.0 (right) *} + +{* + Px_OpenMixer() returns a mixer which will work with the given PortAudio + audio device. Pass 0 as the index for the first (default) mixer. +*} + +function Px_OpenMixer( pa_stream: Pointer; i: Integer ): PPxMixer; cdecl; external LibName; + +{* + Px_CloseMixer() closes a mixer opened using Px_OpenMixer and frees any + memory associated with it. +*} + +procedure Px_CloseMixer( mixer: PPxMixer ); cdecl; external LibName; + +{* + Px_GetNumMixers returns the number of mixers which could be used with the given PortAudio device. On most systems, there will be only one mixer for each device; however there may be multiple mixers for each device, or possibly multiple mixers which are independent of any particular PortAudio device. *} -function Px_GetNumMixers( mixer: PPxMixer ): Integer; cdecl ; external LibName; -function Px_GetMixerName( mixer: PPxMixer; i: Integer ): PChar; cdecl ; external LibName; - -{* - Master (output) volume -*} - -function Px_GetMasterVolume( mixer: PPxMixer ): TPxVolume; cdecl ; external LibName; -procedure Px_SetMasterVolume( mixer: PPxMixer; volume: TPxVolume ); cdecl ; external LibName; - -{* - Main output volume -*} - -function Px_GetPCMOutputVolume( mixer: PPxMixer ): TPxVolume; cdecl ; external LibName; -procedure Px_SetPCMOutputVolume( mixer: PPxMixer; volume: TPxVolume ); cdecl ; external LibName; -function Px_SupportsPCMOutputVolume( mixer: PPxMixer ): Integer; cdecl ; external LibName; - -{* - All output volumes -*} - -function Px_GetNumOutputVolumes( mixer: PPxMixer ): Integer; cdecl ; external LibName; -function Px_GetOutputVolumeName( mixer: PPxMixer; i: Integer ): PChar; cdecl ; external LibName; -function Px_GetOutputVolume( mixer: PPxMixer; i: Integer ): TPxVolume; cdecl ; external LibName; -procedure Px_SetOutputVolume( mixer: PPxMixer; i: Integer; volume: TPxVolume ); cdecl ; external LibName; - -{* - Input source -*} - -function Px_GetNumInputSources( mixer: PPxMixer ): Integer; cdecl ; external LibName; -function Px_GetInputSourceName( mixer: PPxMixer; i: Integer): PChar; cdecl ; external LibName; -function Px_GetCurrentInputSource( mixer: PPxMixer ): Integer; cdecl ; external LibName; {* may return -1 == none *} -procedure Px_SetCurrentInputSource( mixer: PPxMixer; i: Integer ); cdecl ; external LibName; - -{* - Input volume -*} - -function Px_GetInputVolume( mixer: PPxMixer ): TPxVolume; cdecl ; external LibName; -procedure Px_SetInputVolume( mixer: PPxMixer; volume: TPxVolume ); cdecl ; external LibName; - -{* - Balance -*} - -function Px_SupportsOutputBalance( mixer: PPxMixer ): Integer; cdecl ; external LibName; -function Px_GetOutputBalance( mixer: PPxMixer ): TPxBalance; cdecl ; external LibName; -procedure Px_SetOutputBalance( mixer: PPxMixer; balance: TPxBalance ); cdecl ; external LibName; - -{* - Playthrough -*} - -function Px_SupportsPlaythrough( mixer: PPxMixer ): Integer; cdecl ; external LibName; -function Px_GetPlaythrough( mixer: PPxMixer ): TPxVolume; cdecl ; external LibName; -procedure Px_SetPlaythrough( mixer: PPxMixer; volume: TPxVolume ); cdecl ; external LibName; - -implementation - -end. +function Px_GetNumMixers( mixer: PPxMixer ): Integer; cdecl; external LibName; +function Px_GetMixerName( mixer: PPxMixer; i: Integer ): PChar; cdecl; external LibName; + +{* + Master (output) volume +*} + +function Px_GetMasterVolume( mixer: PPxMixer ): TPxVolume; cdecl; external LibName; +procedure Px_SetMasterVolume( mixer: PPxMixer; volume: TPxVolume ); cdecl; external LibName; + +{* + Main output volume +*} + +function Px_GetPCMOutputVolume( mixer: PPxMixer ): TPxVolume; cdecl; external LibName; +procedure Px_SetPCMOutputVolume( mixer: PPxMixer; volume: TPxVolume ); cdecl; external LibName; +function Px_SupportsPCMOutputVolume( mixer: PPxMixer ): Integer; cdecl; external LibName; + +{* + All output volumes +*} + +function Px_GetNumOutputVolumes( mixer: PPxMixer ): Integer; cdecl; external LibName; +function Px_GetOutputVolumeName( mixer: PPxMixer; i: Integer ): PChar; cdecl; external LibName; +function Px_GetOutputVolume( mixer: PPxMixer; i: Integer ): TPxVolume; cdecl; external LibName; +procedure Px_SetOutputVolume( mixer: PPxMixer; i: Integer; volume: TPxVolume ); cdecl; external LibName; + +{* + Input source +*} + +function Px_GetNumInputSources( mixer: PPxMixer ): Integer; cdecl; external LibName; +function Px_GetInputSourceName( mixer: PPxMixer; i: Integer): PChar; cdecl; external LibName; +function Px_GetCurrentInputSource( mixer: PPxMixer ): Integer; cdecl; external LibName; {* may return -1 == none *} +procedure Px_SetCurrentInputSource( mixer: PPxMixer; i: Integer ); cdecl; external LibName; + +{* + Input volume +*} + +function Px_GetInputVolume( mixer: PPxMixer ): TPxVolume; cdecl; external LibName; +procedure Px_SetInputVolume( mixer: PPxMixer; volume: TPxVolume ); cdecl; external LibName; + +{* + Balance +*} + +function Px_SupportsOutputBalance( mixer: PPxMixer ): Integer; cdecl; external LibName; +function Px_GetOutputBalance( mixer: PPxMixer ): TPxBalance; cdecl; external LibName; +procedure Px_SetOutputBalance( mixer: PPxMixer; balance: TPxBalance ); cdecl; external LibName; + +{* + Playthrough +*} + +function Px_SupportsPlaythrough( mixer: PPxMixer ): Integer; cdecl; external LibName; +function Px_GetPlaythrough( mixer: PPxMixer ): TPxVolume; cdecl; external LibName; +procedure Px_SetPlaythrough( mixer: PPxMixer; volume: TPxVolume ); cdecl; external LibName; + +implementation + +end. -- cgit v1.2.3