Since someone was asking for this, and I happened to be playing with something similar; this is how you can play a system sound in Lazarus Pascal on MacOS X:
1) Add the AudioToolbox framework with
{$linkframework AudioToolbox}
2) Declare the procedure:
procedure AudioServicesPlayAlertSound (inSystemSoundID: TSystemSoundID); external name '_AudioServicesPlayAlertSound';
3) Declare the sound ID type:
TSystemSoundID = UInt32;
4) And finally call the function:
AudioServicesPlayAlertSound(1); // the number 1 can be any other number, depending on the sound you want
So a simple example:
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.