Recent

Author Topic: ALSound  (Read 211 times)

Lulu

  • Full Member
  • ***
  • Posts: 170
ALSound
« on: September 01, 2022, 11:48:39 am »
Hello everyone, after spending (a lot of) time on OpenAL-Soft and LibSndFile, I married them and wrote ALSound an interface to ease playing, recording and mixing audio under FreePascal/Lazarus.

OpenAL-Soft is an improved software implementation of OpenAL, actively maintained by Christopher Robinson (https://github.com/kcat/openal-soft).
LibSndFile is a C library for reading and writing audio files (https://github.com/libsndfile/libsndfile).
You hardly have to know these libraries to use ALSound.

ALSound is also compatible with old version of OpenAL but advanced features may not work.

Tested under Linux and Windows, i386 and x86-64.
May work on other platforms with the appropriate compiled libraries.

Typical use

Code: Pascal  [Select][+][-]
  1. uses ..., ALSound;
  2.  
  3. var
  4.   FPlaybackContext: TALSPlaybackContext;
  5.   FSound: TALSSound;
  6. ...
  7.   FPlaybackContext := ALSManager.CreateDefaultPlaybackContext;
  8.   FSound := FPlaybackContext.AddStream( 'PathToMusic'+DirectorySeparator+'myMusic.ogg');
  9.   FSound.Loop := True;
  10.   FSound.Play;
  11. ...
  12.   FPlaybackContext.Free;


Code can be found at https://github.com/Lulu04/ALSound

Thanks to Fred van Stappen, the author of United OpenLib of Sound (UOS) (https://github.com/fredvs/uos) who wrote pascal binding for LibSndFile and PortAudio. This was a good example for me to write pascal binding for OpenAL-Soft and LibSndFile.
wishing you a nice life

 

TinyPortal © 2005-2018