diff options
Diffstat (limited to 'src/audioOutput.c')
-rw-r--r-- | src/audioOutput.c | 43 |
1 files changed, 43 insertions, 0 deletions
diff --git a/src/audioOutput.c b/src/audioOutput.c new file mode 100644 index 000000000..aedfda59f --- /dev/null +++ b/src/audioOutput.c @@ -0,0 +1,43 @@ +#include <audioOutput.h> + +#include <list.h> + +static List * audioOutputPluginList; + +void loadAudioOutputPlugin(AudioOutputPlugin * audioOutputPlugin) { + insertInList(audioOutputPluginList, audioOutputPlugin->name, + audioOutputPlugin); +} + +void unloadAudioOutputPlugin(AudioOutputPlugin * audioOutputPlugin) { + deleteFromList(audioOutputPluginList, audioOutputPlugin->name); +} + +void initAudioOutputPlugins() { + audioOutputPluginList = makeList(NULL); +} + +void finishAudioOutputPlugins() { + freeList(audioOutputPluginList); +} + +AudioOutput * newAudioOutput(char * name) { + AudioOutput * ret = NULL; + void * data = NULL; + + if(findInList(audioOutputPluginList, name, &data)) { + AudioOutputPlugin * plugin = (AudioOutputPlugin *) data; + ret = malloc(sizeof(AudioOutput)); + ret->initConfigFunc = plugin->initConfigFunc; + ret->finishConfigFunc = plugin->finishConfigFunc; + ret->initDriverFunc = plugin->initDriverFunc; + ret->finishDriverFunc = plugin->initDriverFunc; + ret->openDeviceFunc = plugin->openDeviceFunc; + ret->playFunc = plugin->playFunc; + ret->closeDeviceFunc = plugin->closeDeviceFunc; + } + + return ret; +} + +void closeAudioOutput(AudioOutput * audioOutput); |