GERÇEK PAYLAŞIMI BİLENLERİN MEKANI
HOŞGELDİNİZ...
GERÇEK PAYLAŞIMI BİLENLERİN MEKANI
HOŞGELDİNİZ...
GERÇEK PAYLAŞIMI BİLENLERİN MEKANI
Would you like to react to this message? Create an account in a few clicks or log in to continue.

GERÇEK PAYLAŞIMI BİLENLERİN MEKANI

,.-~*´¨¯¨`*·~-.¸-(_FRM¥ØK¥ØK_)-,.-~*´¨¯¨`*·~-.¸
 
AnasayfaLatest imagesAramaKayıt OlGiriş yap

 

 Via speaker melodi çaldırma

Aşağa gitmek 
YazarMesaj
KaRaKuLe
Admin
Admin
KaRaKuLe



Via speaker melodi çaldırma Empty
MesajKonu: Via speaker melodi çaldırma   Via speaker melodi çaldırma Icon_minitimeCuma Mart 27, 2009 12:08 am

{Flashback:aklıma geldide aynı method ile okulda i8085 işlemcisine direkt belirli frekans aralıkları
göndererek böyle bişi yapmiştık daha doğrusu bir org üstelik asm ile ne kadar debelenmiştik}
procedure SetPort(address, Value: Word);
var
bValue: Byte;
begin
bValue := trunc(Value and 255);
asm
mov dx, address
mov al, bValue
out dx, al
end;
end;

function GetPort(address: Word): Word;
var
bValue: Byte;
begin
asm
mov dx, address
in al, dx
mov bValue, al
end;
GetPort := bValue;
end;

procedure Sound(aFreq, aDelay: Integer);

procedure DoSound(Freq: Word);
var
B: Byte;
begin
if Freq > 18 then
begin
Freq := Word(1193181 div Longint(Freq));
B := Byte(GetPort($61));

if (B and 3) = 0 then
begin
SetPort($61, Word(B or 3));
SetPort($43, $B6);
end;

SetPort($42, Freq);
SetPort($42, Freq shr ;
end;
end;

procedure Delay(MSecs: Integer);
var
FirstTickCount: LongInt;
begin
FirstTickCount := GetTickCount;
repeat
Sleep(1);
//or use Application.ProcessMessages instead of Sleep
until ((GetTickCount - FirstTickCount) >= Longint(MSecs));
end;

begin
if Win32Platform = VER_PLATFORM_WIN32_NT then
begin
Windows.Beep(aFreq, aDelay);
end
else
begin
DoSound(aFreq);
Delay(aDelay);
end;
end;

procedure NoSound;
var
Value: Word;
begin
if not (Win32Platform = VER_PLATFORM_WIN32_NT) then
begin
Value := GetPort($61) and $FC;
SetPort($61, Value);
end;
end;

//test :nota sallama
procedure TForm1.Button1Click(Sender: TObject);
begin
Sound(500, 1000);
Sound(780, 1500);
Sound(750, 1060);
Sound(700, 1800);
Sound(900, 1900); {çok kötü bundan daha kötüsü olamaz}
NoSound;
end;
Sayfa başına dön Aşağa gitmek
 
Via speaker melodi çaldırma
Sayfa başına dön 
1 sayfadaki 1 sayfası

Bu forumun müsaadesi var:Bu forumdaki mesajlara cevap veremezsiniz
GERÇEK PAYLAŞIMI BİLENLERİN MEKANI :: BİLGİSAYAR DÜNYASI :: Yazılım :: DelpHi-
Buraya geçin: