Making spesific sounds play on channel 2

Started by LeChuck, Tue 25/10/2005 05:24:57

Previous topic - Next topic

LeChuck

I've got this function where I want to control an audience laughter by the help of a slider (A silly little feature that will by default be off!). I figure the easiest way of doing this is making the wavs play on a single channel that's easy to keep track of, so why not play them on channel 2, since all the other channels are extensively used..

However, I can't find any documentation on how to use PlaySpeech(int, int).
And I can't force AGS to play a sound effect on this channel by using PlaySoundEx either.

Doing a search on PlaySpeech on the forums is hopeless as it returns one million "DisplaySpeech" results... So what's a good workaround in this situation?

Ubel

Well, there is no such code as PlaySpeech.

Why can't you just use PlaySoundEx and use channel 3-5?

Something like PlaySoundEx(yoursoundfile, 3);

LeChuck

#2
Quote from: Pablo on Tue 25/10/2005 05:35:58
Well, there is no such code as PlaySpeech.

Why can't you just use PlaySoundEx and use channel 3-5?

Something like PlaySoundEx(yoursoundfile, 3);

PlaySpeech does pop up in the editor, but I have no idea what it does.

I can't use channels 3-5 because those are affected by the general SFX volume level. I want the audience to be seperate from the rest of the sound effects. Ergo channel 2.

Is this possible, to force sounds to play on channel 2? Anyone?

Edit: If I code channel 3 to one volume slider (audience), and 4 and 5 to another (sfx volume), somehow the regular PlaySound command isn't affected by either of the sliders. Which means I'm back to the original question.  :-\

Gilbert

I don't know, maybe it's some left-over testing function, maybe it's not even functional. (CJ needs to clarify this as I found the same function popping up also).

Anyway, my guess is, the first parameter is the character's ID, the second is the speech #.

For example:
PlaySpeech(EGO, 12); //V2.62 or before
or
PlaySpeech(cEgo.ID, 12); //V2.7+

will play the sound file EGO12.wav (maybe with the line displayed on screen also).

I don't know, it probably won't work anyway, and I can't check it here in the office.

strazer

Try this (AGS v2.7 required):

Set the slider control to min 0 and max 255. Name it "YourSliderControl" for this example.

Code: ags

// global script

function PlayAudienceSound() {
  int channel = PlaySound(eSndAudience); // play the sound and store used channel
  if (channel != -1) SetChannelVolume(channel, YourSliderControl.Value); // if playing successful, set used channel's new volume
}


Code: ags

// script header

enum MySoundFiles {
  eSndAudience = 11 // adjust this to the proper sound number
  //...more sounds
};

import function PlayAudienceSound();


Now everytime you call the PlayAudienceSound function, the sound is played on a free channel and the channel's volume adjusted to the current value of the slider.
When the sound has finished playing or another sound is being played (not sure), the channel's volume should be restored to normal. Let me know if it works.

SMF spam blocked by CleanTalk