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**
|
||||
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.
|
||||
|
||||
|
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;
|
||||
QLabel *seconds;
|
||||
QLCDNumber *totalTime;
|
||||
QLabel *deviceLabel;
|
||||
QLabel *theDevice;
|
||||
QLabel *typeLabel;
|
||||
QLabel *typeOfFile;
|
||||
QLabel *amountLabel;
|
||||
@@ -48,6 +50,8 @@ public:
|
||||
void setupUi (QWidget *qw) {
|
||||
titleLabel = new QLabel ("Playing pre-recorded file");
|
||||
nameofFile = new QLabel ();
|
||||
deviceLabel = new QLabel ();
|
||||
theDevice = new QLabel ();
|
||||
typeLabel = new QLabel ("filetype ");
|
||||
typeOfFile = new QLabel ();
|
||||
amountLabel = new QLabel (" nr samples ");
|
||||
@@ -64,11 +68,14 @@ void setupUi (QWidget *qw) {
|
||||
totalTime -> setFrameShape (QFrame::NoFrame);
|
||||
totalTime -> setSegmentStyle (QLCDNumber::Flat);
|
||||
QHBoxLayout *line_2 = new QHBoxLayout ();
|
||||
line_2 -> addWidget (typeLabel);
|
||||
line_2 -> addWidget (typeOfFile);
|
||||
line_2 -> addWidget (amountLabel);
|
||||
line_2 -> addWidget (sampleCount);
|
||||
line_2 -> addWidget (frequencyLabel);
|
||||
line_2 -> addWidget (deviceLabel);
|
||||
line_2 -> addWidget (theDevice);
|
||||
QHBoxLayout *line_3 = new QHBoxLayout ();
|
||||
line_3 -> addWidget (typeLabel);
|
||||
line_3 -> addWidget (typeOfFile);
|
||||
line_3 -> addWidget (amountLabel);
|
||||
line_3 -> addWidget (sampleCount);
|
||||
line_3 -> addWidget (frequencyLabel);
|
||||
QHBoxLayout *bottom = new QHBoxLayout ();
|
||||
bottom -> addWidget (currentTime);
|
||||
bottom -> addWidget (seconds);
|
||||
@@ -78,6 +85,7 @@ void setupUi (QWidget *qw) {
|
||||
base -> addWidget (titleLabel);
|
||||
base -> addWidget (nameofFile);
|
||||
base -> addItem (line_2);
|
||||
base -> addItem (line_3);
|
||||
base -> addWidget (fileProgress);
|
||||
base -> addItem (bottom);
|
||||
|
||||
|
@@ -40,6 +40,7 @@
|
||||
newFilesSettings = s;
|
||||
setupUi (&myFrame);
|
||||
setPositionAndSize (s, &myFrame, WAVSETTINGS);
|
||||
myFrame. setWindowTitle ("BW64/RIFF reader");
|
||||
myFrame. show ();
|
||||
this -> fileName = fileName;
|
||||
|
||||
@@ -48,7 +49,12 @@
|
||||
currentTime -> display (0);
|
||||
int64_t fileLength = theReader. elementCount ();
|
||||
QString fileType = theReader. fileType ();
|
||||
QString deviceName = theReader. getDevice ();
|
||||
totalTime -> display ((float)fileLength / SAMPLERATE);
|
||||
if (deviceName != "") {
|
||||
deviceLabel -> setText ("Generating device: ");
|
||||
theDevice -> setText (deviceName);
|
||||
}
|
||||
typeOfFile -> setText (fileType);
|
||||
sampleCount -> setText (QString::number (fileLength));
|
||||
int32_t Freq = theReader. getVFOFrequency ();
|
||||
|
@@ -44,9 +44,10 @@ uint32_t segmentSize;
|
||||
char header [5];
|
||||
|
||||
header [4] = 0;
|
||||
bitDepth = 15; // default
|
||||
bitDepth = 0; // i.e. unknown
|
||||
tunedFrequency = -1;
|
||||
denominator = 0;
|
||||
theDevice = "";
|
||||
filePointer = fopen (fileName. toLatin1 (). data (), "rb");
|
||||
if (filePointer == nullptr) {
|
||||
QString val =
|
||||
@@ -173,6 +174,12 @@ char header [5];
|
||||
else
|
||||
if (QString (header) == "bits")
|
||||
fread (&bitDepth, 1, 4, filePointer);
|
||||
else
|
||||
if (QString (header) == "sys ") {
|
||||
char temp [255];
|
||||
fread (temp, 1, segmentSize, filePointer);
|
||||
theDevice = QString (temp);
|
||||
}
|
||||
else
|
||||
fseek (filePointer, segmentSize, SEEK_CUR);
|
||||
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
|
||||
QString val =
|
||||
QString ("File '%1' is no valid SDR file").arg(fileName);
|
||||
@@ -298,6 +305,12 @@ char header [5];
|
||||
else
|
||||
if (QString (header) == "bits")
|
||||
fread (&bitDepth, 1, 4, filePointer);
|
||||
else
|
||||
if (QString (header) == "sys ") {
|
||||
char temp [255];
|
||||
fread (temp, 1, segmentSize, filePointer);
|
||||
theDevice = QString (temp);
|
||||
}
|
||||
else
|
||||
fseek (filePointer, segmentSize, SEEK_CUR);
|
||||
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
|
||||
QString val =
|
||||
QString ("File '%1' is no valid SDR file").arg(fileName);
|
||||
@@ -405,3 +418,7 @@ int riffReader::getVFOFrequency () {
|
||||
return tunedFrequency;
|
||||
}
|
||||
|
||||
QString riffReader::getDevice () {
|
||||
return theDevice;
|
||||
}
|
||||
|
||||
|
@@ -37,11 +37,12 @@ public:
|
||||
uint64_t elementCount ();
|
||||
QString fileType ();
|
||||
uint64_t currentPos ();
|
||||
|
||||
int getVFOFrequency ();
|
||||
QString getDevice ();
|
||||
private:
|
||||
|
||||
QString fileName;
|
||||
QString theDevice;
|
||||
uint16_t formatTag;
|
||||
uint16_t nrChannels;
|
||||
uint32_t samplingRate;
|
||||
|
@@ -48,6 +48,7 @@
|
||||
this -> fileName = fileName;
|
||||
setupUi (&myFrame);
|
||||
setPositionAndSize (s, &myFrame, RAWSETTINGS);
|
||||
myFrame. setWindowTitle ("Reader for raw (8 bit osmocom type) files");
|
||||
myFrame. show ();
|
||||
|
||||
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 OE_bit = getBits_1 (d, 8 + 1);
|
||||
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;
|
||||
while (used < Length)
|
||||
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,
|
||||
int bitDepth) {
|
||||
theReader. startDumping (f, freq, bitDepth);
|
||||
int bitDepth, const QString creator) {
|
||||
theReader. startDumping (f, freq, bitDepth, creator);
|
||||
}
|
||||
|
||||
void ofdmHandler::stopDumping() {
|
||||
|
@@ -62,7 +62,8 @@ public:
|
||||
void stop ();
|
||||
|
||||
void selectTII (uint8_t);
|
||||
void startDumping (const QString &, int, int);
|
||||
void startDumping (const QString &, int,
|
||||
int, const QString);
|
||||
void stopDumping ();
|
||||
bool startEtiGenerator (const QString &);
|
||||
void stopEtiGenerator ();
|
||||
|
@@ -185,8 +185,10 @@ auto *buffer = dynVec (std::complex<float>, nrSamples);
|
||||
}
|
||||
|
||||
void sampleReader::startDumping (const QString &fileName,
|
||||
int freq, int bitDepth) {
|
||||
sourceDumper. init (fileName, SAMPLERATE, freq, bitDepth);
|
||||
int freq, int bitDepth,
|
||||
const QString deviceName) {
|
||||
sourceDumper. init (fileName, SAMPLERATE,
|
||||
freq, bitDepth, deviceName);
|
||||
}
|
||||
|
||||
void sampleReader::stopDumping() {
|
||||
|
@@ -55,7 +55,7 @@ public:
|
||||
void getSamples (std::vector<Complex> &v,
|
||||
int index,
|
||||
int32_t n, int32_t phase, bool saving);
|
||||
void startDumping (const QString &, int, int);
|
||||
void startDumping (const QString &, int, int, const QString);
|
||||
void stopDumping ();
|
||||
private:
|
||||
riffWriter sourceDumper;
|
||||
|
@@ -3476,7 +3476,9 @@ QString channelName = channel. channelName;
|
||||
deviceName, channelName);
|
||||
configHandler_p -> mark_dumpButton (true);
|
||||
theOFDMHandler -> startDumping (rawDumpName,
|
||||
channel. tunedFrequency, bitDepth);
|
||||
channel. tunedFrequency,
|
||||
bitDepth,
|
||||
inputDevice_p -> deviceName ());
|
||||
sourceDumping = true;
|
||||
}
|
||||
|
||||
|
@@ -43,6 +43,8 @@ const char * aux1 = "freq";
|
||||
static
|
||||
const char * aux2 = "bits";
|
||||
static
|
||||
const char * aux3 = "sys ";
|
||||
static
|
||||
const char * data = "data";
|
||||
|
||||
riffWriter::riffWriter () {
|
||||
@@ -52,7 +54,8 @@ const char * data = "data";
|
||||
riffWriter::~riffWriter () {}
|
||||
|
||||
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;
|
||||
filePointer = fopen (fileName. toUtf8 (). data (), "wb");
|
||||
if (filePointer == nullptr)
|
||||
@@ -123,6 +126,17 @@ bool riffWriter::init (const QString &fileName, const int sampleRate,
|
||||
fwrite (&bitDepth, 1, 4, filePointer);
|
||||
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
|
||||
fwrite (data, 1, 4, filePointer);
|
||||
|
@@ -32,7 +32,8 @@ public:
|
||||
riffWriter ();
|
||||
~riffWriter ();
|
||||
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 close ();
|
||||
bool isActive ();
|
||||
|
Reference in New Issue
Block a user