Hej... 
Jeg har her idag (4/5/04) sidet og kodet noget til en lydmotor til forskellige ting, og for at lave så den kan spille mere af gangen har jeg lavet den som flg.:
library Sound;
uses
  SysUtils,
  Classes,
  MMSystem,
  Windows;
type
  TId = class
  private
    FFilename: PChar;
    FId: Integer;
    FPlaying: Boolean;
    FdwFlags: Longint;
    FDeviceID: Integer;
    FCantPlay: Boolean;
    procedure SetFilename(Filename: PChar);
    procedure SetId(Id: Integer);
    procedure SetPlaying(Playing: Boolean);
    procedure SetDeviceId(DeviceId: Integer);
  public
    constructor Create(Filename: PChar; Id: Integer);
    destructor Destroy;
    function Start: Boolean;
    function Pause: Boolean;
    property Filename: PChar Read FFilename Write SetFilename;
    property Id: Integer Read FId Write SetId;
    property Playing: Boolean Read FPlaying Write SetPlaying;
  end;
  TIds = class
    private
      FIds: array of TId;
    public
      constructor Create();
      destructor Destroy;
      function CreateSound(Filename: PChar): Integer;
      function DestroySound(Id: Integer): Boolean;
      function PlaySound(Id: Integer): Boolean;
      function StopSound(Id: Integer): Boolean;
    end;
// Lidt variabler:
var
  Ids: TIds;
// TId Start
constructor TId.Create(Filename: PChar; Id: Integer);
var
  MyOpenFlags: TMCI_OPEN_PARMS;
  Error: LongInt;
begin
  FId := Id;
  FFilename := Filename;
  MyOpenFlags.lpstrDeviceType := 'waveaudio';
  MyOpenFlags.lpstrElementName := Filename;
  FdwFlags := MCI_OPEN or MCI_OPEN_TYPE or MCI_OPEN_ELEMENT;
  Error := mciSendCommand(FDeviceId, MCI_OPEN, FdwFlags, LongInt(@MyOpenFlags));
  if Error <> 0 then begin
    FCantPlay := True;
    fDeviceID := MyOpenFlags.wDeviceID;
  end
  else
    FCantPlay := False;
end;
destructor TId.Destroy;
var
  Error: LongInt;
begin
  Error := mciSendCommand(FDeviceID, MCI_CLOSE, 0, 0);
end;
procedure TId.SetFilename(Filename: PChar);
begin
  FFilename := Filename;
end;
procedure TId.SetId(Id: Integer);
begin
  FId := Id;
end;
procedure TId.SetPlaying(Playing: Boolean);
begin
  FPlaying := Playing;
end;
procedure TId.SetDeviceId(DeviceId: Integer);
begin
  FDeviceId := DeviceId;
end;
function TId.Start: Boolean;
var
  MyStartFlags: TMCI_Play_parms;
  MyOpenFlags: TMCI_OPEN_PARMS;
  Error: LongInt;
begin
  if FCantPlay = false then begin
    if Playing = false then begin
      MyStartFlags.dwFrom := 0;
      FdwFlags := MCI_Notify or MCI_Wait;
      Error := mciSendCommand(FDeviceId, MCI_PLAY, FdwFlags, LongInt(@MyStartFlags));
      if Error = 0 then begin
        Result := True;
        Playing := True;
      end
      else
        Result := False;
    end;
  end;
end;
function TId.Pause: Boolean;
var
  MyPauseFlags: TMCI_Generic_parms;
  Error: LongInt;
begin
  if Playing = true then begin
    FdwFlags := MCI_Notify or MCI_Wait;
    Error := mciSendCommand(FDeviceId, MCI_PAUSE, FdwFlags, LongInt(@MyPauseFlags));
    if Error = 0 then begin
      Result := True;
      Playing := False;
    end
    else
      Result := False;
  end;
end;
// TId Slut
// TIds Start
constructor TIds.Create();
begin
  SetLength(FIds, 0);
end;
destructor TIds.Destroy;
begin
end;
function TIds.CreateSound(Filename: PChar): Integer;
begin
  result := 0;
  SetLength(FIds, High(FIds)+2);
  FIds[High(FIds)].Create(Filename, High(FIds));
  FIds[High(FIds)].FPlaying := False;
  result := High(FIds)+1;
end;
function TIds.DestroySound(Id: Integer): Boolean;
begin
  result := False;
  FIds[Id].Destroy;
  result := True;
end;
function TIds.PlaySound(Id: Integer): Boolean;
begin
  if FIds[Id].Start = true then
    result := True
  else
    result := False;
end;
function TIds.StopSound(Id: Integer): Boolean;
begin
  if FIds[Id].Pause = true then
    result := True
  else
    result := False;
end;
// TIds Slut
// Selve DLL'ens tilgænglelige funktioner
function CreateSound(Filename: PChar): Integer; stdcall; export;
begin
  result := Ids.CreateSound(Filename);
end;
function DestroySound(Id: Integer): Boolean; stdcall; export;
begin
  result := Ids.DestroySound(Id);
end;
function PlaySound(Id: Integer): Boolean; stdcall; export;
begin
  result := Ids.DestroySound(Id);
end;
function StopSound(Id: Integer): Boolean; stdcall; export;
begin
  result := Ids.DestroySound(Id);
end;
procedure CreateBuf(); stdcall; export;
begin
  Ids.Create;
end;
procedure DestroyBuf(); stdcall; export;
begin
  Ids.Destroy;
end;
{$R *.res}
exports
  CreateSound,
  DestroySound,
  PlaySound,
  StopSound,
  CreateBuf,
  DestroyBuf;
begin
end.
Men hvergang jeg kalder CreateBuf, laver den en Access Violation 

... Er der nogen der kan hjælp... På forhånd tak
MH.
    The-Freak
Livet er for kort til at kede sig.