使用 Libgdx 在 Android 应用程序中没有声音 [英] No Sound in Android Application with Libgdx

查看:15
本文介绍了使用 Libgdx 在 Android 应用程序中没有声音的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在使用 Libgdx 创建一个 Android 应用程序.如果我在桌面版本和模拟器上运行程序,声音效果很好.

I am creating an Android App with Libgdx. The sound works pretty well, if I run the program in the desktop-version and on the emulator as well.

当我在我的 Android 手机 (Galaxy S3) 上测试应用程序时,没有声音.除了完全丢失的声音之外,其他一切在我的设备上都运行良好.有谁知道这里可能是什么问题?

When I am testing the application on my android phone (Galaxy S3) there is no sound. Everything else works pretty fine on my device except the sound which is completely is missing. Do anyone know what the issue here could be?

向我索要代码或日志,我想为您发布!

Ask me for code or logs I’d like to post it for you!

问候

以下示例显示了我播放声音的方式:

The following example shows the way i play the sound:

import com.badlogic.gdx.audio.Sound;

public class LevelDesigner {

    public LevelDesigner() {

    Sound mp3Sound = Gdx.audio.newSound(Gdx.files.internal("data/sounds/sound.mp3"));
    mp3Sound.loop();
    }
}

推荐答案

有时声音在加载时播放的帧不同,请尝试等待一帧.或者在另一个班级玩.

Sometimes the sound doesn't play the same frame it was loaded, try waiting one frame. Or playing it in another class.

参考:加载后声音不播放

这篇关于使用 Libgdx 在 Android 应用程序中没有声音的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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