Lazarus

Programming => Graphics and Multimedia => Audio and Video => Topic started by: pcurtis on May 24, 2021, 01:06:20 pm

Title: [CLOSED] BASS Stream from resource
Post by: pcurtis on May 24, 2021, 01:06:20 pm
How can I create a BASS stream from a resource without saving the resource to a file?
Title: Re: BASS Stream from resource
Post by: pcurtis on May 24, 2021, 03:05:33 pm
procedure TForm1.FormCreate(Sender: TObject);
begin
  BASS_Init(-1, 44100, 0, Handle, nil);
  BASS_SetConfig(BASS_CONFIG_BUFFER, 5000);
end;

procedure TForm1.Button1Click(Sender: TObject);
var
  WavStream : TResourceStream;
begin
  WavStream := TResourceStream.Create(HINSTANCE, 'STOP', RT_RCDATA);
  strs := BASS_StreamCreateFile(True, WavStream.Memory, 0, WavStream.Size, 0);
  BASS_ChannelPlay(strs, False);
  WavStream.Free;
end;
TinyPortal © 2005-2018