Android Question Live wallpaper and sounds

FJS

Active Member
Licensed User
Longtime User
Please, I would like to know how to introduce sounds in my live wallpaper.

I tried the follow:

B4X:
Sub Process_Globals
    Dim sounds As SoundPool
    Dim sound1,sound2 As Int
      .......................
end sub

Sub Service_Create
        sounds.Initialize(1)
        sound1=sounds.Load(File.DirAssets, "prueba6.wma")
        sound2=sounds.Load(File.DirAssets, "prueba8.wma")
........................
end sub
Sub soundtouch
    sounds.Play(sound1,0.3,0.8,1,0,1.5)
end sub

But the sound doesnt work

(obviously I have the library audio 1.5)

However I tried a beeper as well and it works!!

Please, Could you help me??

Thank you in advance
 

FJS

Active Member
Licensed User
Longtime User
Check the unfiltered logs when you load the files. SoundPool doesn't support long MP3 files. Short ones should work.
You can use MediaPlayer for longer files.


The size is around 20kb, I think it is not too much

unfiltered logs: Receive BEATS_NATIVE_NOTIFICATION from Native AudioTrack!!!

Could you remond to me the best option to have sounds into a live wallpaper?, any library?

Best regards
 
Upvote 0

FJS

Active Member
Licensed User
Longtime User
It is not related to live wallpaper. SoundPool is limited to short playbacks. For longer playbacks you should use MediaPlayer.

ok, thank you.

I have just used with mediaplayer, but the result is the same
When sound1.isplaying = true I cant hear any sound :(
 
Last edited:
Upvote 0
Top