mirror of
				https://github.com/alsa-project/alsa-tools.git
				synced 2025-11-03 09:01:51 -05:00 
			
		
		
		
	envycontrol/: port from GTK2 to GTK3
This commit is contained in:
		
							parent
							
								
									64b836ed26
								
							
						
					
					
						commit
						60f1430882
					
				
					 12 changed files with 553 additions and 422 deletions
				
			
		| 
						 | 
					@ -47,7 +47,7 @@ void config_close()
 | 
				
			||||||
void config_set_stereo(GtkWidget *but, gpointer data)
 | 
					void config_set_stereo(GtkWidget *but, gpointer data)
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
  gint i=GPOINTER_TO_INT(data);
 | 
					  gint i=GPOINTER_TO_INT(data);
 | 
				
			||||||
  config_stereo[i]=GTK_TOGGLE_BUTTON(but)->active;
 | 
					  config_stereo[i]=gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(but));
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
void config_restore_stereo()
 | 
					void config_restore_stereo()
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -5,6 +5,6 @@ AC_HEADER_STDC
 | 
				
			||||||
AM_INIT_AUTOMAKE
 | 
					AM_INIT_AUTOMAKE
 | 
				
			||||||
AM_MAINTAINER_MODE([enable])
 | 
					AM_MAINTAINER_MODE([enable])
 | 
				
			||||||
 | 
					
 | 
				
			||||||
PKG_CHECK_MODULES(ENVY24CONTROL, gtk+-2.0 alsa >= 0.9.0)
 | 
					PKG_CHECK_MODULES(ENVY24CONTROL, gtk+-3.0 alsa >= 0.9.0)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
AC_OUTPUT(Makefile desktop/Makefile)
 | 
					AC_OUTPUT(Makefile desktop/Makefile)
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -19,7 +19,7 @@
 | 
				
			||||||
 | 
					
 | 
				
			||||||
#include "envy24control.h"
 | 
					#include "envy24control.h"
 | 
				
			||||||
 | 
					
 | 
				
			||||||
void control_input_callback(gpointer data, gint source, GdkInputCondition condition)
 | 
					gint control_input_callback(GIOChannel *source, GIOCondition condition, gpointer data)
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
	snd_ctl_t *ctl = (snd_ctl_t *)data;
 | 
						snd_ctl_t *ctl = (snd_ctl_t *)data;
 | 
				
			||||||
	snd_ctl_event_t *ev;
 | 
						snd_ctl_event_t *ev;
 | 
				
			||||||
| 
						 | 
					@ -29,12 +29,12 @@ void control_input_callback(gpointer data, gint source, GdkInputCondition condit
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	snd_ctl_event_alloca(&ev);
 | 
						snd_ctl_event_alloca(&ev);
 | 
				
			||||||
	if (snd_ctl_read(ctl, ev) < 0)
 | 
						if (snd_ctl_read(ctl, ev) < 0)
 | 
				
			||||||
		return;
 | 
							return FALSE;
 | 
				
			||||||
	name = snd_ctl_event_elem_get_name(ev);
 | 
						name = snd_ctl_event_elem_get_name(ev);
 | 
				
			||||||
	index = snd_ctl_event_elem_get_index(ev);
 | 
						index = snd_ctl_event_elem_get_index(ev);
 | 
				
			||||||
	mask = snd_ctl_event_elem_get_mask(ev);
 | 
						mask = snd_ctl_event_elem_get_mask(ev);
 | 
				
			||||||
	if (! (mask & (SND_CTL_EVENT_MASK_VALUE | SND_CTL_EVENT_MASK_INFO)))
 | 
						if (! (mask & (SND_CTL_EVENT_MASK_VALUE | SND_CTL_EVENT_MASK_INFO)))
 | 
				
			||||||
		return;
 | 
							return FALSE;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	switch (snd_ctl_event_elem_get_interface(ev)) {
 | 
						switch (snd_ctl_event_elem_get_interface(ev)) {
 | 
				
			||||||
	case SND_CTL_ELEM_IFACE_MIXER:
 | 
						case SND_CTL_ELEM_IFACE_MIXER:
 | 
				
			||||||
| 
						 | 
					@ -84,5 +84,6 @@ void control_input_callback(gpointer data, gint source, GdkInputCondition condit
 | 
				
			||||||
	default:
 | 
						default:
 | 
				
			||||||
		break;
 | 
							break;
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
 | 
						return TRUE;
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
										
											
												File diff suppressed because it is too large
												Load diff
											
										
									
								
							| 
						 | 
					@ -85,7 +85,7 @@ extern ice1712_eeprom_t card_eeprom;
 | 
				
			||||||
extern GtkWidget *mixer_mix_drawing;
 | 
					extern GtkWidget *mixer_mix_drawing;
 | 
				
			||||||
extern GtkWidget *mixer_clear_peaks_button;
 | 
					extern GtkWidget *mixer_clear_peaks_button;
 | 
				
			||||||
extern GtkWidget *mixer_drawing[20];
 | 
					extern GtkWidget *mixer_drawing[20];
 | 
				
			||||||
extern GtkObject *mixer_adj[20][2];
 | 
					extern GtkAdjustment *mixer_adj[20][2];
 | 
				
			||||||
extern GtkWidget *mixer_vscale[20][2];
 | 
					extern GtkWidget *mixer_vscale[20][2];
 | 
				
			||||||
extern GtkWidget *mixer_solo_toggle[20][2];
 | 
					extern GtkWidget *mixer_solo_toggle[20][2];
 | 
				
			||||||
extern GtkWidget *mixer_mute_toggle[20][2];
 | 
					extern GtkWidget *mixer_mute_toggle[20][2];
 | 
				
			||||||
| 
						 | 
					@ -108,7 +108,7 @@ extern GtkWidget *hw_master_clock_actual_rate_label;
 | 
				
			||||||
extern GtkWidget *hw_rate_locking_check;
 | 
					extern GtkWidget *hw_rate_locking_check;
 | 
				
			||||||
extern GtkWidget *hw_rate_reset_check;
 | 
					extern GtkWidget *hw_rate_reset_check;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
extern GtkObject *hw_volume_change_adj;
 | 
					extern GtkAdjustment *hw_volume_change_adj;
 | 
				
			||||||
extern GtkWidget *hw_volume_change_spin;
 | 
					extern GtkWidget *hw_volume_change_spin;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
extern GtkWidget *hw_spdif_profi_nonaudio_radio;
 | 
					extern GtkWidget *hw_spdif_profi_nonaudio_radio;
 | 
				
			||||||
| 
						 | 
					@ -151,9 +151,9 @@ extern GtkWidget *input_interface_internal;
 | 
				
			||||||
extern GtkWidget *input_interface_front_input;
 | 
					extern GtkWidget *input_interface_front_input;
 | 
				
			||||||
extern GtkWidget *input_interface_rear_input;
 | 
					extern GtkWidget *input_interface_rear_input;
 | 
				
			||||||
extern GtkWidget *input_interface_wavetable;
 | 
					extern GtkWidget *input_interface_wavetable;
 | 
				
			||||||
extern GtkObject *av_dac_volume_adj[];
 | 
					extern GtkAdjustment *av_dac_volume_adj[];
 | 
				
			||||||
extern GtkObject *av_adc_volume_adj[];
 | 
					extern GtkAdjustment *av_adc_volume_adj[];
 | 
				
			||||||
extern GtkObject *av_ipga_volume_adj[];
 | 
					extern GtkAdjustment *av_ipga_volume_adj[];
 | 
				
			||||||
extern GtkLabel *av_dac_volume_label[];
 | 
					extern GtkLabel *av_dac_volume_label[];
 | 
				
			||||||
extern GtkLabel *av_adc_volume_label[];
 | 
					extern GtkLabel *av_adc_volume_label[];
 | 
				
			||||||
extern GtkLabel *av_ipga_volume_label[];
 | 
					extern GtkLabel *av_ipga_volume_label[];
 | 
				
			||||||
| 
						 | 
					@ -238,6 +238,6 @@ void ipga_volume_adjust(GtkAdjustment *adj, gpointer data);
 | 
				
			||||||
void dac_sense_toggled(GtkWidget *togglebutton, gpointer data);
 | 
					void dac_sense_toggled(GtkWidget *togglebutton, gpointer data);
 | 
				
			||||||
void adc_sense_toggled(GtkWidget *togglebutton, gpointer data);
 | 
					void adc_sense_toggled(GtkWidget *togglebutton, gpointer data);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
void control_input_callback(gpointer data, gint source, GdkInputCondition condition);
 | 
					gint control_input_callback(GIOChannel *source, GIOCondition condition, gpointer data);
 | 
				
			||||||
void mixer_input_callback(gpointer data, gint source, GdkInputCondition condition);
 | 
					gint mixer_input_callback(GIOChannel *source, GIOCondition condition, gpointer data);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -39,7 +39,7 @@ static inline int is_update_needed(void);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
static int is_active(GtkWidget *widget)
 | 
					static int is_active(GtkWidget *widget)
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
	return GTK_TOGGLE_BUTTON(widget)->active ? 1 : 0;
 | 
						return gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(widget));
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
void master_clock_update(void)
 | 
					void master_clock_update(void)
 | 
				
			||||||
| 
						 | 
					@ -353,8 +353,8 @@ void volume_change_rate_update(void)
 | 
				
			||||||
void volume_change_rate_adj(GtkAdjustment *adj, gpointer data)
 | 
					void volume_change_rate_adj(GtkAdjustment *adj, gpointer data)
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
	int err;
 | 
						int err;
 | 
				
			||||||
	
 | 
						double adjustment_value = gtk_adjustment_get_value(adj);
 | 
				
			||||||
	snd_ctl_elem_value_set_integer(volume_rate, 0, adj->value);
 | 
						snd_ctl_elem_value_set_integer(volume_rate, 0, adjustment_value);
 | 
				
			||||||
	if ((err = snd_ctl_elem_write(ctl, volume_rate)) < 0)
 | 
						if ((err = snd_ctl_elem_write(ctl, volume_rate)) < 0)
 | 
				
			||||||
		g_print("Unable to write volume change rate: %s\n", snd_strerror(err));
 | 
							g_print("Unable to write volume change rate: %s\n", snd_strerror(err));
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
| 
						 | 
					@ -598,7 +598,7 @@ void spdif_output_toggled(GtkWidget *togglebutton, gpointer data)
 | 
				
			||||||
			page = 1;
 | 
								page = 1;
 | 
				
			||||||
		}
 | 
							}
 | 
				
			||||||
		spdif_output_write();
 | 
							spdif_output_write();
 | 
				
			||||||
		gtk_notebook_set_page(GTK_NOTEBOOK(hw_spdif_output_notebook), page);
 | 
							gtk_notebook_set_current_page(GTK_NOTEBOOK(hw_spdif_output_notebook), page);
 | 
				
			||||||
		spdif_output_update();
 | 
							spdif_output_update();
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -19,13 +19,13 @@
 | 
				
			||||||
 | 
					
 | 
				
			||||||
#include "envy24control.h"
 | 
					#include "envy24control.h"
 | 
				
			||||||
 | 
					
 | 
				
			||||||
static GdkGC *penGreenShadow[21] = { NULL, };
 | 
					static GdkRGBA *penGreenShadow[21] = { NULL, };
 | 
				
			||||||
static GdkGC *penGreenLight[21] = { NULL, };
 | 
					static GdkRGBA *penGreenLight[21] = { NULL, };
 | 
				
			||||||
static GdkGC *penOrangeShadow[21] = { NULL, };
 | 
					static GdkRGBA *penOrangeShadow[21] = { NULL, };
 | 
				
			||||||
static GdkGC *penOrangeLight[21] = { NULL, };
 | 
					static GdkRGBA *penOrangeLight[21] = { NULL, };
 | 
				
			||||||
static GdkGC *penRedShadow[21] = { NULL, };
 | 
					static GdkRGBA *penRedShadow[21] = { NULL, };
 | 
				
			||||||
static GdkGC *penRedLight[21] = { NULL, };
 | 
					static GdkRGBA *penRedLight[21] = { NULL, };
 | 
				
			||||||
static GdkPixmap *pixmap[21] = { NULL, };
 | 
					static GdkPixbuf *pixmap[21] = { NULL, };
 | 
				
			||||||
static snd_ctl_elem_value_t *peaks;
 | 
					static snd_ctl_elem_value_t *peaks;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
extern int input_channels, output_channels, pcm_output_channels, spdif_channels, view_spdif_playback;
 | 
					extern int input_channels, output_channels, pcm_output_channels, spdif_channels, view_spdif_playback;
 | 
				
			||||||
| 
						 | 
					@ -50,19 +50,14 @@ static void get_levels(int idx, int *l1, int *l2)
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
static GdkGC *get_pen(int idx, int nRed, int nGreen, int nBlue)
 | 
					static GdkRGBA *get_pen(int idx, int nRed, int nGreen, int nBlue)
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
	GdkColor *c;
 | 
					    GdkRGBA *c = g_malloc(sizeof(GdkRGBA));
 | 
				
			||||||
	GdkGC *gc;
 | 
					    c->red = nRed / 255.0;
 | 
				
			||||||
	
 | 
					    c->green = nGreen / 255.0;
 | 
				
			||||||
	c = (GdkColor *)g_malloc(sizeof(GdkColor));
 | 
					    c->blue = nBlue / 255.0;
 | 
				
			||||||
	c->red = nRed;
 | 
					    c->alpha = 1.0; // Fully opaque
 | 
				
			||||||
	c->green = nGreen;
 | 
					    return c;
 | 
				
			||||||
	c->blue = nBlue;
 | 
					 | 
				
			||||||
	gdk_color_alloc(gdk_colormap_get_system(), c);
 | 
					 | 
				
			||||||
	gc = gdk_gc_new(pixmap[idx]);
 | 
					 | 
				
			||||||
	gdk_gc_set_foreground(gc, c);
 | 
					 | 
				
			||||||
	return gc;
 | 
					 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
static int get_index(const gchar *name)
 | 
					static int get_index(const gchar *name)
 | 
				
			||||||
| 
						 | 
					@ -91,61 +86,129 @@ static void redraw_meters(int idx, int width, int height, int level1, int level2
 | 
				
			||||||
	int segs_on1 = ((segments * level1) + 128) / 255;
 | 
						int segs_on1 = ((segments * level1) + 128) / 255;
 | 
				
			||||||
	int segs_on2 = ((segments * level2) + 128) / 255;
 | 
						int segs_on2 = ((segments * level2) + 128) / 255;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    GdkPixbuf *pixbuf = pixmap[idx];
 | 
				
			||||||
 | 
					    // Create a Cairo surface from the GdkPixbuf
 | 
				
			||||||
 | 
					    cairo_surface_t *surface = gdk_cairo_surface_create_from_pixbuf(pixbuf, 0, NULL);
 | 
				
			||||||
 | 
					    // Create a Cairo context from the surface
 | 
				
			||||||
 | 
					    cairo_t *cr = cairo_create(surface);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	// g_print("segs_on1 = %i (%i), segs_on2 = %i (%i)\n", segs_on1, level1, segs_on2, level2);
 | 
						// g_print("segs_on1 = %i (%i), segs_on2 = %i (%i)\n", segs_on1, level1, segs_on2, level2);
 | 
				
			||||||
	for (seg = 0; seg < green_segments; seg++) {
 | 
						for (seg = 0; seg < green_segments; seg++) {
 | 
				
			||||||
		gdk_draw_rectangle(pixmap[idx],
 | 
							// Set the drawing color
 | 
				
			||||||
				   segs_on1 > 0 ? penGreenLight[idx] : penGreenShadow[idx],
 | 
							if (segs_on1 > 0) {
 | 
				
			||||||
				   TRUE,
 | 
							    cairo_set_source_rgb(cr, penGreenLight[idx]->red,
 | 
				
			||||||
				   6, 3 + ((segments - seg - 1) * 4),
 | 
							                             penGreenLight[idx]->green,
 | 
				
			||||||
				   segment_width,
 | 
							                             penGreenLight[idx]->blue);
 | 
				
			||||||
				   3);
 | 
							} else {
 | 
				
			||||||
 | 
							    cairo_set_source_rgb(cr, penGreenShadow[idx]->red,
 | 
				
			||||||
 | 
							                             penGreenShadow[idx]->green,
 | 
				
			||||||
 | 
							                             penGreenShadow[idx]->blue);
 | 
				
			||||||
 | 
							}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
							// Set the rectangle and draw
 | 
				
			||||||
 | 
							cairo_rectangle(cr, 6, 3 + ((segments - seg - 1) * 4), segment_width, 3);
 | 
				
			||||||
 | 
							cairo_fill(cr);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
		if (stereo)
 | 
							if (stereo)
 | 
				
			||||||
			gdk_draw_rectangle(pixmap[idx],
 | 
							{
 | 
				
			||||||
					   segs_on2 > 0 ? penGreenLight[idx] : penGreenShadow[idx],
 | 
								// Set the drawing color
 | 
				
			||||||
					   TRUE,
 | 
								if (segs_on2 > 0) {
 | 
				
			||||||
					   2 + (width / 2),
 | 
								    cairo_set_source_rgb(cr, penGreenLight[idx]->red,
 | 
				
			||||||
					   3 + ((segments - seg - 1) * 4),
 | 
								                             penGreenLight[idx]->green,
 | 
				
			||||||
					   segment_width,
 | 
								                             penGreenLight[idx]->blue);
 | 
				
			||||||
					   3);
 | 
								} else {
 | 
				
			||||||
 | 
								    cairo_set_source_rgb(cr, penGreenShadow[idx]->red,
 | 
				
			||||||
 | 
								                             penGreenShadow[idx]->green,
 | 
				
			||||||
 | 
								                             penGreenShadow[idx]->blue);
 | 
				
			||||||
 | 
								}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
								// Set the rectangle and draw
 | 
				
			||||||
 | 
								cairo_rectangle(cr, 2 + (width / 2), 3 + ((segments - seg - 1) * 4), segment_width, 3);
 | 
				
			||||||
 | 
								cairo_fill(cr);
 | 
				
			||||||
 | 
							}
 | 
				
			||||||
		segs_on1--;
 | 
							segs_on1--;
 | 
				
			||||||
		segs_on2--;
 | 
							segs_on2--;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
	for (seg = green_segments; seg < green_segments + orange_segments; seg++) {
 | 
						for (seg = green_segments; seg < green_segments + orange_segments; seg++) {
 | 
				
			||||||
		gdk_draw_rectangle(pixmap[idx],
 | 
							// Set the drawing color
 | 
				
			||||||
				   segs_on1 > 0 ? penOrangeLight[idx] : penOrangeShadow[idx],
 | 
							if (segs_on1 > 0) {
 | 
				
			||||||
				   TRUE,
 | 
							    cairo_set_source_rgb(cr, penOrangeLight[idx]->red,
 | 
				
			||||||
				   6, 3 + ((segments - seg - 1) * 4),
 | 
							                             penOrangeLight[idx]->green,
 | 
				
			||||||
				   segment_width,
 | 
							                             penOrangeLight[idx]->blue);
 | 
				
			||||||
				   3);
 | 
							} else {
 | 
				
			||||||
 | 
							    cairo_set_source_rgb(cr, penOrangeShadow[idx]->red,
 | 
				
			||||||
 | 
							                             penOrangeShadow[idx]->green,
 | 
				
			||||||
 | 
							                             penOrangeShadow[idx]->blue);
 | 
				
			||||||
 | 
							}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
							// Set the rectangle and draw
 | 
				
			||||||
 | 
							cairo_rectangle(cr, 6, 3 + ((segments - seg - 1) * 4), segment_width, 3);
 | 
				
			||||||
 | 
							cairo_fill(cr);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
		if (stereo)
 | 
							if (stereo)
 | 
				
			||||||
			gdk_draw_rectangle(pixmap[idx],
 | 
							{
 | 
				
			||||||
					   segs_on2 > 0 ? penOrangeLight[idx] : penOrangeShadow[idx],
 | 
					
 | 
				
			||||||
					   TRUE,
 | 
								// Set the drawing color
 | 
				
			||||||
					   2 + (width / 2),
 | 
								if (segs_on2 > 0) {
 | 
				
			||||||
					   3 + ((segments - seg - 1) * 4),
 | 
								    cairo_set_source_rgb(cr, penOrangeLight[idx]->red,
 | 
				
			||||||
					   segment_width,
 | 
								                             penOrangeLight[idx]->green,
 | 
				
			||||||
					   3);
 | 
								                             penOrangeLight[idx]->blue);
 | 
				
			||||||
 | 
								} else {
 | 
				
			||||||
 | 
								    cairo_set_source_rgb(cr, penOrangeShadow[idx]->red,
 | 
				
			||||||
 | 
								                             penOrangeShadow[idx]->green,
 | 
				
			||||||
 | 
								                             penOrangeShadow[idx]->blue);
 | 
				
			||||||
 | 
								}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
								// Set the rectangle and draw
 | 
				
			||||||
 | 
								cairo_rectangle(cr, 2 + (width / 2), 3 + ((segments - seg - 1) * 4), segment_width, 3);
 | 
				
			||||||
 | 
								cairo_fill(cr);
 | 
				
			||||||
 | 
							}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
		segs_on1--;
 | 
							segs_on1--;
 | 
				
			||||||
		segs_on2--;
 | 
							segs_on2--;
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
	for (seg = green_segments + orange_segments; seg < segments; seg++) {
 | 
						for (seg = green_segments + orange_segments; seg < segments; seg++) {
 | 
				
			||||||
		gdk_draw_rectangle(pixmap[idx],
 | 
					
 | 
				
			||||||
				   segs_on1 > 0 ? penRedLight[idx] : penRedShadow[idx],
 | 
							// Set the drawing color
 | 
				
			||||||
				   TRUE,
 | 
							if (segs_on1 > 0) {
 | 
				
			||||||
				   6, 3 + ((segments - seg - 1) * 4),
 | 
							    cairo_set_source_rgb(cr, penRedLight[idx]->red,
 | 
				
			||||||
				   segment_width,
 | 
							                             penRedLight[idx]->green,
 | 
				
			||||||
				   3);
 | 
							                             penRedLight[idx]->blue);
 | 
				
			||||||
 | 
							} else {
 | 
				
			||||||
 | 
							    cairo_set_source_rgb(cr, penRedShadow[idx]->red,
 | 
				
			||||||
 | 
							                             penRedShadow[idx]->green,
 | 
				
			||||||
 | 
							                             penRedShadow[idx]->blue);
 | 
				
			||||||
 | 
							}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
							// Set the rectangle and draw
 | 
				
			||||||
 | 
							cairo_rectangle(cr, 6, 3 + ((segments - seg - 1) * 4), segment_width, 3);
 | 
				
			||||||
 | 
							cairo_fill(cr);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
		if (stereo)
 | 
							if (stereo)
 | 
				
			||||||
			gdk_draw_rectangle(pixmap[idx],
 | 
							{
 | 
				
			||||||
					   segs_on2 > 0 ? penRedLight[idx] : penRedShadow[idx],
 | 
								// Set the drawing color based on segs_on2
 | 
				
			||||||
					   TRUE,
 | 
								if (segs_on2 > 0) {
 | 
				
			||||||
					   2 + (width / 2),
 | 
								    cairo_set_source_rgb(cr, penRedLight[idx]->red,
 | 
				
			||||||
					   3 + ((segments - seg - 1) * 4),
 | 
								                             penRedLight[idx]->green,
 | 
				
			||||||
					   segment_width,
 | 
								                             penRedLight[idx]->blue);
 | 
				
			||||||
					   3);
 | 
								} else {
 | 
				
			||||||
 | 
								    cairo_set_source_rgb(cr, penRedShadow[idx]->red,
 | 
				
			||||||
 | 
								                             penRedShadow[idx]->green,
 | 
				
			||||||
 | 
								                             penRedShadow[idx]->blue);
 | 
				
			||||||
 | 
								}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
								// Set the rectangle and draw
 | 
				
			||||||
 | 
								cairo_rectangle(cr, 2 + (width / 2), 3 + ((segments - seg - 1) * 4), segment_width, 3);
 | 
				
			||||||
 | 
								cairo_fill(cr);
 | 
				
			||||||
 | 
							}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
		segs_on1--;
 | 
							segs_on1--;
 | 
				
			||||||
		segs_on2--;
 | 
							segs_on2--;
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
 | 
						// Clean up the Cairo context
 | 
				
			||||||
 | 
						cairo_destroy(cr);
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
gint level_meters_configure_event(GtkWidget *widget, GdkEventConfigure *event)
 | 
					gint level_meters_configure_event(GtkWidget *widget, GdkEventConfigure *event)
 | 
				
			||||||
| 
						 | 
					@ -153,25 +216,45 @@ gint level_meters_configure_event(GtkWidget *widget, GdkEventConfigure *event)
 | 
				
			||||||
	int idx = get_index(gtk_widget_get_name(widget));
 | 
						int idx = get_index(gtk_widget_get_name(widget));
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	if (pixmap[idx] != NULL)
 | 
						if (pixmap[idx] != NULL)
 | 
				
			||||||
		gdk_pixmap_unref(pixmap[idx]);
 | 
							g_object_unref(pixmap[idx]);
 | 
				
			||||||
	pixmap[idx] = gdk_pixmap_new(widget->window,
 | 
					
 | 
				
			||||||
				     widget->allocation.width,
 | 
						cairo_surface_t *surface = gdk_window_create_similar_surface(gtk_widget_get_window(widget),
 | 
				
			||||||
				     widget->allocation.height,
 | 
						    CAIRO_FORMAT_ARGB32, gtk_widget_get_allocated_width(widget), gtk_widget_get_allocated_height(widget));
 | 
				
			||||||
				     -1);
 | 
						// Create a GdkPixbuf from the cairo surface
 | 
				
			||||||
 | 
						pixmap[idx] = gdk_pixbuf_get_from_surface(surface, 0, 0, gtk_widget_get_allocated_width(widget), gtk_widget_get_allocated_height(widget));
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	penGreenShadow[idx] = get_pen(idx, 0, 0x77ff, 0);
 | 
						penGreenShadow[idx] = get_pen(idx, 0, 0x77ff, 0);
 | 
				
			||||||
	penGreenLight[idx] = get_pen(idx, 0, 0xffff, 0);
 | 
						penGreenLight[idx] = get_pen(idx, 0, 0xffff, 0);
 | 
				
			||||||
	penOrangeShadow[idx] = get_pen(idx, 0xddff, 0x55ff, 0);
 | 
						penOrangeShadow[idx] = get_pen(idx, 0xddff, 0x55ff, 0);
 | 
				
			||||||
	penOrangeLight[idx] = get_pen(idx, 0xffff, 0x99ff, 0);
 | 
						penOrangeLight[idx] = get_pen(idx, 0xffff, 0x99ff, 0);
 | 
				
			||||||
	penRedShadow[idx] = get_pen(idx, 0xaaff, 0, 0);
 | 
						penRedShadow[idx] = get_pen(idx, 0xaaff, 0, 0);
 | 
				
			||||||
	penRedLight[idx] = get_pen(idx, 0xffff, 0, 0);
 | 
						penRedLight[idx] = get_pen(idx, 0xffff, 0, 0);
 | 
				
			||||||
	gdk_draw_rectangle(pixmap[idx],
 | 
					
 | 
				
			||||||
			   widget->style->black_gc,
 | 
						// Get the window for the widget
 | 
				
			||||||
			   TRUE,
 | 
						GdkWindow *window = gtk_widget_get_window(widget);
 | 
				
			||||||
			   0, 0,
 | 
						// Begin drawing on the window (this replaces gdk_cairo_create)
 | 
				
			||||||
			   widget->allocation.width,
 | 
						GdkDrawingContext *context = gdk_window_begin_draw_frame(window, NULL);
 | 
				
			||||||
			   widget->allocation.height);
 | 
						// Get the Cairo context from the drawing context
 | 
				
			||||||
	// g_print("configure: %i:%i\n", widget->allocation.width, widget->allocation.height);
 | 
						cairo_t *cr = gdk_drawing_context_get_cairo_context(context);
 | 
				
			||||||
	redraw_meters(idx, widget->allocation.width, widget->allocation.height, 0, 0);
 | 
						//cairo_t *cr = gdk_cairo_create(gtk_widget_get_window(widget)); //DEPRECATED
 | 
				
			||||||
 | 
						GtkAllocation allocation;
 | 
				
			||||||
 | 
						gtk_widget_get_allocation(widget, &allocation);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
						// Set the source color (black in this case)
 | 
				
			||||||
 | 
						cairo_set_source_rgb(cr, 0.0, 0.0, 0.0);  // RGB for black
 | 
				
			||||||
 | 
						// Create the rectangle with the specified dimensions
 | 
				
			||||||
 | 
						cairo_rectangle(cr, 0, 0, allocation.width, allocation.height);
 | 
				
			||||||
 | 
						// Fill the rectangle (similar to the "TRUE" parameter for filled in gdk_draw_rectangle)
 | 
				
			||||||
 | 
						cairo_fill(cr);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
						// g_print("configure: %i:%i\n", allocation.width, allocation.height);
 | 
				
			||||||
 | 
						redraw_meters(idx, allocation.width, allocation.height, 0, 0);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    gdk_window_end_draw_frame(window, NULL); // End the draw frame
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
						// Don't forget to manage memory and clean up
 | 
				
			||||||
 | 
						cairo_surface_destroy(surface);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	return TRUE;
 | 
						return TRUE;
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
| 
						 | 
					@ -181,16 +264,32 @@ gint level_meters_expose_event(GtkWidget *widget, GdkEventExpose *event)
 | 
				
			||||||
	int l1, l2;
 | 
						int l1, l2;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	get_levels(idx, &l1, &l2);
 | 
						get_levels(idx, &l1, &l2);
 | 
				
			||||||
	redraw_meters(idx, widget->allocation.width, widget->allocation.height, l1, l2);
 | 
						GtkAllocation allocation;
 | 
				
			||||||
	gdk_draw_pixmap(widget->window,
 | 
						gtk_widget_get_allocation(widget, &allocation);
 | 
				
			||||||
			widget->style->black_gc,
 | 
						redraw_meters(idx, allocation.width, allocation.height, l1, l2);
 | 
				
			||||||
			pixmap[idx],
 | 
					
 | 
				
			||||||
			event->area.x, event->area.y,
 | 
						// Get the window for the widget
 | 
				
			||||||
			event->area.x, event->area.y,
 | 
						GdkWindow *window = gtk_widget_get_window(widget);
 | 
				
			||||||
			event->area.width, event->area.height);
 | 
						// Begin drawing on the window (this replaces gdk_cairo_create)
 | 
				
			||||||
 | 
						GdkDrawingContext *context = gdk_window_begin_draw_frame(window, NULL);
 | 
				
			||||||
 | 
						// Get the Cairo context from the drawing context
 | 
				
			||||||
 | 
						cairo_t *cr = gdk_drawing_context_get_cairo_context(context);
 | 
				
			||||||
 | 
						// Convert GdkPixbuf to Cairo surface
 | 
				
			||||||
 | 
						cairo_surface_t *surface = gdk_cairo_surface_create_from_pixbuf(pixmap[idx], 0, gtk_widget_get_window(widget));
 | 
				
			||||||
 | 
						// Set the source surface to the Cairo context
 | 
				
			||||||
 | 
						cairo_set_source_surface(cr, surface, event->area.x, event->area.y);
 | 
				
			||||||
 | 
						// Define the area to draw and fill it
 | 
				
			||||||
 | 
						cairo_rectangle(cr, event->area.x, event->area.y, event->area.width, event->area.height);
 | 
				
			||||||
 | 
						cairo_fill(cr);
 | 
				
			||||||
 | 
						// Clean up the Cairo surface
 | 
				
			||||||
 | 
						cairo_surface_destroy(surface);
 | 
				
			||||||
 | 
						// End the drawing frame
 | 
				
			||||||
 | 
						gdk_window_end_draw_frame(window, context);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	return FALSE;
 | 
						return FALSE;
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					//TODO: Reduce/Remove/Refactor repeated code
 | 
				
			||||||
gint level_meters_timeout_callback(gpointer data)
 | 
					gint level_meters_timeout_callback(gpointer data)
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
	GtkWidget *widget;
 | 
						GtkWidget *widget;
 | 
				
			||||||
| 
						 | 
					@ -200,56 +299,112 @@ gint level_meters_timeout_callback(gpointer data)
 | 
				
			||||||
	for (idx = 0; idx <= pcm_output_channels; idx++) {
 | 
						for (idx = 0; idx <= pcm_output_channels; idx++) {
 | 
				
			||||||
		get_levels(idx, &l1, &l2);
 | 
							get_levels(idx, &l1, &l2);
 | 
				
			||||||
		widget = idx == 0 ? mixer_mix_drawing : mixer_drawing[idx-1];
 | 
							widget = idx == 0 ? mixer_mix_drawing : mixer_drawing[idx-1];
 | 
				
			||||||
		if (GTK_WIDGET_VISIBLE(widget) && (pixmap[idx] != NULL)) {
 | 
							if (gtk_widget_get_visible(widget) && (pixmap[idx] != NULL)) {
 | 
				
			||||||
			redraw_meters(idx, widget->allocation.width, widget->allocation.height, l1, l2);
 | 
								GtkAllocation allocation;
 | 
				
			||||||
			gdk_draw_pixmap(widget->window,
 | 
								gtk_widget_get_allocation(widget, &allocation);
 | 
				
			||||||
					widget->style->black_gc,
 | 
								redraw_meters(idx, allocation.width, allocation.height, l1, l2);
 | 
				
			||||||
					pixmap[idx],
 | 
					
 | 
				
			||||||
					0, 0,
 | 
								// Get the window for the widget
 | 
				
			||||||
					0, 0,
 | 
								GdkWindow *window = gtk_widget_get_window(widget);
 | 
				
			||||||
					widget->allocation.width, widget->allocation.height);
 | 
								// Begin drawing on the window
 | 
				
			||||||
 | 
								GdkDrawingContext *context = gdk_window_begin_draw_frame(window, NULL);
 | 
				
			||||||
 | 
								// Get the Cairo context from the drawing context
 | 
				
			||||||
 | 
								cairo_t *cr = gdk_drawing_context_get_cairo_context(context);
 | 
				
			||||||
 | 
								// Create a Cairo surface from the pixmap
 | 
				
			||||||
 | 
								cairo_surface_t *surface = gdk_cairo_surface_create_from_pixbuf(pixmap[idx], 0, window);
 | 
				
			||||||
 | 
								// Set the source surface to the pixmap (Cairo surface)
 | 
				
			||||||
 | 
								cairo_set_source_surface(cr, surface, 0, 0);
 | 
				
			||||||
 | 
								// Define the area to draw (same as the width and height of the widget)
 | 
				
			||||||
 | 
								cairo_rectangle(cr, 0, 0, allocation.width, allocation.height);
 | 
				
			||||||
 | 
								cairo_fill(cr); // Fill the rectangle with the pixmap
 | 
				
			||||||
 | 
								// Clean up the Cairo surface
 | 
				
			||||||
 | 
								cairo_surface_destroy(surface);
 | 
				
			||||||
 | 
								// End the drawing frame
 | 
				
			||||||
 | 
								gdk_window_end_draw_frame(window, context);
 | 
				
			||||||
		}
 | 
							}
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
	if (view_spdif_playback) {
 | 
						if (view_spdif_playback) {
 | 
				
			||||||
		for (idx = MAX_PCM_OUTPUT_CHANNELS + 1; idx <= MAX_OUTPUT_CHANNELS + spdif_channels; idx++) {
 | 
							for (idx = MAX_PCM_OUTPUT_CHANNELS + 1; idx <= MAX_OUTPUT_CHANNELS + spdif_channels; idx++) {
 | 
				
			||||||
			get_levels(idx, &l1, &l2);
 | 
								get_levels(idx, &l1, &l2);
 | 
				
			||||||
			widget = idx == 0 ? mixer_mix_drawing : mixer_drawing[idx-1];
 | 
								widget = idx == 0 ? mixer_mix_drawing : mixer_drawing[idx-1];
 | 
				
			||||||
			if (GTK_WIDGET_VISIBLE(widget) && (pixmap[idx] != NULL)) {
 | 
								if (gtk_widget_get_visible(widget) && (pixmap[idx] != NULL)) {
 | 
				
			||||||
				redraw_meters(idx, widget->allocation.width, widget->allocation.height, l1, l2);
 | 
									GtkAllocation allocation;
 | 
				
			||||||
				gdk_draw_pixmap(widget->window,
 | 
									gtk_widget_get_allocation(widget, &allocation);
 | 
				
			||||||
						widget->style->black_gc,
 | 
									redraw_meters(idx, allocation.width, allocation.height, l1, l2);
 | 
				
			||||||
						pixmap[idx],
 | 
					
 | 
				
			||||||
						0, 0,
 | 
								// Get the window for the widget
 | 
				
			||||||
						0, 0,
 | 
								GdkWindow *window = gtk_widget_get_window(widget);
 | 
				
			||||||
						widget->allocation.width, widget->allocation.height);
 | 
								// Begin drawing on the window
 | 
				
			||||||
 | 
								GdkDrawingContext *context = gdk_window_begin_draw_frame(window, NULL);
 | 
				
			||||||
 | 
								// Get the Cairo context from the drawing context
 | 
				
			||||||
 | 
								cairo_t *cr = gdk_drawing_context_get_cairo_context(context);
 | 
				
			||||||
 | 
								// Create a Cairo surface from the pixmap
 | 
				
			||||||
 | 
								cairo_surface_t *surface = gdk_cairo_surface_create_from_pixbuf(pixmap[idx], 0, window);
 | 
				
			||||||
 | 
								// Set the source surface to the pixmap (Cairo surface)
 | 
				
			||||||
 | 
								cairo_set_source_surface(cr, surface, 0, 0);
 | 
				
			||||||
 | 
								// Define the area to draw (same as the width and height of the widget)
 | 
				
			||||||
 | 
								cairo_rectangle(cr, 0, 0, allocation.width, allocation.height);
 | 
				
			||||||
 | 
								cairo_fill(cr); // Fill the rectangle with the pixmap
 | 
				
			||||||
 | 
								// Clean up the Cairo surface
 | 
				
			||||||
 | 
								cairo_surface_destroy(surface);
 | 
				
			||||||
 | 
								// End the drawing frame
 | 
				
			||||||
 | 
								gdk_window_end_draw_frame(window, context);
 | 
				
			||||||
			}
 | 
								}
 | 
				
			||||||
		}
 | 
							}
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
	for (idx = MAX_PCM_OUTPUT_CHANNELS + MAX_SPDIF_CHANNELS + 1; idx <= input_channels + MAX_PCM_OUTPUT_CHANNELS + MAX_SPDIF_CHANNELS; idx++) {
 | 
						for (idx = MAX_PCM_OUTPUT_CHANNELS + MAX_SPDIF_CHANNELS + 1; idx <= input_channels + MAX_PCM_OUTPUT_CHANNELS + MAX_SPDIF_CHANNELS; idx++) {
 | 
				
			||||||
		get_levels(idx, &l1, &l2);
 | 
							get_levels(idx, &l1, &l2);
 | 
				
			||||||
		widget = idx == 0 ? mixer_mix_drawing : mixer_drawing[idx-1];
 | 
							widget = idx == 0 ? mixer_mix_drawing : mixer_drawing[idx-1];
 | 
				
			||||||
		if (GTK_WIDGET_VISIBLE(widget) && (pixmap[idx] != NULL)) {
 | 
							if (gtk_widget_get_visible(widget) && (pixmap[idx] != NULL)) {
 | 
				
			||||||
			redraw_meters(idx, widget->allocation.width, widget->allocation.height, l1, l2);
 | 
								GtkAllocation allocation;
 | 
				
			||||||
			gdk_draw_pixmap(widget->window,
 | 
								gtk_widget_get_allocation(widget, &allocation);
 | 
				
			||||||
					widget->style->black_gc,
 | 
								redraw_meters(idx, allocation.width, allocation.height, l1, l2);
 | 
				
			||||||
					pixmap[idx],
 | 
					
 | 
				
			||||||
					0, 0,
 | 
								// Get the window for the widget
 | 
				
			||||||
					0, 0,
 | 
								GdkWindow *window = gtk_widget_get_window(widget);
 | 
				
			||||||
					widget->allocation.width, widget->allocation.height);
 | 
								// Begin drawing on the window
 | 
				
			||||||
 | 
								GdkDrawingContext *context = gdk_window_begin_draw_frame(window, NULL);
 | 
				
			||||||
 | 
								// Get the Cairo context from the drawing context
 | 
				
			||||||
 | 
								cairo_t *cr = gdk_drawing_context_get_cairo_context(context);
 | 
				
			||||||
 | 
								// Create a Cairo surface from the pixmap
 | 
				
			||||||
 | 
								cairo_surface_t *surface = gdk_cairo_surface_create_from_pixbuf(pixmap[idx], 0, window);
 | 
				
			||||||
 | 
								// Set the source surface to the pixmap (Cairo surface)
 | 
				
			||||||
 | 
								cairo_set_source_surface(cr, surface, 0, 0);
 | 
				
			||||||
 | 
								// Define the area to draw (same as the width and height of the widget)
 | 
				
			||||||
 | 
								cairo_rectangle(cr, 0, 0, allocation.width, allocation.height);
 | 
				
			||||||
 | 
								cairo_fill(cr); // Fill the rectangle with the pixmap
 | 
				
			||||||
 | 
								// Clean up the Cairo surface
 | 
				
			||||||
 | 
								cairo_surface_destroy(surface);
 | 
				
			||||||
 | 
								// End the drawing frame
 | 
				
			||||||
 | 
								gdk_window_end_draw_frame(window, context);
 | 
				
			||||||
		}
 | 
							}
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
	for (idx = MAX_PCM_OUTPUT_CHANNELS + MAX_SPDIF_CHANNELS + MAX_INPUT_CHANNELS + 1; \
 | 
						for (idx = MAX_PCM_OUTPUT_CHANNELS + MAX_SPDIF_CHANNELS + MAX_INPUT_CHANNELS + 1; \
 | 
				
			||||||
		    idx <= spdif_channels + MAX_PCM_OUTPUT_CHANNELS + MAX_SPDIF_CHANNELS + MAX_INPUT_CHANNELS; idx++) {
 | 
							    idx <= spdif_channels + MAX_PCM_OUTPUT_CHANNELS + MAX_SPDIF_CHANNELS + MAX_INPUT_CHANNELS; idx++) {
 | 
				
			||||||
		get_levels(idx, &l1, &l2);
 | 
							get_levels(idx, &l1, &l2);
 | 
				
			||||||
		widget = idx == 0 ? mixer_mix_drawing : mixer_drawing[idx-1];
 | 
							widget = idx == 0 ? mixer_mix_drawing : mixer_drawing[idx-1];
 | 
				
			||||||
		if (GTK_WIDGET_VISIBLE(widget) && (pixmap[idx] != NULL)) {
 | 
							if (gtk_widget_get_visible(widget) && (pixmap[idx] != NULL)) {
 | 
				
			||||||
			redraw_meters(idx, widget->allocation.width, widget->allocation.height, l1, l2);
 | 
								GtkAllocation allocation;
 | 
				
			||||||
			gdk_draw_pixmap(widget->window,
 | 
								gtk_widget_get_allocation(widget, &allocation);
 | 
				
			||||||
					widget->style->black_gc,
 | 
								redraw_meters(idx, allocation.width, allocation.height, l1, l2);
 | 
				
			||||||
					pixmap[idx],
 | 
					
 | 
				
			||||||
					0, 0,
 | 
								// Get the window for the widget
 | 
				
			||||||
					0, 0,
 | 
								GdkWindow *window = gtk_widget_get_window(widget);
 | 
				
			||||||
					widget->allocation.width, widget->allocation.height);
 | 
								// Begin drawing on the window
 | 
				
			||||||
 | 
								GdkDrawingContext *context = gdk_window_begin_draw_frame(window, NULL);
 | 
				
			||||||
 | 
								// Get the Cairo context from the drawing context
 | 
				
			||||||
 | 
								cairo_t *cr = gdk_drawing_context_get_cairo_context(context);
 | 
				
			||||||
 | 
								// Create a Cairo surface from the pixmap
 | 
				
			||||||
 | 
								cairo_surface_t *surface = gdk_cairo_surface_create_from_pixbuf(pixmap[idx], 0, window);
 | 
				
			||||||
 | 
								// Set the source surface to the pixmap (Cairo surface)
 | 
				
			||||||
 | 
								cairo_set_source_surface(cr, surface, 0, 0);
 | 
				
			||||||
 | 
								// Define the area to draw (same as the width and height of the widget)
 | 
				
			||||||
 | 
								cairo_rectangle(cr, 0, 0, allocation.width, allocation.height);
 | 
				
			||||||
 | 
								cairo_fill(cr); // Fill the rectangle with the pixmap
 | 
				
			||||||
 | 
								// Clean up the Cairo surface
 | 
				
			||||||
 | 
								cairo_surface_destroy(surface);
 | 
				
			||||||
 | 
								// End the drawing frame
 | 
				
			||||||
 | 
								gdk_window_end_draw_frame(window, context);
 | 
				
			||||||
		}
 | 
							}
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
	return TRUE;
 | 
						return TRUE;
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -243,7 +243,7 @@ int midi_init(char *appname, int channel, int midi_enhanced)
 | 
				
			||||||
void mixer_adjust(GtkAdjustment *adj, gpointer data);
 | 
					void mixer_adjust(GtkAdjustment *adj, gpointer data);
 | 
				
			||||||
void mixer_set_mute(int stream, int left, int right);
 | 
					void mixer_set_mute(int stream, int left, int right);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
void midi_process(gpointer data, gint source, GdkInputCondition condition)
 | 
					gint midi_process(GIOChannel *source, GIOCondition condition, gpointer data)
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
  snd_seq_event_t *ev;
 | 
					  snd_seq_event_t *ev;
 | 
				
			||||||
  static GtkAdjustment *adj=0;
 | 
					  static GtkAdjustment *adj=0;
 | 
				
			||||||
| 
						 | 
					@ -306,6 +306,7 @@ void midi_process(gpointer data, gint source, GdkInputCondition condition)
 | 
				
			||||||
      snd_seq_free_event(ev);
 | 
					      snd_seq_free_event(ev);
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
  while (snd_seq_event_input_pending(seq, 0) > 0);
 | 
					  while (snd_seq_event_input_pending(seq, 0) > 0);
 | 
				
			||||||
 | 
					  return TRUE;
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
/* ************************************************* */
 | 
					/* ************************************************* */
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -7,7 +7,7 @@ int midi_init(char *appname, int channel, int midi_enhanced);
 | 
				
			||||||
int midi_close();
 | 
					int midi_close();
 | 
				
			||||||
void midi_maxstreams(int);
 | 
					void midi_maxstreams(int);
 | 
				
			||||||
int midi_controller(int c, int v);
 | 
					int midi_controller(int c, int v);
 | 
				
			||||||
void midi_process(gpointer data, gint source, GdkInputCondition condition);
 | 
					gint midi_process(GIOChannel *source, GIOCondition condition, gpointer data);
 | 
				
			||||||
int midi_button(int b, int v);
 | 
					int midi_button(int b, int v);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
#endif
 | 
					#endif
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -39,7 +39,7 @@ extern int input_channels, output_channels, pcm_output_channels, spdif_channels,
 | 
				
			||||||
 | 
					
 | 
				
			||||||
static int is_active(GtkWidget *widget)
 | 
					static int is_active(GtkWidget *widget)
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
	return GTK_TOGGLE_BUTTON(widget)->active ? 1 : 0;
 | 
						return gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(widget));
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
void mixer_update_stream(int stream, int vol_flag, int sw_flag)
 | 
					void mixer_update_stream(int stream, int vol_flag, int sw_flag)
 | 
				
			||||||
| 
						 | 
					@ -180,12 +180,13 @@ void mixer_adjust(GtkAdjustment *adj, gpointer data)
 | 
				
			||||||
	int button = (long)data & 1;
 | 
						int button = (long)data & 1;
 | 
				
			||||||
	int stereo = is_active(mixer_stereo_toggle[stream-1]) ? 1 : 0;
 | 
						int stereo = is_active(mixer_stereo_toggle[stream-1]) ? 1 : 0;
 | 
				
			||||||
	int vol[2] = { -1, -1 };
 | 
						int vol[2] = { -1, -1 };
 | 
				
			||||||
 | 
						double adjustment_value = gtk_adjustment_get_value(adj);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	vol[button] = 96 - adj->value;
 | 
					    vol[button] = 96 - adjustment_value;
 | 
				
			||||||
	if (stereo) {
 | 
					    if (stereo) {
 | 
				
			||||||
		gtk_adjustment_set_value(GTK_ADJUSTMENT(mixer_adj[stream-1][button ^ 1]), adj->value);
 | 
					        gtk_adjustment_set_value(GTK_ADJUSTMENT(mixer_adj[stream-1][button ^ 1]), adjustment_value);
 | 
				
			||||||
		vol[button ^ 1] = 96 - adj->value;
 | 
					        vol[button ^ 1] = 96 - adjustment_value;
 | 
				
			||||||
	}
 | 
					    }
 | 
				
			||||||
	set_volume1(stream, vol[0], vol[1]);
 | 
						set_volume1(stream, vol[0], vol[1]);
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -30,7 +30,7 @@ extern int output_channels, input_channels, pcm_output_channels, spdif_channels;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
static int is_active(GtkWidget *widget)
 | 
					static int is_active(GtkWidget *widget)
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
	return GTK_TOGGLE_BUTTON(widget)->active ? 1 : 0;
 | 
						return gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(widget));
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
static int get_toggle_index(int stream)
 | 
					static int get_toggle_index(int stream)
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -105,9 +105,6 @@ int envy_analog_volume_available(void)
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
/*
 | 
					 | 
				
			||||||
 */
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
void dac_volume_update(int idx)
 | 
					void dac_volume_update(int idx)
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
	snd_ctl_elem_value_t *val;
 | 
						snd_ctl_elem_value_t *val;
 | 
				
			||||||
| 
						 | 
					@ -210,14 +207,12 @@ void adc_sense_update(int idx)
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
/*
 | 
					 | 
				
			||||||
 */
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
void dac_volume_adjust(GtkAdjustment *adj, gpointer data)
 | 
					void dac_volume_adjust(GtkAdjustment *adj, gpointer data)
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
	int idx = (int)(long)data;
 | 
						int idx = (int)(long)data;
 | 
				
			||||||
	snd_ctl_elem_value_t *val;
 | 
						snd_ctl_elem_value_t *val;
 | 
				
			||||||
	int err, ival = -(int)adj->value;
 | 
						double adjustment_value = gtk_adjustment_get_value(adj);
 | 
				
			||||||
 | 
						int err, ival = -(int)adjustment_value;
 | 
				
			||||||
	char text[16];
 | 
						char text[16];
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	snd_ctl_elem_value_alloca(&val);
 | 
						snd_ctl_elem_value_alloca(&val);
 | 
				
			||||||
| 
						 | 
					@ -235,7 +230,8 @@ void adc_volume_adjust(GtkAdjustment *adj, gpointer data)
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
	int idx = (int)(long)data;
 | 
						int idx = (int)(long)data;
 | 
				
			||||||
	snd_ctl_elem_value_t *val;
 | 
						snd_ctl_elem_value_t *val;
 | 
				
			||||||
	int err, ival = -(int)adj->value;
 | 
						double adjustment_value = gtk_adjustment_get_value(adj);
 | 
				
			||||||
 | 
						int err, ival = -(int)adjustment_value;
 | 
				
			||||||
	char text[16];
 | 
						char text[16];
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	snd_ctl_elem_value_alloca(&val);
 | 
						snd_ctl_elem_value_alloca(&val);
 | 
				
			||||||
| 
						 | 
					@ -253,7 +249,8 @@ void ipga_volume_adjust(GtkAdjustment *adj, gpointer data)
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
	int idx = (int)(long)data;
 | 
						int idx = (int)(long)data;
 | 
				
			||||||
	snd_ctl_elem_value_t *val;
 | 
						snd_ctl_elem_value_t *val;
 | 
				
			||||||
	int err, ival = -(int)adj->value;
 | 
						double adjustment_value = gtk_adjustment_get_value(adj);
 | 
				
			||||||
 | 
						int err, ival = -(int)adjustment_value;
 | 
				
			||||||
	char text[16];
 | 
						char text[16];
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	snd_ctl_elem_value_alloca(&val);
 | 
						snd_ctl_elem_value_alloca(&val);
 | 
				
			||||||
| 
						 | 
					@ -299,9 +296,6 @@ void adc_sense_toggled(GtkWidget *togglebutton, gpointer data)
 | 
				
			||||||
		g_print("Unable to write adc sense: %s\n", snd_strerror(err));
 | 
							g_print("Unable to write adc sense: %s\n", snd_strerror(err));
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
/*
 | 
					 | 
				
			||||||
 */
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
void analog_volume_init(void)
 | 
					void analog_volume_init(void)
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
	snd_ctl_elem_info_t *info;
 | 
						snd_ctl_elem_info_t *info;
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue