WSJT-X/Detector.cpp

133 lines
4.5 KiB
C++
Raw Normal View History

Qt 5 Audio replaces PortAudio. Currently only Qt5 or above is known to work with this code. It may be possible to backport it to Qt4 if required. Audio output goes back to a separate thread to try and minimize stutters in streaming on Windows particularly. A crash on Linux due to mishandling of stereo audio output has been fixed and both left and right channels are now correctly synthesised with identical contents. Rigs are enumerated directly from hamlib API rather than running a sub process reading output of rigctl -l. This was initially done to get rid of some GUI thread blocking in the configuration dialog, but is generally a better way of doing it anyway. Some refactoring in MainWindow to accomodate the audio streaming, modulation and detecting classes. Exit handling for application refactored to use signals rather than brute force event loop exit. This was required to get correct thread shutdown semantics. The GUI update timer is now stopped during application shutdown which is necessary to stop crashes when shutting down gracefully with signals and window close() calls. There is an outstanding issue with Linux audio streams; the QAudio Input/Output classes create a new stream name each time a stream is started. This doesn't play well with PulseAudio utilities such as pavucontrol to set stream volume as settings are lost every tx period. I have tried to keep a single stream for all output but there are problems restarting it that haven't been resolved yet. The QtCreator project file has been rearranged a little because it passes all the object files to the linker rather than using an archive library. Since the GNU linker is single pass; the object files need to be in a logical order with definitions appearing afer references to them. This was required to avoid a linking error. The lib/Makefile.linux has been enhanced to use the fortran compiler to locate the correct version of the Fortran library to use. This is necessary on the latest Linux distros because the unversioned symlink to compiler support libraries is no longer provided. This only an issue with mixed programming language links where the linker driver for one language has to link support libraraies for another language. git-svn-id: svn+ssh://svn.code.sf.net/p/wsjt/wsjt/branches/wsjtx@3532 ab8295b8-cf94-4d9e-aec4-7959e3be5d79
2013-08-07 19:09:13 -04:00
#include "Detector.hpp"
#include <QDateTime>
#include <QtAlgorithms>
#include <QDebug>
#include "commons.h"
extern "C" {
void fil4_(qint16*, qint32*, qint16*, qint32*);
}
Detector::Detector (unsigned frameRate, unsigned periodLengthInSeconds,
unsigned framesPerSignal, unsigned downSampleFactor,
QObject * parent)
Added audio channel support. Audio input can be mono, left of stereo pair or, right of stereo pair. Audio output can be mono, left of stereo pair, right of stereo pair or, both of stereo pair (the same output goes to both channels in both mode). Settings are remembered between sessions. Stream channel suport is implemented mainly in the new AudioDevice class which is now the base class of Modulator and Detector. Audio channels are selected on the configuration screen. Only supported channel configurations per device can be selected. Audio output volume (actually attenuation) is now possible from the GUI. I have added a slider control to the main window; I don't necessarily propose this as a final release location for the widget as I understand that changes to the main screen are sensitive. This location is just a starting suggestion for a trial. The volume (attenuation) setting is remembered between sessions and is not device dependent. This addresses all issues of volume setting on *nix versions since there is no need to use pavucontrol to set audio levels. The volume (attenuation) action is logarithmic. Shaped CW keying has been implemented in Modulator although it is currently disabled as I am not 100% happy wth the implementation. If you want to try it define the C++ preprocessor macro WSJT_SOFT_KEYING in your build. The Modulator instance has been moved to the same thread as the SoundOutput instance as it should have been since the output callback already operates in that thread. Cross thread slots are now correctly called in a thread safe way as a result. A number of files where in the SVN repository with DOS line endings which I have removed. SVN users on Windows need set the config for native line endings so that DOS line endings are automatically stripped on checkin. The DevSetup class now holds it's UI o the heap to reduce imapact on build dependencies. The application settings are now passed to objects from the main.cpp file. Management of settings are moved to the responsible classes (top level windows). This has involved a few settings moving groups so users will see some settings reverting to default values on the first run of an update. Persistance of top level windows geometry and position is now handled in the recommened manner (constructor for load, closeEvent for store in modal windows and, hideEvent for store in modeless dialogs). The MainWindow class now holds its children as members rather than global variables. The LogQSO class now hides its implementation and takes responsibility for its own settings and widows rendering parameters. A new settings file group is implemented to persist the LogQSO class settings. The WideGraph class now hides its implementation and manages its own settings and window rendering parameters. --This line, and those below, will be ignored-- M Modulator.cpp M rigclass.cpp M widegraph.cpp M signalmeter.cpp M soundin.cpp M soundout.cpp M mainwindow.h M main.cpp M meterwidget.h M devsetup.cpp M mainwindow.ui M Detector.cpp M logqso.h M rigclass.h M mainwindow.cpp M meterwidget.cpp M soundin.h M devsetup.ui M wsjtx.pro M devsetup.h M logqso.cpp M Modulator.hpp M psk_reporter.cpp M killbyname.cpp M Detector.hpp M signalmeter.h M widegraph.h M psk_reporter.h M soundout.h M PSKReporter.h M lib/afc65b.f90 M lib/gran.c M lib/usleep.c M lib/afc9.f90 M lib/wrapkarn.c A AudioDevice.hpp git-svn-id: svn+ssh://svn.code.sf.net/p/wsjt/wsjt/branches/wsjtx@3542 ab8295b8-cf94-4d9e-aec4-7959e3be5d79
2013-08-10 11:29:55 -04:00
: AudioDevice (parent)
Qt 5 Audio replaces PortAudio. Currently only Qt5 or above is known to work with this code. It may be possible to backport it to Qt4 if required. Audio output goes back to a separate thread to try and minimize stutters in streaming on Windows particularly. A crash on Linux due to mishandling of stereo audio output has been fixed and both left and right channels are now correctly synthesised with identical contents. Rigs are enumerated directly from hamlib API rather than running a sub process reading output of rigctl -l. This was initially done to get rid of some GUI thread blocking in the configuration dialog, but is generally a better way of doing it anyway. Some refactoring in MainWindow to accomodate the audio streaming, modulation and detecting classes. Exit handling for application refactored to use signals rather than brute force event loop exit. This was required to get correct thread shutdown semantics. The GUI update timer is now stopped during application shutdown which is necessary to stop crashes when shutting down gracefully with signals and window close() calls. There is an outstanding issue with Linux audio streams; the QAudio Input/Output classes create a new stream name each time a stream is started. This doesn't play well with PulseAudio utilities such as pavucontrol to set stream volume as settings are lost every tx period. I have tried to keep a single stream for all output but there are problems restarting it that haven't been resolved yet. The QtCreator project file has been rearranged a little because it passes all the object files to the linker rather than using an archive library. Since the GNU linker is single pass; the object files need to be in a logical order with definitions appearing afer references to them. This was required to avoid a linking error. The lib/Makefile.linux has been enhanced to use the fortran compiler to locate the correct version of the Fortran library to use. This is necessary on the latest Linux distros because the unversioned symlink to compiler support libraries is no longer provided. This only an issue with mixed programming language links where the linker driver for one language has to link support libraraies for another language. git-svn-id: svn+ssh://svn.code.sf.net/p/wsjt/wsjt/branches/wsjtx@3532 ab8295b8-cf94-4d9e-aec4-7959e3be5d79
2013-08-07 19:09:13 -04:00
, m_frameRate (frameRate)
, m_period (periodLengthInSeconds)
, m_downSampleFactor (downSampleFactor)
Added audio channel support. Audio input can be mono, left of stereo pair or, right of stereo pair. Audio output can be mono, left of stereo pair, right of stereo pair or, both of stereo pair (the same output goes to both channels in both mode). Settings are remembered between sessions. Stream channel suport is implemented mainly in the new AudioDevice class which is now the base class of Modulator and Detector. Audio channels are selected on the configuration screen. Only supported channel configurations per device can be selected. Audio output volume (actually attenuation) is now possible from the GUI. I have added a slider control to the main window; I don't necessarily propose this as a final release location for the widget as I understand that changes to the main screen are sensitive. This location is just a starting suggestion for a trial. The volume (attenuation) setting is remembered between sessions and is not device dependent. This addresses all issues of volume setting on *nix versions since there is no need to use pavucontrol to set audio levels. The volume (attenuation) action is logarithmic. Shaped CW keying has been implemented in Modulator although it is currently disabled as I am not 100% happy wth the implementation. If you want to try it define the C++ preprocessor macro WSJT_SOFT_KEYING in your build. The Modulator instance has been moved to the same thread as the SoundOutput instance as it should have been since the output callback already operates in that thread. Cross thread slots are now correctly called in a thread safe way as a result. A number of files where in the SVN repository with DOS line endings which I have removed. SVN users on Windows need set the config for native line endings so that DOS line endings are automatically stripped on checkin. The DevSetup class now holds it's UI o the heap to reduce imapact on build dependencies. The application settings are now passed to objects from the main.cpp file. Management of settings are moved to the responsible classes (top level windows). This has involved a few settings moving groups so users will see some settings reverting to default values on the first run of an update. Persistance of top level windows geometry and position is now handled in the recommened manner (constructor for load, closeEvent for store in modal windows and, hideEvent for store in modeless dialogs). The MainWindow class now holds its children as members rather than global variables. The LogQSO class now hides its implementation and takes responsibility for its own settings and widows rendering parameters. A new settings file group is implemented to persist the LogQSO class settings. The WideGraph class now hides its implementation and manages its own settings and window rendering parameters. --This line, and those below, will be ignored-- M Modulator.cpp M rigclass.cpp M widegraph.cpp M signalmeter.cpp M soundin.cpp M soundout.cpp M mainwindow.h M main.cpp M meterwidget.h M devsetup.cpp M mainwindow.ui M Detector.cpp M logqso.h M rigclass.h M mainwindow.cpp M meterwidget.cpp M soundin.h M devsetup.ui M wsjtx.pro M devsetup.h M logqso.cpp M Modulator.hpp M psk_reporter.cpp M killbyname.cpp M Detector.hpp M signalmeter.h M widegraph.h M psk_reporter.h M soundout.h M PSKReporter.h M lib/afc65b.f90 M lib/gran.c M lib/usleep.c M lib/afc9.f90 M lib/wrapkarn.c A AudioDevice.hpp git-svn-id: svn+ssh://svn.code.sf.net/p/wsjt/wsjt/branches/wsjtx@3542 ab8295b8-cf94-4d9e-aec4-7959e3be5d79
2013-08-10 11:29:55 -04:00
, m_framesPerSignal (framesPerSignal)
Qt 5 Audio replaces PortAudio. Currently only Qt5 or above is known to work with this code. It may be possible to backport it to Qt4 if required. Audio output goes back to a separate thread to try and minimize stutters in streaming on Windows particularly. A crash on Linux due to mishandling of stereo audio output has been fixed and both left and right channels are now correctly synthesised with identical contents. Rigs are enumerated directly from hamlib API rather than running a sub process reading output of rigctl -l. This was initially done to get rid of some GUI thread blocking in the configuration dialog, but is generally a better way of doing it anyway. Some refactoring in MainWindow to accomodate the audio streaming, modulation and detecting classes. Exit handling for application refactored to use signals rather than brute force event loop exit. This was required to get correct thread shutdown semantics. The GUI update timer is now stopped during application shutdown which is necessary to stop crashes when shutting down gracefully with signals and window close() calls. There is an outstanding issue with Linux audio streams; the QAudio Input/Output classes create a new stream name each time a stream is started. This doesn't play well with PulseAudio utilities such as pavucontrol to set stream volume as settings are lost every tx period. I have tried to keep a single stream for all output but there are problems restarting it that haven't been resolved yet. The QtCreator project file has been rearranged a little because it passes all the object files to the linker rather than using an archive library. Since the GNU linker is single pass; the object files need to be in a logical order with definitions appearing afer references to them. This was required to avoid a linking error. The lib/Makefile.linux has been enhanced to use the fortran compiler to locate the correct version of the Fortran library to use. This is necessary on the latest Linux distros because the unversioned symlink to compiler support libraries is no longer provided. This only an issue with mixed programming language links where the linker driver for one language has to link support libraraies for another language. git-svn-id: svn+ssh://svn.code.sf.net/p/wsjt/wsjt/branches/wsjtx@3532 ab8295b8-cf94-4d9e-aec4-7959e3be5d79
2013-08-07 19:09:13 -04:00
, m_monitoring (false)
, m_starting (false)
, m_buffer ((downSampleFactor > 1) ?
new short [framesPerSignal * downSampleFactor] : 0)
, m_bufferPos (0)
Qt 5 Audio replaces PortAudio. Currently only Qt5 or above is known to work with this code. It may be possible to backport it to Qt4 if required. Audio output goes back to a separate thread to try and minimize stutters in streaming on Windows particularly. A crash on Linux due to mishandling of stereo audio output has been fixed and both left and right channels are now correctly synthesised with identical contents. Rigs are enumerated directly from hamlib API rather than running a sub process reading output of rigctl -l. This was initially done to get rid of some GUI thread blocking in the configuration dialog, but is generally a better way of doing it anyway. Some refactoring in MainWindow to accomodate the audio streaming, modulation and detecting classes. Exit handling for application refactored to use signals rather than brute force event loop exit. This was required to get correct thread shutdown semantics. The GUI update timer is now stopped during application shutdown which is necessary to stop crashes when shutting down gracefully with signals and window close() calls. There is an outstanding issue with Linux audio streams; the QAudio Input/Output classes create a new stream name each time a stream is started. This doesn't play well with PulseAudio utilities such as pavucontrol to set stream volume as settings are lost every tx period. I have tried to keep a single stream for all output but there are problems restarting it that haven't been resolved yet. The QtCreator project file has been rearranged a little because it passes all the object files to the linker rather than using an archive library. Since the GNU linker is single pass; the object files need to be in a logical order with definitions appearing afer references to them. This was required to avoid a linking error. The lib/Makefile.linux has been enhanced to use the fortran compiler to locate the correct version of the Fortran library to use. This is necessary on the latest Linux distros because the unversioned symlink to compiler support libraries is no longer provided. This only an issue with mixed programming language links where the linker driver for one language has to link support libraraies for another language. git-svn-id: svn+ssh://svn.code.sf.net/p/wsjt/wsjt/branches/wsjtx@3532 ab8295b8-cf94-4d9e-aec4-7959e3be5d79
2013-08-07 19:09:13 -04:00
{
clear ();
}
bool Detector::reset ()
{
clear ();
return QIODevice::reset ();
}
void Detector::clear ()
{
// set index to roughly where we are in time (1ms resolution)
// qint64 now (QDateTime::currentMSecsSinceEpoch ());
// unsigned msInPeriod ((now % 86400000LL) % (m_period * 1000));
// jt9com_.kin = qMin ((msInPeriod * m_frameRate) / 1000, static_cast<unsigned> (sizeof (jt9com_.d2) / sizeof (jt9com_.d2[0])));
jt9com_.kin = 0;
// fill buffer with zeros (G4WJS commented out because it might cause decoder hangs)
// qFill (jt9com_.d2, jt9com_.d2 + sizeof (jt9com_.d2) / sizeof (jt9com_.d2[0]), 0);
Qt 5 Audio replaces PortAudio. Currently only Qt5 or above is known to work with this code. It may be possible to backport it to Qt4 if required. Audio output goes back to a separate thread to try and minimize stutters in streaming on Windows particularly. A crash on Linux due to mishandling of stereo audio output has been fixed and both left and right channels are now correctly synthesised with identical contents. Rigs are enumerated directly from hamlib API rather than running a sub process reading output of rigctl -l. This was initially done to get rid of some GUI thread blocking in the configuration dialog, but is generally a better way of doing it anyway. Some refactoring in MainWindow to accomodate the audio streaming, modulation and detecting classes. Exit handling for application refactored to use signals rather than brute force event loop exit. This was required to get correct thread shutdown semantics. The GUI update timer is now stopped during application shutdown which is necessary to stop crashes when shutting down gracefully with signals and window close() calls. There is an outstanding issue with Linux audio streams; the QAudio Input/Output classes create a new stream name each time a stream is started. This doesn't play well with PulseAudio utilities such as pavucontrol to set stream volume as settings are lost every tx period. I have tried to keep a single stream for all output but there are problems restarting it that haven't been resolved yet. The QtCreator project file has been rearranged a little because it passes all the object files to the linker rather than using an archive library. Since the GNU linker is single pass; the object files need to be in a logical order with definitions appearing afer references to them. This was required to avoid a linking error. The lib/Makefile.linux has been enhanced to use the fortran compiler to locate the correct version of the Fortran library to use. This is necessary on the latest Linux distros because the unversioned symlink to compiler support libraries is no longer provided. This only an issue with mixed programming language links where the linker driver for one language has to link support libraraies for another language. git-svn-id: svn+ssh://svn.code.sf.net/p/wsjt/wsjt/branches/wsjtx@3532 ab8295b8-cf94-4d9e-aec4-7959e3be5d79
2013-08-07 19:09:13 -04:00
}
qint64 Detector::writeData (char const * data, qint64 maxSize)
{
if (m_monitoring) {
// no torn frames
Q_ASSERT (!(maxSize % static_cast<qint64> (bytesPerFrame ())));
// these are in terms of input frames (not down sampled)
size_t framesAcceptable ((sizeof (jt9com_.d2) /
sizeof (jt9com_.d2[0]) - jt9com_.kin) * m_downSampleFactor);
size_t framesAccepted (qMin (static_cast<size_t> (maxSize /
bytesPerFrame ()), framesAcceptable));
if (framesAccepted < static_cast<size_t> (maxSize / bytesPerFrame ())) {
qDebug () << "dropped " << maxSize / bytesPerFrame () - framesAccepted
<< " frames of data on the floor!";
}
for (unsigned remaining = framesAccepted; remaining; ) {
size_t numFramesProcessed (qMin (m_framesPerSignal *
m_downSampleFactor - m_bufferPos, remaining));
if(m_downSampleFactor > 1) {
store (&data[(framesAccepted - remaining) * bytesPerFrame ()],
numFramesProcessed, &m_buffer[m_bufferPos]);
m_bufferPos += numFramesProcessed;
if(m_bufferPos==m_framesPerSignal*m_downSampleFactor && m_monitoring) {
qint32 framesToProcess (m_framesPerSignal * m_downSampleFactor);
qint32 framesAfterDownSample;
if(framesToProcess==13824 and jt9com_.kin>=0 and jt9com_.kin<1440000) {
fil4_(&m_buffer[0], &framesToProcess, &jt9com_.d2[jt9com_.kin],
&framesAfterDownSample);
} else {
qDebug() << "framesToProcess = " << framesToProcess;
qDebug() << "jt9com_.kin = " << jt9com_.kin;
qDebug() << "secondInPeriod = " << secondInPeriod();
}
Q_ASSERT(framesAfterDownSample==3456);
jt9com_.kin += framesAfterDownSample;
Q_EMIT framesWritten (jt9com_.kin);
m_bufferPos = 0;
}
} else {
store (&data[(framesAccepted - remaining) * bytesPerFrame ()],
numFramesProcessed, &jt9com_.d2[jt9com_.kin]);
m_bufferPos += numFramesProcessed;
jt9com_.kin += numFramesProcessed;
if (m_bufferPos == static_cast<unsigned> (m_framesPerSignal) &&
m_monitoring) {
Q_EMIT framesWritten (jt9com_.kin);
m_bufferPos = 0;
}
Qt 5 Audio replaces PortAudio. Currently only Qt5 or above is known to work with this code. It may be possible to backport it to Qt4 if required. Audio output goes back to a separate thread to try and minimize stutters in streaming on Windows particularly. A crash on Linux due to mishandling of stereo audio output has been fixed and both left and right channels are now correctly synthesised with identical contents. Rigs are enumerated directly from hamlib API rather than running a sub process reading output of rigctl -l. This was initially done to get rid of some GUI thread blocking in the configuration dialog, but is generally a better way of doing it anyway. Some refactoring in MainWindow to accomodate the audio streaming, modulation and detecting classes. Exit handling for application refactored to use signals rather than brute force event loop exit. This was required to get correct thread shutdown semantics. The GUI update timer is now stopped during application shutdown which is necessary to stop crashes when shutting down gracefully with signals and window close() calls. There is an outstanding issue with Linux audio streams; the QAudio Input/Output classes create a new stream name each time a stream is started. This doesn't play well with PulseAudio utilities such as pavucontrol to set stream volume as settings are lost every tx period. I have tried to keep a single stream for all output but there are problems restarting it that haven't been resolved yet. The QtCreator project file has been rearranged a little because it passes all the object files to the linker rather than using an archive library. Since the GNU linker is single pass; the object files need to be in a logical order with definitions appearing afer references to them. This was required to avoid a linking error. The lib/Makefile.linux has been enhanced to use the fortran compiler to locate the correct version of the Fortran library to use. This is necessary on the latest Linux distros because the unversioned symlink to compiler support libraries is no longer provided. This only an issue with mixed programming language links where the linker driver for one language has to link support libraraies for another language. git-svn-id: svn+ssh://svn.code.sf.net/p/wsjt/wsjt/branches/wsjtx@3532 ab8295b8-cf94-4d9e-aec4-7959e3be5d79
2013-08-07 19:09:13 -04:00
}
if (!secondInPeriod ()) {
if (!m_starting) {
// next samples will be in new period so wrap around to
// start of buffer
//
// we don't bother calling reset () since we expect to fill
// the whole buffer and don't need to waste cycles zeroing
jt9com_.kin = 0;
m_bufferPos = 0;
m_starting = true;
}
} else if(m_starting) {
m_starting = false;
Qt 5 Audio replaces PortAudio. Currently only Qt5 or above is known to work with this code. It may be possible to backport it to Qt4 if required. Audio output goes back to a separate thread to try and minimize stutters in streaming on Windows particularly. A crash on Linux due to mishandling of stereo audio output has been fixed and both left and right channels are now correctly synthesised with identical contents. Rigs are enumerated directly from hamlib API rather than running a sub process reading output of rigctl -l. This was initially done to get rid of some GUI thread blocking in the configuration dialog, but is generally a better way of doing it anyway. Some refactoring in MainWindow to accomodate the audio streaming, modulation and detecting classes. Exit handling for application refactored to use signals rather than brute force event loop exit. This was required to get correct thread shutdown semantics. The GUI update timer is now stopped during application shutdown which is necessary to stop crashes when shutting down gracefully with signals and window close() calls. There is an outstanding issue with Linux audio streams; the QAudio Input/Output classes create a new stream name each time a stream is started. This doesn't play well with PulseAudio utilities such as pavucontrol to set stream volume as settings are lost every tx period. I have tried to keep a single stream for all output but there are problems restarting it that haven't been resolved yet. The QtCreator project file has been rearranged a little because it passes all the object files to the linker rather than using an archive library. Since the GNU linker is single pass; the object files need to be in a logical order with definitions appearing afer references to them. This was required to avoid a linking error. The lib/Makefile.linux has been enhanced to use the fortran compiler to locate the correct version of the Fortran library to use. This is necessary on the latest Linux distros because the unversioned symlink to compiler support libraries is no longer provided. This only an issue with mixed programming language links where the linker driver for one language has to link support libraraies for another language. git-svn-id: svn+ssh://svn.code.sf.net/p/wsjt/wsjt/branches/wsjtx@3532 ab8295b8-cf94-4d9e-aec4-7959e3be5d79
2013-08-07 19:09:13 -04:00
}
remaining -= numFramesProcessed;
}
} else {
jt9com_.kin = 0;
m_bufferPos = 0;
}
Qt 5 Audio replaces PortAudio. Currently only Qt5 or above is known to work with this code. It may be possible to backport it to Qt4 if required. Audio output goes back to a separate thread to try and minimize stutters in streaming on Windows particularly. A crash on Linux due to mishandling of stereo audio output has been fixed and both left and right channels are now correctly synthesised with identical contents. Rigs are enumerated directly from hamlib API rather than running a sub process reading output of rigctl -l. This was initially done to get rid of some GUI thread blocking in the configuration dialog, but is generally a better way of doing it anyway. Some refactoring in MainWindow to accomodate the audio streaming, modulation and detecting classes. Exit handling for application refactored to use signals rather than brute force event loop exit. This was required to get correct thread shutdown semantics. The GUI update timer is now stopped during application shutdown which is necessary to stop crashes when shutting down gracefully with signals and window close() calls. There is an outstanding issue with Linux audio streams; the QAudio Input/Output classes create a new stream name each time a stream is started. This doesn't play well with PulseAudio utilities such as pavucontrol to set stream volume as settings are lost every tx period. I have tried to keep a single stream for all output but there are problems restarting it that haven't been resolved yet. The QtCreator project file has been rearranged a little because it passes all the object files to the linker rather than using an archive library. Since the GNU linker is single pass; the object files need to be in a logical order with definitions appearing afer references to them. This was required to avoid a linking error. The lib/Makefile.linux has been enhanced to use the fortran compiler to locate the correct version of the Fortran library to use. This is necessary on the latest Linux distros because the unversioned symlink to compiler support libraries is no longer provided. This only an issue with mixed programming language links where the linker driver for one language has to link support libraraies for another language. git-svn-id: svn+ssh://svn.code.sf.net/p/wsjt/wsjt/branches/wsjtx@3532 ab8295b8-cf94-4d9e-aec4-7959e3be5d79
2013-08-07 19:09:13 -04:00
return maxSize; // we drop any data past the end of the buffer on
// the floor until the next period starts
Qt 5 Audio replaces PortAudio. Currently only Qt5 or above is known to work with this code. It may be possible to backport it to Qt4 if required. Audio output goes back to a separate thread to try and minimize stutters in streaming on Windows particularly. A crash on Linux due to mishandling of stereo audio output has been fixed and both left and right channels are now correctly synthesised with identical contents. Rigs are enumerated directly from hamlib API rather than running a sub process reading output of rigctl -l. This was initially done to get rid of some GUI thread blocking in the configuration dialog, but is generally a better way of doing it anyway. Some refactoring in MainWindow to accomodate the audio streaming, modulation and detecting classes. Exit handling for application refactored to use signals rather than brute force event loop exit. This was required to get correct thread shutdown semantics. The GUI update timer is now stopped during application shutdown which is necessary to stop crashes when shutting down gracefully with signals and window close() calls. There is an outstanding issue with Linux audio streams; the QAudio Input/Output classes create a new stream name each time a stream is started. This doesn't play well with PulseAudio utilities such as pavucontrol to set stream volume as settings are lost every tx period. I have tried to keep a single stream for all output but there are problems restarting it that haven't been resolved yet. The QtCreator project file has been rearranged a little because it passes all the object files to the linker rather than using an archive library. Since the GNU linker is single pass; the object files need to be in a logical order with definitions appearing afer references to them. This was required to avoid a linking error. The lib/Makefile.linux has been enhanced to use the fortran compiler to locate the correct version of the Fortran library to use. This is necessary on the latest Linux distros because the unversioned symlink to compiler support libraries is no longer provided. This only an issue with mixed programming language links where the linker driver for one language has to link support libraraies for another language. git-svn-id: svn+ssh://svn.code.sf.net/p/wsjt/wsjt/branches/wsjtx@3532 ab8295b8-cf94-4d9e-aec4-7959e3be5d79
2013-08-07 19:09:13 -04:00
}
unsigned Detector::secondInPeriod () const
{
// we take the time of the data as the following assuming no latency
// delivering it to us (not true but close enough for us)
qint64 now (QDateTime::currentMSecsSinceEpoch ());
unsigned secondInToday ((now % 86400000LL) / 1000);
return secondInToday % m_period;
}