Autor Beitrag
hanibal
ontopic starontopic starontopic starontopic starhalf ontopic starofftopic starofftopic starofftopic star
Beiträge: 157

Win xp
d7 eterprise
BeitragVerfasst: Mo 06.11.06 18:46 
Mein OSziluskop stottert, wenn ich die Maus aus dem Fenster bewege :cry:

Woran kann das liegen?

Ps: mein formular ist ein formular mit border = none, und an einem bitmap als wenster, und aktivirter transperent color, und natürlich autobuffred := true.
Leuchtturm
ontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic starofftopic star
Beiträge: 1087

Win Vista, Knoppix, Ubuntu
Delphi 7 Pe, Turbo Delphi, C#(VS 2005 Express), (X)HTML + CSS, bald Assembler
BeitragVerfasst: Mo 06.11.06 18:56 
Was ist ein(e) OSziluskop :?:

_________________
Ich bin dafür verantwortlich was ich sage - nicht dafür was du verstehst.
jakobwenzel
ontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic starofftopic star
Beiträge: 1889
Erhaltene Danke: 1

XP home, ubuntu
BDS 2006 Prof
BeitragVerfasst: Mo 06.11.06 19:36 
vllt ein sehr falsch geschriebenes Oszilloskop?

@Topic: Dein Fehler liegt in Z. 157! Jetz ma im ernst, ohne Quelltext wird dir niemand helfen können.

_________________
I thought what I'd do was, I'd pretend I was one of those deaf-mutes.
hanibal Threadstarter
ontopic starontopic starontopic starontopic starhalf ontopic starofftopic starofftopic starofftopic star
Beiträge: 157

Win xp
d7 eterprise
BeitragVerfasst: Mo 06.11.06 21:21 
das ist Der Quelltext des timers(intervall:=33):
ausblenden Delphi-Quelltext
1:
2:
3:
4:
5:
6:
7:
8:
9:
10:
11:
12:
13:
14:
15:
16:
17:
18:
19:
20:
21:
22:
23:
24:
25:
26:
27:
procedure TForm1.paint_timeTimer(Sender: TObject);
 var FFTFata : TFFTData; WaveData  : TWaveData;
begin

 if BASS_ChannelIsActive(unit1.strs[1]) <> BASS_ACTIVE_PLAYING then Exit;

case funktionox of
  0 :
   begin
    BASS_ChannelGetData(unit1.strs[1], @WaveData, 2048);
    CircleScope.Draw (PaintFrame.Canvas.Handle, WaveData,9045);
   end;

  1 :
   begin
    BASS_ChannelGetData(unit1.strs[1], @WaveData, 2048);
    OcilloScope.Draw (PaintFrame.Canvas.Handle, WaveData, 045);
   end;

  2 :
   begin
    BASS_ChannelGetData(unit1.strs[1], @FFTFata, BASS_DATA_FFT1024);
    Spectrum.Draw (PaintFrame.Canvas.Handle, FFTFata, 250);
   end;
end;

end;


und das ist der aufrufs Quelltext:
ausblenden Delphi-Quelltext
1:
2:
3:
4:
5:
6:
7:
8:
9:
10:
11:
12:
13:
14:
15:
16:
17:
18:
19:
20:
21:
22:
23:
24:
paintframe.Visible:= true;
 paint_time.Enabled:= true; \\der timer für das oszilluskop
  BASS_Init(-1441000, Application.Handle, nil);

  CircleScope := TCircleScope.Create(PaintFrame.Width, PaintFrame.Height);
  OcilloScope := TOcilloScope.Create(PaintFrame.Width, PaintFrame.Height);
  Spectrum    := TSpectrum.Create(PaintFrame.Width, PaintFrame.Height);
  CircleScope.Radius := 30;
 CircleScope.Offset := 50;
 OcilloScope.Offset := 30;
 Spectrum.Height := 50;
 spectrum.Mode:= 0;
 spectrum.Width:= 1;
 CircleScope.BackColor:= oszilbackcolor;
 OcilloScope.BackColor:= oszilbackcolor;
 spectrum.BackColor:= oszilbackcolor;
 circlescope.Pen := oszilcolor;
 ocilloscope.Pen := oszilcolor;
 spectrum.Pen := oszilcolor;
 Spectrum.LineFallOff := 2;
  {BackImageRes.Picture.LoadFromFile(OpenPictureDialog.FileName);}
 CircleScope.SetBackGround(True, BackImageRes.Picture.Graphic);
 OcilloScope.SetBackGround(True, BackImageRes.Picture.Graphic);
 Spectrum.SetBackGround(True, BackImageRes.Picture.Graphic);
Dunkel
ontopic starontopic starontopic starontopic starontopic starontopic starofftopic starofftopic star
Beiträge: 682

Mac OS X Snow Leopard
Xcode 3.1
BeitragVerfasst: Di 07.11.06 17:28 
Das liegt unter Umständen an der Tranzparenz des Bitmaps, schalte diese mal testweise ab.

Tranzparenz kostet einiges mehr an Rechenpower, wenn dein System nicht leistungsfähig genug ist könnte es schon mal haken.
hanibal Threadstarter
ontopic starontopic starontopic starontopic starhalf ontopic starofftopic starofftopic starofftopic star
Beiträge: 157

Win xp
d7 eterprise
BeitragVerfasst: Di 07.11.06 18:53 
das muss aber transperent sein nichrt der vom oszilluskop, sondern von der form.

der vom oszilluskop ist nicht tranzperent.
Dunkel
ontopic starontopic starontopic starontopic starontopic starontopic starofftopic starofftopic star
Beiträge: 682

Mac OS X Snow Leopard
Xcode 3.1
BeitragVerfasst: Mi 08.11.06 20:37 
Das testweise Abschalten der Tranzparenz des Formulars tut aber trotzdem nicht weh. Unter Umständen bist Du ja dann auch ein wenig schlauer, oder eben nicht.
hanibal Threadstarter
ontopic starontopic starontopic starontopic starhalf ontopic starofftopic starofftopic starofftopic star
Beiträge: 157

Win xp
d7 eterprise
BeitragVerfasst: Mi 08.11.06 20:57 
es liegt an transperenzcolor := true, aber ich kann das nicht ausschalten, da ich dann ja wieder eine eckige form hab :cry:
Dunkel
ontopic starontopic starontopic starontopic starontopic starontopic starofftopic starofftopic star
Beiträge: 682

Mac OS X Snow Leopard
Xcode 3.1
BeitragVerfasst: Do 09.11.06 20:32 
Tja, shit happens!

Dein Code ist auf jeden Fall OK, großartig optimieren kannst Du via BASS auch nicht.

Hilft wohl nichts, Du mußt wohl entweder ein eckiges Formular nehmen, oder Dich ein wenig mit der OnDraw bzw. Paint Methode des Formulars auseinandersetzen.
Machbar ist das, keine Frage. Es steckt aber ein wenig mehr Arbeit dahinter, als nur eine Variable auf True zu setzen.

Tschaka, Du schaffst das! Das Forum hier kann Dir bestimmt weiterhelfen!
hanibal Threadstarter
ontopic starontopic starontopic starontopic starhalf ontopic starofftopic starofftopic starofftopic star
Beiträge: 157

Win xp
d7 eterprise
BeitragVerfasst: Fr 10.11.06 16:55 
und wie funktioniert das mit dem ondraw usw?

ich weiß im mom überhaubt nicht, wonach ich suchen soll :(
Dunkel
ontopic starontopic starontopic starontopic starontopic starontopic starofftopic starofftopic star
Beiträge: 682

Mac OS X Snow Leopard
Xcode 3.1
BeitragVerfasst: Fr 10.11.06 17:21 
Schau Dir zum Beispiel mal dieses Tutorial an.

Aber wie schon geschrieben, einfaches zusammenklicken von Formularen ist dann nicht mehr.
hanibal Threadstarter
ontopic starontopic starontopic starontopic starhalf ontopic starofftopic starofftopic starofftopic star
Beiträge: 157

Win xp
d7 eterprise
BeitragVerfasst: Fr 10.11.06 19:22 
ich glaub,das das noch ein bisschen hoch für mich ist :(

muss ich mal schaune, was an da sonst machen kann.

ist das villeicht mit threads möglich?
also multitasting?
Dunkel
ontopic starontopic starontopic starontopic starontopic starontopic starofftopic starofftopic star
Beiträge: 682

Mac OS X Snow Leopard
Xcode 3.1
BeitragVerfasst: Sa 11.11.06 01:30 
Probier es aus!

Nimm den Code aus TCircleScope, TOcilloScope & TSpectrum und pack den in ein TThread-Object (die Draw-Procedure der Units kann fast ohne Änderungen in die Execute-Methode übernommen werden). Das _kann_ mit SingleCore-Prozis ein wenig bringen, auf MultiCores sollte es ohne Probleme flüssig laufen (tut es zumindest bei mir; auch ohne dass diese in einem eigenen Thread laufen).

Alternativ kannst Du den Code aus den oben genannten Units noch ein wenig optimieren/umprogrammieren.

Ansonsten mußt Du halt mit einer stotternden Visualisierung leben, oder ein stink-normales Formular benutzen.


btw.
Was hast Du für Hardware vor Dir stehen? Selbst mit meinem 4 Jahre altem Notebook laufen ähnliche Sachen bei mir problemlos. Sind die Treiber Deiner GraKa auf dem aktuellen Stand?


Edit(h) flüstert mir gerade:
Wie groß machst Du die Visuallisierung? Im FullScreen (bzw. ab einer gewissen Größe) ist TCanvas mehr als nur unperformant. Versuch mal die Visuallisierung via DirectX oder OpenGL zu machen, das sollte flüssiger laufen.
hanibal Threadstarter
ontopic starontopic starontopic starontopic starhalf ontopic starofftopic starofftopic starofftopic star
Beiträge: 157

Win xp
d7 eterprise
BeitragVerfasst: Sa 11.11.06 15:10 
die canvas ist 183*97 Pixel groß, also relativ klein.
ich hab die visualisirung genau so gemacht, wie im beispiel prog von bass.

wie funktioniert das mit threads?
ich hab das noch nie gemacht :oops:

Und das komische bei der ganzen geschichte ist ja, dass das erst stottert, wenn die maus nichtmehr auf dem fenster ist.
Auf allen anderen computern die getestet hab, is das genau so :(


PS: Processor: AMD Athlon 64 3000+
Grafikkarte: Nvidea GeForce 6600 GT 128 MB
Speicher: 512 MB
Win XP Professional
Dunkel
ontopic starontopic starontopic starontopic starontopic starontopic starofftopic starofftopic star
Beiträge: 682

Mac OS X Snow Leopard
Xcode 3.1
BeitragVerfasst: Sa 11.11.06 21:26 
Wenn das Fenster nicht im Vordergrund ist, bzw. nicht aktiv ist, wird vom Windows-Sheduler weniger Rechenzeit dem Programm zugewiesen, das erklärt das Stottern.

Oben rechts ist eine Lupe abgebildet, rechts daneben steht 'Suche'. Schon mal da drauf geklickt?
Google listet auch jede Menge Seiten mit z.T. guten Tutorials und Beispielprogrammen.
Beide Male in das Suchefld sowas wie 'TThread', 'Thread execute' oder ähnliches eingegeben sollte Dir weiterhelfen!
hanibal Threadstarter
ontopic starontopic starontopic starontopic starhalf ontopic starofftopic starofftopic starofftopic star
Beiträge: 157

Win xp
d7 eterprise
BeitragVerfasst: So 12.11.06 12:59 
hab da ein sehr ausführliches tourial von lucki gefunden :D

Muss ich mich nurnoch reinarbeiten...
hanibal Threadstarter
ontopic starontopic starontopic starontopic starhalf ontopic starofftopic starofftopic starofftopic star
Beiträge: 157

Win xp
d7 eterprise
BeitragVerfasst: So 12.11.06 16:57 
Das ist der Thread quelltext:
ausblenden volle Höhe Delphi-Quelltext
1:
2:
3:
4:
5:
6:
7:
8:
9:
10:
11:
12:
13:
14:
15:
16:
17:
18:
19:
20:
21:
22:
23:
24:
25:
26:
27:
28:
29:
30:
31:
32:
33:
34:
35:
36:
37:
38:
39:
40:
41:
42:
43:
44:
45:
46:
47:
48:
49:
50:
51:
52:
53:
54:
55:
56:
57:
58:
59:
60:
61:
62:
63:
64:
65:
66:
67:
68:
69:
70:
71:
72:
73:
74:
75:
76:
77:
78:
79:
80:
81:
82:
83:
unit Unit17;

interface

uses
  Windows,Classes,circle_vis,
  osc_vis,CommonTypes,spectrum_vis,bass,Forms,messages,dialogs;

type
  tmythread = class(TThread)
  private
    { Private-Deklarationen }
    hbtest : hdc;
    procedure UpDateLVCaption;
  protected
    procedure Execute; override;
    public
    FIndex: Integer;
    hstream1 : hstream;
  end;

implementation
uses unit1;

{ Wichtig: Methoden und Eigenschaften von Objekten in visuellen Komponenten dürfen
  nur in einer Methode namens Synchronize aufgerufen werden, z.B.

      Synchronize(UpdateCaption);

  und UpdateCaption könnte folgendermaßen aussehen:

    procedure tmythread.UpdateCaption;
    begin
      Form1.Caption := 'Aktualisiert in einem Thread';
    end; }


{ tmythread }

procedure tmythread.Execute;
var
r1 : integer;
FFTFata : TFFTData;
 WaveData  : TWaveData;
begin

  { Thread-Code hier einfügen }

  repeat

case FIndex of
  0 :
   begin
    BASS_ChannelGetData(hstream1, @WaveData, 2048);
    CircleScope.Draw (hbtest, WaveData,9045);
   end;

  1 :
   begin
    BASS_ChannelGetData(hstream1, @WaveData, 2048);
    OcilloScope.Draw (hbtest, WaveData, 045);
   end;

  2 :
   begin
    BASS_ChannelGetData(hstream1, @FFTFata, BASS_DATA_FFT1024);
    Spectrum.Draw (hbtest, FFTFata, 250);
   end;
end;
if Terminated then
      break;
Synchronize(UpdateLVCaption);
sleep(33);
until r1 = 123;


end;

procedure tmythread.UpDateLVCaption;
begin
form1.UpdateLVCaption(hbtest);
end;

end.


und das der aufrufquelltext:
ausblenden Delphi-Quelltext
1:
2:
3:
4:
5:
6:
7:
8:
9:
10:
11:
12:
13:
14:
15:
16:
17:
18:
19:
20:
21:
22:
23:
24:
25:
26:
27:
28:
29:
BASS_Init(-1441000, Application.Handle, nil);

  CircleScope := TCircleScope.Create(unit1.form1.PaintFrame.Width, unit1.form1.PaintFrame.Height);
  OcilloScope := TOcilloScope.Create(unit1.form1.PaintFrame.Width, unit1.form1.PaintFrame.Height);
  Spectrum    := TSpectrum.Create(unit1.form1.PaintFrame.Width, unit1.form1.PaintFrame.Height);
  CircleScope.Radius := 30;
 CircleScope.Offset := 50;
 OcilloScope.Offset := 30;
 Spectrum.Height := 50;
 spectrum.Mode:= 0;
 spectrum.Width:= 1;
 CircleScope.BackColor:= oszilbackcolor;
 OcilloScope.BackColor:= oszilbackcolor;
 spectrum.BackColor:= oszilbackcolor;
 circlescope.Pen := oszilcolor;
 ocilloscope.Pen := oszilcolor;
 spectrum.Pen := oszilcolor;
 Spectrum.LineFallOff := 2;
 CircleScope.SetBackGround(True, unit1.form1.BackImageRes.Picture.Graphic);
 OcilloScope.SetBackGround(True, unit1.form1.BackImageRes.Picture.Graphic);
 Spectrum.SetBackGround(True, unit1.form1.BackImageRes.Picture.Graphic);

 thread1:= tmythread.Create(True);
 thread1.hstream1 := strs[1];
 thread1.FIndex:= funktionox;

 Thread1.Priority := tpnormal;
 thread1.FreeOnTerminate := True;
 thread1.Resume;



und das ist die funktion in unit 1 zum parameter über geben:(sie ist als puplic deklariert)
ausblenden Delphi-Quelltext
1:
2:
3:
4:
5:
procedure tform1.UpdateLVCaption(htest : hdc);
begin
PaintFrame.Canvas.Handle := htest;

end;



warum zeigt der kein oszilluskop an, wenn ich das starte?
kommt keine fehlermeldung, started alles ganz nomal, nur das der kein oszilluskop anzeigt :(
hanibal Threadstarter
ontopic starontopic starontopic starontopic starhalf ontopic starofftopic starofftopic starofftopic star
Beiträge: 157

Win xp
d7 eterprise
BeitragVerfasst: Mo 13.11.06 18:35 
weiß das keiner?
Dunkel
ontopic starontopic starontopic starontopic starontopic starontopic starofftopic starofftopic star
Beiträge: 682

Mac OS X Snow Leopard
Xcode 3.1
BeitragVerfasst: Mo 13.11.06 19:10 
Die ganzen X.Draw-Aufrufe würde ich in die Synchronize-Methode packen. Diese interagieren ja mit der visuellen Komponente des Hauptformulars.


ausblenden Delphi-Quelltext
1:
2:
3:
4:
5:
6:
7:
8:
9:
10:
11:
12:
13:
14:
procedure TMyThread.Execute;
begin
 while not Terminated do
  begin
   // mach was während der Thread läuft, z.B.:
   BASS_ChannelGetData(AudioStream, @GlobalWaveData, 2048);
   Synchronize(ZeichneMich);
  end;
end;

procedure TMyThread.ZeichneMich;
begin
 X.Draw(HDC, GlobalWaveData, x, y); 
end;


Nicht getestet!