Recent

Author Topic: [CLOSED] BASS Stream from resource  (Read 1639 times)

pcurtis

  • Hero Member
  • *****
  • Posts: 636
[CLOSED] BASS Stream from resource
« 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?
« Last Edit: May 25, 2021, 10:55:51 am by pcurtis »
Windows 10
Laz 2.0.10
FPC 3.2.0

pcurtis

  • Hero Member
  • *****
  • Posts: 636
Re: BASS Stream from resource
« Reply #1 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;
« Last Edit: May 25, 2021, 11:00:41 am by pcurtis »
Windows 10
Laz 2.0.10
FPC 3.2.0

 

TinyPortal © 2005-2018