SOUNDPLAYING() not working on iPhone now

Previous topic - Next topic

Dark Schneider

SOUNDPLAYING() always return 0 on iPhone, on PC and with GLBasic v8 this work well. I noticed because when updated to GLBasic 9, I used SOUNDPLAYING() for sound cycling, and that sound now is a continous re-loop each frame, and is annoying (or crazy).

Kitty Hello

With V8 it worked?
Current version is 10.x - did you mean this? I might have a look then, but I can't remember changing anything there. :(

Dark Schneider

It could be the SDL libs used for sound. I attached a simple project for testing.

[attachment deleted by admin]

Crivens

Yeah, mine seems this way. I only play my sound if the channel from the playsound now has stopped playing with soundplaying. This worked on my old app but now seems to not care and repeats the sound straight away not caring if the old sound has finished or not. This is on a Pre2 BTW.

Cheers
Current fave quote: Cause you like musicians and I like people with boobs.

Crivens

Or on my PC. This worked fine before as my first app didn't have a problem. I just tested my code out on my new app and it isn't having it. I use something like this to play : klaxonsound=PLAYSOUND(klaxon,0.0,1.0)

and then I showed a variable on screen using something the command SOUNDPLAYING(klaxonsound).

Also note I also use STOPSOUND klaxonsound and it won't stop the wav file playing. It keeps going till it is finished... That also worked before as I remember using a swipey command which went on a bit. Nicely I just used STOPSOUND when the movement was finished and it looked and sounded just right (ie. cutting off the sound at the right point). Not so now!

Cheers
Current fave quote: Cause you like musicians and I like people with boobs.

Kitty Hello

Are you sure you didn't play the channel twice? Debug the play and stop channel values.

Code (glbasic) Select

// ------------------------------------------------------------- //
// PLAYSOUND Sample
// ------------------------------------------------------------- //

SYSTEMPOINTER TRUE


// Laden eines Sounds aus einer Wav-Datei / Load sound from wav-file
LOADSOUND "sensaura.wav", 5, 4 // Num: 0 - 127 max

LOCAL iSoundChannel% = -1
LOCAL bPlaying% = FALSE

WHILE TRUE
MOUSESTATE mx, my, b1, b2
IF my>100 THEN my=100
SETMOUSE mx, my
mx=INTEGER((mx-320)*10/32) // -100 <-> +100

// PAN
DRAWLINE 0, 100, 200, 100, RGB(255,255,255)
DRAWLINE mx+100, 90, mx+100, 110, RGB(200,255,255)
// VOL
DRAWLINE 0, 130, 200, 130, RGB(255,255,255)
DRAWLINE my*2, 120, my*2, 140, RGB(255,255,200)

IF b1 AND bPlaying=FALSE THEN iSoundChannel% = PLAYSOUND (5, mx/100, my/100)

IF b2 THEN STOPSOUND iSoundChannel%

bPlaying% = SOUNDPLAYING(iSoundChannel%)

PRINT "Pan[%]:" + mx + " Vol[%]:" + my, 84, 150


IF bPlaying% THEN PRINT "Is playing!", 84, 180
SHOWSCREEN
WEND
HUSH // Ruhe / Silence


This works pretty fine for me.

Crivens

I'll check tomorrow but pretty sure it isn't. 

Cheers
Current fave quote: Cause you like musicians and I like people with boobs.

Crivens

I know what it is. Your example works fine. But it doesn't if you replace the "5" for the sound ID with a GENSOUND(). Actually I knew this with my old game I now remember, just totally forgot. Just use a GENSOUND() command before the LOADSOUND and use that ID on the LOADSOUND and the PLAYSOUND commands and it should not work anymore. Replace the GENSOUND() with a set number for the variable and it all works again...

So basically GENSOUND() has never worked. I was wrong is not a new bug but a really old one as I remember now doing the same thing for my old game.

Cheers
Current fave quote: Cause you like musicians and I like people with boobs.

Kitty Hello

Bingo! Fixed in the next update then. It only worked for channels < 4096/16.

Crivens

This is now working fine on my PC and Pre2. I haven't tried it on my Android tablet or TP, but on my 3GS it is still not working. Soundplaying is not detecting correctly and sounds are not being stopped when they need to be (or played multiple times) because of it.

Cheers
Current fave quote: Cause you like musicians and I like people with boobs.

Qube

I noticed this too (iPad2) and found that checking if a sound is playing at the beginning of function seems to not work. However, shoving that command at the end of the function seemed to do the trick  :S - It's a funny work around but it'll do for now  :P

Also, while I'm here, X_SCREEN2WORLD does not work on the iPad but X_WORLD2SCREEN works perfectly  :noggin:

Crivens

Hmm. Interesting. Hopefully that will point Gernot in the right direction to fixing it for iOS.

Yeah, I was looking to use 3D objects as 2D HUD objects rather than sprites and was using Gernot's latest upgrade to the 3D entity system which uses the screen2world command to set an object at a fixed point on the screen. Doesn't seem to work for me though (although my debug shows the object actually moving as I move the camera so it is trying to follow me). It might be because my camera moves around a lot, but it should still handle it.

While I'm on the subject does anyone know how to make the 3D entity system ignore lighting for certain objects? This would be pretty crucial for a 2D HUD comprised of 3D objects.

Cheers
Current fave quote: Cause you like musicians and I like people with boobs.

spicypixel

On my latest project Plebz the STOPSOUND command seems to be totally ignored too. Using v10.118
http://www.spicypixel.net | http://www.facebook.com/SpicyPixel.NET

Comps Owned - ZX.81, ZX.48K, ZX.128K+2, Vic20, C64, Atari-ST, A500.600.1200, PC, Apple Mini-Mac.