Sorry your browser is not supported!

You are using an outdated browser that does not support modern web technologies, in order to use this site please update to a new browser.

Browsers supported include Chrome, FireFox, Safari, Opera, Internet Explorer 10+ or Microsoft Edge.

Newcomers DBPro Corner / Existing music files

Author
Message
Silence
12
Years of Service
User Offline
Joined: 14th Oct 2012
Location:
Posted: 30th Nov 2012 02:26
Now I have a bunch of loaded music into my code. When I hit "Y" for "Yes I want to play again" it tells me the files already exists and shuts down the gamae. I think that's because they have been loaded a second time correct? How can I fix this problem? I have

cls 0 : backdrop on

(a lot of loaded music files)

I cant load these files anywhere else in the code without the program saying they dont exist. When I run the program once it's just fine until I restart it without shutting down. Does anyone know why?
Darkhog
11
Years of Service
User Offline
Joined: 25th Nov 2012
Location: Mushroom Kingdom
Posted: 30th Nov 2012 03:21
Instead of loading music do something like this:


where 1 is number of music slot you loading into and foo.mp3 is your filename. That will ensure that music won't be loaded second time and thus you won't see this error.

Also in order to free memory possessed by your music files loaded, at the end of the program (place where you exiting game) do following line:

for every of your music slots where again 1 is number of your music slot, otherwise you may face such "interesting" problems, like memory leaks.
MrValentine
AGK Backer
13
Years of Service
User Offline
Joined: 5th Dec 2010
Playing: FFVII
Posted: 30th Nov 2012 03:57 Edited at: 30th Nov 2012 04:03
That's not exactly what I call code...

try this...



I put this together really quickly, it can be cleaned up in many ways, hope this helps...

EDIT

Woops, a little cleanup haha

Oh yeah, just type either 1 or 65535 and press backspace to retype as you go...

Silence
12
Years of Service
User Offline
Joined: 14th Oct 2012
Location:
Posted: 30th Nov 2012 04:26
That doesnt seem to work my friend. You see when you start the game, the music loads right? So when I want to play it again the music also wants to load again but it already exists. I dont have this problem with the image files, just music. Is there a way to make it skip over the loading again?
MrValentine
AGK Backer
13
Years of Service
User Offline
Joined: 5th Dec 2010
Playing: FFVII
Posted: 30th Nov 2012 04:27 Edited at: 30th Nov 2012 04:31
show your code...

EDIT

You can use...



Silence
12
Years of Service
User Offline
Joined: 14th Oct 2012
Location:
Posted: 30th Nov 2012 05:04
Thank you so much! That code worked out great

(in a great mood now)
MrValentine
AGK Backer
13
Years of Service
User Offline
Joined: 5th Dec 2010
Playing: FFVII
Posted: 30th Nov 2012 05:10
You are welcome ^^

Rudolpho
18
Years of Service
User Offline
Joined: 28th Dec 2005
Location: Sweden
Posted: 30th Nov 2012 22:13
You generally don't want to reload media that's already loaded in. Just a note


"Why do programmers get Halloween and Christmas mixed up?"
MrValentine
AGK Backer
13
Years of Service
User Offline
Joined: 5th Dec 2010
Playing: FFVII
Posted: 30th Nov 2012 22:58
Hence the check Rudolpho ^^

Only just spotted Darkhogs post...

Login to post a reply

Server time is: 2024-11-23 17:45:16
Your offset time is: 2024-11-23 17:45:16