Enlightenment CVS committal
Author : technikolor
Project : e17
Module : apps/euphoria
Dir : e17/apps/euphoria/src
Modified Files:
callbacks.c interface.c utils.c utils.h
Log Message:
Return of the mixer.... life without it sucks ass.
===================================================================
RCS file: /cvsroot/enlightenment/e17/apps/euphoria/src/callbacks.c,v
retrieving revision 1.26
retrieving revision 1.27
diff -u -3 -r1.26 -r1.27
--- callbacks.c 14 May 2004 19:30:46 -0000 1.26
+++ callbacks.c 27 May 2004 10:49:21 -0000 1.27
@@ -1,5 +1,5 @@
/*
- * $Id: callbacks.c,v 1.26 2004/05/14 19:30:46 atmosphere Exp $
+ * $Id: callbacks.c,v 1.27 2004/05/27 10:49:21 technikolor Exp $
* vim:noexpandtab:sw=4:sts=4:ts=4
*/
@@ -156,15 +156,28 @@
}
EDJE_CB(volume_raise) {
+ int vol;
+
debug(DEBUG_LEVEL_INFO, "Raising volume\n");
+ vol = read_mixer(e);
+ set_mixer(vol + 1);
+ read_mixer(e);
+
+
/* FIXME */
ui_refresh_volume(e);
}
EDJE_CB(volume_lower) {
+ int vol;
+
debug(DEBUG_LEVEL_INFO, "Lowering volume\n");
+ vol = read_mixer(e);
+ set_mixer(vol - 1);
+ read_mixer(e);
+
/* FIXME */
ui_refresh_volume(e);
}
===================================================================
RCS file: /cvsroot/enlightenment/e17/apps/euphoria/src/interface.c,v
retrieving revision 1.17
retrieving revision 1.18
diff -u -3 -r1.17 -r1.18
--- interface.c 26 May 2004 15:26:19 -0000 1.17
+++ interface.c 27 May 2004 10:49:21 -0000 1.18
@@ -1,5 +1,5 @@
/*
- * $Id: interface.c,v 1.17 2004/05/26 15:26:19 handyande Exp $
+ * $Id: interface.c,v 1.18 2004/05/27 10:49:21 technikolor Exp $
* vim:noexpandtab:sw=4:sts=4:ts=4
*/
@@ -270,7 +270,10 @@
ecore_evas_resize(e->gui.ee, (int) edje_w, (int) edje_h);
setup_playlist(e);
+
+ read_mixer(e);
ui_refresh_volume(e);
+
if(e->playlist && e->playlist->current_item)
ui_fill_track_info(e, e->playlist->current_item);
===================================================================
RCS file: /cvsroot/enlightenment/e17/apps/euphoria/src/utils.c,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -3 -r1.2 -r1.3
--- utils.c 27 Feb 2004 21:55:33 -0000 1.2
+++ utils.c 27 May 2004 10:49:21 -0000 1.3
@@ -1,5 +1,5 @@
/*
- * $Id: utils.c,v 1.2 2004/02/27 21:55:33 tsauerbeck Exp $
+ * $Id: utils.c,v 1.3 2004/05/27 10:49:21 technikolor Exp $
* vim:noexpandtab:sw=4:sts=4:ts=4
*/
@@ -109,3 +109,95 @@
return ret;
}
+
+/************ STOLEN FROM MOC (Music on CLI) *********************/
+/* Get PCM volume, return -1 on error */
+int read_mixer(Euphoria *e) {
+ int vol;
+ int mixer_fd;
+
+ printf("DEBUG: Reading mixer\n");
+
+ mixer_fd = open ("/dev/mixer", O_RDWR);
+
+ if (mixer_fd == -1) {
+ open ("/dev/mixer0", O_RDWR);
+ }
+ if (mixer_fd == -1) {
+ printf("MIXER: Can't open mixer device\n");
+ return;
+ }
+
+ if (mixer_fd != -1) {
+ if (ioctl(mixer_fd, MIXER_READ(SOUND_MIXER_PCM), &vol) == -1)
+ printf("MIXER: Can't read from mixer\n");
+ else {
+ int return_val;
+ /* Average between left and right */
+ return_val = ((vol & 0xFF) + ((vol >> 8) & 0xFF)) / 2;
+ printf("MIXER: Returning value: %d\n", return_val);
+ close(mixer_fd);
+
+
+ /* Update the display with the volume level */
+ {
+
+ char vol_str[3];
+
+ sprintf(vol_str, "%d", (int)return_val);
+ printf("DEBUG: Setting the mixer vol: %s\n", vol_str);
+
+ edje_object_part_text_set(e->gui.edje, "vol_display_text", vol_str);
+ }
+/*
+
+ if(st_session->edje) {
+ if(return_val > 99)
+ return_val == 99;
+ if(return_val < 1)
+ edje_object_part_text_set(st_session->edje,
"vol_display_text", "--");
+ if(return_val < 10)
+ sprintf(return_val, "0%s", (int)return_val);
+
+ edje_object_part_text_set(st_session->edje,
"vol_display_text", return_val);
+ }
+*/
+ return return_val;
+ }
+ }
+
+ return -1;
+}
+
+/* Set PCM volume */
+void set_mixer(int vol){
+
+ int mixer_fd;
+
+ printf("DEBUG: Setting mixer\n");
+
+ mixer_fd = open ("/dev/mixer", O_RDWR);
+
+ if (mixer_fd == -1)
+ mixer_fd = open ("/dev/mixer0", O_RDWR);
+
+ if (mixer_fd == -1) {
+ printf("MIXER: Can't open mixer device\n");
+ return;
+ }
+
+
+ if (mixer_fd != -1) {
+ if (vol > 100)
+ vol = 100;
+ else if (vol < 0)
+ vol = 0;
+
+ vol = vol | (vol << 8);
+ if (ioctl(mixer_fd, MIXER_WRITE(SOUND_MIXER_PCM), &vol) == -1)
+ printf("DEBUG: Can't set mixer\n");
+ }
+ close(mixer_fd);
+}
+/********** END THEFT *********************************************/
+
===================================================================
RCS file: /cvsroot/enlightenment/e17/apps/euphoria/src/utils.h,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -3 -r1.2 -r1.3
--- utils.h 27 Feb 2004 21:55:33 -0000 1.2
+++ utils.h 27 May 2004 10:49:21 -0000 1.3
@@ -2,10 +2,16 @@
#define __UTILS_H
/*
- * $Id: utils.h,v 1.2 2004/02/27 21:55:33 tsauerbeck Exp $
+ * $Id: utils.h,v 1.3 2004/05/27 10:49:21 technikolor Exp $
* vim:noexpandtab:sw=4:sts=4:ts=4
*/
+
+#include <fcntl.h>
+#include <linux/soundcard.h>
+
+#include "euphoria.h"
+
typedef enum {
DEBUG_LEVEL_CRITICAL,
DEBUG_LEVEL_WARNING,
@@ -13,10 +19,14 @@
DEBUG_LEVEL_NUM
} DebugLevel;
+
char *find_theme(const char *name);
bool is_dir(const char *dir);
char *strstrip(char *str);
const char *get_login();
+void set_mixer(int vol);
+int read_mixer(Euphoria *e);
+
void debug(DebugLevel level, const char *fmt, ...);
-------------------------------------------------------
This SF.Net email is sponsored by: Oracle 10g
Get certified on the hottest thing ever to hit the market... Oracle 10g.
Take an Oracle 10g class now, and we'll give you the exam FREE.
http://ads.osdn.com/?ad_id=3149&alloc_id=8166&op=click
_______________________________________________
enlightenment-cvs mailing list
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/enlightenment-cvs