My code -> displaying waveform stereo .wav file
max_l and max_r here is the highest value of the waveform in each channel.
form2:= TForm2.Create(self);
form2.Image1.Visible := true;
form2.Image1.Width := numsamples;
form2.Image1.Height := max_l * 2;
form2.Image1.Canvas.Lock;
form2.Image1.Canvas.MoveTo(0,mid);
form2.Image1.Canvas.Pen.Color := clRed
form2.Image2.Visible := true;
form2.Image2.Width := numsamples;
form2.Image2.Height := max_r * 2;
form2.Image2.Canvas.Lock;
form2.Image2.Canvas.MoveTo(0,mid);
form2.Image2.Canvas.Pen.Color := clRed
x:=0;
for i := 0 to numchannels do begin
if i mod 2 = 0 then begin
form2.Image2.Canvas.MoveTo(x,max_r);
form2.Image2.Canvas.LineTo(x,max_r+buff[i]);
x:=x+1;
end
else begin
form2.Image1.Canvas.MoveTo(x,max_l);
form2.Image1.Canvas.LineTo(x,max_l+buff[i]);
end;
end;
I want to know how much is max for TImage Delphi max height and width? Because i'm trying to draw a big picture of entire waveform of a .wav file. For example now i got image1.height = 23000 more and get EOutOfResource issue or maybe my code got mistake in it?. Any suggestion would be appreciated thanks.
EDIT1 : also i tried to use draw bmp then resize it with stretchdraw method but it doesnt work too, here is my code and the main idea is first i draw the super big original size into bmp, then shrink it using StretchDraw Function then draw it on TImage. But still bitmap also return me the same issue EOutOfResources.
form2:= TForm2.Create(self);
form2.Image1.Visible := true;
bmp:=TBitmap.Create;
bmp.Height:=max_l*2;
bmp.Width:=numsamples;
bmp.Canvas.Pen.Color:=clRed;
bmp.Canvas.MoveTo(0,max_l);
x:=0;
for i := 0 to numchannels do begin
if i mod 2 = 0 then begin
bmp.Canvas.MoveTo(x,max_r);
bmp.Canvas.LineTo(x,max_r+buff[i]);
x:=x+1;
end;
end;
newwidth:=1000;
newheight:=500;
bmp.Canvas.StretchDraw(rect(0,0,newheight,newwidth),bmp);
form2.Image1.Canvas.Draw(0,0,bmp);