Pass audioclip as parameter for functions [SOLVED]

Started by rmonic79, Wed 19/04/2017 15:22:08

Previous topic - Next topic

rmonic79

Hi guys is it possible to Pass audioclip as parameter inside functions? The editor says that i can pass struct as parameter.

Khris

This should work, yes:

Code: ags
function DoAudioStuff(AudioClip *clip) {
    AudioChannel *ch = clip.Play();
    ch.Volume = 30;
}


Elsewhere: DoAudioStuff(aTestSnd);

(you probably forgot the asterisk)

rmonic79


Khris

I think so, yes:

Code: ags
function PlayQuietly(this AudioClip*) {
  AudioChannel *ch = this.Play();
  ch.Volume = 30;
}


aTestSnd.PlayQuietly();


SMF spam blocked by CleanTalk