Just a quick question on SoundChannels. I don't see any built in way to check if a SoundChannel is still playing, so are SoundChannels just destroyed once they've finished playing whatever it is they're playing?
Hi @Mells - that's interesting as there's nothing in the api documentation about pausing. You can certainly get and set the sound volume on a channel. The only way I can think of doing it is to use SoundChannel:getPosition() then stop and destroy the channel when you pause, then on resume trigger the sound to play again but specify the start sound in Sound:play(startTime,loops).
I'll be honest, the audio API as it stands really does seem to be lacking. I know it's on one of the roadmap lists to improve it and I can't wait to see what @atilim does because currently it's bare-bones at best.
I'm having to write an audio manager just to try and facilitate some pretty basic functionality, with a hodge-podge of the limited facilities we have currently.
@moopf I came to the same conclusion as yours. What you suggested, also mentioned by @OZApps, is the only way that I know of. That's why I am intrigued to know if Arturs knows a better way.
@Mells, no, don't know better way, but actually thats a great idea to implement into GiderosCodingEasy. I'll need to experiment more on what happens to SoundChannel
Right well I kind of have the basics of my audio manager done. I've implemented music fading (using GTween to tween volume after a creating a setter and getter - @ar2rsawseen I think I originally saw that from you, thanks) so when a new track is provided the current one is faded out.
But, even when it's faded out there's audio glitches when the track changes - sometimes it's just a click, sometimes it's actually the previous music playing briefly for half a second or so before going to the next track. This is on an iPhone 4S.
Well I've kind of limited the issue by introducing a "fake" tween at the end of the volume fade tween that gives a 1 second gap between stopping the channel that the music is playing on and starting a new one playing. I guess things just need to catch up in the background. Although it still occasionally plays the last track at full volume for a split second before starting the track it should be. That, again, seems like an mp3 buffer still being full somewhere - whether that's Gideros or iOS I don't know. Will try on Android later and cry
Well I've kind of limited the issue by introducing a "fake" tween at the end of the volume fade tween that gives a 1 second gap between stopping the channel that the music is playing on and starting a new one playing.
Just wondering, why don't you use a delay (in seconds, not ms) to achieve that?
Hi @Mells - I'm just trying rough code at the moment to locate the issue - you're right, that can also be done how you suggest. But I think @atilim needs to weigh in on this when he's back of holidays.
Comments
On feb 29 I hope it helps.
Seek current position and store it somewhere
Stop the playback
Play/resume playback from the seek point
Author of Learn Lua for iOS Game Development from Apress ( http://www.apress.com/9781430246626 )
Cool Vizify Profile at https://www.vizify.com/oz-apps
I'll be honest, the audio API as it stands really does seem to be lacking. I know it's on one of the roadmap lists to improve it and I can't wait to see what @atilim does because currently it's bare-bones at best.
I'm having to write an audio manager just to try and facilitate some pretty basic functionality, with a hodge-podge of the limited facilities we have currently.
I came to the same conclusion as yours.
What you suggested, also mentioned by @OZApps, is the only way that I know of.
That's why I am intrigued to know if Arturs knows a better way.
Likes: yarnee
But, even when it's faded out there's audio glitches when the track changes - sometimes it's just a click, sometimes it's actually the previous music playing briefly for half a second or so before going to the next track. This is on an iPhone 4S.
Basically something seems a little broken.
Likes: fxone, jimlev
One question, internally in Gideros does it use hardware decoding where available (on iOS for instance) for background music?