Forum > Other

[SOLVED] Making FreeBSD beep...

(1/1)

trev:
As SysUtils.Beep has no effect on FreeBSD I looked around for a way  to make it beep and found nothing useful. So, I reinvented the wheel as follows:


--- Code: Pascal  [+][-]window.onload = function(){var x1 = document.getElementById("main_content_section"); if (x1) { var x = document.getElementsByClassName("geshi");for (var i = 0; i < x.length; i++) { x[i].style.maxHeight='none'; x[i].style.height = Math.min(x[i].clientHeight+15,306)+'px'; x[i].style.resize = "vertical";}};} ---{$IFDEF FREEBSD}procedure FBSDbeep;var  BProcess: TProcess;  begin    BProcess:= TProcess.Create(nil);    BProcess.CommandLine := 'sh -c "echo xxxxxxx > /dev/dsp"';    BProcess.Execute;    BProcess.Free;  end;{$ENDIF}    
Note:

/dev/dsp will automatically reroute to the sound device's correct device node (eg /dev/dsp0.0) using the dynamic devfs(5) clone handler.

Qualifications:

* Ok, it's more of a burp than a beep, but it serves the purpose.

* If FreeBSD is using a GENERIC kernel, it will work.

* If FreeBSD is using a custom kernel and it's a desktop system, then it will most probably work because who doesn't want sound on their desktop system.

* If FreeBSD is using a custom kernel and is running on a server,  it may not work. I don't see this as a significant defect in user applications which is its use case for my purposes.

marcov:
Console.kiocsound(stdinput,1) or so?

trev:

--- Code: Pascal  [+][-]window.onload = function(){var x1 = document.getElementById("main_content_section"); if (x1) { var x = document.getElementsByClassName("geshi");for (var i = 0; i < x.length; i++) { x[i].style.maxHeight='none'; x[i].style.height = Math.min(x[i].clientHeight+15,306)+'px'; x[i].style.resize = "vertical";}};} ---procedure FBSDbeep;begin  Console.kiocsound(stdinputhandle,1);end; 
No sound - I tried 1 through 1000 for the last argument.

[I assume you meant stdinputhandle - fpc couldn't find stdinput].

marcov:
You could also try stdouthandle. Afaik it is a boolean, so the exact value doesn't matter much.

It is very old though, and afaik syscons has been rewritten since.

trev:
Nope, no sound with stdoutput or stdoutputhandle (both of which are recognised this time).

My wheel is looking good  8-)

Navigation

[0] Message Index

Go to full version