Delphi - Hacer sonar la bocina interna de la computadora

 
Vista:

Hacer sonar la bocina interna de la computadora

Publicado por Exodo (1 intervención) el 12/12/2008 17:30:18
Hola Amigos

Me gustaría mucho que me ayudaran con un proyecto que estoy haciendo. El problema es que quisiera saber como poder crear un programita que me permita reproducir un determinado sonido en la bocina interna de la computadora (La que se encuentra dentro de la Motherboard y que hace un beet cuando enciende). Diganme si esto se puede hacer desde Delphi y como.....
Valora esta pregunta
Me gusta: Está pregunta es útil y esta claraNo me gusta: Está pregunta no esta clara o no es útil
0
Responder
sin imagen de perfil
Val: 65
Oro
Ha mantenido su posición en Delphi (en relación al último mes)
Gráfica de Delphi

RE:Hacer sonar la bocina interna de la computadora

Publicado por E.T. (1244 intervenciones) el 12/12/2008 18:14:34
Encontré un codigo de muestra que lo hace pero no lo he comprobado, aunque aqui se estan metiendo con ensamblador, aqui te lo dejo, además tambien la pagina donde lo encontré

http://www.latiumsoftware.com/en/pascal/0048.php#5

Es el punto número 5 del indice de la página

procedure SpeakerSound(Frequency: word; Duration: longint);
// Copyright (c) 2003 Ernesto De Spirito
// Visit: http://www.latiumsoftware.com
// Plays a tone thru the PC speaker using the 8253/8254
// Counter/Timer chip and the 8255 Programmable Peripheral
// Interface (PPI) chip on the motherboard.
// NOTE: This code won't work under Windows NT/2000/XP.
asm
push edx // Push Duration on the stack (for Sleep)
mov cx, ax // CX := Frequency;
// Prepare the 8253/8254 to receive the frequency data
mov al, $B6 // Function: Expect frequency data
out $43, al // Write to Timer Control Register
// Compute the frequency data
mov dx, $14 // DX:AX = $144F38
mov ax, $4F38 // = 1331000
div cx // AX := 1331000 / Frequency;
// Send the frequency data to the 8253/8254 Counter/Timer chip
out $42, al // Write low byte to the Frequency Address
mov al, ah // AL := High byte of AX
out $42, al // Write high byte to the Frequency Address
// Tell the 8255 PPI to start the sound
in al, $61 // Read Port B of the 8255 PPI
or al, $03 // Set bits 0 and 1:
// bit 0 --> use the 8253/8254
// bit 1 --> turn speaker on
out $61, al // Write to Port B of the 8255 PPI
// Wait
call Sleep // Sleep(Duration); // requires Windows unit
// Tell the 8255 PPI to stop the sound
in al, $61 // Read Port B of the 8255 PPI
and al, NOT 2 // Clear bit 1 (turn speaker off)
out $61, al // Write to Port B of the 8255 PPI
end;

Sample call:

procedure TForm1.Button1Click(Sender: TObject);
var
i: integer;
begin
Randomize;
for i := 1 to 3 do
SpeakerSound(Random(900)+100, 200);
end;
Valora esta respuesta
Me gusta: Está respuesta es útil y esta claraNo me gusta: Está respuesta no esta clara o no es útil
0
Comentar