PlaySnd (sctrls) (Read 14451 times)

Started by Just No Point, September 11, 2015, 02:30:18 PM
Share this topic:
PlaySnd (sctrls)
#1  September 11, 2015, 02:30:18 PM
  • ******
Plays back a sound.

Required parameters:
value = group_no, sound_no (int, int) group_no and sound_no correspond to the identifying pair that you assigned each sound in the player's snd file. To play back a sound from "common.snd", precede group_no with an "F".

Optional parameters:
volumescale = volume_scale (float) volume_scale controls the volume of the sound. A value of 100 specifies 100% volume, 50 for 50%, and so on. Valid values are from 0 to 100.  Defaults to 100.

channel = channel_no (int) channel_no specifies which of the player's sound channels the sound should play on. Only one voice may play on a particular channel at a time. For example, if you play a sound on channel 2, then play any sound on the same channel before the first sound is done, then by default the first sound is stopped as the second one plays. 0 is a special channel reserved for player voices. Channel 0 voices are stopped when the player is hit. It's recommended you play your character's voice sounds on channel 0. If omitted, channel_no defaults to -1, meaning the sound will play on any free channel.

lowpriority = pr (int) This is only valid if the channel is not -1. If pr is nonzero, then a sound currently playing on this sound's channel (from a previous PlaySnd call) cannot be interrupted by this sound.

freqmul = f (float) The sound frequency will be multiplied by f. For example. Setting f to 1.1 will result in a higher-pitched sound. Defaults to 1.0 (no change in frequency).

loop = loop_flag (int) Set loop_flag to a nonzero value to have the sound sample loop over and over. Defaults to 0.

pan = p (int) This is the positional offset of the sound, measured in pixels. If p > 0, then the sound is offset to the front of the player. If p < 0, then sound is offset to the back. Defaults to 0. This parameter is mutually exclusive with abspan.

abspan = p (int) Like pan, except the sound is panned from the center of the screen, not from the player's position. This parameter is mutually exclusive with pan.

; Plays back sound 2,0 from the player's SND file
type = PlaySnd
value = 2,0

; Plays back sound 5,2 from fight.snd
type = PlaySnd
value = F5,2

Related Triggers:   
SndPan (SCTRL)
StopSnd (SCTRL)

Prior to version 1.0 RC8, a volume parameter was used instead of volumescale. The volume parameter is no longer supported and is now ignored.

The only thing is to use another channel, it's like an ID for the sounds.
How many channels are you allowed to have in a character? You have -1, 0, then up to 31. Is this correct?
So the channels are
-1 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31
and if you put 32 there's debug flood saying "ILLEGAL PLAYSND CHANNEL".
Last Edit: January 07, 2018, 02:12:31 PM by Odb718
Re: PlaySnd (sctrls)
#2  September 12, 2015, 02:17:34 AM
  • ******
  • Legendary XIII
  • I am the eye of the storm to come!
    • New Zealand
IIRC freqmul is currently broken in 1.0 and up.

In M.U.G.E.N there is no magic button

They say a little knowledge is a dangerous thing, but it's not one half so bad as a lot of ignorance.
Re: PlaySnd (sctrls)
#3  June 07, 2016, 11:27:59 PM
  • ******
Bumping to say this:
for volumescale you can go over the limit of 100. I think the max value is 255 (not sure).
Re: PlaySnd (sctrls)
#4  January 11, 2018, 05:01:57 PM
  • *****
  • Shame on you!
    • USA
What's the max number of sounds that can be played at once??
It’s whatever you set the max channels to in mugen.cfg. I think it’s 16 by default and split between characters, though it should also be possible to make all sounds stop by playing a blank sound on every channel you can, not entirely certain, though.

Mine was set to 12. You guys might want to check your cfg file.
vVv Wheat Stage Released vVv