SDRAngel  4.11.5
Developer docs for <a href="https://github.com/f4exb/sdrangel">SDRangel<\a>, an Open Source Qt5 / OpenGL 3.0+ SDR and signal analyzer frontend to various hardware.
dsddecoder.cpp
Go to the documentation of this file.
1 // Copyright (C) 2016 F4EXB //
3 // written by Edouard Griffiths //
4 // //
5 // This program is free software; you can redistribute it and/or modify //
6 // it under the terms of the GNU General Public License as published by //
7 // the Free Software Foundation as version 3 of the License, or //
8 // (at your option) any later version. //
9 // //
10 // This program is distributed in the hope that it will be useful, //
11 // but WITHOUT ANY WARRANTY; without even the implied warranty of //
12 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the //
13 // GNU General Public License V3 for more details. //
14 // //
15 // You should have received a copy of the GNU General Public License //
16 // along with this program. If not, see <http://www.gnu.org/licenses/>. //
18 
19 #include "dsddecoder.h"
20 
21 #include <QtGlobal>
22 #include "audio/audiofifo.h"
23 
24 
26 {
27  m_decoder.setQuiet();
28  m_decoder.setUpsampling(6); // force upsampling of audio to 48k
29  m_decoder.setStereo(true); // force copy to L+R channels
30  m_decoder.setDecodeMode(DSDcc::DSDDecoder::DSDDecodeAuto, true); // Initialize with auto-detect
31  m_decoder.setUvQuality(3); // This is gr-dsd default
32  m_decoder.enableCosineFiltering(false);
33  m_decoder.setDataRate(DSDcc::DSDDecoder::DSDRate4800);
34 }
35 
37 {
38 }
39 
40 void DSDDecoder::set48k(bool to48k)
41 {
42  m_decoder.setUpsampling(to48k ? 6 : 0);
43 }
44 
45 void DSDDecoder::setUpsampling(int upsampling)
46 {
47  m_decoder.setUpsampling(upsampling);
48 }
49 
50 void DSDDecoder::setBaudRate(int baudRate)
51 {
52  if (baudRate == 2400)
53  {
54  m_decoder.setDataRate(DSDcc::DSDDecoder::DSDRate2400);
55  }
56  else if (baudRate == 4800)
57  {
58  m_decoder.setDataRate(DSDcc::DSDDecoder::DSDRate4800);
59  }
60  else if (baudRate == 9600)
61  {
62  m_decoder.setDataRate(DSDcc::DSDDecoder::DSDRate9600);
63  }
64  else // default 4800 bauds
65  {
66  m_decoder.setDataRate(DSDcc::DSDDecoder::DSDRate4800);
67  }
68 
69  // when setting baud rate activate detection of all possible modes for this rate
70  // because on the other hand when a mode is selected then the baud rate is automatically changed
71  m_decoder.setDecodeMode(DSDcc::DSDDecoder::DSDDecodeAuto, true);
72 }
DSDcc::DSDDecoder m_decoder
Definition: dsddecoder.h:80
void setBaudRate(int baudRate)
Definition: dsddecoder.cpp:50
void setUpsampling(int upsampling)
Definition: dsddecoder.cpp:45
void set48k(bool to48k)
Definition: dsddecoder.cpp:40