mirror of
https://github.com/cjcliffe/CubicSDR.git
synced 2024-11-26 05:38:39 -05:00
commit
0f245e71b2
@ -87,21 +87,50 @@ IF (WIN32)
|
|||||||
|
|
||||||
ENDIF (WIN32)
|
ENDIF (WIN32)
|
||||||
|
|
||||||
IF (UNIX)
|
IF (UNIX AND NOT APPLE)
|
||||||
set(RTLSDR_INCLUDE "/opt/local/include" CACHE FILEPATH "RTL-SDR Include Path")
|
set(RTLSDR_INCLUDE "/usr/local/include" CACHE FILEPATH "RTL-SDR Include Path")
|
||||||
set(RTLSDR_LIB "/opt/local/lib" CACHE FILEPATH "RTL-SDR Lib Path")
|
set(RTLSDR_LIB "/usr/local/lib" CACHE FILEPATH "RTL-SDR Lib Path")
|
||||||
|
set(USE_AUDIO_PULSE ON CACHE BOOL "Use Pulse Audio")
|
||||||
|
set(USE_AUDIO_JACK OFF CACHE BOOL "Use Jack Audio")
|
||||||
|
set(USE_AUDIO_ALSA OFF CACHE BOOL "Use ALSA Audio")
|
||||||
|
set(USE_AUDIO_OSS OFF CACHE BOOL "Use OSS Audio")
|
||||||
include_directories(${RTLSDR_INCLUDE})
|
include_directories(${RTLSDR_INCLUDE})
|
||||||
link_directories(${RTLSDR_LIB})
|
link_directories(${RTLSDR_LIB})
|
||||||
|
|
||||||
set(FFTW_LIB fftw3f)
|
set(FFTW_LIB fftw3f)
|
||||||
|
|
||||||
ADD_DEFINITIONS(
|
IF(USE_AUDIO_PULSE)
|
||||||
# -D__UNIX_JACK__
|
SET (OTHER_LIBRARIES ${OTHER_LIBRARIES} pulse-simple pulse)
|
||||||
# -D__LINUX_ALSA__
|
ADD_DEFINITIONS(
|
||||||
# -D__LINUX_PULSE__
|
-D__LINUX_PULSE__
|
||||||
# -D__LINUX_OSS__
|
)
|
||||||
)
|
ENDIF(USE_AUDIO_PULSE)
|
||||||
ENDIF(UNIX)
|
|
||||||
|
IF(USE_AUDIO_JACK)
|
||||||
|
SET (OTHER_LIBRARIES ${OTHER_LIBRARIES} jack)
|
||||||
|
ADD_DEFINITIONS(
|
||||||
|
-D__UNIX_JACK__
|
||||||
|
)
|
||||||
|
ENDIF(USE_AUDIO_JACK)
|
||||||
|
|
||||||
|
IF(USE_AUDIO_ALSA)
|
||||||
|
SET (OTHER_LIBRARIES ${OTHER_LIBRARIES} asound)
|
||||||
|
set(ALSA_INCLUDE_DIR "/usr/include" CACHE FILEPATH "ALSA include path")
|
||||||
|
include_directories(${ALSA_INCLUDE_DIR})
|
||||||
|
set(ALSA_LIB_DIR "/usr/lib" CACHE FILEPATH "ALSA lib path")
|
||||||
|
link_directories(${ALSA_LIB_DIR})
|
||||||
|
ADD_DEFINITIONS(
|
||||||
|
-D__LINUX_ALSA__
|
||||||
|
)
|
||||||
|
ENDIF(USE_AUDIO_ALSA)
|
||||||
|
|
||||||
|
IF(USE_AUDIO_OSS)
|
||||||
|
SET (OTHER_LIBRARIES ${OTHER_LIBRARIES} oss)
|
||||||
|
ADD_DEFINITIONS(
|
||||||
|
-D__LINUX_OSS__
|
||||||
|
)
|
||||||
|
ENDIF(USE_AUDIO_OSS)
|
||||||
|
ENDIF(UNIX AND NOT APPLE)
|
||||||
|
|
||||||
IF (APPLE)
|
IF (APPLE)
|
||||||
set(RTLSDR_INCLUDE "/opt/local/include" CACHE FILEPATH "RTL-SDR Include Path")
|
set(RTLSDR_INCLUDE "/opt/local/include" CACHE FILEPATH "RTL-SDR Include Path")
|
||||||
|
@ -99,7 +99,7 @@ Target Platforms:
|
|||||||
----------------
|
----------------
|
||||||
- [x] OSX
|
- [x] OSX
|
||||||
- [x] Windows
|
- [x] Windows
|
||||||
- [ ] Linux
|
- [x] Linux
|
||||||
|
|
||||||
|
|
||||||
License:
|
License:
|
||||||
|
@ -13,10 +13,17 @@ const char filePathSeparator =
|
|||||||
#ifdef __APPLE__
|
#ifdef __APPLE__
|
||||||
#define BUF_SIZE (16384*2)
|
#define BUF_SIZE (16384*2)
|
||||||
#define DEFAULT_SAMPLE_RATE 2000000
|
#define DEFAULT_SAMPLE_RATE 2000000
|
||||||
#else
|
#endif
|
||||||
|
#ifdef __linux__
|
||||||
|
#define BUF_SIZE (16384*6)
|
||||||
|
#define DEFAULT_SAMPLE_RATE 2000000
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifndef BUF_SIZE
|
||||||
#define BUF_SIZE (16384*5)
|
#define BUF_SIZE (16384*5)
|
||||||
#define DEFAULT_SAMPLE_RATE 2500000
|
#define DEFAULT_SAMPLE_RATE 2500000
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#define DEFAULT_FFT_SIZE 2048
|
#define DEFAULT_FFT_SIZE 2048
|
||||||
|
|
||||||
#define DEFAULT_FREQ 100000000
|
#define DEFAULT_FREQ 100000000
|
||||||
|
@ -4,7 +4,7 @@
|
|||||||
#include <algorithm>
|
#include <algorithm>
|
||||||
#include "DemodulatorThread.h"
|
#include "DemodulatorThread.h"
|
||||||
|
|
||||||
#ifdef __APPLE__
|
#ifdef USE_MIXER
|
||||||
std::map<int, AudioThread *> AudioThread::deviceController;
|
std::map<int, AudioThread *> AudioThread::deviceController;
|
||||||
std::map<int, std::thread *> AudioThread::deviceThread;
|
std::map<int, std::thread *> AudioThread::deviceThread;
|
||||||
#endif
|
#endif
|
||||||
@ -12,18 +12,18 @@ std::map<int, std::thread *> AudioThread::deviceThread;
|
|||||||
AudioThread::AudioThread(AudioThreadInputQueue *inputQueue, DemodulatorThreadCommandQueue* threadQueueNotify) :
|
AudioThread::AudioThread(AudioThreadInputQueue *inputQueue, DemodulatorThreadCommandQueue* threadQueueNotify) :
|
||||||
currentInput(NULL), inputQueue(inputQueue), audioQueuePtr(0), underflowCount(0), terminated(false), active(false), outputDevice(-1), gain(
|
currentInput(NULL), inputQueue(inputQueue), audioQueuePtr(0), underflowCount(0), terminated(false), active(false), outputDevice(-1), gain(
|
||||||
1.0), threadQueueNotify(threadQueueNotify) {
|
1.0), threadQueueNotify(threadQueueNotify) {
|
||||||
#ifdef __APPLE__
|
#ifdef USE_MIXER
|
||||||
boundThreads = new std::vector<AudioThread *>;
|
boundThreads = new std::vector<AudioThread *>;
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
AudioThread::~AudioThread() {
|
AudioThread::~AudioThread() {
|
||||||
#ifdef __APPLE__
|
#ifdef USE_MIXER
|
||||||
delete boundThreads.load();
|
delete boundThreads.load();
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifdef __APPLE__
|
#ifdef USE_MIXER
|
||||||
void AudioThread::bindThread(AudioThread *other) {
|
void AudioThread::bindThread(AudioThread *other) {
|
||||||
if (std::find(boundThreads.load()->begin(), boundThreads.load()->end(), other) == boundThreads.load()->end()) {
|
if (std::find(boundThreads.load()->begin(), boundThreads.load()->end(), other) == boundThreads.load()->end()) {
|
||||||
boundThreads.load()->push_back(other);
|
boundThreads.load()->push_back(other);
|
||||||
@ -306,7 +306,7 @@ void AudioThread::setupDevice(int deviceId) {
|
|||||||
|
|
||||||
try {
|
try {
|
||||||
|
|
||||||
#ifdef __APPLE__
|
#ifdef USE_MIXER
|
||||||
if (deviceController.find(outputDevice.load()) != deviceController.end()) {
|
if (deviceController.find(outputDevice.load()) != deviceController.end()) {
|
||||||
deviceController[outputDevice.load()]->removeThread(this);
|
deviceController[outputDevice.load()]->removeThread(this);
|
||||||
}
|
}
|
||||||
@ -388,12 +388,12 @@ void AudioThread::threadMain() {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
#if !__APPLE__
|
#if !USE_MIXER
|
||||||
AudioThreadInput dummy;
|
AudioThreadInput dummy;
|
||||||
inputQueue->push(&dummy);
|
inputQueue->push(&dummy);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifdef __APPLE__
|
#ifdef USE_MIXER
|
||||||
if (deviceController[parameters.deviceId] != this) {
|
if (deviceController[parameters.deviceId] != this) {
|
||||||
deviceController[parameters.deviceId]->removeThread(this);
|
deviceController[parameters.deviceId]->removeThread(this);
|
||||||
} else {
|
} else {
|
||||||
@ -440,7 +440,7 @@ bool AudioThread::isActive() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
void AudioThread::setActive(bool state) {
|
void AudioThread::setActive(bool state) {
|
||||||
#ifdef __APPLE__
|
#ifdef USE_MIXER
|
||||||
AudioThreadInput *dummy;
|
AudioThreadInput *dummy;
|
||||||
if (state && !active) {
|
if (state && !active) {
|
||||||
while (!inputQueue->empty()) { // flush queue
|
while (!inputQueue->empty()) { // flush queue
|
||||||
|
@ -18,6 +18,14 @@
|
|||||||
#include "RtAudio.h"
|
#include "RtAudio.h"
|
||||||
#include "DemodDefs.h"
|
#include "DemodDefs.h"
|
||||||
|
|
||||||
|
#ifdef __APPLE__
|
||||||
|
#define USE_MIXER 1
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifdef __linux__
|
||||||
|
#define USE_MIXER 1
|
||||||
|
#endif
|
||||||
|
|
||||||
class AudioThreadInput: public ReferenceCounter {
|
class AudioThreadInput: public ReferenceCounter {
|
||||||
public:
|
public:
|
||||||
long long frequency;
|
long long frequency;
|
||||||
@ -90,7 +98,7 @@ private:
|
|||||||
AudioThreadCommandQueue cmdQueue;
|
AudioThreadCommandQueue cmdQueue;
|
||||||
DemodulatorThreadCommandQueue* threadQueueNotify;
|
DemodulatorThreadCommandQueue* threadQueueNotify;
|
||||||
|
|
||||||
#ifdef __APPLE__
|
#ifdef USE_MIXER
|
||||||
public:
|
public:
|
||||||
void bindThread(AudioThread *other);
|
void bindThread(AudioThread *other);
|
||||||
void removeThread(AudioThread *other);
|
void removeThread(AudioThread *other);
|
||||||
|
@ -27,6 +27,7 @@ void MouseTracker::OnMouseMoved(wxMouseEvent& event) {
|
|||||||
|
|
||||||
if (isMouseDown || isMouseRightDown) {
|
if (isMouseDown || isMouseRightDown) {
|
||||||
#ifndef __APPLE__
|
#ifndef __APPLE__
|
||||||
|
#ifndef __linux__
|
||||||
if (horizDragLock && vertDragLock) {
|
if (horizDragLock && vertDragLock) {
|
||||||
target->WarpPointer(originMouseX * ClientSize.x, (1.0 - originMouseY) * ClientSize.y);
|
target->WarpPointer(originMouseX * ClientSize.x, (1.0 - originMouseY) * ClientSize.y);
|
||||||
mouseX = originMouseX;
|
mouseX = originMouseX;
|
||||||
@ -38,6 +39,7 @@ void MouseTracker::OnMouseMoved(wxMouseEvent& event) {
|
|||||||
target->WarpPointer(originMouseX * ClientSize.x, event.m_y);
|
target->WarpPointer(originMouseX * ClientSize.x, event.m_y);
|
||||||
mouseX = originMouseX;
|
mouseX = originMouseX;
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -54,11 +54,13 @@ void PrimaryGLContext::CheckGLError() {
|
|||||||
PrimaryGLContext::PrimaryGLContext(wxGLCanvas *canvas, wxGLContext *sharedContext) :
|
PrimaryGLContext::PrimaryGLContext(wxGLCanvas *canvas, wxGLContext *sharedContext) :
|
||||||
wxGLContext(canvas, sharedContext) {
|
wxGLContext(canvas, sharedContext) {
|
||||||
SetCurrent(*canvas);
|
SetCurrent(*canvas);
|
||||||
|
#ifndef __linux__
|
||||||
// Pre-load fonts
|
// Pre-load fonts
|
||||||
for (int i = 0; i < GLFONT_MAX; i++) {
|
for (int i = 0; i < GLFONT_MAX; i++) {
|
||||||
getFont((GLFontSize) i);
|
getFont((GLFontSize) i);
|
||||||
}
|
}
|
||||||
CheckGLError();
|
CheckGLError();
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
GLFont &PrimaryGLContext::getFont(GLFontSize esize) {
|
GLFont &PrimaryGLContext::getFont(GLFontSize esize) {
|
||||||
|
@ -20,23 +20,6 @@ void WaterfallContext::Setup(int fft_size_in, int num_waterfall_lines_in) {
|
|||||||
|
|
||||||
waterfall_tex = new unsigned char[fft_size * waterfall_lines];
|
waterfall_tex = new unsigned char[fft_size * waterfall_lines];
|
||||||
memset(waterfall_tex, 0, fft_size * waterfall_lines);
|
memset(waterfall_tex, 0, fft_size * waterfall_lines);
|
||||||
|
|
||||||
glDisable(GL_CULL_FACE);
|
|
||||||
glDisable(GL_DEPTH_TEST);
|
|
||||||
|
|
||||||
glMatrixMode(GL_PROJECTION);
|
|
||||||
glLoadIdentity();
|
|
||||||
|
|
||||||
glGenTextures(1, &waterfall);
|
|
||||||
|
|
||||||
glEnable(GL_TEXTURE_2D);
|
|
||||||
glBindTexture(GL_TEXTURE_2D, waterfall);
|
|
||||||
glPixelStorei(GL_UNPACK_ALIGNMENT, 1);
|
|
||||||
|
|
||||||
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_CLAMP);
|
|
||||||
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_CLAMP);
|
|
||||||
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR);
|
|
||||||
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void WaterfallContext::refreshTheme() {
|
void WaterfallContext::refreshTheme() {
|
||||||
@ -51,6 +34,19 @@ void WaterfallContext::refreshTheme() {
|
|||||||
|
|
||||||
void WaterfallContext::Draw(std::vector<float> &points) {
|
void WaterfallContext::Draw(std::vector<float> &points) {
|
||||||
|
|
||||||
|
if (!waterfall) {
|
||||||
|
glGenTextures(1, &waterfall);
|
||||||
|
|
||||||
|
glEnable(GL_TEXTURE_2D);
|
||||||
|
glBindTexture(GL_TEXTURE_2D, waterfall);
|
||||||
|
glPixelStorei(GL_UNPACK_ALIGNMENT, 1);
|
||||||
|
|
||||||
|
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_CLAMP);
|
||||||
|
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_CLAMP);
|
||||||
|
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR);
|
||||||
|
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR);
|
||||||
|
}
|
||||||
|
|
||||||
if (activeTheme != ThemeMgr::mgr.currentTheme) {
|
if (activeTheme != ThemeMgr::mgr.currentTheme) {
|
||||||
refreshTheme();
|
refreshTheme();
|
||||||
activeTheme = ThemeMgr::mgr.currentTheme;
|
activeTheme = ThemeMgr::mgr.currentTheme;
|
||||||
|
Loading…
Reference in New Issue
Block a user