
COMPLETLEY OUTDATED --FIX ME--


This shows how it is possible to create a nice Spectrum
Analyser which is not thread. The GUI polls the Analyser data
with eg: every 100 milliseconds

Let's Assume we have already a player and a whole bunch of
devices. (Programm shows the control flow of the GUI)

MyGui::InitAnalyser() {
  mulicaster = new MulitcastDevice();

  player->setDevice(multicaster);

  device1 = new Audiodevice("/dev/dsp");

  multicaster->addListener(device1);    // filled by thread

  pip = new PipeDevice();
  analyser = new SpectrumAnalyserDevice(32); // number of bands
  window = new WindowDevice();        // only memcpy's last data and stores
                                       // it

  multicaster->addListener(pipe);

  pipe->SetInput(window);
  pipe->SetOutput(analyser);

  timer= new QTimer();
  connect (timer,timeout,this,updateGui);
  timer->start(500);
}

MyGui::updateGui() {
  int data[32];
  pipe->pipe();    // gets the last valid data and pipe it to
                   // the analyser.
                   // The pipe takes care that the analyser
                   // does not eat too much cpu data
                   // when the data is not needed
  
  analyser->fillData(&data); // get the analyer data
  print(data);     // prints data in a nice GUI Component
}




