# Putting all together

So far we have seen the most important objects involved doing an audio processing tree. Now we want to do complete example putting all together. In this example we instantiate AgsAudioThread and AgsChannelThread to play a simple pattern. The sound we use is generated using a sine wave.

In order that the threads are used we provide an appropriate AgsConfig. Further we define an AgsPattern and add the needed recalls to do playback using the AgsFxFactory.

The example creates 2 different AgsAudio objects. One called master which does the actual playback and a second called slave doing the sequencer work. Since the slave is linked to the master, we only have to start slave, which initializes the audio tree for playback.

The slave owns the audio signal and has to provide audio processing threads for it. This is done by `AGS_AUDIO_OUTPUT_HAS_RECYCLING` flag. We set the ags-fx staging flags and the staging program. We need to do this explicitely in view of reverse compatibility to the deprecated recall engine.

Note, here thread-safety doesn't matter. If you need to do more complex work-flows, you have to care about it. In practice you wouldn't make direct use of any struct fields. Rather use the appropriate getter/setter functions and take care of owner ship.

Usually, you wouldn't call directly `void ags_channel_set_link(AgsChannel*, AgsChannel*, GError**)`, but rather use the AgsLinkChannel task and add it to the AgsTaskLauncher. Else, everything is fine.

## Simple pattern sequencer with master playback