Jump to content


Photo

Loading External Sound


  • Please log in to reply
2 replies to this topic

#1 Kyon

Kyon

    Creator of Dirkels

  • GMC Member
  • 4241 posts
  • Version:Unknown

Posted 22 May 2009 - 11:33 PM

ok,
I have this code:

global.hey=sound_add(working_directory+"\Sound\hey.wav",4,0)

This works perfectly :)
Now, when the action that the sound have to play I do:

sound_play(global.hey)

Alright.
Now the problem is this.
The first time the sound plays.
It doesnt work.
The next times it does.

So, it does not load the first time.
Only the other times.
How to solve this?
(this happened to every sound I uploaded)


Kyon E.

Edited by Kyon, 23 May 2009 - 12:16 AM.

  • 0

#2 GameGeisha

GameGeisha

    GameGeisha

  • GMC Member
  • 3641 posts
  • Version:GM:Studio

Posted 22 May 2009 - 11:58 PM

You put the wrong number in the second argument. Look at the manual once more:

sound_add(fname,kind,preload) Adds a sound resource to the game. fname is the name of the sound file. kind indicates the kind of sound (0=normal, 1=background, 2=3d, 3=mmplayer) preload indicates whether the sound should immediately be stored in audio memory (true or false). The function returns the index of the new sound, which can be used to play the sound. (-1 if an error occurred, e.g. the file does not exist).

There isn't anything with the sound type 4 in there, so that is likely to be the problem.

Change the 4 to 0, and you should be fine. If it still doesn't work, use 3.

GameGeisha
  • 0

#3 Kyon

Kyon

    Creator of Dirkels

  • GMC Member
  • 4241 posts
  • Version:Unknown

Posted 23 May 2009 - 12:16 AM

Lol,
that I didnt see that.
Thanks m8
  • 0




0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users