AUDIO XTRA HELP: GETTING STARTED | ||
Audio Xtra is a Scripting Xtra. Scripting Xtras are used to extend the Lingo language with new functions and datatypes. Unlike Asset Xtras there is no visual representation of a scripting Xtra in the Director interface, and you can not create castmembers or sprites. The creation of Scripting Xtras is done in your Lingo or JavaScript syntax scripts, by using the #new Lingo keyword. The first step is to download and install the Audio Xtra, following the instructions in the installation page. Now that it's installed, let's verify that the installation was successful. You should see the Audio Xtra entry in the Scripting Xtras context menu, appearing at the top of the message window. Selecting the Audio Xtra submenu and the "put interface" entry will output a list of all commands understood by Audio Xtra in the message window. You can also use the following command
Lingo: put the xtralist JavaScript syntax: trace(_player.xtraList) to verify which Xtras are installed, including the version number for each one.
THE SOUNDLIST The soundlist is Audio Xtra's internal list of sounds that it is currently working with. The source of the sound can be a file, a cast member or a sound recorded into RAM, but the sound must be loaded into Audio Xtra's sound list before other Audio Xtra commands can work with it. There are 3 ways to add a sound to Audio Xtra's sound list:
1. Record a new sound, which automatically adds it to the sound list 2. Load an existing sound file or sound cast member into the list using axLoadSound or axLoadSoundIntoRAM 3. Save a sound already in the sound list to a different format using axConvertToMember or axConvertToFile.
Use axGetSoundList to determine which sounds are currently on the sound list.
THE SOUNDS DIRECTORY Almost all commands in Shockwave require a sounds directory set by the user. The sounds directory is used as the path to record to and the path to load sounds from. You prompt the user for the path using axPromptForSoundsDirectory.
RECORDING A SOUND You can record sound to an external file, a cast member, or straight to RAM. You must perform the following steps to record:
1. Set a sounds directory, or if you are going to record to a file in Shockwave, set the environment property useDswMediaDirectory to TRUE. 2. Issue axOpenRecorder and get no error back. 3. Issue either axRecordSoundToFile, axRecordSoundToRAM or axRecordSoundToMember. 4. Issue axStopRecording to stop recording. RAM or member based recordings will stop automatically when the buffer is full. 5. Issue axCloseRecorder to close the recorder.
PLAYING A SOUND Once a sound is on the sound list you can play it using axPlay and stop it with axStop.
Examples: axPlay("New Sound") axStop("New Sound")
The Audio Xtra sample movie available in the TUTORIALS AND SAMPLES section at our website includes a full implementation of a simple application used to record, play and export audio files, complete with error checking and behaviors you can re-use on your files. The sample application was built to demonstrate best practices when accessing Audio Xtra functions and we strongly encourage you to re-use as much code from this sample as possible. |