I have been playing a bit with DiskArbitration.h, and I'm definitely not an expert, but this seems to work:
1) Add the AudioToolbox framework with
{$linkframework AudioToolbox}
2) Declare the procedure like you did:
procedure AudioServicesPlayAlertSound (inSystemSoundID: TSystemSoundID); external name '_AudioServicesPlayAlertSound';
(note that I added a "T" in front of the SystemSoundID)
3) Declare the sound ID:
4) And finally call:
AudioServicesPlayAlertSound(1);
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.