I have 2 devices, a Nexus4 phone (android 5.0.1), and a Nexus7 tablet (android 5.1)
I have only been testing device playback on my Nexus7. Until today things were going fine and then when I added music I noticed that the music would play once, but not repeat. I thought this was odd because in the local player the music does repeat.
So I updated (dunno what I was using) to Gideros 2015.04.08 and now things have turned to total custard!
When the player starts on the Nexus7 the screen is white, there is no information on the ip, version, or anything else. When the app plays the display turns black and there are no graphics. I know the app is running because the music plays, but of course it does not repeat!
So, I installed the player on my Nexus4 and tested with that. The graphic issues are exactly the same, no damn grahics. However the music does repeat on the Nexus4.
I am totally confused and mildly annoyed because now I cannot test my app on either device. I am more annoyed because the app requires multi-touch which I can't do in the local simulator.
Can anyone assist me in getting the player to again work on my devices? And also I need some help with getting the music to repeat on the Nexus7.
are there some specific settings I need to change somewhere?
Comments
@ar2rsawseen has the fix and should (hopefully) be making a new version tomorrow (Sunday).
The simulator does multi-touch btw, I've tested it on two Windows multitouch screens.
Use something like this type of routine to play the music with repeat (on some tablet/tune combinations the repeat flag doesn't work).
music=Sound.new("themetune.mp3")
function restartMusic()
playingMusic:removeEventListener(Event.COMPLETE,restartMusic)
playingMusic=music:play()
if playingMusic then
playingMusic:addEventListener(Event.COMPLETE,restartMusic)
end
end
playingMusic=music:play()
if playingMusic then
playingMusic:addEventListener(Event.COMPLETE,restartMusic)
end
Likes: antix, Zizanyman
https://deluxepixel.com
I still have the issue where there are no graphics on my devices
Likes: antix
https://deluxepixel.com
Damn, now I'll have to kludge in that music code for now I suppose. Will that be resolved in an upcomming patch too?
Oh well I suppose I can do some gardening today instead of programming
Likes: antix
if position==endOfSongPosition then
position=startPosition
end
But in C of course!
When maybe the position pointer sometimes stops just after or just before the end of the song, so maybe that code could be changed to:
if position>=endOfSongPosition-1 then
position=startPosition
end
You see?
Something is odd or different somewhere though because the COMPLETE event fires!
Maybe you should joing GitHub and mark it as a bug ?
Likes: antix
https://deluxepixel.com
@hgy29 Heheh, no worries. I will downgrade tomorrow and see what happens. The weather was not good for gardening today so I spent a lot of time optimizing my texture atlas and writing down ideas for future games
Likes: hgy29
Likes: SinisterSoft
https://deluxepixel.com
Likes: antix
https://deluxepixel.com
Here is some benchmarks for standard Lua vs LuaJIT
http://luajit.org/performance_arm.html
https://deluxepixel.com
Likes: SinisterSoft
Music = Core.class()
function Music:restartMusic()
self.playingMusic:removeEventListener(Event.COMPLETE,self.restartMusic)
self.playingMusic = self.optionsTheme:play()
if self.playingMusic then
self.playingMusic:addEventListener(Event.COMPLETE,self.restartMusic)
end
end
function Music:init()
self.startTheme = Sound.new("sounds/start.mp3")
self.optionsTheme = Sound.new("sounds/options.mp3")
self.highscoreTheme = Sound.new("sounds/highscore.mp3")
self.gameTheme = Sound.new("sounds/game.mp3")
end
function Music:on(theme)
if not self.playingMusic then
if theme == "start" then
self.playingMusic = self.startTheme:play(0)
self.playingMusic:setVolume(0.5)
elseif theme == "options" then
self.playingMusic = optionsTheme:play(0)
self.playingMusic:setVolume(0.5)
elseif theme == "game" then
self.playingMusic = self.gameTheme:play(0)
self.playingMusic:setVolume(0.10)
elseif theme == "highscore" then
self.playingMusic = self.highscoreTheme:play(0)
self.playingMusic:setVolume(0.5)
end
self.playingMusic:addEventListener(Event.COMPLETE,self.restartMusic)
end
end
function Music:off()
if self.playingMusic then
self.playingMusic:stop()
self.playingMusic = nil
end
end
Maybe that is why it is also not looping the standard way.
What type of file are you using?
How many files are you playing?
Once a sound has completed playing or stopped - isn't it's sound channel automatically free?
@antix maybe when you call Music:off() and set self.playingMusic to nil then completed event still fires afterwards? If it does then self.playingMusic would be nil at that point?
https://deluxepixel.com
Also the latency is pretty big. Was there talk once of moving to another lib on Android with a lot less latency?
https://deluxepixel.com
https://deluxepixel.com
http://java.dzone.com/articles/playing-sounds-android
http://developer.android.com/reference/android/media/SoundPool.html
https://deluxepixel.com
https://deluxepixel.com
@SinisterSoft - Yep maybe that could happen but I am not calling Music:off at all with my tests. The app loads, and starts the options music, then it tries to restart the options music once it ends and gets the nil error.
Since (I think) I'm only ever using one channel I can't see how it becomes nil
Unless.. whenever Sound.new is called it is allocating a channel?
loadedDound:play() -- that should be allocating the channel
Likes: antix
https://deluxepixel.com
If you check the same game from the book - Mashballs
Does it happen on your device that the music looping stops?
On the Nexus 4 it works without any issues.
I am feeling more and more that this is an issue with the Nexus 7?