Bleepin’ Beeps!

Ok, here you go. I looked into the mystery that is devc-con, and I found a way to modify the beep.

The unfortunate side is that it only works if you are running devc-con in QNX mode, so you will either have to do that (by passing the -Q option) or suffer with the loud beeps (for now)

Ok, so go change your build file, and make sure your TERM env var is qnx

So we need to emit an escape sequence, which can be done thusly…

# printf “%cs%c%c%c” 0x1b, <c1>, <c2>, <c3>

Where c1 c2 and c3 are the parameters…

Here’s a snippet of the state machine…

case STATE_QNX4_11:     /* esc_beep_set */
s->beep_ticks = (c <= ' ') ? 6 : c - ' ';
s->esc_flag = STATE_QNX4_12;
case STATE_QNX4_12:
s->xpos = c - ' ';
s->esc_flag = STATE_QNX4_13;
case STATE_QNX4_13:
n = (s->xpos % 192) + ((c - ' ') % 192) * 192;
s->beep_counter = 0x0606;
s->beep_counter = (n &lt; 19) ? 0xffff :
(unsigned)(1193180L / (long)n);

The default values for beep_ticks and beep_counter are 6 and 0x0606, respectively.

I haven’t quite worked out the optimimum, but basically if you screw it up, the beep is gone anyways, so I’m alright with that. You guys can have fun playing.

I’ll try and work a nobeep facility into the next version of devc-con.

Sorry this is brief, I’m running out of time today. I’ll try and elaborate more on exactly WHAT these things mean later (or maybe Thomas will…)




1 comment so far

  1. More on BEEP « Send Receive Reply on

    […] the dark agains, BF (Before Foundry27), I hurriedly blogged about trying to turn off the annoying Beep – the bane of laptop owners […]

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: