zheng.guan Posted October 29, 2014 Share Posted October 29, 2014 Hi, I use the AmbientSource Class to play an audio. It can play normally. But the console shows an error -- "OpenAL error: invalid value". I use the SoundSource Class instead. It wouldn't show that again. Thank you~ Link to comment
unclebob Posted October 29, 2014 Share Posted October 29, 2014 Hey, It may depend on many factors starting from hardware and ending with a lot of sounds playing at the same time at the same spot. So it will be much more productive if you show how you're using AmbineSource instances. Thank you! Link to comment
zheng.guan Posted October 30, 2014 Author Share Posted October 30, 2014 Hi, AmbientSource backgroundMusic; engine.sound.setEnabled (1) ; backgroundMusic = new AmbientSource("static_mono_02.oga",0); backgroundMusic.setLoop(2); backgroundMusic.play(); I used AmbientSource Class in the above way. I wondered if my wave files bring the error? I used the Adobe Audition to make audio by myself. At first, all the audio made by myself using Audition couldn't be heard any sound while playing. Finally I find a software to exchange my audio, it may cause wastage to wave files. Is Unigine has its own limit about audio files. Thank you ~^ ^~ Link to comment
unclebob Posted October 30, 2014 Share Posted October 30, 2014 Could you please make a test scene so we can reproduce that on our side? For large files it's better to use streaming feature (just pass "1" after file name in AmbientSource constructor). How big is your audio? Link to comment
zheng.guan Posted October 31, 2014 Author Share Posted October 31, 2014 Hi, Could you please make a test scene so we can reproduce that on our side? For large files it's better to use streaming feature (just pass "1" after file name in AmbientSource constructor). How big is your audio? It is solved by using streaming feature. Thank you very much. But my audio isn't large enough. It is just 11 Kb. And it wouldn't be more than 60Mb. I just write these codes: #include <core/unigine.h> AmbientSource backgroundMusic; int init() { PlayerSpectator camera = new PlayerSpectator(); camera.setPosition(Vec3(2.0f,0.0f,1.5f)); camera.setDirection(Vec3(-1.0f,0.0f,-0.5f)); engine.game.setPlayer(camera); engine.sound.setEnabled (1) ; backgroundMusic = new AmbientSource("miiix.oga",1); backgroundMusic.setLoop(2); backgroundMusic.play(); return 1; } int shutdown() { return 1; } int update() { return 1; } :) Thanks a lot~ Link to comment
unclebob Posted October 31, 2014 Share Posted October 31, 2014 You're welcome! For small files I also recommend you to use raw .wav files instead of compressed .oga, without streaming feature enabled. For large files (>= 2-5 MB) it's better to use compressed .oga format and enabled streaming. Link to comment
Recommended Posts