Upstream version 3.03AN

pull/2/head
Stelios Bounanos 2008-09-11 02:35:48 +01:00
rodzic 28abb21cfd
commit 2b352bc8ff
16 zmienionych plików z 148 dodań i 154 usunięć

Wyświetl plik

@ -41,6 +41,11 @@ Change Log:
logbook fields.
24) If compiled into the executable the xmlrpc server is always started.
ARQ server is also started. Both can be serviced concurrently.
24) Increased RTTY cross-hair scope sensitivity
25) Modified Generate/Playback file to be closer to Capture in signal
level.
26) Modified "view transmit" signal level to be closer in amplitude to
Rx signal level.
3.02
1) Added hamlib interface for rig control

Wyświetl plik

@ -9,7 +9,7 @@ dnl major and minor must be integers; patch may
dnl contain other characters or be empty
m4_define(FLDIGI_MAJOR, [3])
m4_define(FLDIGI_MINOR, [0])
m4_define(FLDIGI_PATCH, [3AM])
m4_define(FLDIGI_PATCH, [3AN])
AC_INIT([fldigi], FLDIGI_MAJOR.FLDIGI_MINOR[FLDIGI_PATCH], [w1hkj AT w1hkj DOT com])

Wyświetl plik

@ -15,7 +15,7 @@ AC_DEFUN([AC_FLDIGI_FLTK], [
if test $? -ne 0; then
AC_MSG_ERROR([$FLTK_CONFIG failed])
fi
if test "x$FLTK_API_VERSION" = "x1.1" || "x$FLTK_API_VERSION" = "x1.2" || "x$FLTK_API_VERSION" = "x1.3"; then
if test "x$FLTK_API_VERSION" = "x1.1" || test "x$FLTK_API_VERSION" = "x1.2" || test "x$FLTK_API_VERSION" = "x1.3"; then
HAVE_FLTK_API_VERSION=yes
fi
if test "${HAVE_FLTK_API_VERSION}" = "no"; then

Wyświetl plik

@ -4,8 +4,7 @@
# fldigi-shell version 0.35
# A program to control fldigi over HTTP/XML-RPC.
#
# To use, build fldigi with xml-rpc support (see INSTALL)
# and start it with --xmlrpc-server.
# Fldigi must have been built with xml-rpc support; see INSTALL.
#
# Copyright (C) 2008
# Stelios Bounanos, M0GLD
@ -117,7 +116,7 @@ sub req
encode(\@_);
my $r = $client->send_request(@_);
if (!ref($r)) {
print $OUT "Error: " . $r . "\n";
print $OUT "Error: " . $r . "\n" unless ($r =~ /Unknown tag.+nil$/);
$r = undef;
}
elsif ($r->is_fault()) {
@ -153,7 +152,8 @@ sub execute($)
@line = split(/ +/, $_[0], length($sig) + 1);
}
print Dumper(\@line) if ($debug);
print $OUT decode(@line), "\n";
my $r = decode(@line);
print $OUT $r, "\n" if ($r ne "");
}
else {
print $OUT $line[0] . ": command not found. Do you need ``help''?\n";

Wyświetl plik

@ -466,7 +466,7 @@ int rtty::rx_process(const double *buf, int len)
QI[i] = QI[i] * complex(cos(rotate), sin(rotate));
avgsig = decayavg(avgsig, zp[i].mag(), 32);
if (avgsig > 0.025) {
if (avgsig > 0.002) {
QI[i].re = (0.7 / avgsig) * QI[i].re;
QI[i].im = (0.7 / avgsig) * QI[i].im;
}

Wyświetl plik

@ -1441,7 +1441,6 @@ static const char szBaudRates[] = "300|600|1200|2400|4800|9600|19200|38400|57600
tabOperator->selection_color((Fl_Color)51);
tabOperator->callback((Fl_Callback*)cb_tabOperator);
tabOperator->when(FL_WHEN_CHANGED);
tabOperator->hide();
{ inpMyCallsign = new Fl_Input(78, 36, 85, 24, "Callsign:");
inpMyCallsign->callback((Fl_Callback*)cb_inpMyCallsign);
} // Fl_Input* inpMyCallsign
@ -1740,6 +1739,7 @@ static const char szBaudRates[] = "300|600|1200|2400|4800|9600|19200|38400|57600
tabVideo->end();
} // Fl_Group* tabVideo
{ tabRig = new Fl_Group(0, 25, 400, 195, "Rig");
tabRig->hide();
{ Fl_Group* o = new Fl_Group(10, 36, 185, 150, "Ptt");
o->box(FL_ENGRAVED_FRAME);
o->align(FL_ALIGN_TOP_LEFT|FL_ALIGN_INSIDE);
@ -2737,6 +2737,7 @@ l with your sound hardware.");
chkXagc->down_box(FL_DOWN_BOX);
chkXagc->callback((Fl_Callback*)cb_chkXagc);
chkXagc->align(FL_ALIGN_LEFT);
chkXagc->hide();
o->value(progdefaults.Xagc);
} // Fl_Check_Button* chkXagc
{ Fl_Group* o = new Fl_Group(135, 119, 130, 62, "Unshift On Space");

Wyświetl plik

@ -46,8 +46,8 @@ static const char szBaudRates[] = "300|600|1200|2400|4800|9600|19200|38400|57600
} {
Fl_Group tabOperator {
label Oper
callback {progdefaults.changed = true;} open
xywh {0 25 400 195} color 51 selection_color 51 when 1 hide
callback {progdefaults.changed = true;} open selected
xywh {0 25 400 195} color 51 selection_color 51 when 1
} {
Fl_Input inpMyCallsign {
label {Callsign:}
@ -448,7 +448,7 @@ progdefaults.changed = true;}
}
Fl_Group tabRig {
label Rig open
xywh {0 25 400 195}
xywh {0 25 400 195} hide
} {
Fl_Group {} {
label Ptt open
@ -512,7 +512,7 @@ progdefaults.changed = true;}
xywh {200 34 200 150}
} {
Fl_Group {} {
label Ham open selected
label Ham open
xywh {200 60 200 120}
} {
Fl_Check_Button chkUSEHAMLIB {
@ -1648,7 +1648,7 @@ progdefaults.changed = true;}
label {X-agc}
callback {progdefaults.Xagc=o->value();
progdefaults.changed = true;}
xywh {364 185 22 22} down_box DOWN_BOX align 4
xywh {364 185 22 22} down_box DOWN_BOX align 4 hide
code0 {o->value(progdefaults.Xagc);}
}
Fl_Group {} {

Wyświetl plik

@ -653,7 +653,6 @@ void init_modem_sync(trx_mode m)
wait_modem_ready_prep();
init_modem(m);
wait_modem_ready_cmpl();
REQ_FLUSH();
}
void cb_init_mode(Fl_Widget *, void *mode)

Wyświetl plik

@ -230,7 +230,6 @@ struct configuration {
int VIEWERtimeout;
// XMLRPC parameters
bool xmlrpc_server;
string xmlrpc_address;
string xmlrpc_port;

Wyświetl plik

@ -118,6 +118,7 @@ protected:
SRC_DATA *rx_src_data;
float *snd_buffer;
float *src_buffer;
double *wrt_buffer;
#if USE_SNDFILE
SNDFILE* ofCapture;

Wyświetl plik

@ -273,8 +273,7 @@ int main(int argc, char ** argv)
arq_init();
#if USE_XMLRPC
// if (progdefaults.xmlrpc_server)
XML_RPC_Server::start(progdefaults.xmlrpc_address.c_str(), progdefaults.xmlrpc_port.c_str());
XML_RPC_Server::start(progdefaults.xmlrpc_address.c_str(), progdefaults.xmlrpc_port.c_str());
#endif
int ret = Fl::run();
@ -297,20 +296,6 @@ int main(int argc, char ** argv)
void generate_option_help(void) {
// is there a better way of enumerating schemes?
// string schemes = "none";
// const char *possible_schemes[] = { "plastic", "gtk+", 0 };
// const char *old = Fl::scheme();
// const char **s = possible_schemes;
// while (*s) {
// Fl::scheme(*s);
// if (strcasecmp(*s, Fl::scheme()) == 0)
// schemes.append(" ").append(*s);
// s++;
// }
// Fl::scheme(old ? old : "none");
ostringstream help;
help << "Usage:\n"
<< " " << PACKAGE_NAME << " [option...]\n\n";
@ -342,8 +327,6 @@ void generate_option_help(void) {
<< " The default is: " << progdefaults.arq_port << "\n\n"
#if USE_XMLRPC
<< " --xmlrpc-server\n"
<< " Start the XML-RPC server\n\n"
<< " --xmlrpc-server-address HOSTNAME\n"
<< " Set the XML-RPC server address\n"
<< " The default is: " << progdefaults.xmlrpc_address << "\n\n"
@ -395,10 +378,6 @@ void generate_option_help(void) {
<< " -na CLASSNAME, -name CLASSNAME\n"
<< " Set the window class to CLASSNAME\n\n"
// << " -s SCHEME, -scheme SCHEME\n"
// << " Set the widget scheme\n"
// << " SCHEME can be one of: " << schemes << "\n\n"
<< " -ti WINDOWTITLE, -title WINDOWTITLE\n"
<< " Set the window title\n\n"
@ -442,7 +421,7 @@ int parse_args(int argc, char **argv, int& idx)
#endif
OPT_CONFIG_DIR, OPT_EXPERIMENTAL, OPT_ARQ_ADDRESS, OPT_ARQ_PORT,
#if USE_XMLRPC
OPT_CONFIG_XMLRPC_ADDRESS, OPT_CONFIG_XMLRPC_PORT,
OPT_CONFIG_XMLRPC, OPT_CONFIG_XMLRPC_ADDRESS, OPT_CONFIG_XMLRPC_PORT,
#endif
OPT_FONT, OPT_WFALL_WIDTH, OPT_WFALL_HEIGHT,
OPT_WINDOW_WIDTH, OPT_WINDOW_HEIGHT,
@ -468,6 +447,7 @@ int parse_args(int argc, char **argv, int& idx)
{ "arq-server-port", 1, 0, OPT_ARQ_PORT },
#if USE_XMLRPC
{ "xmlrpc-server", 0, 0, OPT_CONFIG_XMLRPC },
{ "xmlrpc-server-address", 1, 0, OPT_CONFIG_XMLRPC_ADDRESS },
{ "xmlrpc-server-port", 1, 0, OPT_CONFIG_XMLRPC_PORT },
#endif
@ -535,6 +515,10 @@ int parse_args(int argc, char **argv, int& idx)
break;
#if USE_XMLRPC
case OPT_CONFIG_XMLRPC:
cerr << "W: the --" << longopts[longindex].name
<< " option will be removed in the next version\n";
break;
case OPT_CONFIG_XMLRPC_ADDRESS:
progdefaults.xmlrpc_address = optarg;
break;
@ -736,7 +720,7 @@ double speed_test(int converter, unsigned repeat)
memset(src.data_in, 0, src.input_frames * sizeof(float));
// warm up
src_simple(&src, SRC_SINC_FASTEST, 1);
src_simple(&src, converter, 1);
struct timespec t0, t1;
#ifdef _POSIX_MONOTONIC_CLOCK
@ -745,7 +729,7 @@ double speed_test(int converter, unsigned repeat)
clock_gettime(CLOCK_REALTIME, &t0);
#endif
for (unsigned i = 0; i < repeat; i++)
src_simple(&src, SRC_SINC_FASTEST, 1);
src_simple(&src, converter, 1);
#ifdef _POSIX_MONOTONIC_CLOCK
clock_gettime(CLOCK_MONOTONIC, &t1);
#else

Wyświetl plik

@ -264,7 +264,6 @@ configuration progdefaults = {
20, // int VIEWERchannels
10.0, // double VIEWERsquelch
15, // int VIEWERtimeout
false, // bool xmlrpc_server
"127.0.0.1", // string xmlrpc_address
"7362", // string xmlrpc_port
};

Wyświetl plik

@ -55,8 +55,6 @@
#include "rigio.h"
#include "debug.h"
string strOK = "OK";
using namespace std;
struct rpc_method
@ -344,7 +342,7 @@ public:
string s = params.getString(0);
for (size_t i = 0; i < NUM_MODES; i++) {
if (s == mode_info[i].sname) {
init_modem_sync(i);
REQ_SYNC(init_modem_sync, i);
found = true;
break;
}
@ -369,7 +367,7 @@ public:
int cur = active_modem->get_mode();
int i = params.getInt(0, 0, NUM_MODES-1);
init_modem_sync(i);
REQ_SYNC(init_modem_sync, i);
*retval = xmlrpc_c::value_int(cur);
}
@ -588,8 +586,7 @@ public:
void execute(const xmlrpc_c::paramList& params, xmlrpc_c::value* retval)
{
REQ(&modem::searchUp, active_modem);
// *retval = xmlrpc_c::value_nil();
*retval = xmlrpc_c::value_string(strOK);
*retval = xmlrpc_c::value_nil();
}
};
@ -604,8 +601,7 @@ public:
void execute(const xmlrpc_c::paramList& params, xmlrpc_c::value* retval)
{
REQ(&modem::searchDown, active_modem);
// *retval = xmlrpc_c::value_nil();
*retval = xmlrpc_c::value_string(strOK);
*retval = xmlrpc_c::value_nil();
}
};
@ -690,17 +686,17 @@ public:
}
void execute(const xmlrpc_c::paramList& params, xmlrpc_c::value* retval)
{
double d = params.getDouble(0, 0.0);
double d = params.getDouble(0, 0.0);
long long int rfc = (long long int)d;
int mc = active_modem->get_freq();
if (progdefaults.chkUSEXMLRPCis)
xmlrpc_set_qsy(rfc, mc);
if (progdefaults.chkUSERIGCATis)
else if (progdefaults.chkUSERIGCATis)
rigCAT_set_qsy(rfc, mc);
if (progdefaults.chkUSEMEMMAPis)
else if (progdefaults.chkUSEMEMMAPis)
rigMEM_set_qsy(rfc, mc);
#if USE_HAMLIB
if (progdefaults.chkUSEHAMLIBis)
else if (progdefaults.chkUSEHAMLIBis)
hamlib_set_qsy(rfc, mc);
#endif
*retval = xmlrpc_c::value_double(d);
@ -1019,8 +1015,7 @@ public:
REQ(set_button, btnRSID, false);
REQ(set_button, wf->xmtrcv, true);
}
// *retval = xmlrpc_c::value_nil();
*retval = xmlrpc_c::value_string(strOK);
*retval = xmlrpc_c::value_nil();
}
};
@ -1030,7 +1025,7 @@ public:
Main_tune()
{
_signature = "n:n";
_help = "Toggles tuning.";
_help = "Tunes.";
}
void execute(const xmlrpc_c::paramList& params, xmlrpc_c::value* retval)
{
@ -1039,8 +1034,7 @@ public:
REQ(set_button, btnRSID, false);
REQ(set_button, btnTune, !btnTune->value());
}
// *retval = xmlrpc_c::value_nil();
*retval = xmlrpc_c::value_string(strOK);
*retval = xmlrpc_c::value_nil();
}
};
@ -1058,8 +1052,7 @@ public:
REQ(set_button, wf->xmtrcv, false);
else if (btnRSID->value())
REQ(set_button, btnRSID, false);
// *retval = xmlrpc_c::value_nil();
*retval = xmlrpc_c::value_string(strOK);
*retval = xmlrpc_c::value_nil();
}
};
@ -1075,8 +1068,7 @@ public:
{
if (trx_state == STATE_TX || trx_state == STATE_TUNE)
REQ(abort_tx);
// *retval = xmlrpc_c::value_nil();
*retval = xmlrpc_c::value_string(strOK);
*retval = xmlrpc_c::value_nil();
}
};
@ -1091,8 +1083,7 @@ public:
void execute(const xmlrpc_c::paramList& params, xmlrpc_c::value* retval)
{
REQ(&Main_run_macro::run_macro, params.getInt(0, 0, MAXMACROS-1));
// *retval = xmlrpc_c::value_nil();
*retval = xmlrpc_c::value_string(strOK);
*retval = xmlrpc_c::value_nil();
}
static void run_macro(int i) { macros.execute(i); }
};
@ -1123,8 +1114,7 @@ public:
{
if (!(wf->xmtrcv->value() || btnTune->value() || btnRSID->value()))
REQ(set_button, btnRSID, true);
// *retval = xmlrpc_c::value_nil();
*retval = xmlrpc_c::value_string(strOK);
*retval = xmlrpc_c::value_nil();
}
};
@ -1303,14 +1293,13 @@ class Log_clear : public xmlrpc_c::method
public:
Log_clear()
{
_signature = "s:n";
_signature = "n:n";
_help = "Clears the contents of the log fields.";
}
void execute(const xmlrpc_c::paramList& params, xmlrpc_c::value* retval)
{
{
REQ(clearQSO);
// *retval = xmlrpc_c::value_nil();
*retval = xmlrpc_c::value_string(strOK);
*retval = xmlrpc_c::value_nil();
}
};
@ -1327,8 +1316,6 @@ public:
void execute(const xmlrpc_c::paramList& params, xmlrpc_c::value* retval)
{
*retval = xmlrpc_c::value_int(ReceiveText->buffer()->length());
// *retval = xmlrpc_c::value_nil();
*retval = xmlrpc_c::value_string(strOK);
}
};
@ -1370,8 +1357,7 @@ public:
void execute(const xmlrpc_c::paramList& params, xmlrpc_c::value* retval)
{
REQ(&FTextBase::clear, ReceiveText);
// *retval = xmlrpc_c::value_nil();
*retval = xmlrpc_c::value_string(strOK);
*retval = xmlrpc_c::value_nil();
}
};
@ -1380,13 +1366,13 @@ class Text_add_tx : public xmlrpc_c::method
public:
Text_add_tx()
{
_signature = "i:s";
_signature = "n:s";
_help = "Adds a string to the TX text widget.";
}
void execute(const xmlrpc_c::paramList& params, xmlrpc_c::value* retval)
{
REQ_SYNC(&FTextBase::addstr, TransmitText, params.getString(0).c_str(), FTextBase::RECV);
*retval = xmlrpc_c::value_int(0);
*retval = xmlrpc_c::value_nil();
}
};
@ -1395,20 +1381,16 @@ class Text_add_tx_bytes : public xmlrpc_c::method
public:
Text_add_tx_bytes()
{
_signature = "i:6";
_signature = "n:6";
_help = "Adds a byte string to the TX text widget.";
}
void execute(const xmlrpc_c::paramList& params, xmlrpc_c::value* retval)
{
vector<unsigned char> bytes = params.getBytestring(0);
size_t len = bytes.size();
char* chars = new char[len + 1];
memcpy(chars, &bytes[0], len);
chars[len] = '\0';
REQ_SYNC(&FTextBase::addstr, TransmitText, chars, FTextBase::RECV);
delete [] chars;
bytes.push_back(0);
REQ_SYNC(&FTextBase::addstr, TransmitText, (const char*)&bytes[0], FTextBase::RECV);
*retval = xmlrpc_c::value_int(0);
*retval = xmlrpc_c::value_nil();
}
};
@ -1423,8 +1405,7 @@ public:
void execute(const xmlrpc_c::paramList& params, xmlrpc_c::value* retval)
{
REQ(&FTextBase::clear, TransmitText);
// *retval = xmlrpc_c::value_nil();
*retval = xmlrpc_c::value_string(strOK);
*retval = xmlrpc_c::value_nil();
}
};
@ -1435,7 +1416,7 @@ public:
void XML_RPC_Server::add_methods(void)
{
methods->clear();
methods->reserve(64);
methods->reserve(72);
methods->push_back(rpc_method(new Fldigi_list, "fldigi.list"));
methods->push_back(rpc_method(new Fldigi_name, "fldigi.name"));

Wyświetl plik

@ -98,6 +98,7 @@ SoundBase::~SoundBase()
{
if (snd_buffer) delete [] snd_buffer;
if (src_buffer) delete [] src_buffer;
if (wrt_buffer) delete [] wrt_buffer;
if (tx_src_data) delete tx_src_data;
if (rx_src_data) delete rx_src_data;
if (rx_src_state) src_delete (rx_src_state);
@ -250,7 +251,10 @@ sf_count_t SoundBase::read_file(SNDFILE* file, double* buf, size_t count)
sf_count_t SoundBase::write_file(SNDFILE* file, double* buf, size_t count)
{
return sf_writef_double(file, buf, count);
if (capture)
return sf_writef_double(file, buf, count);
for (size_t n = 0; n < count; n++) wrt_buffer[n] = buf[n] * 0.1;
return sf_write_double(file, wrt_buffer, count);
}
bool SoundBase::format_supported(int format)
@ -305,6 +309,7 @@ SoundOSS::SoundOSS(const char *dev ) {
try {
snd_buffer = new float [2*SND_BUF_LEN];
src_buffer = new float [2*SND_BUF_LEN];
wrt_buffer = new double [SND_BUF_LEN];
cbuff = new unsigned char [4 * SND_BUF_LEN];
}
catch (const std::bad_alloc& e) {
@ -313,6 +318,8 @@ SoundOSS::SoundOSS(const char *dev ) {
}
for (int i = 0; i < 2*SND_BUF_LEN; i++)
snd_buffer[i] = src_buffer[i] = 0.0;
for (int i = 0; i < SND_BUF_LEN; i++)
wrt_buffer[i] = 0.0;
for (int i = 0; i < 4 * SND_BUF_LEN; i++)
cbuff[i] = 0;
@ -511,12 +518,12 @@ size_t SoundOSS::Read(double *buffer, size_t buffersize)
if (capture)
write_file(ofCapture, buffer, buffersize);
if (playback) {
double vol = 1.0;
read_file(ifPlayback, buffer, buffersize);
if (progdefaults.EnableMixer) {
double vol = progStatus.RcvMixer;
for (size_t i = 0; i < buffersize; i++)
buffer[i] *= vol;
}
if (progdefaults.EnableMixer)
vol = progStatus.RcvMixer;
for (size_t i = 0; i < buffersize; i++)
buffer[i] *= vol;
return buffersize;
}
#endif
@ -776,25 +783,34 @@ SoundPort::SoundPort(const char *in_dev, const char *out_dev)
pthread_cond_init(sd[i].ccond, NULL);
}
try {
tx_src_data = new SRC_DATA;
}
catch (const std::bad_alloc& e) {
LOG_ERROR("Cannot create libsamplerate data structures");
throw;
}
try {
tx_src_data = new SRC_DATA;
}
catch (const std::bad_alloc& e) {
LOG_ERROR("Cannot create libsamplerate data structures");
throw;
}
try {
src_buffer = new float[OUTPUT_CHANNELS * SND_BUF_LEN];
fbuf = new float[OUTPUT_CHANNELS * SND_BUF_LEN];
}
catch (const std::bad_alloc& e) {
LOG_ERROR("Cannot allocate libsamplerate buffers");
throw;
}
try {
src_buffer = new float[OUTPUT_CHANNELS * SND_BUF_LEN];
fbuf = new float[OUTPUT_CHANNELS * SND_BUF_LEN];
}
catch (const std::bad_alloc& e) {
LOG_ERROR("Cannot allocate libsamplerate buffers");
throw;
}
try {
wrt_buffer = new double [SND_BUF_LEN];
}
catch (const std::bad_alloc& e) {
LOG_ERROR("Cannot allocate write buffer");
throw;
}
for (int i = 0; i < SND_BUF_LEN; i++)
wrt_buffer[i]= 0.0;
memset(src_buffer, 0, OUTPUT_CHANNELS * SND_BUF_LEN);
memset(fbuf, 0, OUTPUT_CHANNELS * SND_BUF_LEN);
memset(src_buffer, 0, OUTPUT_CHANNELS * SND_BUF_LEN);
memset(fbuf, 0, OUTPUT_CHANNELS * SND_BUF_LEN);
}
SoundPort::~SoundPort()
@ -949,16 +965,16 @@ size_t SoundPort::Read(double *buf, size_t count)
{
#if USE_SNDFILE
if (playback) {
read_file(ifPlayback, buf, count);
if (progdefaults.EnableMixer) {
double vol = valRcvMixer->value();
for (size_t i = 0; i < count; i++)
buf[i] *= vol;
}
if (!capture) {
usleep((useconds_t)ceil((1e6 * count) / req_sample_rate));
return count;
}
double vol = 1.0;
read_file(ifPlayback, buf, count);
if (progdefaults.EnableMixer)
vol = progStatus.RcvMixer;
for (size_t i = 0; i < count; i++)
buf[i] *= vol;
if (!capture) {
usleep((useconds_t)ceil((1e6 * count) / req_sample_rate));
return count;
}
}
#endif
@ -1028,7 +1044,7 @@ size_t SoundPort::Write(double *buf, size_t count)
{
#if USE_SNDFILE
if (generate)
write_file(ofGenerate, buf, count);
write_file(ofGenerate, buf, count);
#endif
// copy input to both channels
@ -1042,7 +1058,7 @@ size_t SoundPort::Write_stereo(double *bufleft, double *bufright, size_t count)
{
#if USE_SNDFILE
if (generate)
write_file(ofCapture, bufleft, count);
write_file(ofCapture, bufleft, count);
#endif
// interleave into fbuf
@ -1529,23 +1545,32 @@ SoundPulse::SoundPulse(const char *dev)
sd[0].stream_params.channels = INPUT_CHANNELS;
sd[1].stream_params.channels = OUTPUT_CHANNELS;
try {
tx_src_data = new SRC_DATA;
}
catch (const std::bad_alloc& e) {
LOG_ERROR("Cannot create libsamplerate data structures");
throw;
}
try {
tx_src_data = new SRC_DATA;
}
catch (const std::bad_alloc& e) {
LOG_ERROR("Cannot create libsamplerate data structures");
throw;
}
try {
snd_buffer = new float[INPUT_CHANNELS * SND_BUF_LEN];
src_buffer = new float[OUTPUT_CHANNELS * SND_BUF_LEN];
fbuf = new float[MAX(INPUT_CHANNELS, OUTPUT_CHANNELS) * SND_BUF_LEN];
}
catch (const std::bad_alloc& e) {
LOG_ERROR("Cannot allocate libsamplerate buffers");
throw;
}
try {
snd_buffer = new float[INPUT_CHANNELS * SND_BUF_LEN];
src_buffer = new float[OUTPUT_CHANNELS * SND_BUF_LEN];
fbuf = new float[MAX(INPUT_CHANNELS, OUTPUT_CHANNELS) * SND_BUF_LEN];
}
catch (const std::bad_alloc& e) {
LOG_ERROR("Cannot allocate libsamplerate buffers");
throw;
}
try {
wrt_buffer = new double [SND_BUF_LEN];
}
catch (const std::bad_alloc& e) {
LOG_ERROR("Cannot allocate write buffer");
throw;
}
for (int i = 0; i < SND_BUF_LEN; i++)
wrt_buffer[i]= 0.0;
}
SoundPulse::~SoundPulse()
@ -1713,12 +1738,12 @@ size_t SoundPulse::Read(double *buf, size_t count)
{
#if USE_SNDFILE
if (playback) {
double vol = 1.0;
read_file(ifPlayback, buf, count);
if (progdefaults.EnableMixer) {
double vol = progStatus.RcvMixer;
for (size_t i = 0; i < count; i++)
buf[i] *= vol;
}
if (progdefaults.EnableMixer)
vol = progStatus.RcvMixer;
for (size_t i = 0; i < count; i++)
buf[i] *= vol;
return count;
}
#endif
@ -1784,7 +1809,7 @@ size_t SoundNull::Write(double* buf, size_t count)
{
#if USE_SNDFILE
if (generate)
write_file(ofGenerate, buf, count);
write_file(ofGenerate, buf, count);
#endif
usleep((useconds_t)ceil((1e6 * count) / sample_frequency));
@ -1796,7 +1821,7 @@ size_t SoundNull::Write_stereo(double* bufleft, double* bufright, size_t count)
{
#if USE_SNDFILE
if (generate)
write_file(ofGenerate, bufleft, count);
write_file(ofGenerate, bufleft, count);
#endif
usleep((useconds_t)ceil((1e6 * count) / sample_frequency));
@ -1810,14 +1835,14 @@ size_t SoundNull::Read(double *buf, size_t count)
#if USE_SNDFILE
if (capture)
write_file(ofCapture, buf, count);
write_file(ofCapture, buf, count);
if (playback) {
double vol = 1.0;
read_file(ifPlayback, buf, count);
if (progdefaults.EnableMixer) {
double vol = progStatus.RcvMixer;
for (size_t i = 0; i < count; i++)
buf[i] *= vol;
}
if (progdefaults.EnableMixer)
vol = progStatus.RcvMixer;
for (size_t i = 0; i < count; i++)
buf[i] *= vol;
}
#endif

Wyświetl plik

@ -242,7 +242,7 @@ void modem::ModulateXmtr(double *buffer, int len)
if (!progdefaults.viewXmtSignal)
return;
for (int i = 0; i < len; i++) {
_mdm_scdbl[scptr] = buffer[i] * 0.5;
_mdm_scdbl[scptr] = buffer[i] * 0.1;
scptr++;
if (scptr == 512) {
REQ(&waterfall::sig_data, wf, _mdm_scdbl.c_array(), 512, samplerate );
@ -268,7 +268,7 @@ void modem::ModulateStereo(double *left, double *right, int len)
if (!progdefaults.viewXmtSignal)
return;
for (int i = 0; i < len; i++) {
_mdm_scdbl[scptr] = left[i] * 0.5;
_mdm_scdbl[scptr] = left[i] * 0.1;
scptr++;
if (scptr == 512) {
REQ(&waterfall::sig_data, wf, _mdm_scdbl.c_array(), 512, samplerate);

Wyświetl plik

@ -130,7 +130,7 @@ void Digiscope::data(double *data, int len, bool scale)
min = MIN(min, _buf[i]);
}
for (int i = 0; i < _len; i++)
if (_buf[i] > 0.01) // threshold
if (_buf[i] > 0.001) // threshold
_buf[i] = (_buf[i] - min) / (max - min);
else
_buf[i] = 0.0;