Table of Contents
Making Advanced Gtk+ Sequencer objects reachable from different contices was mandatory as introducing AgsApplicationContext. Imagine you are within a GUI callback and want to lookup a soundcard or sequencer the application context shall provide this functioanlity and provide access to its objects through a well defined interface. As doing it with interfaces you are not limited to one specific implementation rather having the option to choose the appropriate one implementing the interfaces.
There are different contices available e.g. AgsThreadApplicationContext providing its functionality by AgsConcurrencyProvider, AgsAudioApplicationContext giving you the wished objects by implementing AgsConcurrencyProvider and AgsSoundProvider. For example the code below should each giving you the same meaning object but using different contices.
Creating a AgsThreadApplicationContext and then get the task thread by calling
Since the AgsConcurrency interface is implemented by the context, we retrieve
the task thread. The AgsTaskThread gives you a thread safe signal. It is used
to launch AgsTask objects to do thread safe operations but later on this.
Example 1.1. Thread application context
#include <glib.h> #include <glib-object.h> #include <ags/libags.h> AgsApplicationContext *application_context; AgsThread *task_thread; application_context = (AgsApplicationContext *) ags_thread_application_context_new(); task_thread = ags_concurrency_provider_get_task_thread(AGS_CONCURRENCY_PROVIDER(application_context));
The AgsAudioApplicationContext inherites from AgsApplicationContext and implements the AgsConcurrency interface, too. So you can retrieve the task thread the same way. But the context implements one more, the AgsSoundProvider interface. Giving you objects related to threading and audio processing.
Example 1.2. Audio application context
#include <glib.h> #include <glib-object.h> #include <ags/libags.h> #include <ags/libags-audio.h> AgsApplicationContext *application_context; AgsThread *task_thread; application_context = (AgsApplicationContext *) ags_audio_application_context_new(); task_thread = ags_concurrency_provider_get_task_thread(AGS_CONCURRENCY_PROVIDER(application_context));