[Pommed-commits] r371 - in trunk: . gpomme gpomme/themes/CrystalLarge gpomme/themes/KStyle gpomme/themes/Tango gpomme/themes/elegant-bright gpomme/themes/elegant-dark pommed

jblache at alioth.debian.org jblache at alioth.debian.org
Fri Nov 9 13:09:48 UTC 2007


Author: jblache
Date: 2007-11-09 13:09:48 +0000 (Fri, 09 Nov 2007)
New Revision: 371

Removed:
   trunk/gpomme/audio.c
   trunk/gpomme/audio.h
   trunk/gpomme/themes/CrystalLarge/click.wav
   trunk/gpomme/themes/KStyle/click.wav
   trunk/gpomme/themes/Tango/click.wav
   trunk/gpomme/themes/elegant-bright/click.wav
   trunk/gpomme/themes/elegant-dark/click.wav
Modified:
   trunk/AUTHORS
   trunk/ChangeLog
   trunk/INSTALL
   trunk/gpomme/Makefile
   trunk/gpomme/gpomme.c
   trunk/pommed/Makefile
Log:
Remove anything audio-related from gpomme.


Modified: trunk/AUTHORS
===================================================================
--- trunk/AUTHORS	2007-11-09 12:59:40 UTC (rev 370)
+++ trunk/AUTHORS	2007-11-09 13:09:48 UTC (rev 371)
@@ -7,6 +7,8 @@
        for the Radeon X1600 backlight support
   - Ryan LORTIE <desrt at desrt.ca>
        for the Intel GMA950 backlight support
+  - pbbuttonsd
+       for the audio thread code in pommed/beep.c
 
 The following people contributed to pommed:
   - Romain BEAUXIS <toots at rastageeks.org>

Modified: trunk/ChangeLog
===================================================================
--- trunk/ChangeLog	2007-11-09 12:59:40 UTC (rev 370)
+++ trunk/ChangeLog	2007-11-09 13:09:48 UTC (rev 371)
@@ -4,6 +4,7 @@
 version 1.11:
 	- pommed: beep on volume change, now that we have the audio code
 	in pommed itself.
+	- gpomme: remove audio-related code.
 
 version 1.10:
 	- pommed: add a beeper feature as a substitute to the missing PC

Modified: trunk/INSTALL
===================================================================
--- trunk/INSTALL	2007-11-09 12:59:40 UTC (rev 370)
+++ trunk/INSTALL	2007-11-09 13:09:48 UTC (rev 371)
@@ -22,8 +22,6 @@
 
 gpomme requires:
  - libdbus
- - libasound
- - libaudiofile
  - GTK+ 2.0
  - glade 2.0
 

Modified: trunk/gpomme/Makefile
===================================================================
--- trunk/gpomme/Makefile	2007-11-09 12:59:40 UTC (rev 370)
+++ trunk/gpomme/Makefile	2007-11-09 13:09:48 UTC (rev 371)
@@ -9,19 +9,13 @@
 DBUS_CFLAGS = $(shell pkg-config dbus-1 --cflags) -DDBUS_API_SUBJECT_TO_CHANGE
 DBUS_LIBS = $(shell pkg-config dbus-1 --libs)
 
-ALSA_CFLAGS = $(shell pkg-config alsa --cflags)
-ALSA_LIBS = $(shell pkg-config alsa --libs)
-
-AUDIOFILE_CFLAGS = $(shell pkg-config audiofile --cflags)
-AUDIOFILE_LIBS = $(shell pkg-config audiofile --libs)
-
 CONFUSE_CFLAGS = $(shell pkg-config libconfuse --cflags)
 CONFUSE_LIBS = $(shell pkg-config libconfuse --libs)
 
-CFLAGS = -g -O2 -Wall $(ALSA_CFLAGS) $(AUDIOFILE_CFLAGS) $(DBUS_CFLAGS) $(GTK_CFLAGS) $(CONFUSE_CFLAGS) $(GLADE_CFLAGS)
-LDFLAGS = -lpthread $(ALSA_LIBS) $(AUDIOFILE_LIBS) $(DBUS_LIBS) $(GTK_LIBS) $(CONFUSE_LIBS) $(GLADE_LIBS)
+CFLAGS = -g -O2 -Wall $(DBUS_CFLAGS) $(GTK_CFLAGS) $(CONFUSE_CFLAGS) $(GLADE_CFLAGS)
+LDFLAGS = -lpthread $(DBUS_LIBS) $(GTK_LIBS) $(CONFUSE_LIBS) $(GLADE_LIBS)
 
-SOURCES = gpomme.c theme.c audio.c conffile.c ../dbus-client/dbus-client.c
+SOURCES = gpomme.c theme.c conffile.c ../dbus-client/dbus-client.c
 POFILES = po/fr.po po/de.po po/es.po po/it.po
 
 OBJS = $(SOURCES:%.c=%.o)
@@ -33,12 +27,10 @@
 
 gpomme: $(OBJS) $(LIBS)
 
-gpomme.o: gpomme.c gpomme.h theme.h audio.h ../dbus-client/dbus-client.h
+gpomme.o: gpomme.c gpomme.h theme.h ../dbus-client/dbus-client.h
 
 theme.o: theme.c theme.h gpomme.h
 
-audio.o: audio.c audio.h gpomme.h
-
 conffile.o: conffile.c conffile.h gpomme.h theme.h
 
 ../dbus-client/dbus-client.o: ../dbus-client/dbus-client.c ../dbus-client/dbus-client.h

Deleted: trunk/gpomme/audio.c
===================================================================
--- trunk/gpomme/audio.c	2007-11-09 12:59:40 UTC (rev 370)
+++ trunk/gpomme/audio.c	2007-11-09 13:09:48 UTC (rev 371)
@@ -1,333 +0,0 @@
-/*
- * gpomme - GTK application for use with pommed
- *
- * $Id$
- *
- * Copyright (C) 2006 Soeren SONNENBURG <debian at nn7.de>
- * Copyright (C) 2006-2007 Julien BLACHE <jb at jblache.org>
- *
- * Portions of the code below were shamelessly
- * stolen from pbbuttonsd. Thanks ! ;-)
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; version 2 of the License.
- *
- * This program 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 General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License along
- * with this program; if not, write to the Free Software Foundation, Inc.,
- * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
- */
-
-
-#include <stdio.h>
-#include <limits.h>
-
-#include <pthread.h>
-
-#define NDEBUG
-#include <alsa/asoundlib.h>
-
-#include <audiofile.h>
-
-#include "gpomme.h"
-#include "audio.h"
-
-
-struct dspdata _dsp;
-
-/*
- * This code is also used in pommed/beep.c.
- * If you find a bug in the code below, please fix it in pommed too.
- */
-
-
-/* Called from the main thread */
-static struct sample *
-load_sample(char *theme, char *name)
-{
-  AFfilehandle affd;     /* filehandle for soundfile from libaudiofile */
-  AFframecount framecount;
-  int dummy, channels, byteorder, framesize, precision, err = 0;
-  struct sample *sample;
-
-  char file[PATH_MAX];
-  int ret;
-
-  ret = snprintf(file, PATH_MAX, "%s/%s/%s", THEME_BASE, theme, name);
-  if (ret >= PATH_MAX)
-    return NULL;
-
-  sample = (struct sample *) malloc(sizeof(struct sample));
-  if (sample == NULL)
-    return NULL;
-
-  affd = afOpenFile(file, "r", 0);
-  if (affd > 0)
-    {
-      afGetSampleFormat(affd, AF_DEFAULT_TRACK, &dummy, &precision);
-      channels = afGetChannels(affd, AF_DEFAULT_TRACK);
-      byteorder = afGetVirtualByteOrder(affd, AF_DEFAULT_TRACK);
-      framesize = (int) afGetFrameSize(affd, AF_DEFAULT_TRACK, 0);
-      framecount = afGetFrameCount(affd, AF_DEFAULT_TRACK);
-      sample->speed = (int) afGetRate(affd, AF_DEFAULT_TRACK);
-
-      if (channels <= 2)
-	sample->channels = channels;
-      else
-	err = -1;
-
-      if (precision == 8)
-	sample->format = SND_PCM_FORMAT_S8;
-      else if (precision == 16)
-	{
-	  if (byteorder == AF_BYTEORDER_LITTLEENDIAN)
-	    sample->format = SND_PCM_FORMAT_S16_LE;
-	  else
-	    sample->format = SND_PCM_FORMAT_S16_BE;
-	}
-      else
-	err = -1;
-
-      if (err == 0)
-	{
-	  sample->framesize = framesize;
-	  sample->framecount = framecount;
-	  sample->audiodatalen = framecount * framesize;
-
-	  sample->audiodata = (char *) malloc(sample->audiodatalen);
-	  if (sample->audiodata != NULL)
-	    {
-	      ret = afReadFrames(affd, AF_DEFAULT_TRACK, sample->audiodata, framecount);
-	      if (ret != framecount)
-		{
-		  free(sample->audiodata);
-		  err = -1;
-		}
-	    }
-	  else
-	    ret = -1;
-	}
-      afCloseFile(affd);
-    }
-
-  if (err == -1)
-    {
-      free(sample);
-      return NULL;
-    }
-
-  sample->periods = sample->framesize;
-  sample->buffersize = (sample->periods * 8192) >> 2;
-
-  return sample;
-}
-
-
-/* Called from the audio thread */
-static void
-play_sample(struct dspdata *dsp, int cmd)
-{
-  snd_pcm_t *pcm_handle;          
-  snd_pcm_hw_params_t *hwparams;
-
-  char *pcm_name = "default";
-
-  struct sample *s = dsp->sample[cmd];
-
-  snd_pcm_hw_params_alloca(&hwparams);
-
-  if (snd_pcm_open(&pcm_handle, pcm_name, SND_PCM_STREAM_PLAYBACK, 0) < 0)
-    {
-      fprintf(stderr, "Error opening PCM device %s\n", pcm_name);
-      return;
-    }
-
-  if (snd_pcm_hw_params_any(pcm_handle, hwparams) < 0)
-    {
-      fprintf(stderr, "Can not configure this PCM device.\n");
-      return;
-    }
-
-  if (snd_pcm_hw_params_set_access(pcm_handle, hwparams, SND_PCM_ACCESS_RW_INTERLEAVED) < 0)
-    {
-      fprintf(stderr, "Error setting access.\n");
-      return;
-    }
-
-  if (snd_pcm_hw_params_set_format(pcm_handle, hwparams, s->format) < 0)
-    {
-      fprintf(stderr, "Error setting format.\n");
-      return;
-    }
-
-  if (snd_pcm_hw_params_set_rate_near(pcm_handle, hwparams, &s->speed, 0) < 0)
-    {
-      fprintf(stderr, "Error setting rate.\n");
-      return;
-    }
-
-  /* Set number of channels */
-  if (snd_pcm_hw_params_set_channels_near(pcm_handle, hwparams, &s->channels) < 0)
-    {
-      fprintf(stderr, "Error setting channels.\n");
-      return;
-    }
-
-  /* Set number of periods. Periods used to be called fragments. */ 
-  if (snd_pcm_hw_params_set_periods_near(pcm_handle, hwparams, &s->periods, 0) < 0)
-    {
-      fprintf(stderr, "Error setting periods.\n");
-      return;
-    }
-
-  /* Set buffer size (in frames). The resulting latency is given by */
-  /* latency = periodsize * periods / (rate * bytes_per_frame)     */
-  if (snd_pcm_hw_params_set_buffer_size_near(pcm_handle, hwparams, &s->buffersize) < 0)
-    {
-      fprintf(stderr, "Error setting buffersize.\n");
-      return;
-    }
-
-  /* Apply HW parameter settings to */
-  /* PCM device and prepare device  */
-  if (snd_pcm_hw_params(pcm_handle, hwparams) < 0)
-    {
-      fprintf(stderr, "Error setting HW params.\n");
-      return;
-    }
-
-  int pcmreturn;
-  /* Write num_frames frames from buffer data to    */ 
-  /* the PCM device pointed to by pcm_handle.       */
-  /* Returns the number of frames actually written. */
-  while ((pcmreturn = snd_pcm_writei(pcm_handle, s->audiodata, s->framecount)) < 0)
-    {
-      snd_pcm_prepare(pcm_handle);
-      fprintf(stderr, "<<<<<<<<<<<<<<< Buffer Underrun >>>>>>>>>>>>>>>\n");
-    }
-
-  /* Stop PCM device and drop pending frames */
-  snd_pcm_drop(pcm_handle);
-
-  /* Stop PCM device after pending frames have been played */ 
-  if (snd_pcm_close(pcm_handle) < 0)
-    {
-      fprintf(stderr, "snd_pcm_close error\n");
-      return;
-    }
-}
-
-
-/* Called from the audio thread
- * Audio thread main loop
- */
-void *
-audio_thread (void *arg)
-{
-  struct dspdata *dsp = (struct dspdata *) arg;
-  for (;;)
-    {
-      pthread_mutex_lock(&dsp->mutex);
-      pthread_cond_wait(&dsp->cond, &dsp->mutex);
-      pthread_mutex_unlock(&dsp->mutex);
-
-      switch (dsp->command)
-	{
-	  case AUDIO_CLICK:
-	    dsp->command = AUDIO_COMMAND_NONE;
-
-	    play_sample(dsp, AUDIO_CLICK);
-	    break;
-	  case AUDIO_COMMAND_QUIT:
-	    pthread_exit(NULL);
-	    break;
-	  case AUDIO_COMMAND_NONE:
-	    break;
-	}
-    }
-
-  return NULL;
-}
-
-
-/* Called from the main thread
- * This function wakes the audio thread
- */
-void
-audio_command(int command)
-{
-  if (!_dsp.sample)
-    return;
-
-  pthread_mutex_lock(&(_dsp.mutex));
-
-  _dsp.command = command;
-
-  pthread_cond_signal(&(_dsp.cond));
-  pthread_mutex_unlock(&(_dsp.mutex));
-}
-
-
-/* Called from the main thread */
-void
-audio_cleanup(void)
-{
-  int i;
-
-  if (!_dsp.sample)
-    return;
-
-  for (i = 0; i < AUDIO_N; i++)
-    {
-      if (_dsp.sample[i] == NULL)
-	continue;
-
-      if (_dsp.sample[i]->audiodata != NULL)
-	free(_dsp.sample[i]->audiodata);
-
-      free(_dsp.sample[i]);
-    }
-
-  pthread_mutex_destroy(&(_dsp.mutex));
-  pthread_cond_destroy(&(_dsp.cond));
-}
-
-/* Called from the main thread
- * This function sets up the sound playing thread.
- * It starts the thread or if an error occur cleans
- * up all the audio stuff
- */
-int
-audio_init_thread(void)
-{
-  pthread_attr_t attr;
-  int ret;
-
-  _dsp.sample[AUDIO_CLICK] = load_sample("CrystalLarge", "click.wav");
-
-  if (_dsp.sample[AUDIO_CLICK] == NULL)
-    return -1;
-
-  _dsp.thread = 0;
-
-  pthread_mutex_init(&(_dsp.mutex), NULL);
-  pthread_cond_init (&(_dsp.cond), NULL);
-  pthread_attr_init(&attr);
-  pthread_attr_setdetachstate(&attr, PTHREAD_CREATE_JOINABLE);
-
-  ret = pthread_create(&(_dsp.thread), &attr, audio_thread, (void *) &_dsp);
-  if (ret != 0)
-    {
-      audio_cleanup();
-      ret = -1;
-    }
-
-  pthread_attr_destroy(&attr);
-
-  return ret;
-}

Deleted: trunk/gpomme/audio.h
===================================================================
--- trunk/gpomme/audio.h	2007-11-09 12:59:40 UTC (rev 370)
+++ trunk/gpomme/audio.h	2007-11-09 13:09:48 UTC (rev 371)
@@ -1,46 +0,0 @@
-/*
- * $Id$
- */
-
-#ifndef __AUDIO_H__
-#define __AUDIO_H__
-
-struct sample {
-  char *audiodata;
-  int audiodatalen;
-  int format;
-  unsigned int channels;
-  unsigned int speed;
-  unsigned int framesize;
-  int framecount;
-  unsigned int periods;
-  unsigned long buffersize;
-};
-
-enum {
-  AUDIO_COMMAND_NONE = -2,
-  AUDIO_COMMAND_QUIT = -1,
-  AUDIO_CLICK = 0,
-  AUDIO_N /* keep this one last */
-};
-
-struct dspdata {
-  int command;
-  pthread_mutex_t mutex;
-  pthread_cond_t cond;
-  pthread_t thread;
-  struct sample *sample[AUDIO_N];   /* sound to play */
-};
-
-
-void
-audio_command(int command);
-
-void
-audio_cleanup(void);
-
-int
-audio_init_thread(void);
-
-
-#endif /* !__AUDIO_H__ */

Modified: trunk/gpomme/gpomme.c
===================================================================
--- trunk/gpomme/gpomme.c	2007-11-09 12:59:40 UTC (rev 370)
+++ trunk/gpomme/gpomme.c	2007-11-09 13:09:48 UTC (rev 371)
@@ -41,7 +41,6 @@
 
 #include "gpomme.h"
 #include "theme.h"
-#include "audio.h"
 #include "conffile.h"
 
 #include "../dbus-client/dbus-client.h"
@@ -373,10 +372,7 @@
 	  ratio = (double)cur / (double)max;
 
 	  if (!mbp.muted)
-	    {
-	      show_window(IMG_AUDIO_VOL_ON, _("Sound volume"), ratio);
-	      audio_command(AUDIO_CLICK);
-	    }
+	    show_window(IMG_AUDIO_VOL_ON, _("Sound volume"), ratio);
 	  else
 	    show_window(IMG_AUDIO_VOL_OFF, _("Sound volume (muted)"), ratio);
 	}
@@ -515,22 +511,14 @@
   signal(SIGINT, sig_int_term_handler);
   signal(SIGTERM, sig_int_term_handler);
 
-  ret = audio_init_thread();
-  if (ret < 0)
-    printf("Failed to create audio thread\n");
-
   create_window();
 
   g_timeout_add(100, mbp_check_events, NULL);
 
   gtk_main();
 
-
   close(cfg_ifd);
 
-  audio_command(AUDIO_COMMAND_QUIT);
-  audio_cleanup();
-
   mbp_dbus_cleanup();
 
   return 0;

Deleted: trunk/gpomme/themes/CrystalLarge/click.wav
===================================================================
(Binary files differ)

Deleted: trunk/gpomme/themes/KStyle/click.wav
===================================================================
(Binary files differ)

Deleted: trunk/gpomme/themes/Tango/click.wav
===================================================================
(Binary files differ)

Deleted: trunk/gpomme/themes/elegant-bright/click.wav
===================================================================
(Binary files differ)

Deleted: trunk/gpomme/themes/elegant-dark/click.wav
===================================================================
(Binary files differ)

Modified: trunk/pommed/Makefile
===================================================================
--- trunk/pommed/Makefile	2007-11-09 12:59:40 UTC (rev 370)
+++ trunk/pommed/Makefile	2007-11-09 13:09:48 UTC (rev 371)
@@ -1,4 +1,4 @@
-ARCH ?= $(shell uname -m)
+#ARCH ?= $(shell uname -m)
 
 CC = gcc
 
@@ -17,6 +17,7 @@
 CFLAGS = -g -O2 -Wall $(DBUS_CFLAGS) $(ALSA_CFLAGS) $(AUDIOFILE_CFLAGS) $(CONFUSE_CFLAGS)
 
 ifeq ($(ARCH), ppc)
+CFLAGS += -D__powerpc__
 OFLIB ?=
 
 LDFLAGS = -lz $(DBUS_LIBS) $(ALSA_LIBS) $(AUDIOFILE_LIBS) $(CONFUSE_LIBS)




More information about the Pommed-commits mailing list