LibGDX声音和音乐类型之间有什么区别? [英] What's the difference between LibGDX Sound and Music types?

查看:95
本文介绍了LibGDX声音和音乐类型之间有什么区别?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

LibGDX中的声音和音乐类型有什么区别?这在台式机和Android上均有效:

What is difference between Sound and Music types in LibGDX? This worked both on desktop and Android:

Music gameMusic = Gdx.audio.newMusic(Gdx.files.internal("sound/gamemusic.mp3"));
gameMusic.play();:

Sound gameMusic = Gdx.audio.newSound(Gdx.files.internal("sound/gamemusic.mp3"));
gameMusic.play();

推荐答案

音乐流传输,而声音加载到内存中. (由于带有libgdx的Android的声音"文件限制为1mb,因此音乐的大小可能会更大)

Music is streamed, while Sound is loaded into memory. (Because Android with libgdx has limit of 1mb file for 'sound', Music can be of greater size)

在这里是这样说的:

https://github.com/libgdx/libgdx/wiki/声音效果

https://github.com/libgdx/libgdx/wiki/Streaming-music

根据关于SO的另一个问题,您必须等待一帧,然后才能在加载后直接播放声音: 使用Libgdx的Android应用程序中没有声音

And according to another question on SO, you must wait a frame before you can play a Sound directly after loading: No Sound in Android Application with Libgdx

这篇关于LibGDX声音和音乐类型之间有什么区别?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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