TMediaPlayer是否有替代品可用于多平台快速音效? [英] Is there an alternative to TMediaPlayer for multi platform rapid sound effects?

查看:114
本文介绍了TMediaPlayer是否有替代品可用于多平台快速音效?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在寻找一种方法,可以在开销少的多平台游戏(Android和Windows)中播放多种快速音效(WAV格式).

I am looking for a way to play multiple rapid sound effects (WAV format) in a multi-platform game (Android and Windows) with low overhead.

我尝试使用TMediaPlayer组件,但是创建多个实例会增加启动和关闭时间的开销.

I tried using the TMediaPlayer component, but creating multiple instances adds a lot of overhead to startup and shutdown times.

我研究并找到了此代码,它提供了一种开销低的方法.可悲的是,该代码与Android下的Delphi 10.2(Tokyo)不兼容(Windows可以正常工作).在Android下,永远不会触发onLoadComplete,从而导致GLoaded标志保持为false并冻结应用程序. http://www.fmxexpress.com/free-game-audio-manager-wrapper-class-in-delphi-xe6-firemonkey-for-android-ios-windows-and-osx/

I researched and found this code which offers a low-overhead approach. Sadly, the code is incompatible with Delphi 10.2 (Tokyo) under Android (windows works fine). Under Android, the onLoadComplete is never triggered, causing the GLoaded flag to remain false and the app to freeze. http://www.fmxexpress.com/free-game-audio-manager-wrapper-class-in-delphi-xe6-firemonkey-for-android-ios-windows-and-osx/

有人知道替代解决方案吗?还是可以理解为什么GameAudioManager回调函数无法触发?

Does anyone know of an alternative solution or can understand why the GameAudioManager callback function fails to trigger?

推荐答案

似乎有一个新版本的'GameAudioManager'单元(现在称为"AudioManager")与Delphi Tokyo上的Android兼容.我查看了代码,似乎只是删除了"onload"回调和已加载"检查循环.

It seems there's a newer version of the 'GameAudioManager' unit (now dubbed "AudioManager") that is compatible with Android on Delphi Tokyo. I reviewed the code and it seems to just remove the "onload" callback and 'loaded' check-loop.

这是更新的代码: https://github.com/Embarcadero/DelphiArcadeGames/blob/master/Full/AlienInvasion/AudioManager.pas

这篇关于TMediaPlayer是否有替代品可用于多平台快速音效?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆