Playmusic and sound length problems

Discuss any general programming issues here
Post Reply
xabierpayet
Posts: 214
Joined: Fri Feb 24, 2012 9:34 am

Playmusic and sound length problems

Post by xabierpayet »

i have a problem wih playmusic instruction, in android is not possible to know if the song is finished, i have problems with IsMusicPlaying also, in android if you start the music the result ever is True, under windows work fine.
Under windows and android the song length is around 17 seconds more that the real length (17 seconds of blank space), and i need do this to
solve the problem:

dura = GetAttribute(#MUSIC, 100, #ATTRDURATION)
posi = GetAttribute(#MUSIC, 100, #ATTRPOSITION)
plyn = GetAttribute(#MUSIC, 100, #ATTRPLAYING)
dura2=dura-17000
If posi>dura2
StopMusic(100)
musica=0
EndIf
.....

That´s a bug? i´m doing something bad?

User avatar
airsoftsoftwair
Posts: 4206
Joined: Fri Feb 12, 2010 2:33 pm
Location: Germany
Contact:

Re: Playmusic and sound length problems

Post by airsoftsoftwair »

What format is the music in? MP3? Protracker? WAV? etc.

xabierpayet
Posts: 214
Joined: Fri Feb 24, 2012 9:34 am

Re: Playmusic and sound length problems

Post by xabierpayet »

Mp3

User avatar
airsoftsoftwair
Posts: 4206
Joined: Fri Feb 12, 2010 2:33 pm
Location: Germany
Contact:

Re: Playmusic and sound length problems

Post by airsoftsoftwair »

Please provide the MP3 so that I can check.

xabierpayet
Posts: 214
Joined: Fri Feb 24, 2012 9:34 am

Re: Playmusic and sound length problems

Post by xabierpayet »

i have the same problem with evey mp3 song here

User avatar
airsoftsoftwair
Posts: 4206
Joined: Fri Feb 12, 2010 2:33 pm
Location: Germany
Contact:

Re: Playmusic and sound length problems

Post by airsoftsoftwair »

Sorry, can't reproduce the problem here. For a random test MP3 which is 3 minutes and 4 seconds, #ATTRDURATION returns 184345 when using avcodec.hwp on Windows and 184346 when using DirectShow for MP3 streaming. Both results are very precise and they definitely aren't off by 17 seconds. Also, IsMusicPlaying() on Android returns 0 as soon as the MP3 has finished playing.

If it doesn't work for you, please provide a full test script including data files.

Post Reply