How do I...?

Make a Slideshow with Audio

Tip: AutoPlay Media Studio 8 now contains a SlideShow object that can also be used for this functionality.

As an example, we will create a slideshow with voiceovers for each image. This project will require one audio file for every image, and one page in your project for every image that you want to display.  On each page, create one image object which loads the desired image.

  1. Create one page in your project for every image file you wish to display. In this example, we will have three images, and three audio files.

  2. On each page in your project, create an image object which loads the desired image.

  3. Create global variables:

-- will keep track of the audio files
audio_count = 1;

--loads desired audio files into a table
audio = {
"Autoplay\\Audio\\audio_file1.ogg",
"Autoplay\\Audio\\audio_file2.ogg",
"Autoplay\\Audio\\audio_file3.ogg"
};

  1. Create the following action in the On Show event of every page:

Audio.Load(CHANNEL_USER1, audio[audio_count], true, false);

  1. Create the following script in the On Audio event of every page (except your last page):

Input.SetText("Input1", e_State);
if e_State == "Finish" then
    audio_count = audio_count + 1;
    Page.Navigate(PAGE_NEXT);
end

Note: When run, this application will load the first page and play the audio file. When that audio file is complete, the application will jump to the next page, and launch the audio file. This continues until the last page. Each image is displayed for the length of the audio file.

Tip: If you want to have background music playing in your application, insert the following code into the first page's On Show event (you will load the background music into a different channel than the voiceovers are being loaded into):

Audio.Load(CHANNEL_BACKGROUND, "AutoPlay\\Audio\\background.ogg, true, true);
Audio.SetVolume(CHANNEL_BACKGROUND, (255 * 0.25)); --sets the volume to 25%