mirror of
https://github.com/JvanKatwijk/qt-dab.git
synced 2025-10-06 00:02:40 +02:00
added devicename to .sdr files
This commit is contained in:
@@ -265,7 +265,7 @@ The device widget gives information what the "type" of the file is (RIFF or BW64
|
|||||||

|

|
||||||
|
|
||||||
When reading input from an ".sdr" file that was **generated by Qt-DAB**
|
When reading input from an ".sdr" file that was **generated by Qt-DAB**
|
||||||
the channel frequency of the reception is displayed as shown in the pictures above.
|
both the name of the SDR device as well as the channel frequency of the reception is displayed as shown in the pictures above.
|
||||||
|
|
||||||
* reading prerecorded dump rtlsdr type "raw" (8 bits) files. The RTLSDR device handlers show a button "dump" for dumping the raw input into a ".raw" file.
|
* reading prerecorded dump rtlsdr type "raw" (8 bits) files. The RTLSDR device handlers show a button "dump" for dumping the raw input into a ".raw" file.
|
||||||
|
|
||||||
|
Binary file not shown.
Before Width: | Height: | Size: 30 KiB After Width: | Height: | Size: 36 KiB |
Binary file not shown.
Before Width: | Height: | Size: 30 KiB After Width: | Height: | Size: 36 KiB |
@@ -37,6 +37,8 @@ public:
|
|||||||
QLCDNumber *currentTime;
|
QLCDNumber *currentTime;
|
||||||
QLabel *seconds;
|
QLabel *seconds;
|
||||||
QLCDNumber *totalTime;
|
QLCDNumber *totalTime;
|
||||||
|
QLabel *deviceLabel;
|
||||||
|
QLabel *theDevice;
|
||||||
QLabel *typeLabel;
|
QLabel *typeLabel;
|
||||||
QLabel *typeOfFile;
|
QLabel *typeOfFile;
|
||||||
QLabel *amountLabel;
|
QLabel *amountLabel;
|
||||||
@@ -48,6 +50,8 @@ public:
|
|||||||
void setupUi (QWidget *qw) {
|
void setupUi (QWidget *qw) {
|
||||||
titleLabel = new QLabel ("Playing pre-recorded file");
|
titleLabel = new QLabel ("Playing pre-recorded file");
|
||||||
nameofFile = new QLabel ();
|
nameofFile = new QLabel ();
|
||||||
|
deviceLabel = new QLabel ();
|
||||||
|
theDevice = new QLabel ();
|
||||||
typeLabel = new QLabel ("filetype ");
|
typeLabel = new QLabel ("filetype ");
|
||||||
typeOfFile = new QLabel ();
|
typeOfFile = new QLabel ();
|
||||||
amountLabel = new QLabel (" nr samples ");
|
amountLabel = new QLabel (" nr samples ");
|
||||||
@@ -64,11 +68,14 @@ void setupUi (QWidget *qw) {
|
|||||||
totalTime -> setFrameShape (QFrame::NoFrame);
|
totalTime -> setFrameShape (QFrame::NoFrame);
|
||||||
totalTime -> setSegmentStyle (QLCDNumber::Flat);
|
totalTime -> setSegmentStyle (QLCDNumber::Flat);
|
||||||
QHBoxLayout *line_2 = new QHBoxLayout ();
|
QHBoxLayout *line_2 = new QHBoxLayout ();
|
||||||
line_2 -> addWidget (typeLabel);
|
line_2 -> addWidget (deviceLabel);
|
||||||
line_2 -> addWidget (typeOfFile);
|
line_2 -> addWidget (theDevice);
|
||||||
line_2 -> addWidget (amountLabel);
|
QHBoxLayout *line_3 = new QHBoxLayout ();
|
||||||
line_2 -> addWidget (sampleCount);
|
line_3 -> addWidget (typeLabel);
|
||||||
line_2 -> addWidget (frequencyLabel);
|
line_3 -> addWidget (typeOfFile);
|
||||||
|
line_3 -> addWidget (amountLabel);
|
||||||
|
line_3 -> addWidget (sampleCount);
|
||||||
|
line_3 -> addWidget (frequencyLabel);
|
||||||
QHBoxLayout *bottom = new QHBoxLayout ();
|
QHBoxLayout *bottom = new QHBoxLayout ();
|
||||||
bottom -> addWidget (currentTime);
|
bottom -> addWidget (currentTime);
|
||||||
bottom -> addWidget (seconds);
|
bottom -> addWidget (seconds);
|
||||||
@@ -78,6 +85,7 @@ void setupUi (QWidget *qw) {
|
|||||||
base -> addWidget (titleLabel);
|
base -> addWidget (titleLabel);
|
||||||
base -> addWidget (nameofFile);
|
base -> addWidget (nameofFile);
|
||||||
base -> addItem (line_2);
|
base -> addItem (line_2);
|
||||||
|
base -> addItem (line_3);
|
||||||
base -> addWidget (fileProgress);
|
base -> addWidget (fileProgress);
|
||||||
base -> addItem (bottom);
|
base -> addItem (bottom);
|
||||||
|
|
||||||
|
@@ -40,6 +40,7 @@
|
|||||||
newFilesSettings = s;
|
newFilesSettings = s;
|
||||||
setupUi (&myFrame);
|
setupUi (&myFrame);
|
||||||
setPositionAndSize (s, &myFrame, WAVSETTINGS);
|
setPositionAndSize (s, &myFrame, WAVSETTINGS);
|
||||||
|
myFrame. setWindowTitle ("BW64/RIFF reader");
|
||||||
myFrame. show ();
|
myFrame. show ();
|
||||||
this -> fileName = fileName;
|
this -> fileName = fileName;
|
||||||
|
|
||||||
@@ -48,7 +49,12 @@
|
|||||||
currentTime -> display (0);
|
currentTime -> display (0);
|
||||||
int64_t fileLength = theReader. elementCount ();
|
int64_t fileLength = theReader. elementCount ();
|
||||||
QString fileType = theReader. fileType ();
|
QString fileType = theReader. fileType ();
|
||||||
|
QString deviceName = theReader. getDevice ();
|
||||||
totalTime -> display ((float)fileLength / SAMPLERATE);
|
totalTime -> display ((float)fileLength / SAMPLERATE);
|
||||||
|
if (deviceName != "") {
|
||||||
|
deviceLabel -> setText ("Generating device: ");
|
||||||
|
theDevice -> setText (deviceName);
|
||||||
|
}
|
||||||
typeOfFile -> setText (fileType);
|
typeOfFile -> setText (fileType);
|
||||||
sampleCount -> setText (QString::number (fileLength));
|
sampleCount -> setText (QString::number (fileLength));
|
||||||
int32_t Freq = theReader. getVFOFrequency ();
|
int32_t Freq = theReader. getVFOFrequency ();
|
||||||
|
@@ -44,9 +44,10 @@ uint32_t segmentSize;
|
|||||||
char header [5];
|
char header [5];
|
||||||
|
|
||||||
header [4] = 0;
|
header [4] = 0;
|
||||||
bitDepth = 15; // default
|
bitDepth = 0; // i.e. unknown
|
||||||
tunedFrequency = -1;
|
tunedFrequency = -1;
|
||||||
denominator = 0;
|
denominator = 0;
|
||||||
|
theDevice = "";
|
||||||
filePointer = fopen (fileName. toLatin1 (). data (), "rb");
|
filePointer = fopen (fileName. toLatin1 (). data (), "rb");
|
||||||
if (filePointer == nullptr) {
|
if (filePointer == nullptr) {
|
||||||
QString val =
|
QString val =
|
||||||
@@ -173,6 +174,12 @@ char header [5];
|
|||||||
else
|
else
|
||||||
if (QString (header) == "bits")
|
if (QString (header) == "bits")
|
||||||
fread (&bitDepth, 1, 4, filePointer);
|
fread (&bitDepth, 1, 4, filePointer);
|
||||||
|
else
|
||||||
|
if (QString (header) == "sys ") {
|
||||||
|
char temp [255];
|
||||||
|
fread (temp, 1, segmentSize, filePointer);
|
||||||
|
theDevice = QString (temp);
|
||||||
|
}
|
||||||
else
|
else
|
||||||
fseek (filePointer, segmentSize, SEEK_CUR);
|
fseek (filePointer, segmentSize, SEEK_CUR);
|
||||||
fread (header, 1, 4, filePointer);
|
fread (header, 1, 4, filePointer);
|
||||||
@@ -184,7 +191,7 @@ char header [5];
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
denominator = value_for (bitDepth);
|
denominator = bitDepth != 0 ? value_for (bitDepth) : 32768;
|
||||||
if (QString (header) != "data") { // should not happen
|
if (QString (header) != "data") { // should not happen
|
||||||
QString val =
|
QString val =
|
||||||
QString ("File '%1' is no valid SDR file").arg(fileName);
|
QString ("File '%1' is no valid SDR file").arg(fileName);
|
||||||
@@ -298,6 +305,12 @@ char header [5];
|
|||||||
else
|
else
|
||||||
if (QString (header) == "bits")
|
if (QString (header) == "bits")
|
||||||
fread (&bitDepth, 1, 4, filePointer);
|
fread (&bitDepth, 1, 4, filePointer);
|
||||||
|
else
|
||||||
|
if (QString (header) == "sys ") {
|
||||||
|
char temp [255];
|
||||||
|
fread (temp, 1, segmentSize, filePointer);
|
||||||
|
theDevice = QString (temp);
|
||||||
|
}
|
||||||
else
|
else
|
||||||
fseek (filePointer, segmentSize, SEEK_CUR);
|
fseek (filePointer, segmentSize, SEEK_CUR);
|
||||||
fread (header, 1, 4, filePointer);
|
fread (header, 1, 4, filePointer);
|
||||||
@@ -309,7 +322,7 @@ char header [5];
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
denominator = value_for (bitDepth);
|
denominator = bitDepth != 0 ? value_for (bitDepth): 32768;
|
||||||
if (QString (header) != "data") { // should not happen
|
if (QString (header) != "data") { // should not happen
|
||||||
QString val =
|
QString val =
|
||||||
QString ("File '%1' is no valid SDR file").arg(fileName);
|
QString ("File '%1' is no valid SDR file").arg(fileName);
|
||||||
@@ -405,3 +418,7 @@ int riffReader::getVFOFrequency () {
|
|||||||
return tunedFrequency;
|
return tunedFrequency;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
QString riffReader::getDevice () {
|
||||||
|
return theDevice;
|
||||||
|
}
|
||||||
|
|
||||||
|
@@ -37,11 +37,12 @@ public:
|
|||||||
uint64_t elementCount ();
|
uint64_t elementCount ();
|
||||||
QString fileType ();
|
QString fileType ();
|
||||||
uint64_t currentPos ();
|
uint64_t currentPos ();
|
||||||
|
|
||||||
int getVFOFrequency ();
|
int getVFOFrequency ();
|
||||||
|
QString getDevice ();
|
||||||
private:
|
private:
|
||||||
|
|
||||||
QString fileName;
|
QString fileName;
|
||||||
|
QString theDevice;
|
||||||
uint16_t formatTag;
|
uint16_t formatTag;
|
||||||
uint16_t nrChannels;
|
uint16_t nrChannels;
|
||||||
uint32_t samplingRate;
|
uint32_t samplingRate;
|
||||||
|
@@ -48,6 +48,7 @@
|
|||||||
this -> fileName = fileName;
|
this -> fileName = fileName;
|
||||||
setupUi (&myFrame);
|
setupUi (&myFrame);
|
||||||
setPositionAndSize (s, &myFrame, RAWSETTINGS);
|
setPositionAndSize (s, &myFrame, RAWSETTINGS);
|
||||||
|
myFrame. setWindowTitle ("Reader for raw (8 bit osmocom type) files");
|
||||||
myFrame. show ();
|
myFrame. show ();
|
||||||
|
|
||||||
filePointer = fopen (fileName. toUtf8 (). data (), "rb");
|
filePointer = fopen (fileName. toUtf8 (). data (), "rb");
|
||||||
|
@@ -923,7 +923,17 @@ const int16_t Length = getBits_5 (d, 3);
|
|||||||
const uint8_t CN_bit = getBits_1 (d, 8 + 0);
|
const uint8_t CN_bit = getBits_1 (d, 8 + 0);
|
||||||
const uint8_t OE_bit = getBits_1 (d, 8 + 1);
|
const uint8_t OE_bit = getBits_1 (d, 8 + 1);
|
||||||
const uint8_t PD_bit = getBits_1 (d, 8 + 2);
|
const uint8_t PD_bit = getBits_1 (d, 8 + 2);
|
||||||
fprintf (stderr, "Fig20\n");
|
#ifndef __MINGW32__
|
||||||
|
static bool shown = false;
|
||||||
|
if (!shown) {
|
||||||
|
if (theEnsemble. namePresent) {
|
||||||
|
fprintf (stderr, "FIG0/20 appears in %s\n",
|
||||||
|
theEnsemble. ensembleName.
|
||||||
|
toLatin1 (). data ());
|
||||||
|
shown = true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
#endif
|
||||||
return;
|
return;
|
||||||
while (used < Length)
|
while (used < Length)
|
||||||
used = HandleFIG0Extension21 (d, used, CN_bit, OE_bit, PD_bit);
|
used = HandleFIG0Extension21 (d, used, CN_bit, OE_bit, PD_bit);
|
||||||
|
@@ -643,8 +643,8 @@ bool ofdmHandler::setDataChannel (packetdata &d,
|
|||||||
}
|
}
|
||||||
|
|
||||||
void ofdmHandler::startDumping (const QString &f, int freq,
|
void ofdmHandler::startDumping (const QString &f, int freq,
|
||||||
int bitDepth) {
|
int bitDepth, const QString creator) {
|
||||||
theReader. startDumping (f, freq, bitDepth);
|
theReader. startDumping (f, freq, bitDepth, creator);
|
||||||
}
|
}
|
||||||
|
|
||||||
void ofdmHandler::stopDumping() {
|
void ofdmHandler::stopDumping() {
|
||||||
|
@@ -62,7 +62,8 @@ public:
|
|||||||
void stop ();
|
void stop ();
|
||||||
|
|
||||||
void selectTII (uint8_t);
|
void selectTII (uint8_t);
|
||||||
void startDumping (const QString &, int, int);
|
void startDumping (const QString &, int,
|
||||||
|
int, const QString);
|
||||||
void stopDumping ();
|
void stopDumping ();
|
||||||
bool startEtiGenerator (const QString &);
|
bool startEtiGenerator (const QString &);
|
||||||
void stopEtiGenerator ();
|
void stopEtiGenerator ();
|
||||||
|
@@ -185,8 +185,10 @@ auto *buffer = dynVec (std::complex<float>, nrSamples);
|
|||||||
}
|
}
|
||||||
|
|
||||||
void sampleReader::startDumping (const QString &fileName,
|
void sampleReader::startDumping (const QString &fileName,
|
||||||
int freq, int bitDepth) {
|
int freq, int bitDepth,
|
||||||
sourceDumper. init (fileName, SAMPLERATE, freq, bitDepth);
|
const QString deviceName) {
|
||||||
|
sourceDumper. init (fileName, SAMPLERATE,
|
||||||
|
freq, bitDepth, deviceName);
|
||||||
}
|
}
|
||||||
|
|
||||||
void sampleReader::stopDumping() {
|
void sampleReader::stopDumping() {
|
||||||
|
@@ -55,7 +55,7 @@ public:
|
|||||||
void getSamples (std::vector<Complex> &v,
|
void getSamples (std::vector<Complex> &v,
|
||||||
int index,
|
int index,
|
||||||
int32_t n, int32_t phase, bool saving);
|
int32_t n, int32_t phase, bool saving);
|
||||||
void startDumping (const QString &, int, int);
|
void startDumping (const QString &, int, int, const QString);
|
||||||
void stopDumping ();
|
void stopDumping ();
|
||||||
private:
|
private:
|
||||||
riffWriter sourceDumper;
|
riffWriter sourceDumper;
|
||||||
|
@@ -3476,7 +3476,9 @@ QString channelName = channel. channelName;
|
|||||||
deviceName, channelName);
|
deviceName, channelName);
|
||||||
configHandler_p -> mark_dumpButton (true);
|
configHandler_p -> mark_dumpButton (true);
|
||||||
theOFDMHandler -> startDumping (rawDumpName,
|
theOFDMHandler -> startDumping (rawDumpName,
|
||||||
channel. tunedFrequency, bitDepth);
|
channel. tunedFrequency,
|
||||||
|
bitDepth,
|
||||||
|
inputDevice_p -> deviceName ());
|
||||||
sourceDumping = true;
|
sourceDumping = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -43,6 +43,8 @@ const char * aux1 = "freq";
|
|||||||
static
|
static
|
||||||
const char * aux2 = "bits";
|
const char * aux2 = "bits";
|
||||||
static
|
static
|
||||||
|
const char * aux3 = "sys ";
|
||||||
|
static
|
||||||
const char * data = "data";
|
const char * data = "data";
|
||||||
|
|
||||||
riffWriter::riffWriter () {
|
riffWriter::riffWriter () {
|
||||||
@@ -52,7 +54,8 @@ const char * data = "data";
|
|||||||
riffWriter::~riffWriter () {}
|
riffWriter::~riffWriter () {}
|
||||||
|
|
||||||
bool riffWriter::init (const QString &fileName, const int sampleRate,
|
bool riffWriter::init (const QString &fileName, const int sampleRate,
|
||||||
const int frequency, const int bitDepth) {
|
const int frequency, const int bitDepth,
|
||||||
|
QString creatorText) {
|
||||||
isValid = false;
|
isValid = false;
|
||||||
filePointer = fopen (fileName. toUtf8 (). data (), "wb");
|
filePointer = fopen (fileName. toUtf8 (). data (), "wb");
|
||||||
if (filePointer == nullptr)
|
if (filePointer == nullptr)
|
||||||
@@ -123,6 +126,17 @@ bool riffWriter::init (const QString &fileName, const int sampleRate,
|
|||||||
fwrite (&bitDepth, 1, 4, filePointer);
|
fwrite (&bitDepth, 1, 4, filePointer);
|
||||||
locationCounter += 4;
|
locationCounter += 4;
|
||||||
}
|
}
|
||||||
|
// the "creator" chunk
|
||||||
|
if (bitDepth > 0) {
|
||||||
|
fwrite (aux3, 1, 4, filePointer);
|
||||||
|
locationCounter += 4;
|
||||||
|
int size = strlen (creatorText. toLatin1 (). data ());
|
||||||
|
locationCounter += 4;
|
||||||
|
fwrite (&size, 1, 4, filePointer);
|
||||||
|
locationCounter += 4;
|
||||||
|
fwrite (creatorText. toLatin1 (). data (), 1, size, filePointer);
|
||||||
|
locationCounter += size;
|
||||||
|
}
|
||||||
//
|
//
|
||||||
// start of the "data" chunk
|
// start of the "data" chunk
|
||||||
fwrite (data, 1, 4, filePointer);
|
fwrite (data, 1, 4, filePointer);
|
||||||
|
@@ -32,7 +32,8 @@ public:
|
|||||||
riffWriter ();
|
riffWriter ();
|
||||||
~riffWriter ();
|
~riffWriter ();
|
||||||
bool init (const QString &, int,
|
bool init (const QString &, int,
|
||||||
int bitDepth = 0, int frequency = 0);
|
int bitDepth = 0, int frequency = 0,
|
||||||
|
QString creator = "Qt-DAB-6.9.3");
|
||||||
void write (int16_t *buff, uint64_t samples);
|
void write (int16_t *buff, uint64_t samples);
|
||||||
void close ();
|
void close ();
|
||||||
bool isActive ();
|
bool isActive ();
|
||||||
|
Reference in New Issue
Block a user