Setting up the mixer levels on call start/stop/etc (untested)
This commit is contained in:
parent
41f560524d
commit
a1864b7956
@ -5,7 +5,8 @@ LIBDIR = $(PREFIX)/lib
|
||||
CC = cc
|
||||
CPPFLAGSF= -I ../../include
|
||||
CPPFLAGS= -I $(PREFIX)/include
|
||||
CFLAGSF = -fPIC
|
||||
CFLAGSF = -W
|
||||
CFLAGS = -Wall -g -O2 -pedantic -fPIC `pkg-config --cflags gtk+-2.0`
|
||||
AR = ar -rc
|
||||
RANLIB = ranlib
|
||||
LD = $(CC) -shared
|
||||
|
@ -15,8 +15,21 @@
|
||||
|
||||
|
||||
|
||||
#include <stdlib.h>
|
||||
#include <stdio.h>
|
||||
#include <string.h>
|
||||
#include <errno.h>
|
||||
#include <glib.h>
|
||||
#include <System.h>
|
||||
#include "Phone.h"
|
||||
#include "../../config.h"
|
||||
|
||||
#ifndef PREFIX
|
||||
# define PREFIX "/usr/local"
|
||||
#endif
|
||||
#ifndef DATADIR
|
||||
# define DATADIR PREFIX "/share"
|
||||
#endif
|
||||
|
||||
|
||||
/* Openmoko */
|
||||
@ -37,15 +50,40 @@ PhonePlugin plugin =
|
||||
/* private */
|
||||
/* functions */
|
||||
/* openmoko_init */
|
||||
static int _event_mixer_set(char const * filename);
|
||||
|
||||
static void _openmoko_event(PhoneEvent event)
|
||||
{
|
||||
switch(event)
|
||||
{
|
||||
case PHONE_EVENT_CALL_ESTABLISHED:
|
||||
_event_mixer_set("gsmhandset.xml");
|
||||
break;
|
||||
case PHONE_EVENT_CALL_INCOMING:
|
||||
case PHONE_EVENT_CALL_OUTGOING:
|
||||
/* FIXME is there anything to do? */
|
||||
break;
|
||||
case PHONE_EVENT_CALL_TERMINATED:
|
||||
/* FIXME implement */
|
||||
_event_mixer_set("speaker.xml");
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
static int _event_mixer_set(char const * filename)
|
||||
{
|
||||
char const scenarios[] = DATADIR "/openmoko/scenarios";
|
||||
char * pathname;
|
||||
size_t len;
|
||||
char * alsactl[] = { "/usr/sbin/alsactl", "alsactl", "-f", NULL,
|
||||
"restore", NULL };
|
||||
|
||||
len = sizeof(scenarios) + 1 + strlen(filename);
|
||||
if((pathname = malloc(len)) == NULL)
|
||||
return error_set_code(1, "%s", strerror(errno));
|
||||
snprintf(pathname, len, "%s/%s", scenarios, filename);
|
||||
alsactl[3] = pathname;
|
||||
g_spawn_async(NULL, alsactl, NULL, G_SPAWN_FILE_AND_ARGV_ZERO,
|
||||
NULL, NULL, NULL, NULL);
|
||||
free(pathname);
|
||||
return 0;
|
||||
}
|
||||
|
@ -1,7 +1,8 @@
|
||||
targets=openmoko
|
||||
cppflags_force=-I ../../include
|
||||
cppflags=-I $(PREFIX)/include
|
||||
cflags_force=-fPIC
|
||||
cflags_force=-W
|
||||
cflags=-Wall -g -O2 -pedantic -fPIC `pkg-config --cflags gtk+-2.0`
|
||||
dist=Makefile
|
||||
|
||||
[openmoko]
|
||||
|
Loading…
Reference in New Issue
Block a user