kopia lustrzana https://github.com/jamescoxon/dl-fldigi
MT63 Olivia Peak signal
* Corrected MT63 and Olivia tx signal generation to avoid sound codec overflowpull/1/head
rodzic
311925bab2
commit
e77aafe440
|
@ -69,19 +69,12 @@ int mt63::tx_process()
|
|||
guard_lock dsp_lock(&mt63_mutex);
|
||||
|
||||
int c;
|
||||
double maxval = 0;
|
||||
|
||||
if (startflag == true) {
|
||||
startflag = false;
|
||||
if (progdefaults.mt63_usetones) {
|
||||
double maxval = 0.0;
|
||||
for (int i = 0; i < (bandwidth * progdefaults.mt63_tone_duration / 96); i++) {
|
||||
Tx->SendTune( progdefaults.mt63_twotones );
|
||||
for (int i = 0; i < Tx->Comb.Output.Len; i++)
|
||||
if (fabs(Tx->Comb.Output.Data[i]) > maxval)
|
||||
maxval = fabs(Tx->Comb.Output.Data[i]);
|
||||
for (int i = 0; i < Tx->Comb.Output.Len; i++)
|
||||
Tx->Comb.Output.Data[i] /= maxval;
|
||||
ModulateXmtr((Tx->Comb.Output.Data), Tx->Comb.Output.Len);
|
||||
}
|
||||
}
|
||||
|
@ -100,20 +93,9 @@ int mt63::tx_process()
|
|||
stopflag = false;
|
||||
while (--flush) {
|
||||
Tx->SendChar(0);
|
||||
for (int i = 0; i < Tx->Comb.Output.Len; i++)
|
||||
if (fabs(Tx->Comb.Output.Data[i]) > maxval)
|
||||
maxval = fabs(Tx->Comb.Output.Data[i]);
|
||||
for (int i = 0; i < Tx->Comb.Output.Len; i++) {
|
||||
Tx->Comb.Output.Data[i] /= maxval;
|
||||
}
|
||||
ModulateXmtr((Tx->Comb.Output.Data), Tx->Comb.Output.Len);
|
||||
}
|
||||
Tx->SendJam();
|
||||
for (int i = 0; i < Tx->Comb.Output.Len; i++)
|
||||
if (fabs(Tx->Comb.Output.Data[i]) > maxval)
|
||||
maxval = fabs(Tx->Comb.Output.Data[i]);
|
||||
for (int i = 0; i < Tx->Comb.Output.Len; i++)
|
||||
Tx->Comb.Output.Data[i] /= maxval;
|
||||
ModulateXmtr((Tx->Comb.Output.Data), Tx->Comb.Output.Len);
|
||||
cwid();
|
||||
return -1; /* we're done */
|
||||
|
@ -127,21 +109,10 @@ int mt63::tx_process()
|
|||
if (sendc > 127) {
|
||||
sendc &= 127;
|
||||
Tx->SendChar(127);
|
||||
for (int i = 0; i < Tx->Comb.Output.Len; i++)
|
||||
if (fabs(Tx->Comb.Output.Data[i]) > maxval)
|
||||
maxval = fabs(Tx->Comb.Output.Data[i]);
|
||||
for (int i = 0; i < Tx->Comb.Output.Len; i++)
|
||||
Tx->Comb.Output.Data[i] /= maxval;
|
||||
ModulateXmtr((Tx->Comb.Output.Data), Tx->Comb.Output.Len);
|
||||
}
|
||||
|
||||
Tx->SendChar(sendc);
|
||||
for (int i = 0; i < Tx->Comb.Output.Len; i++)
|
||||
if (fabs(Tx->Comb.Output.Data[i]) > maxval)
|
||||
maxval = fabs(Tx->Comb.Output.Data[i]);
|
||||
for (int i = 0; i < Tx->Comb.Output.Len; i++) {
|
||||
Tx->Comb.Output.Data[i] /= maxval;
|
||||
}
|
||||
ModulateXmtr((Tx->Comb.Output.Data), Tx->Comb.Output.Len);
|
||||
|
||||
put_echo_char(c);
|
||||
|
|
|
@ -123,7 +123,7 @@ int MT63tx::Preset(double freq, int BandWidth, int LongInterleave)
|
|||
|
||||
WindowLen = SymbolLen;
|
||||
TxWindow = SymbolShape;
|
||||
TxAmpl = 4.0 / DataCarriers; // for maximum output level we can set TxAmpl=4.0/DataCarriers
|
||||
TxAmpl = 4.0 / DataCarriers; // for maximum undistorted output
|
||||
CarrMarkCode = 0x16918BBEL;
|
||||
CarrMarkAmpl = 0;
|
||||
|
||||
|
|
|
@ -119,11 +119,11 @@ void olivia::send_tones()
|
|||
|
||||
preamblephase = 0;
|
||||
for (int i = 0; i < SR4; i++)
|
||||
tonebuff[2*SR4 + i] = tonebuff[i] = nco(freqa) * ampshape[i];
|
||||
tonebuff[2*SR4 + i] = tonebuff[i] = 0.9 * nco(freqa) * ampshape[i];
|
||||
|
||||
preamblephase = 0;
|
||||
for (int i = 0; i < SR4; i++)
|
||||
tonebuff[3*SR4 + i] = tonebuff[SR4 + i] = nco(freqb) * ampshape[i];
|
||||
tonebuff[3*SR4 + i] = tonebuff[SR4 + i] = 0.9 * nco(freqb) * ampshape[i];
|
||||
|
||||
for (int j = 0; j < TONE_DURATION; j += SCBLOCKSIZE)
|
||||
ModulateXmtr(&tonebuff[j], SCBLOCKSIZE);
|
||||
|
@ -208,8 +208,10 @@ int olivia::tx_process()
|
|||
if (c > 0)
|
||||
put_echo_char(c);
|
||||
|
||||
if ((len = Tx->Output(txfbuffer)) > 0)
|
||||
if ((len = Tx->Output(txfbuffer)) > 0) {
|
||||
for (int i = 0; i < len; i++) txfbuffer[i] *= 0.9;
|
||||
ModulateXmtr(txfbuffer, len);
|
||||
}
|
||||
|
||||
if (stopflag && Tx->DoPostambleYet() == 1 && postamblesent != 1) {
|
||||
postamblesent = 1;
|
||||
|
|
|
@ -455,12 +455,9 @@ void modem::ModulateXmtr(double *buffer, int len)
|
|||
|
||||
if (withnoise && progdefaults.noise) add_noise(buffer, len);
|
||||
|
||||
double mult = pow(10, progdefaults.txlevel / 20.0);
|
||||
for (int i = 0; i < len; i++) {
|
||||
if (buffer[i] < -1.0) buffer[i] = -1.0;
|
||||
if (buffer[i] > 1.0) buffer[i] = 1.0;
|
||||
double mult = 0.98 * pow(10, progdefaults.txlevel / 20.0);
|
||||
for (int i = 0; i < len; i++)
|
||||
buffer[i] *= mult;
|
||||
}
|
||||
|
||||
try {
|
||||
unsigned n = 4;
|
||||
|
|
Ładowanie…
Reference in New Issue