You are not logged in.
@Lyceuhns
playlist_column_widths=1;1;1;623;
Why not manually set your columns in the conrc to something other than 1? So you can actually see them
Offline
$ amixer scontrols
Simple mixer control 'IEC958',0
Simple mixer control 'IEC958 Multi',0
Simple mixer control 'IEC958 Multi',1
Simple mixer control 'IEC958',1
Simple mixer control 'Delta IEC958 Input Status',0
Simple mixer control 'H/W',0
Simple mixer control 'H/W',1
Simple mixer control 'H/W',2
Simple mixer control 'H/W',3
Simple mixer control 'H/W',4
Simple mixer control 'H/W',5
Simple mixer control 'H/W',6
Simple mixer control 'H/W',7
Simple mixer control 'H/W Multi',0
Simple mixer control 'H/W Multi',1
Simple mixer control 'H/W Multi',2
Simple mixer control 'H/W Multi',3
Simple mixer control 'H/W Multi',4
Simple mixer control 'H/W Multi',5
Simple mixer control 'H/W Multi',6
Simple mixer control 'H/W Multi',7
Simple mixer control 'Multi',0
Simple mixer control 'Multi',1
Simple mixer control 'Multi',2
Simple mixer control 'Multi',3
Simple mixer control 'Multi',4
Simple mixer control 'Multi',5
Simple mixer control 'Multi',6
Simple mixer control 'Multi',7
Simple mixer control 'Multi',8
Simple mixer control 'Multi',9
Simple mixer control 'Multi Track Internal Clock',0
Simple mixer control 'Multi Track Internal Clock Default',0
Simple mixer control 'Multi Track Peak',0
Simple mixer control 'Multi Track Rate Locking',0
Simple mixer control 'Multi Track Rate Reset',0
Simple mixer control 'Multi Track Volume Rate',0
Simple mixer control 'Word Clock Status',0
Simple mixer control 'Word Clock Sync',0Modprobe Conf ---------------------------------------------
alias snd-card-0 snd-hda-intel
alias snd-card-1 snd-cmipci
options snd-cmipci id="first" mpu_port=0x330
alias sound-slot-0 snd-card-0
alias sound-slot-1 snd-card-1Proc Asound -----------------------------------------------
Advanced Linux Sound Architecture Driver Version 1.0.14 (Thu May 31 09:03:25 2007 UTC).
0 [M1010 ]: ICE1712 - M Audio Delta 1010
M Audio Delta 1010 at 0x4080, irq 18
0: [ 0] : control
1: : sequencer
8: [ 0- 0]: raw midi
16: [ 0- 0]: digital audio playback
24: [ 0- 0]: digital audio capture
33: : timer
00-00: ICE1712 multi : ICE1712 multi : playback 1 : capture 1
Client info
cur clients : 3
peak clients : 3
max clients : 192Client 0 : "System" [Kernel]
Port 0 : "Timer" (Rwe-)
Port 1 : "Announce" (R-e-)
Connecting To: 15:0
Client 15 : "OSS sequencer" [Kernel]
Port 0 : "Receiver" (-we-)
Connected From: 0:1
Client 16 : "M Audio Delta 1010" [Kernel]
Port 0 : "M Audio Delta 1010 MIDI" (RWeX)Dev Snd ---------------------------------------------------
controlC0 midiC0D0 pcmC0D0c pcmC0D0p seq timerCPU -------------------------------------------------------
model name : Intel(R) XEON(TM) CPU 2.40GHz
cpu MHz : 2394.301
model name : Intel(R) XEON(TM) CPU 2.40GHz
cpu MHz : 2394.301RAM -------------------------------------------------------
MemTotal: 2062700 kB
SwapTotal: 1024120 kBHardware --------------------------------------------------
00:00.0 Host bridge: Intel Corporation 82860 860 (Wombat) Chipset Host Bridge (MCH) (rev 04)
04:06.0 Multimedia audio controller: VIA Technologies Inc. ICE1712 [Envy24] PCI Multi-Channel I/O Controller (rev 02)
This page has information on how to map OSS mixers to ALSA mixers, with specific information for your sound card.
http://alsa.opensrc.org/Mapping_oss_mix … alsa_mixer
Offline
Here is a patch I wrote that saves the windows size, and sets up defaults if there are none. I tried to stick to your code style where possible.
I set 640x480 as the minimum window size but it could be anything since after the first resize its set. You could also set a max size incase for some reason someone made the window bigger than their screen I guess.
Edit: Removed some comments.
diff -aur trunk/src/consonance.c trunk.new/src/consonance.c
--- trunk/src/consonance.c 2008-06-15 00:00:50.513798406 +1200
+++ trunk.new/src/consonance.c 2008-06-15 00:01:42.377308115 +1200
@@ -1616,6 +1616,10 @@
g_signal_connect(G_OBJECT(cwin->mainwindow), "delete_event", G_CALLBACK(exit_gui), cwin);
g_signal_connect(G_OBJECT(cwin->mainwindow), "destroy", G_CALLBACK(exit_consonance), cwin);
+ /* Set Default Size */
+
+ gtk_window_set_default_size(GTK_WINDOW(cwin->mainwindow), cwin->cpref->window_width, cwin->cpref->window_height );
+
/* Systray */
create_status_icon(cwin);
@@ -1743,13 +1747,14 @@
osd_f,
shuffle_f,
repeat_f,
+ window_size_f,
all_f;
gsize cnt = 0, i;
CDEBUG("(%s): Initializing configuration", __func__);
libs_f = columns_f = nodes_f = cur_lib_view_f = FALSE;
- hidden_f = album_f = osd_f = shuffle_f = repeat_f = all_f = FALSE;
+ window_size_f = hidden_f = album_f = osd_f = shuffle_f = repeat_f = all_f = FALSE;
home = g_get_home_dir();
condir = g_strdup_printf("%s%s", home, "/.consonance");
@@ -1881,6 +1886,32 @@
nodes_f = TRUE;
}
+ /* Retrieve window size */
+
+ cwin->cpref->window_width = g_key_file_get_integer(cwin->cpref->configrc_keyfile,
+ GROUP_GENERAL,
+ KEY_WINDOW_WIDTH,
+ &error);
+
+ cwin->cpref->window_height = g_key_file_get_integer(cwin->cpref->configrc_keyfile,
+ GROUP_GENERAL,
+ KEY_WINDOW_HEIGHT,
+ &error);
+
+ if (error) {
+ g_error_free(error);
+ error = NULL;
+ window_size_f = TRUE;
+ }
+ else {
+ if (cwin->cpref->window_height < WINDOW_MIN_HEIGHT) {
+ cwin->cpref->window_height = WINDOW_MIN_HEIGHT;
+ }
+ if (cwin->cpref->window_width < (gint )WINDOW_MIN_WIDTH) {
+ cwin->cpref->window_width = WINDOW_MIN_WIDTH;
+ }
+ }
+
/* Retrieve library view order */
cwin->cpref->cur_library_view =
@@ -1992,6 +2023,10 @@
cwin->cpref->shuffle = FALSE;
if (all_f || repeat_f)
cwin->cpref->repeat = FALSE;
+ if (all_f || window_size_f) {
+ cwin->cpref->window_width = WINDOW_MIN_WIDTH;
+ cwin->cpref->window_height = WINDOW_MIN_HEIGHT;
+ }
/* Cleanup */
diff -aur trunk/src/consonance.h trunk.new/src/consonance.h
--- trunk/src/consonance.h 2008-06-15 00:00:50.517130394 +1200
+++ trunk.new/src/consonance.h 2008-06-15 00:01:45.241309228 +1200
@@ -94,6 +94,12 @@
#define KEY_PLAYLIST_COLUMN_WIDTHS "playlist_column_widths"
#define KEY_LIBRARY_TREE_NODES "library_tree_nodes"
#define KEY_LIBRARY_VIEW_ORDER "library_view_order"
+// Window Size
+#define KEY_WINDOW_WIDTH "window_width"
+#define KEY_WINDOW_HEIGHT "window_height"
+
+#define WINDOW_MIN_WIDTH 640
+#define WINDOW_MIN_HEIGHT 480
/* Current playlist movement */
@@ -266,6 +272,8 @@
GtkWidget *album_art; /* Album art widget */
GtkWidget *osd; /* OSD */
GtkWidget *library_view; /* Library list widget */
+ gint window_width; /* Window Width */
+ gint window_height; /* Window Height */
};
struct musicobject {
diff -aur trunk/src/pref.c trunk.new/src/pref.c
--- trunk/src/pref.c 2008-06-15 00:00:50.517130394 +1200
+++ trunk.new/src/pref.c 2008-06-15 00:01:50.747125053 +1200
@@ -243,6 +243,22 @@
KEY_SHOW_OSD,
cwin->cpref->show_osd);
+ /* Window Size Options */
+ gtk_window_get_size(GTK_WINDOW(cwin->mainwindow), &cwin->cpref->window_width, &cwin->cpref->window_height);
+ g_key_file_set_integer(cwin->cpref->configrc_keyfile,
+ GROUP_GENERAL,
+ KEY_WINDOW_WIDTH,
+ cwin->cpref->window_width);
+
+ g_key_file_set_integer(cwin->cpref->configrc_keyfile,
+ GROUP_GENERAL,
+ KEY_WINDOW_HEIGHT,
+ cwin->cpref->window_height);
+
/* List of libraries */
if (cwin->cpref->library_dir) {
Last edited by shazeal (2008-06-14 23:00:37)
Offline
Here is a patch I wrote that saves the windows size, and sets up defaults if there are none. I tried to stick to your code style where possible.
I set 640x480 as the minimum window size but it could be anything since after the first resize its set. You could also set a max size incase for some reason someone made the window bigger than their screen I guess.
Thanks for the patch. I have made a few changes and committed it to SVN trunk,
Please check if everything works !
Offline
Just updated it, yup works great thank you, no more cursing on startup
Offline
Are you running ARCH i686 or x86_64 ?
i686
@Lyceuhns
playlist_column_widths=1;1;1;623;
Why not manually set your columns in the conrc to something other than 1? So you can actually see them
I posted once about this, and i did just delete the 'conrc', and everything worked fine again.
But it's happen again, so i'm reporting and waiting to solve this if possible (in a peace way XD ).
And the window size it's save! \o/
Very nice, thanks.
Offline
Patch to fix column size incorrect in conrc, and allows OSS playback (but no mixer controls inside consonance) this is experimental, tested with OSS via ALSA only. Need some setting in the configure script to allow usage of OSS mixer.
I am looking at non standard mixer controls (ie ones other than PCM) as well.
diff -aur trunk/src/consonance.c trunk.new/src/consonance.c
--- trunk/src/consonance.c 2008-06-18 22:17:19.263531054 +1200
+++ trunk.new/src/consonance.c 2008-06-18 22:04:13.939441449 +1200
@@ -1753,13 +1753,14 @@
shuffle_f,
repeat_f,
window_size_f,
+ audio_driver_f,
all_f;
gsize cnt = 0, i;
CDEBUG("(%s): Initializing configuration", __func__);
libs_f = columns_f = nodes_f = cur_lib_view_f = FALSE;
- hidden_f = album_f = osd_f = shuffle_f = repeat_f = window_size_f = all_f = FALSE;
+ hidden_f = album_f = osd_f = shuffle_f = repeat_f = window_size_f = audio_driver_f = all_f = FALSE;
home = g_get_home_dir();
condir = g_strdup_printf("%s%s", home, "/.consonance");
@@ -1809,6 +1810,19 @@
error = NULL;
}
+ /* Retrieve Audio driver */
+
+ cwin->cpref->audio_driver = g_key_file_get_string(cwin->cpref->configrc_keyfile,
+ GROUP_AUDIO,
+ KEY_AUDIO_DRIVER,
+ &error);
+
+ if (!cwin->cpref->audio_driver) {
+ g_error_free(error);
+ error = NULL;
+ audio_driver_f = TRUE;
+ }
+
/* Retrieve window size */
win_size = g_key_file_get_integer_list(cwin->cpref->configrc_keyfile,
@@ -1878,7 +1892,13 @@
if (col_widths) {
for (i=0; i<cnt; i++) {
- cwin->cpref->playlist_column_widths = g_slist_append(cwin->cpref->playlist_column_widths,
+ // break out if the column size is too small and reset to defaults
+ if (col_widths[i] < 50) {
+ col_widths_f = TRUE;
+ break;
+ }
+ else
+ cwin->cpref->playlist_column_widths = g_slist_append(cwin->cpref->playlist_column_widths,
GINT_TO_POINTER(col_widths[i]));
}
g_free(col_widths);
@@ -1989,6 +2009,10 @@
/* Fill up with failsafe defaults */
+ if (all_f || audio_driver_f) {
+ // default system configured audio eg. /etc/libao.conf
+ cwin->cpref->audio_driver = "default";
+ }
if (all_f || window_size_f) {
cwin->cpref->window_width = MIN_WINDOW_WIDTH;
cwin->cpref->window_height = MIN_WINDOW_HEIGHT;
@@ -2062,13 +2086,29 @@
static void init_audio_mixer(struct con_win *cwin)
{
CDEBUG("(%s): Initializing audio mixer", __func__);
-
- cwin->cmixer->set_volume = alsa_set_volume;
- cwin->cmixer->inc_volume = alsa_inc_volume;
- cwin->cmixer->dec_volume = alsa_dec_volume;
- cwin->cmixer->init_mixer = alsa_init_mixer;
- cwin->cmixer->deinit_mixer = alsa_deinit_mixer;
- cwin->cmixer->mute_mixer = alsa_mute_mixer;
+ if (strcmp(cwin->cpref->audio_driver, "alsa")==0) {
+ cwin->cmixer->set_volume = alsa_set_volume;
+ cwin->cmixer->inc_volume = alsa_inc_volume;
+ cwin->cmixer->dec_volume = alsa_dec_volume;
+ cwin->cmixer->init_mixer = alsa_init_mixer;
+ cwin->cmixer->deinit_mixer = alsa_deinit_mixer;
+ cwin->cmixer->mute_mixer = alsa_mute_mixer;
+ }
+ else if (strcmp(cwin->cpref->audio_driver, "oss")==0) {
+ cwin->cmixer->set_volume = oss_set_volume;
+ cwin->cmixer->inc_volume = oss_inc_volume;
+ cwin->cmixer->dec_volume = oss_dec_volume;
+ cwin->cmixer->init_mixer = oss_init_mixer;
+ cwin->cmixer->deinit_mixer = oss_deinit_mixer;
+ cwin->cmixer->mute_mixer = oss_mute_mixer; }
+ else {
+ cwin->cmixer->set_volume = NULL;
+ cwin->cmixer->inc_volume = NULL;
+ cwin->cmixer->dec_volume = NULL;
+ cwin->cmixer->init_mixer = NULL;
+ cwin->cmixer->deinit_mixer = NULL;
+ cwin->cmixer->mute_mixer = NULL;
+ }
}
static gint init_audio(struct con_win *cwin)
@@ -2076,14 +2116,21 @@
gint id = 0, ret = 0;
ao_sample_format format;
ao_device *ao_dev;
+ ao_info *ao_inf;
CDEBUG("(%s): Initializing audio", __func__);
ao_initialize();
- id = ao_driver_id("alsa");
- if (id == -1) {
- g_critical("(%s): ALSA driver not found", __func__);
+ if (strcmp(cwin->cpref->audio_driver, "default")==0) {
+ id = ao_default_driver_id();
+ }
+ else {
+ id = ao_driver_id(cwin->cpref->audio_driver);
+ }
+
+ if (id == -1) {
+ g_critical("(%s): %s driver not found", __func__, cwin->cpref->audio_driver);
ao_shutdown();
ret = -1;
goto bad1;
@@ -2105,13 +2152,26 @@
ret = -1;
goto bad1;
}
-
+ else {
+ // update the audio driver short name incase the "default" option was used
+ ao_inf = ao_dev->funcs->driver_info();
+ if (ao_inf != NULL) {
+ cwin->cpref->audio_driver = ao_inf->short_name;
+ }
+ }
init_audio_mixer(cwin);
- if (cwin->cmixer->init_mixer(cwin) == -1) {
- ret = -1;
- goto bad2;
- }
+ // check for supported mixer first then init
+ if (cwin->cmixer->init_mixer!=NULL) {
+ if (cwin->cmixer->init_mixer(cwin) == -1) {
+ ret = -1;
+ goto bad2;
+ }
+ }
+ else {
+ ret = -1;
+ goto bad2;
+ }
#if 0
/* Have to really analyze this one ... */
diff -aur trunk/src/consonance.h trunk.new/src/consonance.h
--- trunk/src/consonance.h 2008-06-18 22:17:19.263531054 +1200
+++ trunk.new/src/consonance.h 2008-06-17 15:49:02.657004914 +1200
@@ -84,6 +84,7 @@
#define GROUP_GENERAL "General"
#define GROUP_LIBRARY "Library"
+#define GROUP_AUDIO "Audio"
#define KEY_INSTALLED_VERSION "installed_version"
#define KEY_LIBRARY_DIR "library_dir"
@@ -97,6 +98,7 @@
#define KEY_LIBRARY_TREE_NODES "library_tree_nodes"
#define KEY_LIBRARY_VIEW_ORDER "library_view_order"
#define KEY_WINDOW_SIZE "window_size"
+#define KEY_AUDIO_DRIVER "audio_driver"
/* Current playlist movement */
@@ -253,6 +255,7 @@
struct con_pref {
gchar *installed_version; /* Installed version from conrc */
+ gchar *audio_driver; /* Selected Audio driver */
gint window_width; /* Main window width */
gint window_height; /* Main window height */
gint cur_library_view; /* Current library view */
@@ -645,6 +648,15 @@
void alsa_dec_volume(struct con_win *cwin);
gint alsa_mute_mixer(struct con_win *cwin);
+/* OSS mixer functions */
+
+gint oss_init_mixer(struct con_win *cwin);
+void oss_deinit_mixer(struct con_win *cwin);
+void oss_set_volume(struct con_win *cwin);
+void oss_inc_volume(struct con_win *cwin);
+void oss_dec_volume(struct con_win *cwin);
+gint oss_mute_mixer(struct con_win *cwin);
+
/* Systray functions */
void show_osd(struct con_win *cwin);
diff -aur trunk/src/mixer.c trunk.new/src/mixer.c
--- trunk/src/mixer.c 2008-06-18 22:17:19.263531054 +1200
+++ trunk.new/src/mixer.c 2008-06-17 15:49:02.657004914 +1200
@@ -26,7 +26,7 @@
snd_mixer_elem_t *elem = NULL;
const gchar *elem_name = NULL;
- if (snd_mixer_open(&alsa_mixer, 0) < 0) {
+ if (snd_mixer_open(&alsa_mixer, 0) < 0) {
g_critical("(%s): Unable to open Alsa mixer", __func__);
return -1;
}
@@ -124,3 +124,36 @@
snd_mixer_free(alsa_mixer);
}
+
+/* OSS Mixer Functions */
+
+gint oss_init_mixer(struct con_win *cwin)
+{
+ // STUB
+ return 0;
+}
+
+void oss_deinit_mixer(struct con_win *cwin)
+{
+ // STUB
+}
+
+void oss_set_volume(struct con_win *cwin)
+{
+ // STUB
+}
+
+void oss_inc_volume(struct con_win *cwin)
+{
+ // STUB
+}
+
+void oss_dec_volume(struct con_win *cwin)
+{
+ // STUB
+}
+
+gint oss_mute_mixer(struct con_win *cwin)
+{
+ return 0;
+}
diff -aur trunk/src/pref.c trunk.new/src/pref.c
--- trunk/src/pref.c 2008-06-18 22:17:19.266865556 +1200
+++ trunk.new/src/pref.c 2008-06-18 22:12:42.176058459 +1200
@@ -191,7 +191,7 @@
const gchar *col_name;
gchar *data, **libs, **columns, **nodes;
gsize length;
- gint cnt = 0, i = 0, *col_widths, *window_size;
+ gint cnt = 0, i = 0, *col_widths, col_width, *window_size;
gint win_width, win_height;
GError *error = NULL;
GSList *list;
@@ -260,7 +260,14 @@
2);
g_free(window_size);
- /* List of libraries */
+ /* Sound driver */
+
+ g_key_file_set_string(cwin->cpref->configrc_keyfile,
+ GROUP_AUDIO,
+ KEY_AUDIO_DRIVER,
+ cwin->cpref->audio_driver);
+
+ /* List of libraries */
if (cwin->cpref->library_dir) {
list = cwin->cpref->library_dir;
@@ -297,10 +304,10 @@
if (cwin->cpref->playlist_columns) {
list = cwin->cpref->playlist_columns;
cnt = g_slist_length(cwin->cpref->playlist_columns);
- columns = g_new0(gchar *, cnt);
+ columns = g_new0(gchar*, cnt);
for (i=0; i<cnt; i++) {
- columns[i] = (gchar*)list->data;
+ columns[i] = (gchar *)list->data;
list = list->next;
}
@@ -321,8 +328,18 @@
for (j=cols, i=0; j != NULL; j = j->next) {
col = j->data;
col_name = gtk_tree_view_column_get_title(col);
- if (is_present_str_list(col_name, cwin->cpref->playlist_columns))
- col_widths[i++] = gtk_tree_view_column_get_width(col);
+ // get size
+ if (is_present_str_list(col_name, cwin->cpref->playlist_columns)) {
+ col_width = gtk_tree_view_column_get_width(col);
+ // incriment col number
+ // check size
+ if (col_width >= 50)
+ col_widths[i] = col_width;
+ else
+ col_widths[i] = 200;
+ i++;
+ }
}
g_key_file_set_integer_list(cwin->cpref->configrc_keyfile,
GROUP_GENERAL,
Last edited by shazeal (2008-06-18 13:50:39)
Offline
New patch, non-incremental. This includes the changes from the patch above (with some fixes) and now includes the option to change the default output driver and default mixer from the preferences menu (These options require a restart atm).
It also selects a default mixer on startup rather than bailing if it cannot find the PCM mixer (though PCM is still the prefered mixer on first startup), you will need to change the mixer option to the correct channel in the preferences.
diff -aur trunk/src/consonance.c trunk.20080619/src/consonance.c
--- trunk/src/consonance.c 2008-06-19 11:20:15.445992562 +1200
+++ trunk.20080619/src/consonance.c 2008-06-19 01:49:29.155591048 +1200
@@ -1753,13 +1753,14 @@
shuffle_f,
repeat_f,
window_size_f,
+ audio_driver_f,
all_f;
gsize cnt = 0, i;
CDEBUG("(%s): Initializing configuration", __func__);
libs_f = columns_f = nodes_f = cur_lib_view_f = FALSE;
- hidden_f = album_f = osd_f = shuffle_f = repeat_f = window_size_f = all_f = FALSE;
+ hidden_f = album_f = osd_f = shuffle_f = repeat_f = window_size_f = audio_driver_f = all_f = FALSE;
home = g_get_home_dir();
condir = g_strdup_printf("%s%s", home, "/.consonance");
@@ -1809,6 +1810,32 @@
error = NULL;
}
+ /* Retrieve Audio driver */
+
+ cwin->cpref->audio_driver = g_key_file_get_string(cwin->cpref->configrc_keyfile,
+ GROUP_AUDIO,
+ KEY_AUDIO_DRIVER,
+ &error);
+
+ if (!cwin->cpref->audio_driver) {
+ g_error_free(error);
+ error = NULL;
+ audio_driver_f = TRUE;
+ }
+
+ /* Retrieve Audio mixer */
+
+ cwin->cpref->audio_mixer = g_key_file_get_string(cwin->cpref->configrc_keyfile,
+ GROUP_AUDIO,
+ KEY_AUDIO_MIXER,
+ &error);
+
+ if (!cwin->cpref->audio_mixer) {
+ g_error_free(error);
+ error = NULL;
+ audio_driver_f = TRUE;
+ }
+
/* Retrieve window size */
win_size = g_key_file_get_integer_list(cwin->cpref->configrc_keyfile,
@@ -1878,7 +1905,13 @@
if (col_widths) {
for (i=0; i<cnt; i++) {
- cwin->cpref->playlist_column_widths = g_slist_append(cwin->cpref->playlist_column_widths,
+ // break out if the column size is too small and reset to defaults
+ if (col_widths[i] < 50) {
+ col_widths_f = TRUE;
+ break;
+ }
+ else
+ cwin->cpref->playlist_column_widths = g_slist_append(cwin->cpref->playlist_column_widths,
GINT_TO_POINTER(col_widths[i]));
}
g_free(col_widths);
@@ -1989,6 +2022,11 @@
/* Fill up with failsafe defaults */
+ if (all_f || audio_driver_f) {
+ // default system configured audio eg. /etc/libao.conf
+ cwin->cpref->audio_driver = "default";
+ cwin->cpref->audio_mixer = "PCM";
+ }
if (all_f || window_size_f) {
cwin->cpref->window_width = MIN_WINDOW_WIDTH;
cwin->cpref->window_height = MIN_WINDOW_HEIGHT;
@@ -2062,13 +2100,29 @@
static void init_audio_mixer(struct con_win *cwin)
{
CDEBUG("(%s): Initializing audio mixer", __func__);
-
- cwin->cmixer->set_volume = alsa_set_volume;
- cwin->cmixer->inc_volume = alsa_inc_volume;
- cwin->cmixer->dec_volume = alsa_dec_volume;
- cwin->cmixer->init_mixer = alsa_init_mixer;
- cwin->cmixer->deinit_mixer = alsa_deinit_mixer;
- cwin->cmixer->mute_mixer = alsa_mute_mixer;
+ if (strcmp(cwin->cpref->audio_driver, "alsa")==0) {
+ cwin->cmixer->set_volume = alsa_set_volume;
+ cwin->cmixer->inc_volume = alsa_inc_volume;
+ cwin->cmixer->dec_volume = alsa_dec_volume;
+ cwin->cmixer->init_mixer = alsa_init_mixer;
+ cwin->cmixer->deinit_mixer = alsa_deinit_mixer;
+ cwin->cmixer->mute_mixer = alsa_mute_mixer;
+ }
+ else if (strcmp(cwin->cpref->audio_driver, "oss")==0) {
+ cwin->cmixer->set_volume = oss_set_volume;
+ cwin->cmixer->inc_volume = oss_inc_volume;
+ cwin->cmixer->dec_volume = oss_dec_volume;
+ cwin->cmixer->init_mixer = oss_init_mixer;
+ cwin->cmixer->deinit_mixer = oss_deinit_mixer;
+ cwin->cmixer->mute_mixer = oss_mute_mixer; }
+ else {
+ cwin->cmixer->set_volume = NULL;
+ cwin->cmixer->inc_volume = NULL;
+ cwin->cmixer->dec_volume = NULL;
+ cwin->cmixer->init_mixer = NULL;
+ cwin->cmixer->deinit_mixer = NULL;
+ cwin->cmixer->mute_mixer = NULL;
+ }
}
static gint init_audio(struct con_win *cwin)
@@ -2076,14 +2130,27 @@
gint id = 0, ret = 0;
ao_sample_format format;
ao_device *ao_dev;
+ ao_info *ao_inf;
CDEBUG("(%s): Initializing audio", __func__);
+ // generate audio driver list
+ cwin->caudio->avail_drivers = g_slist_append(cwin->caudio->avail_drivers,
+ "alsa");
+ cwin->caudio->avail_drivers = g_slist_append(cwin->caudio->avail_drivers,
+ "oss");
+
ao_initialize();
- id = ao_driver_id("alsa");
- if (id == -1) {
- g_critical("(%s): ALSA driver not found", __func__);
+ if (strcmp(cwin->cpref->audio_driver, "default")==0) {
+ id = ao_default_driver_id();
+ }
+ else {
+ id = ao_driver_id(cwin->cpref->audio_driver);
+ }
+
+ if (id == -1) {
+ g_critical("(%s): %s driver not found", __func__, cwin->cpref->audio_driver);
ao_shutdown();
ret = -1;
goto bad1;
@@ -2105,13 +2172,26 @@
ret = -1;
goto bad1;
}
-
+ else {
+ // update the audio driver short name incase the "default" option was used
+ ao_inf = ao_dev->funcs->driver_info();
+ if (ao_inf != NULL) {
+ cwin->cpref->audio_driver = ao_inf->short_name;
+ }
+ }
init_audio_mixer(cwin);
- if (cwin->cmixer->init_mixer(cwin) == -1) {
- ret = -1;
- goto bad2;
- }
+ // check for supported mixer first then init
+ if (cwin->cmixer->init_mixer!=NULL) {
+ if (cwin->cmixer->init_mixer(cwin) == -1) {
+ ret = -1;
+ goto bad2;
+ }
+ }
+ else {
+ ret = -1;
+ goto bad2;
+ }
#if 0
/* Have to really analyze this one ... */
@@ -2198,7 +2278,11 @@
cwin->cmixer->deinit_mixer(cwin);
g_slice_free(struct con_mixer, cwin->cmixer);
- if (cwin->clibao->ao_dev) {
+ g_slist_free(cwin->caudio->avail_drivers);
+ g_slist_free(cwin->caudio->avail_mixers);
+ g_slice_free(struct con_audio, cwin->caudio);
+
+ if (cwin->clibao->ao_dev) {
CDEBUG("Freeing ao dev");
ao_close(cwin->clibao->ao_dev);
}
@@ -2333,7 +2417,9 @@
cwin->cdbase = g_slice_new0(struct con_dbase);
cwin->cmixer = g_slice_new0(struct con_mixer);
cwin->clibao = g_slice_new0(struct con_libao);
- show_debug = FALSE;
+ cwin->caudio = g_slice_new0(struct con_audio);
+
+ show_debug = FALSE;
if (init_dbus(cwin) == -1) {
g_critical("(%s): Unable to init dbus connection", __func__);
diff -aur trunk/src/consonance.h trunk.20080619/src/consonance.h
--- trunk/src/consonance.h 2008-06-19 11:20:15.452660451 +1200
+++ trunk.20080619/src/consonance.h 2008-06-19 01:39:51.238919818 +1200
@@ -84,6 +84,7 @@
#define GROUP_GENERAL "General"
#define GROUP_LIBRARY "Library"
+#define GROUP_AUDIO "Audio"
#define KEY_INSTALLED_VERSION "installed_version"
#define KEY_LIBRARY_DIR "library_dir"
@@ -97,6 +98,8 @@
#define KEY_LIBRARY_TREE_NODES "library_tree_nodes"
#define KEY_LIBRARY_VIEW_ORDER "library_view_order"
#define KEY_WINDOW_SIZE "window_size"
+#define KEY_AUDIO_DRIVER "audio_driver"
+#define KEY_AUDIO_MIXER "audio_mixer"
/* Current playlist movement */
@@ -253,6 +256,8 @@
struct con_pref {
gchar *installed_version; /* Installed version from conrc */
+ gchar *audio_driver; /* Selected Audio driver */
+ gchar *audio_mixer; /* Selected Audio mixer */
gint window_width; /* Main window width */
gint window_height; /* Main window height */
gint cur_library_view; /* Current library view */
@@ -271,6 +276,8 @@
GtkWidget *album_art; /* Album art widget */
GtkWidget *osd; /* OSD */
GtkWidget *library_view; /* Library list widget */
+ GtkWidget *a_driver; /* driver widget */
+ GtkWidget *a_mixer; /* mixer widget */
};
struct musicobject {
@@ -333,6 +340,11 @@
ao_sample_format format; /* Sample format */
};
+struct con_audio {
+ GSList *avail_drivers; /* Available Audio drivers */
+ GSList *avail_mixers; /* Available Audio mixers */
+};
+
struct con_win {
struct pixbuf *pixbuf; /* Various pixbufs */
struct con_pref *cpref; /* Preferences */
@@ -340,7 +352,8 @@
struct con_dbase *cdbase; /* Library DB */
struct con_mixer *cmixer; /* Mixer */
struct con_libao *clibao; /* libao */
- GtkWidget *mainwindow; /* Main GTK window */
+ struct con_audio *caudio; /* audio lists */
+ GtkWidget *mainwindow; /* Main GTK window */
GtkWidget *hbox_panel; /* Panel hbox */
GtkWidget *album_art_frame; /* Album art frame */
GtkWidget *album_art; /* Album art image */
@@ -645,6 +658,15 @@
void alsa_dec_volume(struct con_win *cwin);
gint alsa_mute_mixer(struct con_win *cwin);
+/* OSS mixer functions */
+
+gint oss_init_mixer(struct con_win *cwin);
+void oss_deinit_mixer(struct con_win *cwin);
+void oss_set_volume(struct con_win *cwin);
+void oss_inc_volume(struct con_win *cwin);
+void oss_dec_volume(struct con_win *cwin);
+gint oss_mute_mixer(struct con_win *cwin);
+
/* Systray functions */
void show_osd(struct con_win *cwin);
diff -aur trunk/src/mixer.c trunk.20080619/src/mixer.c
--- trunk/src/mixer.c 2008-06-19 11:20:15.445992562 +1200
+++ trunk.20080619/src/mixer.c 2008-06-19 11:13:42.409132001 +1200
@@ -19,6 +19,7 @@
static snd_mixer_t *alsa_mixer = NULL;
static snd_mixer_elem_t *alsa_elem = NULL;
+static int mixer_oss = -1;
gint alsa_init_mixer(struct con_win *cwin)
{
@@ -26,7 +27,7 @@
snd_mixer_elem_t *elem = NULL;
const gchar *elem_name = NULL;
- if (snd_mixer_open(&alsa_mixer, 0) < 0) {
+ if (snd_mixer_open(&alsa_mixer, 0) < 0) {
g_critical("(%s): Unable to open Alsa mixer", __func__);
return -1;
}
@@ -51,18 +52,24 @@
elem = snd_mixer_first_elem(alsa_mixer);
- while (elem) {
+ // default to first mixer element
+ alsa_elem = elem;
+
+ while (elem) {
if (snd_mixer_elem_get_type(elem) == SND_MIXER_ELEM_SIMPLE) {
elem_name = snd_mixer_selem_get_name(elem);
- if (!g_ascii_strcasecmp(elem_name, ALSA_MIXER_ELEM)) {
+ // store all the alsa mixer elements
+ cwin->caudio->avail_mixers = g_slist_append(cwin->caudio->avail_mixers,
+ (gchar *)elem_name);
+ if (!g_ascii_strcasecmp(elem_name, cwin->cpref->audio_mixer)) {
CDEBUG("(%s): Found ALSA elem: %s", __func__, ALSA_MIXER_ELEM);
- break;
+ alsa_elem = elem;
}
}
elem = snd_mixer_elem_next(elem);
}
- alsa_elem = elem;
- if (!alsa_elem) {
+
+ if (!alsa_elem) {
g_critical("(%s): Unable to find alsa mixer element : %s", __func__, ALSA_MIXER_ELEM);
ret = -1;
goto bad;
@@ -124,3 +131,44 @@
snd_mixer_free(alsa_mixer);
}
+
+/* OSS Mixer Functions */
+
+gint oss_init_mixer(struct con_win *cwin)
+{
+/*
+ if ((mixer_oss = open ("/dev/mixer", O_RDWR, 0)) == -1)
+ {
+ g_critical("(%s): Unable to open Alsa mixer", __func__);
+ return -1;
+ }
+*/
+ return 0;
+}
+
+void oss_deinit_mixer(struct con_win *cwin)
+{
+/*
+ close (mixer_oss);
+*/
+}
+
+void oss_set_volume(struct con_win *cwin)
+{
+ // STUB
+}
+
+void oss_inc_volume(struct con_win *cwin)
+{
+ // STUB
+}
+
+void oss_dec_volume(struct con_win *cwin)
+{
+ // STUB
+}
+
+gint oss_mute_mixer(struct con_win *cwin)
+{
+ return 0;
+}
diff -aur trunk/src/pref.c trunk.20080619/src/pref.c
--- trunk/src/pref.c 2008-06-19 11:20:15.452660451 +1200
+++ trunk.20080619/src/pref.c 2008-06-19 11:16:46.408512649 +1200
@@ -67,7 +67,16 @@
else
cwin->cpref->show_osd = FALSE;
- /* Library */
+ /* Audio Driver */
+
+ cwin->cpref->audio_driver = gtk_combo_box_get_active_text(GTK_COMBO_BOX(cwin->cpref->a_driver));
+
+
+ /* Audio Mixer */
+
+ cwin->cpref->audio_mixer = gtk_combo_box_get_active_text(GTK_COMBO_BOX(cwin->cpref->a_mixer));
+
+ /* Library */
model = gtk_tree_view_get_model(GTK_TREE_VIEW(cwin->cpref->library_view));
ret = gtk_tree_model_get_iter_first(model, &iter);
@@ -170,6 +179,34 @@
if (cwin->cpref->show_osd)
gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(cwin->cpref->osd), TRUE);
+ /* Update Audio Driver */
+ if (cwin->caudio->avail_drivers) {
+ cnt = g_slist_length(cwin->caudio->avail_drivers);
+ list = cwin->caudio->avail_drivers;
+
+ for (i=0;i<cnt; i++) {
+ gtk_combo_box_append_text (GTK_COMBO_BOX(cwin->cpref->a_driver),
+ (gchar *)list->data);
+ if (strcmp((gchar *)list->data, cwin->cpref->audio_driver)==0)
+ gtk_combo_box_set_active(GTK_COMBO_BOX(cwin->cpref->a_driver), i);
+ list = list->next;
+ }
+ }
+
+ /* Update Audio Mixer */
+ if (cwin->caudio->avail_mixers) {
+ cnt = g_slist_length(cwin->caudio->avail_mixers);
+ list = cwin->caudio->avail_mixers;
+
+ for (i=0;i<cnt; i++) {
+ gtk_combo_box_append_text (GTK_COMBO_BOX(cwin->cpref->a_mixer),
+ (gchar *)list->data);
+ if (strcmp((gchar *)list->data, cwin->cpref->audio_mixer)==0)
+ gtk_combo_box_set_active(GTK_COMBO_BOX(cwin->cpref->a_mixer), i);
+ list = list->next;
+ }
+ }
+
/* Append libraries, if any */
if (cwin->cpref->library_dir) {
@@ -191,7 +228,7 @@
const gchar *col_name;
gchar *data, **libs, **columns, **nodes;
gsize length;
- gint cnt = 0, i = 0, *col_widths, *window_size;
+ gint cnt = 0, i = 0, *col_widths, col_width, *window_size;
gint win_width, win_height;
GError *error = NULL;
GSList *list;
@@ -260,7 +297,21 @@
2);
g_free(window_size);
- /* List of libraries */
+ /* Sound driver */
+
+ g_key_file_set_string(cwin->cpref->configrc_keyfile,
+ GROUP_AUDIO,
+ KEY_AUDIO_DRIVER,
+ cwin->cpref->audio_driver);
+
+ /* Sound Mixer */
+
+ g_key_file_set_string(cwin->cpref->configrc_keyfile,
+ GROUP_AUDIO,
+ KEY_AUDIO_MIXER,
+ cwin->cpref->audio_mixer);
+
+ /* List of libraries */
if (cwin->cpref->library_dir) {
list = cwin->cpref->library_dir;
@@ -297,10 +348,10 @@
if (cwin->cpref->playlist_columns) {
list = cwin->cpref->playlist_columns;
cnt = g_slist_length(cwin->cpref->playlist_columns);
- columns = g_new0(gchar *, cnt);
+ columns = g_new0(gchar*, cnt);
for (i=0; i<cnt; i++) {
- columns[i] = (gchar*)list->data;
+ columns[i] = (gchar *)list->data;
list = list->next;
}
@@ -317,13 +368,26 @@
cols = gtk_tree_view_get_columns(GTK_TREE_VIEW(cwin->current_playlist));
cnt = g_list_length(cols);
if (cols) {
- col_widths = g_new0(gint, cnt);
- for (j=cols, i=0; j != NULL; j = j->next) {
- col = j->data;
- col_name = gtk_tree_view_column_get_title(col);
- if (is_present_str_list(col_name, cwin->cpref->playlist_columns))
- col_widths[i++] = gtk_tree_view_column_get_width(col);
- }
+ if (cwin->cpref->playlist_columns) {
+ list = cwin->cpref->playlist_column_widths;
+ col_widths = g_new0(gint, cnt);
+ for (j=cols, i=0; j != NULL; j = j->next) {
+ col = j->data;
+ col_name = gtk_tree_view_column_get_title(col);
+ // get size
+ if (is_present_str_list(col_name, cwin->cpref->playlist_columns)) {
+ col_width = gtk_tree_view_column_get_width(col);
+ // check size
+ if (col_width >= 50)
+ col_widths[i] = col_width;
+ else
+ col_widths[i] = GPOINTER_TO_INT(&list->data);
+ i++;
+ list = list->next;
+ }
+
+ }
+ }
g_key_file_set_integer_list(cwin->cpref->configrc_keyfile,
GROUP_GENERAL,
KEY_PLAYLIST_COLUMN_WIDTHS,
@@ -365,11 +429,11 @@
void preferences_dialog(struct con_win *cwin)
{
GtkWidget *vbox_general, *hbox_library;
- GtkWidget *dialog, *label_general, *label_library;
- GtkWidget *hidden_align, *album_align, *osd_align, *library_align;
- GtkWidget *hidden_files, *album_art, *osd, *library_view;
+ GtkWidget *dialog, *label_general, *label_driver, *label_mixer, *label_library;
+ GtkWidget *hidden_align, *album_align, *osd_align, *a_driver_align, *a_mixer_align, *library_align;
+ GtkWidget *hidden_files, *album_art, *a_driver, *a_mixer, *osd, *library_view;
GtkWidget *library_bbox_align, *library_bbox, *library_add, *library_remove;
- GtkListStore *library_store;
+ GtkListStore *library_store;
GtkCellRenderer *renderer;
GtkTreeViewColumn *column;
@@ -392,7 +456,15 @@
gtk_label_set_markup(GTK_LABEL(label_general), "<b>General</b>");
gtk_misc_set_alignment(GTK_MISC(label_general), 0, 0);
- label_library = gtk_label_new(NULL);
+ label_driver = gtk_label_new(NULL);
+ gtk_label_set_markup(GTK_LABEL(label_driver), "<b>Audio Driver</b> (Requires restart)");
+ gtk_misc_set_alignment(GTK_MISC(label_driver), 0, 0);
+
+ label_mixer = gtk_label_new(NULL);
+ gtk_label_set_markup(GTK_LABEL(label_mixer), "<b>Audio Mixer</b> (Requires restart)");
+ gtk_misc_set_alignment(GTK_MISC(label_mixer), 0, 0);
+
+ label_library = gtk_label_new(NULL);
gtk_label_set_markup(GTK_LABEL(label_library), "<b>Library</b>");
gtk_misc_set_alignment(GTK_MISC(label_library), 0, 0);
@@ -417,6 +489,20 @@
osd = gtk_check_button_new_with_label("Show OSD for track change");
gtk_container_add(GTK_CONTAINER(osd_align), osd);
+ /* Audio Driver */
+
+ a_driver_align = gtk_alignment_new(0,0,0,0);
+ gtk_alignment_set_padding(GTK_ALIGNMENT(a_driver_align), 0, 0, 20, 0);
+ a_driver = gtk_combo_box_new_text ();
+ gtk_container_add(GTK_CONTAINER(a_driver_align), a_driver);
+
+ /* Mixer Channel */
+
+ a_mixer_align = gtk_alignment_new(0,0,0,0);
+ gtk_alignment_set_padding(GTK_ALIGNMENT(a_mixer_align), 0, 0, 20, 0);
+ a_mixer = gtk_combo_box_new_text ();
+ gtk_container_add(GTK_CONTAINER(a_mixer_align), a_mixer);
+
/* Library List */
hbox_library= gtk_hbox_new(FALSE, 2);
@@ -487,6 +573,26 @@
FALSE,
0);
gtk_box_pack_start(GTK_BOX(vbox_general),
+ label_driver,
+ FALSE,
+ FALSE,
+ 0);
+ gtk_box_pack_start(GTK_BOX(vbox_general),
+ a_driver_align,
+ FALSE,
+ FALSE,
+ 0);
+ gtk_box_pack_start(GTK_BOX(vbox_general),
+ label_mixer,
+ FALSE,
+ FALSE,
+ 0);
+ gtk_box_pack_start(GTK_BOX(vbox_general),
+ a_mixer_align,
+ FALSE,
+ FALSE,
+ 0);
+ gtk_box_pack_start(GTK_BOX(vbox_general),
label_library,
FALSE,
FALSE,
@@ -507,6 +613,8 @@
cwin->cpref->album_art = album_art;
cwin->cpref->osd = osd;
cwin->cpref->library_view = library_view;
+ cwin->cpref->a_driver = a_driver;
+ cwin->cpref->a_mixer = a_mixer;
/* Setup signal handlers */
Offline
Remember to the save window size, what about save the current playlist?
I know there's a option to save the playlist (but it's more to personalize), i talk about x songs in playlist, and after close and open the program, the x songs, keep there, i think it's useful. My opinion.
Offline
Yay, speeeeeeed
I love it
compared to amarok ... or exaile...
You know you're paranoid when you start thinking random letters while typing a password.
A good post about vim
Python has no multithreading.
Offline
very great app dude, love it, so fast so cool, but i have a problem, i set my library folder, and rescan it, but nothings shows in library why? the statistics show this:
Total Tracks: 0
Total Artists: 88
Total Albums: 171
EDIT: the problem its only in the trunk version, i installed the stable version from AUR, add the folder and works, then open the svn version and shows the library but cannot play any file, i rescan the folder again an i got an empty library again i must use the stable version for now i guess
Last edited by IDSG (2008-06-23 17:35:33)
Offline
bump
someone is having this problem too?, please help me, the svn looks good bu t cannot use it
Last edited by IDSG (2008-06-27 18:27:08)
Offline
bump
someone is having this problem too?, please help me, the svn looks good bu t cannot use it
Try deleting your ~/.consonance and start everything again.
Good luck.
Last edited by Lyceuhns (2008-06-27 19:26:19)
Offline
IDSG wrote:bump
someone is having this problem too?, please help me, the svn looks good bu t cannot use it
Try deleting your ~/.consonance and start everything again.
Good luck.
IT WORKS , thanks dude, i feel so noob
BTW a feature request, you could add an equalizer?
Last edited by IDSG (2008-06-28 04:00:35)
Offline
This looks promising. What about a search bar?
It's a must for collections as large as mine.
Offline
This looks promising. What about a search bar?
It's a must for collections as large as mine.
I think the SVN version just have this.
What version are you trying?
Offline
I tried 0.2. Will try SVN now, thanks.
Offline
Great application.
Using SVN version at this moment.
Offline
It would be nice to see replaygain support. And it would be insane to see replaygain support like in Windows player Foobar2000. There is no linux player, that has such simple and useful replaygain functionality. Thanks.
Offline
can you implement DBus on this player?, keep up the good work
Last edited by IDSG (2008-07-07 18:17:40)
Offline
can you implement DBus on this player?, keep up the good work
Can you specify what feature you want in DBUS ?
Right now, a few operations are implemented using dbus, mainly, start, stop, resume, etc.
Offline
IDSG wrote:can you implement DBus on this player?, keep up the good work
Can you specify what feature you want in DBUS ?
Right now, a few operations are implemented using dbus, mainly, start, stop, resume, etc.
well i dont know much about this, but a dbus feature that make possible to write a current song plugin for the emesene client,
i started a thread, maybe if u want to ask more information
http://emesene.org/smf/index.php/topic, … ml#msg9729
thanks for the fast response dude, you rock
Last edited by IDSG (2008-07-08 03:12:39)
Offline
I had to add
Icon=/usr/share/consonance/data/consonance.png
to the .desktop, because
Icon=consonance.png
wasn't show any icon.
Offline
Wicked fast!
+1 for replaygain support;-)
Thanks for sharing.
VB
Offline