Omdat iemand anders er naar vroeg, en ik toch al met iets soortgelijks bezig was; zo speel je een systeem geluid af op een Mac onder Lazarus Pascal:
1) Voeg het AudioToolbox framework toe aan de code
{$linkframework AudioToolbox}
2) Declareer deze procedure:
procedure AudioServicesPlayAlertSound (inSystemSoundID: TSystemSoundID); external name '_AudioServicesPlayAlertSound';
3) Declareer het sound ID type:
TSystemSoundID = UInt32;
4) En als laatste roep de functie aan:
AudioServicesPlayAlertSound(1); // het nummer geeft een systeem geluid aan
Een simpel voorbeeld:
unit Unit1;
{$mode objfpc}{$H+}
interface
{$linkframework AudioToolbox}
uses
Classes, SysUtils, Forms, Controls, Graphics, Dialogs, StdCtrls, MacOSAll, CocoaInt;
type
{ TForm1 }
TForm1 = class(TForm)
Button1: TButton;
procedure Button1Click(Sender: TObject);
private
public
end;
TSystemSoundID = UInt32;
procedure AudioServicesPlayAlertSound (inSystemSoundID: TSystemSoundID); external name '_AudioServicesPlayAlertSound';
var
Form1: TForm1;
implementation
{$R *.lfm}
{ TForm1 }
procedure TForm1.Button1Click(Sender: TObject);
begin
AudioServicesPlayAlertSound(1);
AudioServicesPlayAlertSound(2);
end;
end.