Module of module types for OrderedType,ComparableType,Printable,Serializable,Discrete...
[ocaml.git] / otherlibs / graph / sound.c
blobdc75b7ed034ab52535ec6cfd78efa0751fef0172
1 /***********************************************************************/
2 /* */
3 /* Objective Caml */
4 /* */
5 /* Xavier Leroy, projet Cristal, INRIA Rocquencourt */
6 /* */
7 /* Copyright 1996 Institut National de Recherche en Informatique et */
8 /* en Automatique. All rights reserved. This file is distributed */
9 /* under the terms of the GNU Library General Public License, with */
10 /* the special exception on linking described in file ../../LICENSE. */
11 /* */
12 /***********************************************************************/
14 /* $Id$ */
16 #include "libgraph.h"
18 value caml_gr_sound(value vfreq, value vdur)
20 XKeyboardControl kbdcontrol;
22 caml_gr_check_open();
23 kbdcontrol.bell_pitch = Int_val(vfreq);
24 kbdcontrol.bell_duration = Int_val(vdur);
25 XChangeKeyboardControl(caml_gr_display, KBBellPitch | KBBellDuration,
26 &kbdcontrol);
27 XBell(caml_gr_display, 0);
28 kbdcontrol.bell_pitch = -1; /* restore default value */
29 kbdcontrol.bell_duration = -1; /* restore default value */
30 XChangeKeyboardControl(caml_gr_display, KBBellPitch | KBBellDuration,
31 &kbdcontrol);
32 XFlush(caml_gr_display);
33 return Val_unit;