anchor.diff:    TAdrSampleFormat = (
       Adr_SampleFormat_U8,
       Adr_SampleFormat_S16
  +  );
  +
  +  { TAdrFileFormat }
  +  TAdrFileFormat = (
  +    FF_AUTODETECT,
  +    FF_WAV,
  +    FF_OGG,
  +    FF_FLAC,
  +    FF_MP3,
  +    FF_MOD
     );
   
     { TAdrRefCounted  }
  
positive.code: 
  {**************************************************************************
   * Audiere Sound System                                                   *
   * Version 1.9.2                                                          *
   * (c) 2002 Chad Austin                                                   *
   *                                                                        *
   * This API uses principles explained at                                  *
   * http://aegisknight.org/cppinterface.html                               *
   *                                                                        *
   * This code licensed under the terms of the LGPL.  See license.txt.      *
   *------------------------------------------------------------------------*
   * Delphi conversion by:                                                  *
   * Jarrod Davis                                                           *
   * Jarrod Davis Software                                                  *
   * http://www.jarroddavis.com                                             *
   * support@jarroddavis.com                                                *
   **************************************************************************)
  
  {$Z4}
  
  unit Audiere;
  
  interface
  
  const
    DLL_NAME = 'audiere.dll';
  
  type
  
  
negative.code:   end;
  
  { --- Audiere Routines -------------------------------------------------- }
  {$IFNDEF DYNAMIC}
  function AdrGetVersion: PChar; stdcall; external DLL_NAME name '_AdrGetVersion@0';
  function AdrGetSupportedFileFormats: PChar; stdcall; external DLL_NAME name '_AdrGetSupportedFileFormats@0';
  function AdrGetSupportedAudioDevices: PChar; stdcall; external DLL_NAME name '_AdrGetSupportedAudioDevices@0';
  function AdrGetSampleSize(aFormat: TAdrSampleFormat): Integer; stdcall; external DLL_NAME name '_AdrGetSampleSize@4';
  function AdrOpenDevice(const aName: PChar; const aParams: PChar): TAdrAudioDevice; stdcall; external DLL_NAME name '_AdrOpenDevice@8';
  function AdrOpenSampleSource(const aFilename: PChar; aFileFormat: TAdrFileFormat): TAdrSampleSource; stdcall; external DLL_NAME name '_AdrOpenSampleSource@8';
  function AdrOpenSampleSourceFromFile(aFile: TAdrFile; aFileFormat: TAdrFileFormat): TAdrSampleSource; stdcall; external DLL_NAME name '_AdrOpenSampleSourceFromFile@8';
  function AdrCreateTone(aFrequency: Double): TAdrSampleSource; stdcall; external DLL_NAME name '_AdrCreateTone@8';
  function AdrCreateSquareWave(aFrequency: Double): TAdrSampleSource; stdcall; external DLL_NAME name '_AdrCreateSquareWave@8';
  function AdrCreateWhiteNoise: TAdrSampleSource; stdcall; external DLL_NAME name '_AdrCreateWhiteNoise@0';
  function AdrCreatePinkNoise: TAdrSampleSource; stdcall; external DLL_NAME name '_AdrCreatePinkNoise@0';
  function AdrOpenSound(aDevice: TAdrAudioDevice; aSource: TAdrSampleSource; aStreaming: LongBool): TAdrOutputStream; stdcall; external DLL_NAME name '_AdrOpenSound@12';
  function AdrCreateSampleBuffer(aSamples: Pointer; aFrameCount, aChannelCount, aSampleRate: Integer; aSampleFormat: TAdrSampleFormat): TAdrSampleBuffer; stdcall; external DLL_NAME name '_AdrCreateSampleBuffer@20';
  function AdrCreateSampleBufferFromSource(aSource: TAdrSampleSource): TAdrSampleBuffer; stdcall; external DLL_NAME name '_AdrCreateSampleBufferFromSource@4';
  function AdrOpenSoundEffect(aDevice: TAdrAudioDevice; aSource: TAdrSampleSource; aType: TAdrSoundEffectType): TAdrSoundEffect; stdcall; external DLL_NAME name '_AdrOpenSoundEffect@12';
  {$ENDIF}
  
  {$IFDEF DYNAMIC}
  var
    AdrGetVersion                  : function: PChar; stdcall = nil;
    AdrGetSupportedFileFormats     : function: PChar; stdcall = nil;
    AdrGetSupportedAudioDevices    : function : PChar; stdcall = nil;
    AdrGetSampleSize               : function(aFormat: TAdrSampleFormat): Integer; stdcall = nil;
    AdrOpenDevice                  : function(const aName: PChar; const aParams: PChar): TAdrAudioDevice; stdcall = nil;
    AdrOpenSampleSource            : function(const aFilename: PChar; aFileFormat: TAdrFileFormat): TAdrSampleSource; stdcall = nil;
    AdrOpenSampleSourceFromFile    : function(aFile: TAdrFile; aFileFormat: TAdrFileFormat): TAdrSampleSource; stdcall = nil;
    AdrCreateTone                  : function(aFrequency: Double): TAdrSampleSource; stdcall = nil;
    AdrCreateSquareWave            : function(aFrequency: Double): TAdrSampleSource; stdcall = nil;
    AdrCreateWhiteNoise            : function: TAdrSampleSource; stdcall = nil;
    AdrCreatePinkNoise             : function: TAdrSampleSource; stdcall = nil;
    AdrOpenSound                   : function(aDevice: TAdrAudioDevice; aSource: TAdrSampleSource; aStreaming: LongBool): TAdrOutputStream; stdcall = nil;
    AdrCreateSampleBuffer          : function(aSamples: Pointer; aFrameCount, aChannelCount, aSampleRate: Integer; aSampleFormat: TAdrSampleFormat): TAdrSampleBuffer; stdcall = nil;
    AdrCreateSampleBufferFromSource: function(aSource: TAdrSampleSource): TAdrSampleBuffer; stdcall = nil;
    AdrOpenSoundEffect             : function(aDevice: TAdrAudioDevice; aSource: TAdrSampleSource; aType: TAdrSoundEffectType): TAdrSoundEffect; stdcall = nil;
  
  function AdrLoadDLL: Boolean; stdcall;
  procedure AdrUnloadDLL; stdcall;
  {$ENDIF}
  
  implementation
  
  {$IFDEF DYNAMIC}
  uses
    Windows;
  
  var
    AdrDLL: HMODULE = 0;
  
  function AdrLoadDLL: Boolean;
  begin
    Result := False;
  
    AdrDLL := LoadLibrary('audiere.dll');
    if(AdrDLL = 0) then
    begin
      Exit;
    end;
  
    @AdrGetVersion                   := GetProcAddress(AdrDLL, '_AdrGetVersion@0');
    @AdrGetSupportedFileFormats      := GetProcAddress(AdrDLL, '_AdrGetSupportedFileFormats@0');
    @AdrGetSupportedAudioDevices     := GetProcAddress(AdrDLL, '_AdrGetSupportedAudioDevices@0');
    @AdrGetSampleSize                := GetProcAddress(AdrDLL, '_AdrGetSampleSize@4');
    @AdrOpenDevice                   := GetProcAddress(AdrDLL, '_AdrOpenDevice@8');
    @AdrOpenSampleSource             := GetProcAddress(AdrDLL, '_AdrOpenSampleSource@8');
    @AdrOpenSampleSourceFromFile     := GetProcAddress(AdrDLL, '_AdrOpenSampleSourceFromFile@8');
    @AdrCreateTone                   := GetProcAddress(AdrDLL, '_AdrCreateTone@8');
    @AdrCreateSquareWave             := GetProcAddress(AdrDLL, '_AdrCreateSquareWave@8');
    @AdrCreateWhiteNoise             := GetProcAddress(AdrDLL, '_AdrCreateWhiteNoise@0');
    @AdrCreatePinkNoise              := GetProcAddress(AdrDLL, '_AdrCreatePinkNoise@0');
    @AdrOpenSound                    := GetProcAddress(AdrDLL, '_AdrOpenSound@12');
    @AdrCreateSampleBuffer           := GetProcAddress(AdrDLL, '_AdrCreateSampleBuffer@20');
    @AdrCreateSampleBufferFromSource := GetProcAddress(AdrDLL, '_AdrCreateSampleBufferFromSource@4');
    @AdrOpenSoundEffect              := GetProcAddress(AdrDLL, '_AdrOpenSoundEffect@12');
  
    if not Assigned(AdrGetVersion) then Exit;
    if not Assigned(AdrGetSupportedFileFormats) then Exit;
    if not Assigned(AdrGetSupportedAudioDevices) then Exit;
    if not Assigned(AdrGetSampleSize) then Exit;
    if not Assigned(AdrOpenDevice) then Exit;
    if not Assigned(AdrOpenSampleSource) then Exit;
    if not Assigned(AdrOpenSampleSourceFromFile) then Exit;
    if not Assigned(AdrCreateTone) then Exit;
    if not Assigned(AdrCreateSquareWave) then Exit;
    if not Assigned(AdrCreateWhiteNoise) then Exit;
    if not Assigned(AdrCreatePinkNoise) then Exit;
    if not Assigned(AdrOpenSound) then Exit;
    if not Assigned(AdrCreateSampleBuffer) then Exit;
    if not Assigned(AdrCreateSampleBufferFromSource) then Exit;
    if not Assigned(AdrOpenSoundEffect) then Exit;
  
    Result := True;
  end;
  
  procedure AdrUnloadDLL;
  begin
    if AdrDLL <> 0 then
    begin
      FreeLibrary(AdrDLL);
      AdrDLL := 0;
    end;
  end;
  
  initialization
  begin
  end;
  
  finalization
  begin
    AdrUnLoadDLL;
  end;
  
  {$ENDIF}
  
  end.
  