Re: Play sound on new mail (feature)



> > or try this call the gdk_beep() function.

> will that not emit a beep from the sound card, too, if one is present?

not quite sure, but i scanned the gnome-control-center sourcecode
where you could set a beep with pitch, percent and duration and i
ripped the code off, it looks like they are using straight Xlib
lowlevel calls. here the code.

static void
bell_cb (GtkWidget *widget, Bonobo_PropertyBag bag)
{
	XKeyboardState backup;
	XKeyboardControl kbdcontrol;

	XGetKeyboardControl (GDK_DISPLAY (), &backup);

	kbdcontrol.bell_percent = get_value_ulong (bag, "bell_volume");
	kbdcontrol.bell_pitch = get_value_ulong (bag, "bell_pitch");
	kbdcontrol.bell_duration = get_value_ulong (bag, "bell_duration");
	XChangeKeyboardControl (GDK_DISPLAY (),
				KBBellPercent | KBBellPitch | KBBellDuration, 
				&kbdcontrol);
	XBell (GDK_DISPLAY (), 0);

	kbdcontrol.bell_percent = backup.bell_percent;
	kbdcontrol.bell_pitch = backup.bell_pitch;
	kbdcontrol.bell_duration = backup.bell_duration;

	XChangeKeyboardControl (GDK_DISPLAY (),
				KBBellPercent | KBBellPitch | KBBellDuration, 
				&kbdcontrol);
}

;-----------------------------------------------------------
	kbdcontrol.bell_percent = get_value_ulong (bag, "bell_volume");
	kbdcontrol.bell_pitch = get_value_ulong (bag, "bell_pitch");
	kbdcontrol.bell_duration = get_value_ulong (bag, "bell_duration");
	XChangeKeyboardControl (GDK_DISPLAY (),
				KBBellPercent | KBBellPitch | KBBellDuration, 
				&kbdcontrol);
	XBell (GDK_DISPLAY (), 0);
;-----------------------------------------------------------

these cut lines above look reasonable. now we could implement not only
the speaker beep we are also able to set 3 sliders to change some values.
i really need to get back into details, after i stopped motif application
development nearly 1 year ago, i need to get back into things again, this
includes deeper GTK+/GNOME programming and back to Xlib and Xt *braining*
i was really good at xlib, xt, motif things but due my 'uni' and all uni
related exams and stuff i am a bit out of all.

-- 
Name....: Ali Akcaagac
Status..: Student Of Computer & Economic Science
E-Mail..: mailto:ali.akcaagac@stud.fh-wilhelmshaven.de
WWW.....: http://www.fh-wilhelmshaven.de/~akcaagaa




[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]