The Dink Network

Reply to Re: playsound - 3D variable not working?

If you don't have an account, just leave the password field blank.
Username:
Password:
Subject:
Antispam: Enter Dink Smallwood's last name (surname) below.
Formatting: :) :( ;( :P ;) :D >( : :s :O evil cat blood
Bold font Italic font hyperlink Code tags
Message:
 
 
April 26th, 12:57 AM
peasantmb.gif
yeoldetoast
Peasant They/Them Australia
LOOK UPON MY DEFORMED FACE! 
Alright I figured it out. The problem is not so much with playsound as it is with the "3d positioning" update function that is run every frame, and is a misnomer anyway. It has a number of conditionals which must be met for a sound to be continually updated, and when those are not met, the sound is halted.

For the sound to be updated, it must be a living sprite, but most importantly/unfortunately, the specified living sprite must have a number other than zero in its own sound slot. This is the sound slot that is assigned in the editor, and that gets updated when running sp_sound, after which playsound is called by the engine.

If the sprite's sound value is set to zero, the sound is immediately halted on the next frame by the update function. You can fudge this by running sp_sound, or assigning a value in the editor that corresponds to an unused sound slot. Therefore the example above with the savebot becomes:

sp_sound(&current_sprite, 99)
playsound(34, 22050, 0, &current_sprite, 1)


Where 99 can be replaced with any blank sound slot. This fools the update function and should make the playsound audible. Apologies for double posting.