Adventure Game Studio

AGS Support => Advanced Technical Forum => Topic started by: eanmrtn123 on Thu 16/08/2012 19:09:32

Title: no PLAY command or anything for Ambient Music
Post by: eanmrtn123 on Thu 16/08/2012 19:09:32
Recently, working on a game in AGS, I wanted to implement audio, such as background music (ambient) and some voice tests. Focusing on Ambient music,
I did:
function room_AfterFadeIn()
{
PlayAmbientSound(0, 1, 50, 0, 0);
}

But as I was typing "PlayAmbientSound", nothing came up in the 'suggestion' box (for scripting. As you are typing. e.g. if you type "cyourcharacter" it would bring up a list of variables, etc.). And after compiling it:
Failed to save room room1.crm; details below

room1.asc(41): Error (line 41): Undefined token 'PlayAmbientSound'

Same thing happens with PLAY and pretty much anything relevant to playing audio. Help! I'm using the latest version of AGS running in Windows XP.
Title: Re: no PLAY command or anything for Ambient Music
Post by: Khris on Thu 16/08/2012 20:58:12
The audio system was overhauled as of version 3.2.

Import the sound file into the project tree, then use this:
Code (ags) Select
  AudioChannel*ac = aAmbient.Play();
  ac.Volume = 50;
  ac.SetPosition(x, y);
Title: Re: no PLAY command or anything for Ambient Music
Post by: Crimson Wizard on Thu 16/08/2012 21:17:30
Also check "AudioChannel" and "AudioClip functions and properties" topics in the manual (in the "Scripting" category).
"Upgrading to AGS 3.2" topic (in the manual contents root) might be helpful as well.
Title: Re: no PLAY command or anything for Ambient Music
Post by: eanmrtn123 on Mon 20/08/2012 08:43:07
Thanks you guys! I implemented it with:

    aSomesongname.Play();

Now I can start finishing that map. e.e 'Special Effects' help a lot. :-)
Thanks!

- Ean