summaryrefslogtreecommitdiff
path: root/otherlibs/graph/sound.c
blob: 75ab2a5730acd3d582adaf189a48e3120be0be28 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
/**************************************************************************/
/*                                                                        */
/*                                 OCaml                                  */
/*                                                                        */
/*             Xavier Leroy, projet Cristal, INRIA Rocquencourt           */
/*                                                                        */
/*   Copyright 1996 Institut National de Recherche en Informatique et     */
/*     en Automatique.                                                    */
/*                                                                        */
/*   All rights reserved.  This file is distributed under the terms of    */
/*   the GNU Lesser General Public License version 2.1, with the          */
/*   special exception on linking described in the file LICENSE.          */
/*                                                                        */
/**************************************************************************/

#include "libgraph.h"

value caml_gr_sound(value vfreq, value vdur)
{
  XKeyboardControl kbdcontrol;

  caml_gr_check_open();
  kbdcontrol.bell_pitch = Int_val(vfreq);
  kbdcontrol.bell_duration = Int_val(vdur);
  XChangeKeyboardControl(caml_gr_display, KBBellPitch | KBBellDuration,
                         &kbdcontrol);
  XBell(caml_gr_display, 0);
  kbdcontrol.bell_pitch = -1;   /* restore default value */
  kbdcontrol.bell_duration = -1; /* restore default value */
  XChangeKeyboardControl(caml_gr_display, KBBellPitch | KBBellDuration,
                         &kbdcontrol);
  XFlush(caml_gr_display);
  return Val_unit;
}