Andrew Haines wrote:
I used fmod a while back and it has the ability to output VU levels. I just put the paint methods in a timer event and used a TPanel to draw on. I'm not sure if this would work for you.

What is VU?

I am using a Analigic-to-Digital conversor witch can handle up to 200 khz, so I need a timer that is able to execute at 500 khz or so to keep asking the ISA card to send data faster then it can to avoid loss of data.

TTimer can only executa at a maximum of 1khz, so it is discarted.

I remember that once I used DirectX as a interface to DirectDraw, and I used a special timer that came with DirecX to draw instead of the default one claiming the Delphi timer is unreliable at high speed. Is it the same with lazarus timer? Should I build my own timer?

In the lack of a Timer I may even create a separete thread that runs on a infinite loop asking the ISA to send data, but this is really ugly. Of course Interuptions or Direct Memory Access (DMA) would be more elegant, but this can as well work. If there is time left on november I may implement interruptions for the osciloscope.

My current method is: Put the data fletching routine on the Timer and the drawing function on the a PaintBox.RePaint event. So I need to put a PaintBox.RePaint on the Timer that executes from time to time (10Hz or so ?).

Is this method eficient? There is significant change between the frames as if RePaint executes on 10Hz the data has already changed many times. Is there a better method then Repaint?

I used the Canvas.LineTo procedure and I found that the most efficient way overall to draw the line was to only draw the differences.

Ummmm ... acctually I did not understand it. Here is my current code:

procedure TForm1.PaintBox1Paint(Sender: TObject);
var
  Largura, Altura: Integer;
  x, y: Integer;
begin
  Largura := 500;
  Altura := 400;

  // Limpa a tela
  Canvas.Pen.Color := clWhite;
  Canvas.Rectangle(0, 0, Largura, Altura);

  // Desenha os quadrados
  Canvas.Pen.Color := clBlack;
  for x := 1 to 8 do
   for y := 1 to 8 do
   begin
Canvas.Rectangle(Round((x - 1) * Largura / 8), Round((y - 1) * Altura / 8), Round(x * Largura / 8), Round(y * Altura / 8));
   end;

  // Desenha utilizando o metodo das retas
  Canvas.Pen.Color := clBlack;
  Canvas.MoveTo(0, 0);
  for x := 0 to 200 do
   Canvas.LineTo(5 * x, (Altura div 2) + -5 * Medidas[x]);
end;

procedure TForm1.Timer1Timer(Sender: TObject);
begin
// here I populate Medidas[x] with data. Currently it is dummy data, but it will be data from the Osciloscope next month =)
end;

and put a: "PaintBox.Repaint;" on a separate timer that is slower.

_________________________________________________________________
    To unsubscribe: mail [EMAIL PROTECTED] with
               "unsubscribe" as the Subject
  archives at http://www.lazarus.freepascal.org/mailarchives

Reply via email to