From 894c7187303802deefb4b221afb6c7b78dc4e89a Mon Sep 17 00:00:00 2001 From: "Charles J. Cliffe" Date: Thu, 4 Dec 2014 22:25:18 -0500 Subject: [PATCH] Mostly working on OSX /w rtaudio now Looks like just some priority tweaks remain --- CMakeLists.txt | 62 +++++++++++++++++++++++++++++++----------------- src/CubicSDR.cpp | 8 +++++++ 2 files changed, 48 insertions(+), 22 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 2ae830a..a77ed53 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -48,11 +48,8 @@ SET( CMAKE_RUNTIME_OUTPUT_DIRECTORY_RELEASE ${PROJECT_BINARY_DIR}) #include_directories ( ${PROJECT_SOURCE_DIR}/../CubicVR-2/build/include ) #link_directories ( ${PROJECT_SOURCE_DIR}/../CubicVR-2/build/lib ) - - find_package(OpenGL REQUIRED) - find_package(wxWidgets REQUIRED gl core base) set(wxWidgets_CONFIGURATION mswu) include(${wxWidgets_USE_FILE}) @@ -60,8 +57,7 @@ include(${wxWidgets_USE_FILE}) # include_directories ( ${PROJECT_SOURCE_DIR}/../CubicVR-2/build/include ) # link_directories ( ${PROJECT_SOURCE_DIR}/../CubicVR-2/build/lib ${OPENGL_INCLUDE_DIR}) - -if (DEFINED WIN32) +IF (DEFINED WIN32) set(wxWidgets_USE_STATIC ON) include_directories ( ${PROJECT_SOURCE_DIR}/external/fftw-3.3.4-dll64 ${PROJECT_SOURCE_DIR}/external/rtl-sdr-release ) link_directories ( ${PROJECT_SOURCE_DIR}/external/fftw-3.3.4-dll64 ${PROJECT_SOURCE_DIR}/external/rtl-sdr-release/x64 ) @@ -71,22 +67,49 @@ if (DEFINED WIN32) include_directories ( ${PROJECT_SOURCE_DIR}/external/liquid-dsp/include ) ADD_DEFINITIONS( + # To use wasapi -D__WINDOWS_WASAPI__ -# -D__WINDOWS_DS__ + # To use directsound + #-D__WINDOWS_DS__ ) - SET(OTHER_LIBRARIES -luuid -lksuser ) - #SET(OTHER_LIBRARIES -ldsound) - -else (DEFINED WIN32) - set(RTLSDR_INCLUDE "/opt/local/include" CACHE FILEPATH "RTL-SDR Include Path") - set(RTLSDR_LIB "/opt/local/lib" CACHE FILEPATH "RTL-SDR Lib Path") - include_directories(${RTLSDR_INCLUDE}) - link_directories(${RTLSDR_LIB}) - - set(FFTW_LIB fftw3) -endif (DEFINED WIN32) + # To use wasapi + SET(OTHER_LIBRARIES -luuid -lksuser ) + # To use DirectSound (which uses WASAPI anyways?) + # SET(OTHER_LIBRARIES -ldsound) +ENDIF (DEFINED WIN32) +IF (UNIX) + set(RTLSDR_INCLUDE "/opt/local/include" CACHE FILEPATH "RTL-SDR Include Path") + set(RTLSDR_LIB "/opt/local/lib" CACHE FILEPATH "RTL-SDR Lib Path") + include_directories(${RTLSDR_INCLUDE}) + link_directories(${RTLSDR_LIB}) + + set(FFTW_LIB fftw3) + + ADD_DEFINITIONS( + # -D__UNIX_JACK__ + # -D__LINUX_ALSA__ + # -D__LINUX_PULSE__ + # -D__LINUX_OSS__ + ) +ENDIF(UNIX) + +IF (APPLE) + set(RTLSDR_INCLUDE "/opt/local/include" CACHE FILEPATH "RTL-SDR Include Path") + set(RTLSDR_LIB "/opt/local/lib" CACHE FILEPATH "RTL-SDR Lib Path") + include_directories(${RTLSDR_INCLUDE}) + link_directories(${RTLSDR_LIB}) + + set(FFTW_LIB fftw3) + + ADD_DEFINITIONS( + -D__MACOSX_CORE__ + ) + + FIND_LIBRARY(COREAUDIO_LIBRARY CoreAudio) + SET (OTHER_LIBRARIES ${COREAUDIO_LIBRARY}) +ENDIF (APPLE) SET (cubicsdr_sources @@ -155,8 +178,3 @@ add_executable(CubicSDR ${cubicsdr_sources} ${cubicsdr_headers}) target_link_libraries(CubicSDR rtlsdr liquid ${FFTW_LIB} ${wxWidgets_LIBRARIES} ${OPENGL_LIBRARIES} ${OTHER_LIBRARIES}) # cubicvr2 glfw ${GLFW_LIBRARIES} - - - - - diff --git a/src/CubicSDR.cpp b/src/CubicSDR.cpp index 732882e..a28acae 100644 --- a/src/CubicSDR.cpp +++ b/src/CubicSDR.cpp @@ -47,6 +47,14 @@ bool CubicSDR::OnInit() { AppFrame *appframe = new AppFrame(); + int main_policy; + struct sched_param main_param; + + main_policy = SCHED_OTHER; + main_param.sched_priority = sched_get_priority_min(SCHED_OTHER); + + pthread_setschedparam(pthread_self(), main_policy, &main_param); + return true; }