+1 vote

Hi
I am working on a simple game with a background music (an OGG file) which works great on Windows and worked well on android devices too until some day it just stopped playing the background music (other sounds still working ok)
I tried to look at the logcat but I can't point to the problem.. here's the log:

...
...
08-04 19:24:19.921: I/godot(4665): S3TC: 0 ATITC: 1
08-04 19:24:20.007: I/godot(4665): OpenSL Init OK!
08-04 19:24:20.029: W/AudioTrack(4665): AUDIO_OUTPUT_FLAG_FAST denied by client; transfer 1, track 44100 Hz, output 48000 Hz
08-04 19:24:22.303: I/godot(4665): MAGIC: 1128612935
08-04 19:24:22.303: I/godot(4665): MODE: 1
08-04 19:24:22.305: I/godot(4665): [1;31mERROR: set_file: [0m[1mCondition ' err ' is true. returned: err
08-04 19:24:22.305: I/godot(4665): [0;31m   At: drivers/vorbis/audio_stream_ogg_vorbis.cpp:265.[0m
08-04 19:24:22.305: I/godot(4665): [1;31mERROR: setup: [0m[1mCondition ' p_channels!=1 && p_channels!=2 && p_channels!=4 && p_channels!=6 ' is true. returned: ERR_INVALID_PARAMETER
08-04 19:24:22.305: I/godot(4665): [0;31m   At: servers/audio/audio_rb_resampler.cpp:268.[0m
08-04 19:24:22.305: I/godot(4665): [1;31mERROR: _load_stream: [0m[1mCondition ' !stream_valid ' is true. returned: ERR_UNCONFIGURED
08-04 19:24:22.305: I/godot(4665): [0;31m   At: drivers/vorbis/audio_stream_ogg_vorbis.cpp:304.[0m
08-04 19:24:22.305: I/godot(4665): MAGIC: 1128612935
08-04 19:24:22.306: I/godot(4665): MODE: 1
08-04 19:24:24.664: I/godot(4665): MAGIC: 1128612935
08-04 19:24:24.664: I/godot(4665): MODE: 1
08-04 19:24:41.481: I/godot(4665): MAGIC: 1128612935
08-04 19:24:41.481: I/godot(4665): MODE: 1
08-04 19:25:38.099: I/godot(4665): BACK PRESSED

What I'm doing is loading a StreamPlayer instance and an instance of my music resource
Then playing it after my global.gd (autoload) script done loading
as shown here:

extends Node

... other stuff here ...

var music_player = StreamPlayer.new()
var music = ResourceLoader.load("res://assets/mfx/main_loop.ogg")

... other stuff here ...

func _ready():
    ... other stuff here ...
    play_music()

... other stuff here ...

func play_music():
    music.set_path("main_loop")
    music_player.set_stream(music)
    music_player.set_volume(.4)
    music_player.set_loop(true)
    music_player.play()

Am I doing something wrong?

EDIT:
I also tried to create a singleton AutoLoad StreamPlayer based scene to play my bg music exactly as shown here:
http://fede0d.github.io/blog/2015/10/18/tutorial-singleton-music.html
Same results. on Windows runs perfect. Android WON'T play any music!
I also tried changing the audio channels with Auditor but it's matter not..
Changing to another audio file doesn't matter too.

Another edit:
It seems that every export cause loosing background music even when exporting to Windows
The only way it works is when I test it on Windows

in Engine by (43 points)
edited by

1 Answer

+1 vote
Best answer

The problem occurs when exporting. it didn't export "by dependency" like it was intended and I had to include the ogg\wav file in the export (resources page when exporting)
The whole time it was exported without those files so the background music file was missing therefore there's nothing to play.. I wish there were a feature warning you when there's a file necessary not being exported.

by (43 points)
Welcome to Godot Engine Q&A, where you can ask questions and receive answers from other members of the community.

Please make sure to read How to use this Q&A? before posting your first questions.
Social login is currently unavailable. If you've previously logged in with a Facebook or GitHub account, use the I forgot my password link in the login box to set a password for your account. If you still can't access your account, send an email to webmaster@godotengine.org with your username.