Tuesday, December 1, 2020

Play MIDI from memory stream

{
Create a new text file, and write: MIDI RCDATA 1.mid, save text file as MID.rc Then create a new text file, and write: brcc32 mid.rc, save it as "brcc.bat"
run the brcc.bat, to convert *.rc file to *.res Move MediaPlayer to your form (the media player is on the "System"tab). Now copy this code to Your project:
}

unit Unit1;

interface

uses

Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, MPlayer;

type

TForm1 = class(TForm)

mplayer: TMediaPlayer;

procedure FormCreate(Sender: TObject);

private

{ Private declarations }

public

{ Public declarations }

end;

var

Form1: TForm1;

implementation

{$R *.dfm}

{$R mid.res}

procedure TForm1.FormCreate(Sender: TObject);

var

stream:tresourcestream;

tmp:string;

begin

try

stream:=tresourcestream.Create(hinstance,'MIDI',RT_RCDATA);

try

setlength(tmp,300);

setlength(tmp,GetTempPath(300,pchar(tmp)));

tmp:=tmp+inttostr(hinstance)+'.mid';

stream.SaveToFile(tmp);

finally

stream.free;

end;

mplayer.FileName:=tmp;

mplayer.Open;

mplayer.Play;

except

end;

end;


end.

{
this is the easiest example. So, keygens use a special sound format - *.XM, the file is read into memory from a resource and played using libraries like FMOD (read more in internet)
}



OBS


The best way to save your Zoom session in mp4 on Windows and Linux.

No comments:

Post a Comment

Коментар: