File: drmrx.cpp

package info (click to toggle)
qsstv 9.5.8-6
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 10,928 kB
  • sloc: cpp: 47,579; makefile: 4
file content (75 lines) | stat: -rw-r--r-- 1,544 bytes parent folder | download | duplicates (5)
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
#include "drmrx.h"
#include "appglobal.h"
#include "drm.h"
#include "demodulator.h"
#include "dispatcher.h"
#include "filters.h"


drmRx::drmRx(QObject *parent) : QObject(parent),iqFilter(RXSTRIPE)
{
  srcDecoder=new sourceDecoder;
  demodulatorPtr=new demodulator;
}

drmRx::~drmRx()
{
  delete srcDecoder;
}

void drmRx::init()
{
  avgSNR=0;
  avgSNRAvailable=false;
  n = DRMBUFSIZE;
  /* initialisations */
  demodulatorPtr->init();
  initGetmode( n / 4);
  rRation = 1.000;
  samplerate_offset_estimation = 0.0;
  runstate = RUN_STATE_POWER_ON;		/* POWER_ON */
  channel_decoding();
  runstate = RUN_STATE_INIT;		/* INIT */
  channel_decoding();
  runstate = RUN_STATE_FIRST;			/* FIRSTRUN */
  runstate = RUN_STATE_NORMAL;			/* NORMAL RUN */
  srcDecoder->init();
}



void drmRx::run(DSPFLOAT *dataPtr)
{
  bool done=false;
  DSPFLOAT temp;
  displayDRMStatEvent *ce1;
  displayDRMInfoEvent *ce2 ;

  temp=WMERFAC;
  if(temp<0) temp=0;
  if(avgSNRAvailable)
    {
      avgSNR=(1-0.05)*avgSNR+0.05*temp;
      ce1 = new displayDRMStatEvent(avgSNR);
      ce1->waitFor(&done);
      QApplication::postEvent(dispatcherPtr, ce1);
      while(!done) { usleep(10);}

    }

 if(input_samples_buffer_request ==0)
    {
      demodulatorPtr->demodulate(resamp_signal,0);
    }
  iqFilter.process(dataPtr,resamp_signal,RXSTRIPE);
  im=RXSTRIPE;

  demodulatorPtr->demodulate(resamp_signal,im);

  done=false;
  ce2 = new displayDRMInfoEvent;
  ce2->waitFor(&done);
  QApplication::postEvent(dispatcherPtr, ce2);
  while(!done) { usleep(10);}
}