diff options
-rw-r--r-- | fsoaudiod/configure.ac | 1 | ||||
-rw-r--r-- | fsoaudiod/src/plugins/Makefile.am | 1 | ||||
-rw-r--r-- | fsoaudiod/src/plugins/router_alsa/Makefile.am | 58 | ||||
-rw-r--r-- | fsoaudiod/src/plugins/router_alsa/plugin.vala | 100 |
4 files changed, 160 insertions, 0 deletions
diff --git a/fsoaudiod/configure.ac b/fsoaudiod/configure.ac index d9e15f6c..52afb4a1 100644 --- a/fsoaudiod/configure.ac +++ b/fsoaudiod/configure.ac @@ -94,6 +94,7 @@ AC_CONFIG_FILES([ src/plugins/Makefile src/plugins/manager/Makefile src/plugins/router_palmpre/Makefile + src/plugins/router_alsa/Makefile ]) AC_OUTPUT diff --git a/fsoaudiod/src/plugins/Makefile.am b/fsoaudiod/src/plugins/Makefile.am index 92c08936..bdf28293 100644 --- a/fsoaudiod/src/plugins/Makefile.am +++ b/fsoaudiod/src/plugins/Makefile.am @@ -7,5 +7,6 @@ SUBDIRS = \ manager \ \ router_palmpre \ + router_alsa \ \ $(NULL) diff --git a/fsoaudiod/src/plugins/router_alsa/Makefile.am b/fsoaudiod/src/plugins/router_alsa/Makefile.am new file mode 100644 index 00000000..5284bf55 --- /dev/null +++ b/fsoaudiod/src/plugins/router_alsa/Makefile.am @@ -0,0 +1,58 @@ +include $(top_srcdir)/Makefile.decl +NULL = + +AM_CFLAGS = \ + -I$(top_srcdir)/src/lib \ + $(FSO_GLIB_CFLAGS) \ + $(FSO_CFLAGS) \ + $(GLIB_CFLAGS) \ + $(GEE_CFLAGS) \ + $(NULL) + +noinst_PROGRAMS = $(TEST_PROGS) + +progs_ldadd = \ + $(FSO_GLIB_LIBS) \ + $(FSO_LIBS) \ + $(GLIB_LIBS) \ + $(GEE_LIBS) \ + $(top_srcdir)/src/lib/libfsoaudio.la + +VALAC_ARGS = \ + --basedir $(top_srcdir) \ + --vapidir ../../lib \ + --pkg glib-2.0 \ + --pkg gee-1.0 \ + --pkg fso-glib-1.0 \ + --pkg fsoframework-2.0 \ + --pkg fsoaudio-2.0 + +if WANT_DEBUG +VALAC_ARGS += -g -D DEBUG +AM_CFLAGS += -ggdb -O0 +endif + +# +# plugin +# +modlibexecdir = $(libdir)/cornucopia/modules/fsoaudio +modlibexec_LTLIBRARIES = router_alsa.la +router_alsa_la_SOURCES = plugin.c +router_alsa_la_VALASOURCES = plugin.vala +$(router_alsa_la_SOURCES): $(router_alsa_la_VALASOURCES) + $(VALAC) -C $(VALAC_ARGS) $^ + touch $@ +router_alsa_la_LIBADD = $(progs_ldadd) +router_alsa_la_LDFLAGS = -no-undefined -module -avoid-version +router_alsa_la_LIBTOOLFLAGS = --tag=disable-static + +CLEANFILES = \ + *.c \ + *.h \ + *.la \ + *.lo \ + $(NULL) + +MAINTAINERCLEANFILES = \ + Makefile.in \ + $(NULL) diff --git a/fsoaudiod/src/plugins/router_alsa/plugin.vala b/fsoaudiod/src/plugins/router_alsa/plugin.vala new file mode 100644 index 00000000..e640e478 --- /dev/null +++ b/fsoaudiod/src/plugins/router_alsa/plugin.vala @@ -0,0 +1,100 @@ +/* + * Copyright (C) 2011 Simon Busch <morphis@gravedo.de> + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + * + */ + +using GLib; + +namespace FsoAudio +{ + public static const string ROUTER_ALSA_MODULE_NAME = "fsoaudio.router_alsa"; +} + +public class Router.Alsa : FsoAudio.AbstractRouter +{ + construct + { + normal_supported_outputs = new FreeSmartphone.Audio.Device[] { + FreeSmartphone.Audio.Device.BACKSPEAKER, + FreeSmartphone.Audio.Device.FRONTSPEAKER, + FreeSmartphone.Audio.Device.HEADSET + }; + + call_supported_outputs = new FreeSmartphone.Audio.Device[] { + FreeSmartphone.Audio.Device.BACKSPEAKER, + FreeSmartphone.Audio.Device.FRONTSPEAKER, + FreeSmartphone.Audio.Device.HEADSET + }; + + logger.info( @"Created and configured." ); + } + + public override string repr() + { + return "<>"; + } + + public override void set_mode( FreeSmartphone.Audio.Mode mode ) + { + if ( mode == current_mode ) + { + return; + } + + var previous_mode = current_mode; + base.set_mode( mode ); + } + + public override void set_output_device( FreeSmartphone.Audio.Device device ) + { + base.set_output_device( device ); + } + + public override void set_volume( uint volume ) + { + } +} + +/** + * This function gets called on plugin initialization time. + * @return the name of your plugin here + * @note that it needs to be a name in the format <subsystem>.<plugin> + * else your module will be unloaded immediately. + **/ +public static string fso_factory_function( FsoFramework.Subsystem subsystem ) throws Error +{ + return FsoAudio.ROUTER_ALSA_MODULE_NAME; +} + +[ModuleInit] +public static void fso_register_function( TypeModule module ) +{ + FsoFramework.theLogger.debug( "fsoaudio.manager fso_register_function" ); +} + +/** + * This function gets called on plugin load time. + * @return false, if the plugin operating conditions are present. + * @note Some versions of glib contain a bug that leads to a SIGSEGV + * in g_module_open, if you return true here. + **/ +/*public static bool g_module_check_init( void* m ) +{ + var ok = FsoFramework.FileHandling.isPresent( Kernel26.SYS_CLASS_LEDS ); + return (!ok); +} +*/ |