Obsluga glosnika systemowego ( tzw brzeczyka ).

0

Chcialbym napisac obsluge "brzeczyka", chodzi mi o przerwania, ktore pozwalaja zminiac czestotliwosc i inne parametry ( to chyba jest 8, ale nie wiem do konca ), chcailbym w ogóle kawalek kodu ( chyba bedzie musial byc w aemblerze, ale moze byc w cpp albo pascalu ).--Marcin samo zło :-D

0

To Unit Bleeper'a. Jak nie będzie działąć to daj maila i podeśle ci całego zipa(jeszcze dwa unity są BleepInt , GWBleep)

Unit Bleeper; { Bleeper / BleepInt / GWBleep Version 5.5 }

{ Copyright 1999 - 2001 Andy Preston - Apollo Developments, Swindon U.K. http://www.apollod.omnia.co.uk/aa/

HACKERS OF THE WORLD UNITE! HACKERS OF THE WORLD UNITE! HACKERS OF THE WORLD UNITE! HACKERS OF THE WORLD UNITE!

Control of the PC speaker, the bleeper unit, see bleepint.htm for details

This unit is free software; you can redistribute it and/or modify it under the terms of the GNU Library General Public
License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version.

This unit is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Library General Public License for more details.

You should have received a copy of the GNU Library General Public License along with this unit; if not, write to the
Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
}

Interface

{ Rountines for your use, in this unit. }

Procedure ShutUp; { Added to help counter the effects of DoBleep (Freq, -1).
If you are producing a tone, & you want to stop without doing another Bleep, call this procedure }

Procedure DoBleep (Freq : Word; MSecs : LongInt); { Duration of -1 means bleep until the next bleep sent, or ShutUp is called }

Procedure BleepPause (MSecs : LongInt);

{ These are the same routines, but given names for Turbo Pascal Compatability }

Procedure NoSound;
Procedure Sound (Freq : Integer);
Procedure Delay (MSecs : LongInt);

Implementation

Uses
{$IFDEF WIN32}Windows{$ELSE}WinProcs{$ENDIF}, SysUtils{$IFNDEF CONSOLE}, Forms{$ENDIF};

{ -- --- -- --- -- --- -- --- -- --- -- --- -- --- Assembler Bits for Wind 3.x And '95 -- --- -- --- -- --- -- --- -- --- }

Procedure AsmShutUp;
{$IFDEF WIN32}Pascal;
{$ENDIF}
Begin
Asm
Mov AL, 0
Out $61, AL
End;
End;

Procedure AsmBeep (Freq : Word);
{$IFDEF WIN32}Pascal;
{$ENDIF}
Begin
Asm
MOV AL, 3
OUT $61, AL
MOV AL, $B6
OUT $43, AL
MOV AX, Freq
OUT $42, AL
MOV AL, AH
OUT $42, AL
End;
End;

{ -- --- -- --- -- --- -- --- -- --- -- --- -- --- Low Level Bits for Wind 3.x And '95 -- --- -- --- -- --- -- --- -- --- }

Procedure HardBleep (Freq : Word; MSecs : LongInt);
Begin
{ This line is made redundant by the tests at the start of DoBleep }
{ If (Freq &gt= 20) And (Freq &lt= 5000) Then Begin }
AsmBeep (Word (1193181 Div LongInt (Freq)));
If MSecs &gt= 0 Then Begin
BleepPause (MSecs);
AsmShutUp;
End;
End;

{ -- --- -- --- -- --- -- --- -- --- -- --- -- --- Part of Windows NT Detector -- --- -- --- -- --- -- --- -- --- -- --- }

{$IFDEF WIN32}
Var
SysWinNT : Boolean;
{$ENDIF}

{ -- --- -- --- -- --- -- --- -- --- -- --- -- --- -- --- Procedures for you to use -- --- -- --- -- --- -- --- -- --- -- --- }

Procedure BleepPause (MSecs : LongInt);
Const
HiValue = {$IFDEF WIN32}High (DWord){$ELSE}High (LongInt){$ENDIF};
Var
iCurrTickCount, iFirstTickCount : {$IFDEF WIN32}DWord{$ELSE}LongInt{$ENDIF};
iElapTime : LongInt;
Begin
iFirstTickCount := GetTickCount;
Repeat
{$IFNDEF CONSOLE}
If MSecs &gt 1000 Then Application.ProcessMessages;
{$ENDIF}
iCurrTickCount := GetTickCount;
{ Has GetTickCount wrapped to 0 ? }
If iCurrTickCount &lt iFirstTickCount Then iElapTime := HiValue - iFirstTickCount + iCurrTickCount
Else iElapTime := iCurrTickCount - iFirstTickCount;
Until iElapTime &gt= MSecs;
End;

Procedure DoBleep (Freq : Word; MSecs : LongInt);
Var
MinRange : Integer;
OK:Boolean;
Begin
If MSecs &lt -1 Then
Raise ERangeError.Create ('Bleeper: MSecs &lt -1');
{ Turbo Pascal routines used Freq between 20 and 20000 i.e. the Range of human hearing }
{ NT Requires Freq to be between 37 and 32767 for it's BEEP procedure }
{$IFDEF WIN32}If SysWinNT Then MinRange := 37 Else {$ENDIF}MinRange := 20;
If Freq &lt MinRange Then
Raise ERangeError.Create ('Bleeper: Freq &lt ' + IntToStr (MinRange));
If Freq &gt 20000 Then
Raise ERangeError.Create ('Bleeper: Freq &gt 20000');
{$IFDEF WIN32}If SysWinNT Then Begin
OK:=Windows.Beep (Freq, MSecs);
end Else {$ENDIF}HardBleep (Freq, MSecs);
End;

Procedure ShutUp;
Begin
{$IFDEF WIN32}If SysWinNT Then Windows.Beep (1, 0) Else {$ENDIF}AsmShutUp;
End;

{ -- --- -- --- -- --- -- --- -- --- -- --- Procedures for you to use (Turbo Pascal Compatability) -- --- -- --- -- --- }

Procedure NoSound;
Begin
ShutUp;
End;

Procedure Sound (Freq : Integer);
Begin
DoBleep (Freq, -1);
End;

Procedure Delay (MSecs : LongInt);
Begin
BleepPause (MSecs);
End;

{ -- --- -- --- -- --- -- --- -- --- -- --- -- --- -- --- Windows NT Detector -- --- -- --- -- --- -- --- -- --- -- --- }

{$IFDEF WIN32}

Procedure InitSysType;
Var
VersionInfo : TOSVersionInfo;
Begin
VersionInfo.dwOSVersionInfoSize := SizeOf (VersionInfo);
GetVersionEx (VersionInfo);
SysWinNt := VersionInfo.dwPlatformID = VER_PLATFORM_WIN32_NT;
End;

Initialization
InitSysType;

{$ENDIF}

End.--Delphi 6
Pozdrowienia,
Imperior

0

Jest komponent o nazwie PcSpak, umożliwia on obsługę komputerowego głośniczka.

Pozdrowienia dla całego FORUM !!!--Marco_99

0

w dziale kody zrodlowe ( http://www.4programmers.net/zrodla/kody_delphi.html ) masz
zrodla bleepint.zip, ktore pokazuja jak obslugiwac PC Speakera

---=[ Delphi 3, 6 ]=-
-=-==[ LKS ]==-=-

0

Jeśli chcesz naprawdę dobrze pobawić sie z PC Speakerem bez Assemblera nie ruszysz:(--Pracuję w Delphi 5

Pozdrawiam
RockY
[email protected],pl

0

Imperior : dziekuje, sprawdze to, jak to nie problem to wyslij mi to na maila ( [email protected] - chyba i tak teraz bedzie wypisany po nickiem ).
Rocky : z asemblerem sobie nie radze za dobrze, ale jakos sobie poradze to jak masz cos to bede wdzieczny.--Marcin samo zło :-D

0

Przesłałem tobie na konto komponent, o którym mówiłem wcześniej.
Nie jest on mojego autorstwa, ale jest FREE.
Kiedyś „gryzłem” temat z PC-towskim głośnikiem.
Przebrnąłem przez Asemblerowe procedury, które są mało czytelne i znalazłem w końcu ten komponent.

Pozdrowienia dla całego FORUM.--Marco_99

1 użytkowników online, w tym zalogowanych: 0, gości: 1, botów: 0