Free Game Audio Manager Wrapper Class In Delphi XE6 Firemonkey For Android, IOS, Windows, and OSX

Delphi XE6 Firemonkey Audio Manager ClassIf you want to be able to play multiple simultaneous audio files across all platforms in Delphi XE6 Firemonkey you should check out this TGameAudioManager class. I had it built by a professional developer through oDesk and it is architected for playing lots of short sound files (like game sound effects) in Firemonkey. I had need of this class when I was building the Flappy Bird clone and finally got around to having it built. It uses the native sound API from each of the supported platforms which are Windows, Android, IOS, and OSX. The least amount of testing has been done on the OSX implementation but overall it feels pretty solid. For music (long running audio files) you should stick with the built in TMediaPlayer component. The TGameAudioManager class is built so that you pre-register the sounds that you are going to play with AddSound() and then you play them with PlaySound(). It is written in Object Pascal and should also compile in AppMethod (and probably Delphi XE5) without much trouble. There is a mobile and a desktop demo included in the archive. Here is the class type information:

Download TGameAudioManager, the free audio manager wrapper class in Delphi XE6 Firemonkey for Android, IOS, Windows, and OSX.

Have Delphi Firemonkey questions? Ask and get answers on StackOverflow.

8 Responses to Free Game Audio Manager Wrapper Class In Delphi XE6 Firemonkey For Android, IOS, Windows, and OSX

  1. Pingback: Generate Sound Effects For Your Android And IOS Delphi XE7 Firemonkey Games And Apps | Delphi XE5 XE6 XE7 Firemonkey, Delphi Android, Delphi IOS

  2. Pingback: Code Snippet To Play Sounds With Delphi XE7 Firemonkey On Windows and Mac OSX | Delphi XE5 XE6 XE7 Firemonkey, Delphi Android, Delphi IOS

  3. Pingback: Delphi Pac-Man Hilfe - Seite 8 - Delphi-PRAXiS

  4. Pingback: FireMonkey: kein .wav wie in VCL - Delphi-PRAXiS

  5. Pingback: Cool App Contender: SUMOTORI DE CHU | The Podcast at

  6. Gil says:

    A procedure to play audio from resources in windows could be a nice addition to this class:

    procedure TGameAudioManager.PlayRCSound(AIndex: integer);
    wRec: PSoundRec;
    if AIndex < fSoundsList.Count then
    wRec := fSoundsList[AIndex];
    MMSystem.PlaySound(Pchar(wRec.SFilename), hInstance, SND_RESOURCE or SND_ASYNC);
    On E:Exception do
    Raise Exception.create('[Unknown Name] : '+E.message);

  7. Yaron says:

    Sadly, this code is incompatible with Delphi 10.2 (Tokyo) at least under Android (windows works fine), the onLoadComplete is never triggered for Android, causing GLoaded to remain false and the app to freeze.

    If anyone has a fix for this, I would appreciate it.

    • Dave says:

      I think I managed to solve the problem in Android. You need to change the code en the assignment of the listener. They are assigning a type not an instance.
      Find this code:

      wOnAndroidSndComplete := TJSoundPool_OnLoadCompleteListener.Wrap((TOnSpoolLoadCallBack.Create as ILocalObject).GetObjectID);

      and use something like this:

      OnSpoolLoadCallBack : TOnSpoolLoadCallBack;

      OnSpoolLoadCallBack := TOnSpoolLoadCallBack.Create;
      wOnAndroidSndComplete := TJSoundPool_OnLoadCompleteListener.Wrap(
      (OnSpoolLoadCallBack as ILocalObject).GetObjectID);

      also change
      GLoaded := False;
      GLoaded := Not False;

      It avoid the wait loop. I know is not the best solution but it work for me this way.

      I also moved the ding?.wav files to another location in my phone and modified the path in UNIT8 just in case that the demo folder is locked or whatever.

      The sample will work and you will have sound.

Leave a Reply

Show Buttons
Hide Buttons
Read previous post:
Build A Custom Button Using TRectangle In Delphi XE6 Firemonkey On Android And IOS

Developer Antonio Estevez has some sample source code for implementing a TRectangle component as a button in Delphi XE6 Firemonkey...