
Zitat von
urbanbruhin:
aber kann man auch mit der bass.dll arbeiten, wenn man zum abspielen von dateien den Tmediaplayer nimmt??
Nein. Es könnte u.U. einen Umweg geben, indem man mit der bass.dll das vom Mediaplayer wiedergegebene aufnehmen lässt, und sich den Pegel davon abholt, aber das ist ziemlicher Schwachfug

.
Der Mediaplayer ist
imho nicht wirklich der Weisheit letzter Schluss...

Zitat von
urbanbruhin:
wenn ja: wie kann man so ein colles dings da in der mitte programmieren?? (ein code wäre nicht schlecht, falls du ihn hergeben willst)
Willst du wirklich!?
Na gut....
Delphi-Quellcode:
//------------------------------------------------------------------------------
//------- The Volume-Bars ------------------------------------------------------
// SECTION BEGIN ---------------------------------------------------------------
{ How does it work?
At first the volumes is "smoothed". This is done by checking whether the new
volume is lower or greater than the former one.
If it is lower, then not the actual new vlomue is taken, but the former one
slightly decreased.
If it is greater, the value is just taken "as is".
The resulting volume-values are taken to calculate an angle between 0 and
(3/4)*pi.
(Pi would make a 180°-turn, and i didn't want the bars to clap together at
max-volume -> thus i took (3/4)*pi.)
The channel-volume is also the base for calculating the colors. Low volume
produces green color, and the higher the volume gets, the more the color turns
into red.
Then when drawing the bars, i use a loop that draws the lines for all volumes
that are lower or equal to the actual value, because just drawing the line
for the actual value wouldn't result in "bars" but simple two dancing lines...
The constant numbers in the drawing-routines are depending on where the bars
should appear, and how large the inner and outer ellipse should be.
(They are constant here because it is faster.) }
procedure DrawVisVolume(var bmp: TBitmap32; const Source: TBassplayer);
var
lv, rv : Double;
m : Double;
c : Integer;
sinM, cosM: Extended;
const
step: Double = 0.02;
begin
lv := Source.LeftPeak;
rv := Source.RightPeak;
if lv > 128 then lv := 0;
if rv > 128 then rv := 0;
lv := 0.018407769*lv; // := 0.005859375*lv*pi; // := (lv / 128)*(pi/4)*3; <--- is same
rv := 0.018407769*rv; // := 0.005859375*rv*pi; // := (rv / 128)*(pi/4)*3; <--- is same
if lv < lVol then
lVol := lVol - 0.125
else
lVol := lv;
if rv < rVol then
rVol := rVol - 0.125
else
rVol := rv;
m := 0;
repeat
c := trunc(108.2253613*m); // := trunc(340*m / pi); <--- // := trunc((m * 255) / ((3/4)*pi)); <--- is same
sincos(m, sinM, cosM);
bmp.LineF(200+120*-sinM,
200+150* cosM,
200+180*-sinM,
200+180* cosM,
Color32(c,255-c,32));
m := m + step;
until m > lVol;
m := step;
repeat
c := trunc(108.2253613*m); // := trunc(340*m / pi); <--- // := trunc((m * 255) / ((3/4)*pi)); <--- is same
sincos(m, sinM, cosM);
bmp.LineF(200-120*-sinM,
200+150* cosM,
200-180*-sinM,
200+180* cosM,
Color32(c,255-c,32));
m := m + step;
until m > rVol;
end;
Packs die nicht standardmäßig bei Delphi dabei sind: Graphics32-Lib; bass.dll + modifizierte Version der Bassplayer.pas vom
DP-User Gandalfus (TBassplayer).
Die komischen Kommentare im Code sind für mich zur Erinnerung wie die konstanten Werte im eigentlichen Code ursprünglich entstanden sind.
Diese Prozedur zeichnet die Volume-Bars auf ein beliebiges TBitmap32 das ausreichend groß ist. Da das ganze allerdings doch schon recht speziell ist, weiss ich nicht, ob dir das so wirklich weiter hilft...

Zitat von
urbanbruhin:
oder einfach ein ganz normaler Tstatusbar, der den pegel anzeigt??
Wäre zumindest erstmal die einfachere Alternative. Um ehrlich zu sein hab ich das auch zunächst so gemacht. Einfach rumspielen und haufenweise Fehler kassieren, und wenn es irgendwann gut aussieht, dann so lassen. So mach ich das immer
Gruss,
Fabian
\\edit: btw.: Die gesamte
Unit für die Visuals ist genau 599 Zeilen, die die dafür sorgt dass alles zur rechten Zeit an rechter Stelle gezeichnet wird macht nochmal ~300. Das sind mal sopntan 900 Zeilen Code
nur für das Visual, da ist noch kein Lied mit abgespielt, geschweige denn eine
GUI gebaut und gesteuert...
Fabian K.
INSERT INTO HandVonFreundin SELECT * FROM Himmel