Skip to content

exercise_9

bjornstahl edited this page Oct 14, 2021 · 1 revision

Exercise 9

This will continue exploring basic resource localisation and input/output.

1 - Sample of things to come

Get a hold of a PCM encoded WAV file and add it to a new appl. Similarly to load_image from the earlier exercises, use load_asample.

Add an input handler so that when you press a button, the sample will be played back. See play_audio

2 - Can you hear that?

Take the solution from 1 and use audio_gain to set the state of the sample playback to have a gain of 0.0. Then add a timed step from that to 1.0 and down to 0.0.

3 - Repeat yourself

Continue with the appl from 1 and modify so that when it finishes playing back, it starts anew.

4 - Mixing Things Up

Use the decode frameserver to playback a video clip with audio or a music- only file such as an MP3 track. Then combine that with the code from exercises 1 and 2 to make sure that the mp3 is audible in the background, but the audio sample is louder.

Clone this wiki locally