changeset 1150:6bafb1360398 trunk

[svn] - use global value for buffer size
author nenolod
date Sun, 04 Jun 2006 21:39:41 -0700
parents e63d783b1325
children e0fd5171cbaa
files Plugins/Output/alsa/alsa.h Plugins/Output/alsa/audio.c Plugins/Output/alsa/configure.c Plugins/Output/alsa/init.c
diffstat 4 files changed, 5 insertions(+), 31 deletions(-) [+]
line wrap: on
line diff
--- a/Plugins/Output/alsa/alsa.h	Sun Jun 04 21:32:59 2006 -0700
+++ b/Plugins/Output/alsa/alsa.h	Sun Jun 04 21:39:41 2006 -0700
@@ -25,6 +25,7 @@
 
 #include <libaudacious/util.h>
 #include <libaudacious/configdb.h>
+#include <audacious/main.h>
 #include <audacious/plugin.h>
 #include <glib/gi18n.h>
 
@@ -50,7 +51,6 @@
 	char *mixer_device;
 	int buffer_time;
 	int period_time;
-	int thread_buffer_time;
 	gboolean debug;
 	struct
 	{
--- a/Plugins/Output/alsa/audio.c	Sun Jun 04 21:32:59 2006 -0700
+++ b/Plugins/Output/alsa/audio.c	Sun Jun 04 21:39:41 2006 -0700
@@ -882,7 +882,7 @@
 	prebuffer = TRUE;
 	remove_prebuffer = FALSE;
 
-	thread_buffer_size = (guint64)alsa_cfg.thread_buffer_time * inputf->bps / 1000;
+	thread_buffer_size = (guint64)cfg.output_buffer_size * inputf->bps / 1000;
 	if (thread_buffer_size < hw_buffer_size)
 		thread_buffer_size = hw_buffer_size * 2;
 	if (thread_buffer_size < 8192)
--- a/Plugins/Output/alsa/configure.c	Sun Jun 04 21:32:59 2006 -0700
+++ b/Plugins/Output/alsa/configure.c	Sun Jun 04 21:39:41 2006 -0700
@@ -21,7 +21,7 @@
 
 static GtkWidget *configure_win = NULL;
 static GtkWidget *buffer_time_spin, *period_time_spin;
-static GtkWidget *softvolume_toggle_button, *thread_buffer_time_spin;
+static GtkWidget *softvolume_toggle_button;
 
 static GtkWidget *devices_combo, *mixer_devices_combo;
 
@@ -38,7 +38,6 @@
 	alsa_cfg.pcm_device = GET_CHARS(GTK_COMBO(devices_combo)->entry);
 	alsa_cfg.buffer_time = GET_SPIN_INT(buffer_time_spin);
 	alsa_cfg.period_time = GET_SPIN_INT(period_time_spin);
-	alsa_cfg.thread_buffer_time = GET_SPIN_INT(thread_buffer_time_spin);
 	alsa_cfg.soft_volume = GET_TOGGLE(softvolume_toggle_button);
 	alsa_cfg.mixer_card = current_mixer_card;
 	alsa_cfg.mixer_device = GET_CHARS(GTK_COMBO(mixer_devices_combo)->entry);
@@ -53,7 +52,6 @@
 
 	bmp_cfg_db_set_int(cfgfile, "ALSA", "buffer_time", alsa_cfg.buffer_time);
 	bmp_cfg_db_set_int(cfgfile, "ALSA", "period_time", alsa_cfg.period_time);
-	bmp_cfg_db_set_int(cfgfile, "ALSA", "thread_buffer_time", alsa_cfg.thread_buffer_time);
 	bmp_cfg_db_set_string(cfgfile,"ALSA","pcm_device", alsa_cfg.pcm_device);
 	bmp_cfg_db_set_int(cfgfile, "ALSA", "mixer_card", alsa_cfg.mixer_card);
 	bmp_cfg_db_set_string(cfgfile,"ALSA","mixer_device", alsa_cfg.mixer_device);
@@ -254,8 +252,7 @@
 	GtkWidget *advanced_vbox, *card_vbox;
 	GtkWidget *buffer_frame, *buffer_vbox, *buffer_table;
 	GtkWidget *card_frame, *buffer_time_label, *period_time_label;
-	GtkWidget *thread_buffer_time_label;
-	GtkObject *buffer_time_adj, *period_time_adj, *thread_buffer_time_adj;
+	GtkObject *buffer_time_adj, *period_time_adj;
 	GtkWidget *bbox, *ok, *cancel;
 
 	int mset;
@@ -411,20 +408,6 @@
 	gtk_table_set_col_spacings(GTK_TABLE(buffer_table), 5);
 	gtk_box_pack_start_defaults(GTK_BOX(buffer_vbox), buffer_table);
 
-	thread_buffer_time_label = gtk_label_new(_("Buffer time (ms):"));
-	gtk_label_set_justify(GTK_LABEL(thread_buffer_time_label), GTK_JUSTIFY_LEFT);
-	gtk_misc_set_alignment(GTK_MISC(thread_buffer_time_label), 0, 0.5);
-	gtk_table_attach(GTK_TABLE(buffer_table), thread_buffer_time_label,
-			 0, 1, 0, 1, GTK_FILL, 0, 0, 0);
-	thread_buffer_time_adj = gtk_adjustment_new(alsa_cfg.thread_buffer_time,
-						    1000, 10000, 100, 100, 100);
-	thread_buffer_time_spin =
-		gtk_spin_button_new(GTK_ADJUSTMENT(thread_buffer_time_adj), 8, 0);
-
-	gtk_widget_set_usize(thread_buffer_time_spin, 60, -1);
-	gtk_table_attach(GTK_TABLE(buffer_table), thread_buffer_time_spin,
-			 1, 2, 0, 1, 0, 0, 0, 0);
-
 	gtk_notebook_append_page(GTK_NOTEBOOK(notebook), advanced_vbox,
 				 gtk_label_new(_("Advanced settings")));
 
--- a/Plugins/Output/alsa/init.c	Sun Jun 04 21:32:59 2006 -0700
+++ b/Plugins/Output/alsa/init.c	Sun Jun 04 21:39:41 2006 -0700
@@ -16,13 +16,11 @@
  *  along with this program; if not, write to the Free Software
  *  Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
  */
+#include "audacious/main.h"
 #include "alsa.h"
 #include <dlfcn.h>
 #include <ctype.h>
 
-#define THREAD_BUFFER_TIME_MIN 1000
-#define THREAD_BUFFER_TIME_MAX 10000
-
 struct alsa_config alsa_cfg;
 
 void alsa_init(void)
@@ -32,7 +30,6 @@
 	memset(&alsa_cfg, 0, sizeof (alsa_cfg));
 	alsa_cfg.buffer_time = 500;
 	alsa_cfg.period_time = 50;
-	alsa_cfg.thread_buffer_time = 3000;
 	alsa_cfg.debug = 0;
 	alsa_cfg.vol.left = 100;
 	alsa_cfg.vol.right = 100;
@@ -48,12 +45,6 @@
 	bmp_cfg_db_get_int(cfgfile, "ALSA", "mixer_card", &alsa_cfg.mixer_card);
 	bmp_cfg_db_get_int(cfgfile, "ALSA", "buffer_time", &alsa_cfg.buffer_time);
 	bmp_cfg_db_get_int(cfgfile, "ALSA", "period_time", &alsa_cfg.period_time);
-	bmp_cfg_db_get_int(cfgfile, "ALSA", "thread_buffer_time",
-			  &alsa_cfg.thread_buffer_time);
-
-	alsa_cfg.thread_buffer_time = CLAMP(alsa_cfg.thread_buffer_time,
-					    THREAD_BUFFER_TIME_MIN,
-					    THREAD_BUFFER_TIME_MAX);
 
 	bmp_cfg_db_get_bool(cfgfile, "ALSA", "soft_volume",
 			      &alsa_cfg.soft_volume);