AGB  ·  Datenschutz  ·  Impressum  







Anmelden
Nützliche Links
Registrieren

Scrolling Spectrum

Ein Thema von Abversoft · begonnen am 13. Feb 2014 · letzter Beitrag vom 15. Feb 2014
 
Abversoft

Registriert seit: 30. Aug 2010
6 Beiträge
 
#7

AW: Scrolling Spectrum

  Alt 13. Feb 2014, 18:46
Then what do you need? We can do marvelous things here, but reading minds ain't one. Why do so many people have such problems simply stating what they want to do, and what happens instead? Escapes me entirely.
When in doubt, post code, mark the line where compiling fails or a runtime error appears, and copy&paste the error message(s) underneath. Even if it's just that output differs from expectation, at least SOME information about what you did would be greatly appreciated. And by that I, of course, mean code.
Below is a code that allows you to create motion Spectrum. The problem is that it is wrong to count the data. As a result, Spectrum does not look believable.


var
Form1 : TForm1;
Mp3Len : Cardinal;
XPos : Integer = 0;
aLevel : Cardinal;
aLeft, aRight: single;
WaveOscil : TWaveData;
wavebufL, wavebufR: array of smallint;
ArrWaveL, ArrWaveR: array of array of Integer;

procedure DrawLine(Canvas: TCanvas; X, Y, X2, Y2: Integer);
begin
Canvas.MoveTo(X, Y);
Canvas.LineTo(X2, Y2);
end;

{Draw waveforms}

procedure TForm1.Draw;
var
i, j, y : integer;
WvWig : integer;
L, R, aL, aR : SmallInt;
VisBuff : Tbitmap;
Sample : Smallint;
begin
VisBuff := CreateBmp32(PaintBox2.Width, PaintBox2.Height);
y := (PaintBox2.height - 2) div 2;
WvWig := Round(PaintBox2.Width / WvSpeed);

VisBuff.Canvas.Brush.Color := 0;
VisBuff.Canvas.Pen.Color := $00E6C62D;
VisBuff.Canvas.FillRect(VisBuff.Canvas.ClipRect);
for j := 0 to WvSpeed do
begin

Sample := MulDiv(128, Smallint(LOWORD(WaveOscil[j])), 32768);
if Sample < Low(ShortInt) then
Sample := Low(ShortInt)
else if Sample > High(ShortInt) then
Sample := High(ShortInt);
//-----------------------
L := SmallInt(Loword(WaveOscil[j]));
R := SmallInt(Hiword(WaveOscil[j]));
aL := (trunc(((L ) / (65535)) * y));
// aL := Abs(Trunc(L/32768*50));
aR := (trunc(((R) / (65535)) * y));
//----------------------------
ArrWaveL[j][0] := aL;
ArrWaveR[j][0] := aR;

for i := 0 to WvWig do
begin
ArrWaveL[j][WvWig - i] := ArrWaveL[j][WvWig - i - 1];
ArrWaveR[j][WvWig - i] := ArrWaveR[j][WvWig - i - 1];
end;

end;

for i := 0 to WvWig do
begin
for j := 0 to WvSpeed do
begin
DrawLine(VisBuff.Canvas,
i * WvSpeed + j, y div 2,
i * WvSpeed + j, (y div 2) + ArrWaveL[j][WvWig - i]);

DrawLine(VisBuff.Canvas,
i * WvSpeed + j, y div 2,
i * WvSpeed + j, (y div 2) - ArrWaveL[j][WvWig - i]);

DrawLine(VisBuff.Canvas,
i * WvSpeed + j, (VisBuff.height div 2) + (y div 2),
i * WvSpeed + j, (VisBuff.height div 2) + (y div 2) + ArrWaveR[j][WvWig -
i]);

DrawLine(VisBuff.Canvas,
i * WvSpeed + j, (VisBuff.height div 2) + (y div 2),
i * WvSpeed + j, (VisBuff.height div 2) + (y div 2) - ArrWaveR[j][WvWig -
i]);

end;
end;

BitBlt(PaintBox2.Canvas.Handle, 0, 0, VisBuff.Width, VisBuff.Height,
VisBuff.Canvas.Handle, 0, 0, srccopy);
VisBuff.Free;

end;

See the compiled example
Angehängte Grafiken
Dateityp: jpg screen1.jpg (40,7 KB, 21x aufgerufen)
Angehängte Dateien
Dateityp: zip mp3_9d.zip (234,7 KB, 20x aufgerufen)

Geändert von Abversoft (13. Feb 2014 um 18:57 Uhr)
  Mit Zitat antworten Zitat
 

Themen-Optionen Thema durchsuchen
Thema durchsuchen:

Erweiterte Suche
Ansicht

Forumregeln

Es ist dir nicht erlaubt, neue Themen zu verfassen.
Es ist dir nicht erlaubt, auf Beiträge zu antworten.
Es ist dir nicht erlaubt, Anhänge hochzuladen.
Es ist dir nicht erlaubt, deine Beiträge zu bearbeiten.

BB-Code ist an.
Smileys sind an.
[IMG] Code ist an.
HTML-Code ist aus.
Trackbacks are an
Pingbacks are an
Refbacks are aus

Gehe zu:

Impressum · AGB · Datenschutz · Nach oben
Alle Zeitangaben in WEZ +1. Es ist jetzt 15:46 Uhr.
Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
LinkBacks Enabled by vBSEO © 2011, Crawlability, Inc.
Delphi-PRAXiS (c) 2002 - 2023 by Daniel R. Wolf, 2024-2025 by Thomas Breitkreuz