Adventure Game Studio

AGS Support => Beginners' Technical Questions => Topic started by: rmonic79 on Wed 19/04/2017 15:22:08

Title: Pass audioclip as parameter for functions [SOLVED]
Post by: rmonic79 on Wed 19/04/2017 15:22:08
Hi guys is it possible to Pass audioclip as parameter inside functions? The editor says that i can pass struct as parameter.
Title: Re: Pass audioclip as parameter for functions
Post by: Khris on Wed 19/04/2017 15:32:07
This should work, yes:

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


Elsewhere: DoAudioStuff(aTestSnd);

(you probably forgot the asterisk)
Title: Re: Pass audioclip as parameter for functions [SOLVED]
Post by: rmonic79 on Wed 19/04/2017 16:02:10
And about extender? Is it possible ?
Title: Re: Pass audioclip as parameter for functions [SOLVED]
Post by: Khris on Wed 19/04/2017 16:09:03
I think so, yes:

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


aTestSnd.PlayQuietly();
Title: Re: Pass audioclip as parameter for functions [SOLVED]
Post by: rmonic79 on Wed 19/04/2017 16:12:11
Thanks khris :)