Menu

Show posts

This section allows you to view all posts made by this member. Note that you can only see posts made in areas you currently have access to.

Show posts Menu

Topics - Nathan

#1
In the game I'm currently writing, I wish to play a sound effect, which could be played more than once at the same time, therefore I'm make use of the buffers% parameter of LOADSOUND, which is all well and good.  When compiling for win32 this works fine, when the project is compiled on the iPod however, the sound is cut off, each new PLAYSOUND iteration stops the present iteration playing.

In the game I've used DEBUG/STDOUT statements to see what channel% number is generated from each PLAYSOUND, on win32 it correctly increments, on the iPod it always uses the same number, hence the sound cut off.

To test further and to demonstrate I've written a small program ...
Code (glbasic) Select
// --------------------------------- //
// Project: SoundTests
// Start: Wednesday, January 04, 2012
// IDE Version: 10.209

SETCURRENTDIR("Media") // go to media files
LOCAL channel%
LOADSOUND "smallSound.wav", 0, 4

FOR i = 0 TO 3
channel = PLAYSOUND(0, 0.0, 1.0)
STDOUT channel + "\n"
SLEEP 200
NEXT
SHOWSCREEN
MOUSEWAIT
END


Win32 output gives ...

Code (glbasic) Select
Channel number = 0
Channel number = 1
Channel number = 2
Channel number = 3


... and the iPod gives ...

Code (glbasic) Select
Channel number = 0
Channel number = 0
Channel number = 0
Channel number = 0


Does anyone else have experience with this, is it a bug or does iOS not support this sort of functionality?  I've tried other GLB  iPhone games and they seem to be playing the same sounds without cut off, so I'm just not sure what I'm doing wrong?
#2
So before I started writing my game, I prototyped a lot of the stuff I was going to be doing in small test programs, and one of the obvious ones was smooth movement based on timing.  Using a routine written by MrAToad and I believe Ampos, I created the following test program which draws two rectangles just to see which routine is smoother/better/etc.  And I sure at time, which was probably a couple of months ago now, the movement was perfectly smooth without any jumping or "jerkiness".  However, I try the same routine now and it seems jumpy and non-smooth. 

Is anyone else having similar issues?

Code (glbasic) Select

GLOBAL movementRate
GLOBAL screenWidth
GLOBAL screenHeight

GETSCREENSIZE screenWidth, screenHeight

GLOBAL x = 0
GLOBAL y = ( screenHeight / 2 )

GLOBAL x2 = 0
GLOBAL y2 = ( screenHeight / 2 ) + 100

GLOBAL timer AS TAppTime
timer.Initialise(60)

WHILE (x2+50) < screenWidth
movementRate = ( screenHeight / 2) * 0.001 * GETTIMER()

DRAWRECT x, y, 50, 50, RGB(0, 0, 255)
INC x, (0.2 * movementRate)

DRAWRECT x2, y2 + 50, 50, 50, RGB(255, 0, 0)
INC x2, (0.8 * timer.Update())

SHOWSCREEN
WEND
MOUSEWAIT
END

// --------------------------------- //
// Project: AppTimer
// Start: Thursday, September 11, 2008
// IDE Version: 5.360

TYPE TAppTime
AppTime_UPS;AppTime_Iterator;AppTime_CurrentTime;AppTime_PauseStart;AppTime_Speed;AppTime_DesiredLoopTime;AppTime_LastUpdateTime
AppTime_LastUPSTime;AppTime_DesiredFrequency%

//! This function initialises the AppTimer system, and must be called first.
//\param frameRate% - This is the frame rate that you want all movement to be based on.  It defaults to 60 FPS, which is the lowest rate that should be used.
//\return Nothing is returned
FUNCTION Initialise%:frameRate%=60
self.AppTime_UPS=0.0
self.AppTime_Iterator=0.0
self.AppTime_CurrentTime=0.0
self.AppTime_PauseStart=0.0
self.AppTime_Speed=1.0
self.AppTime_LastUpdateTime=0.0
self.AppTime_LastUPSTime=0.0
self.AppTime_DesiredLoopTime=1000.0/(frameRate*1.0)
RETURN TRUE
ENDFUNCTION

//! This function updates the timing system.  It needs to be called once per loop.
//\param No parameters are passed
//\return A movement value is returned.  This should be muliplied by the amount you want to move.  If the routine is paused, then 0.0 is returned
FUNCTION Update:
LOCAL time
LOCAL elapsed

IF self.AppTime_PauseStart<>0
RETURN 0.0
ENDIF

time=GETTIMERALL()

IF self.AppTime_LastUpdateTime=0.0
self.AppTime_Speed=1.0
self.AppTime_LastUPSTime=time
ELSE
elapsed=time-self.AppTime_LastUpdateTime
IF elapsed=0.0
elapsed=1.0
SLEEP 1
INC time,1.0
ENDIF

self.AppTime_Speed=elapsed/self.AppTime_DesiredLoopTime
ENDIF
self.AppTime_LastUpdateTime=time
self.AppTime_CurrentTime=time

INC self.AppTime_Iterator,1.0 // Its a float as it can go very large...

IF self.AppTime_CurrentTime-self.AppTime_LastUPSTime>=1000.0
self.AppTime_UPS=self.AppTime_Iterator/((self.AppTime_CurrentTime-self.AppTime_LastUPSTime)/1000)
self.AppTime_LastUPSTime=self.AppTime_CurrentTime
self.AppTime_Iterator=0
ENDIF

RETURN self.AppTime_Speed
ENDFUNCTION

//! This function is used when your program is paused or not.  If it is, then the step speed is still updated
//\param pause% - If this is TRUE, then your program is paused.  If FALSE, then it isn't
//\return Nothing is returned
FUNCTION Pause%:DoPause%
LOCAL elapsed

IF DoPause%=TRUE
IF self.AppTime_PauseStart=0.0
self.AppTime_PauseStart=GETTIMERALL()
self.AppTime_UPS=0
self.AppTime_Speed=0
ENDIF
ELSE
IF self.AppTime_PauseStart<>0.0
IF self.AppTime_LastUpdateTime<>0.0
elapsed=GETTIMERALL()-self.AppTime_PauseStart
INC self.AppTime_LastUpdateTime,elapsed
ENDIF

self.AppTime_PauseStart=0.0
self.Update()
ENDIF
ENDIF
ENDFUNCTION

//!  This function returns the updates per second, and is an approximation
//\param No parameters are passed
//\return Updates per second
FUNCTION UPS:
RETURN self.AppTime_UPS
ENDFUNCTION
ENDTYPE
#3
So within the IDE, I press F9 to add a breakpoint to the program.
I also make sure debugging is toggled to ON.

I then press F5 to compile and run the program, but it never pauses or stops for me to step through the code, do I need to do something else?

I'm running IDE version 9.040 under Vista x64.