Browse Source

Updated CMake files for QTEditor cmake style.

AudioOutput had previously stalled, mutex temporary removed(Q&D workaround, need for study OSX Audio Concurency).
Removed some part of code in DemodBFM for OSX compilations.
Code runs and was tested with HackRF.
Note: There is need have investigate two potencial problems(DemodBFM bug and AudioOutput deadlocking?).
chirpmodem-v8.0.0
Ziga S 11 years ago
parent
commit
08602c661b
  1. 5
      CMakeLists.txt
  2. 2
      fcdhid/CMakeLists.txt
  3. 2
      plugins/channel/demodbfm/CMakeLists.txt
  4. 14
      plugins/channel/demodbfm/rdsparser.cpp
  5. 2
      plugins/samplesource/hackrf/CMakeLists.txt
  6. 13
      sdrbase/audio/audiooutput.cpp
  7. 4
      sdrbase/dsp/phaselock.cpp

5
CMakeLists.txt

@ -61,10 +61,7 @@ ENDIF() @@ -61,10 +61,7 @@ ENDIF()
# MacOS Compatibility
if(APPLE)
find_package(ICONV)
set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -stdlib=libc++ -lc++abi")
find_package(ICONV)
endif(APPLE)
##############################################################################

2
fcdhid/CMakeLists.txt

@ -30,4 +30,4 @@ target_link_libraries(fcdhid @@ -30,4 +30,4 @@ target_link_libraries(fcdhid
${ICONV_LIBRARY}
)
install(TARGETS fcdhid DESTINATION lib)
install(TARGETS fcdhid DESTINATION lib)

2
plugins/channel/demodbfm/CMakeLists.txt

@ -49,4 +49,4 @@ target_link_libraries(demodbfm @@ -49,4 +49,4 @@ target_link_libraries(demodbfm
qt5_use_modules(demodbfm Core Widgets OpenGL Multimedia)
install(TARGETS demodbfm DESTINATION lib/plugins/channel)
install(TARGETS demodbfm DESTINATION lib/plugins/channel)

14
plugins/channel/demodbfm/rdsparser.cpp

@ -526,15 +526,21 @@ void RDSParser::decode_type0(unsigned int *group, bool B) @@ -526,15 +526,21 @@ void RDSParser::decode_type0(unsigned int *group, bool B)
if (af_1)
{
std::pair<std::_Rb_tree_const_iterator<double>, bool> res = m_g0_alt_freq.insert(af_1/1e3);
m_g0_af_updated = m_g0_af_updated || res.second;
// @TODO: Find proper header or STL on OSX
#ifndef __APPLE__
std::pair<std::_Rb_tree_const_iterator<double>, bool> res = m_g0_alt_freq.insert(af_1/1e3);
m_g0_af_updated = m_g0_af_updated || res.second;
#endif
no_af += 1;
}
if (af_2)
{
std::pair<std::_Rb_tree_const_iterator<double>, bool> res = m_g0_alt_freq.insert(af_2/1e3);
m_g0_af_updated = m_g0_af_updated || res.second;
// @TODO: Find proper header or STL on OSX
#ifndef __APPLE__
std::pair<std::_Rb_tree_const_iterator<double>, bool> res = m_g0_alt_freq.insert(af_2/1e3);
m_g0_af_updated = m_g0_af_updated || res.second;
#endif
no_af += 2;
}

2
plugins/samplesource/hackrf/CMakeLists.txt

@ -21,7 +21,7 @@ set(hackrf_FORMS @@ -21,7 +21,7 @@ set(hackrf_FORMS
)
include_directories(
.
.
${CMAKE_CURRENT_BINARY_DIR}
${LIBHACKRF_INCLUDE_DIR}
)

13
sdrbase/audio/audiooutput.cpp

@ -150,8 +150,12 @@ bool AudioOutput::open(OpenMode mode) @@ -150,8 +150,12 @@ bool AudioOutput::open(OpenMode mode)
qint64 AudioOutput::readData(char* data, qint64 maxLen)
{
//qDebug("AudioOutput::readData: %lld", maxLen);
QMutexLocker mutexLocker(&m_mutex);
//qDebug("AudioOutput::readData: %lld", maxLen);
// @TODO: Study this mutex on OSX, for now deadlocks possible
#ifndef __APPLE__
QMutexLocker mutexLocker(&m_mutex);
#endif
unsigned int framesPerBuffer = maxLen / 4;
@ -183,7 +187,7 @@ qint64 AudioOutput::readData(char* data, qint64 maxLen) @@ -183,7 +187,7 @@ qint64 AudioOutput::readData(char* data, qint64 maxLen)
if (samples != framesPerBuffer)
{
//qDebug("AudioOutput::readData: read %d samples vs %d requested", samples, framesPerBuffer);
qDebug("AudioOutput::readData: read %d samples vs %d requested", samples, framesPerBuffer);
}
for (uint i = 0; i < samples; i++)
@ -195,8 +199,7 @@ qint64 AudioOutput::readData(char* data, qint64 maxLen) @@ -195,8 +199,7 @@ qint64 AudioOutput::readData(char* data, qint64 maxLen)
++src;
++dst;
}
}
}
// convert to int16
//std::vector<qint32>::const_iterator src = m_mixBuffer.begin(); // Valgrind optim

4
sdrbase/dsp/phaselock.cpp

@ -182,7 +182,7 @@ void PhaseLock::process(const std::vector<Real>& samples_in, std::vector<Real>& @@ -182,7 +182,7 @@ void PhaseLock::process(const std::vector<Real>& samples_in, std::vector<Real>&
// Convert I/Q ratio to estimate of phase error.
Real phase_err;
if (phasor_i > abs(phasor_q)) {
if (phasor_i > std::abs(phasor_q)) {
// We are within +/- 45 degrees from lock.
// Use simple linear approximation of arctan.
phase_err = phasor_q / phasor_i;
@ -278,7 +278,7 @@ void PhaseLock::process(const Real& sample_in, Real *samples_out) @@ -278,7 +278,7 @@ void PhaseLock::process(const Real& sample_in, Real *samples_out)
// Convert I/Q ratio to estimate of phase error.
Real phase_err;
if (phasor_i > abs(phasor_q)) {
if (phasor_i > std::abs(phasor_q)) {
// We are within +/- 45 degrees from lock.
// Use simple linear approximation of arctan.
phase_err = phasor_q / phasor_i;

Loading…
Cancel
Save