|
From: C. v. W. <van...@ch...> - 2017-04-27 07:34:09
|
Dear all,
last week I reported the the latest version of fldigi does not work
for me, now I have analyzed the problem and propose a fix.
Since I have a Mac, everything only refers to PORTAUDIO (PA)
Often, a soundcard with input+output channels shows up as two
separate PA devices, in this case there is no problem.
Some sound devices show up as a *single* PA device with both input
and output channels, in this case the two instances represented
by TXscard and RXscard cannot run independently. This was the origin
of the problem. For me it shows up with soundcards in microHam
USB interfaces, but you can analyze it also using the virtual
SoundFlower device for MacOS.
Emergency fix: at the beginning of trx_transmit_loop, close the
RX stream, at the beginning of trx_receive_loop, close the TX
stream:
--- src.orig/trx/trx.cxx 2017-04-13 02:56:38.000000000 +0200
+++ src/trx/trx.cxx 2017-04-27 09:14:27.000000000 +0200
@@ -221,6 +221,10 @@
}
try {
+#if USE_PORTAUDIO
+ TXscard->Close(O_WRONLY);
+ current_TXsamplerate = 0;
+#endif
if (current_RXsamplerate != active_modem->get_samplerate() ) {
current_RXsamplerate = active_modem->get_samplerate();
RXscard->Close(O_RDONLY);
@@ -262,7 +266,7 @@
for (size_t i = 0; i < numread; i++)
hsbuff[i] = fbuf[i];
} else {
- if (trxrb.write_space() == 0) // diRXscard some old data
+ if (trxrb.write_space() == 0) // discard some old data
trxrb.read_advance(SCBLOCKSIZE);
size_t room = trxrb.get_wv(rbvec, numread);
@@ -343,6 +347,10 @@
if (active_modem) {
try {
+#if USE_PORTAUDIO
+ RXscard->Close(O_RDONLY);
+ current_RXsamplerate = 0;
+#endif
if (current_TXsamplerate != active_modem->get_samplerate() ) {
current_TXsamplerate = active_modem->get_samplerate();
TXscard->Close(O_WRONLY);
@@ -420,7 +428,7 @@
TXscard->flush();
// if (TXscard->must_close(O_WRONLY))
-// RXscard->Close(O_WRONLY);
+// TXscard->Close(O_WRONLY);
} else
MilliSleep(10);
This of course is not desirable, since in most cases this will not
be necessary. So I suggest to add to the SoundPort class two
functions RXdev() and TXdev() which return the PA device number.
Then the correct code will be
#if USE_PORTAUDIO
if (RXscard->RXdev() == TXscard->TXdev()) {
TXscard->Close(O_WRONLY);
current_TXsamplerate = 0;
}
#endif
and accordingly at the beginning of transmit_loop. For the time being, I will live with
the emergency fix.
Yours,
DL1YCF.
|