chore: cleanup SDL2 definitions (#6467)
This commit is contained in:
+1
-1
@@ -142,7 +142,7 @@ if(NATIVE_BUILD)
|
||||
include(NativeTargets)
|
||||
else()
|
||||
# Prevent CMake warnings
|
||||
set(IGNORE "${SDL2_LIBRARY_PATH}" "${LIBUSB1_ROOT_DIR}" "${OPENSSL_ROOT_DIR}")
|
||||
set(IGNORE "${LIBUSB1_ROOT_DIR}" "${OPENSSL_ROOT_DIR}")
|
||||
endif()
|
||||
|
||||
add_subdirectory(${RADIO_SRC_DIR})
|
||||
|
||||
@@ -24,3 +24,5 @@ target_include_directories(imgui PUBLIC
|
||||
${CMAKE_CURRENT_BINARY_DIR}/imgui
|
||||
${CMAKE_CURRENT_BINARY_DIR}/imgui/backends
|
||||
)
|
||||
|
||||
target_link_libraries(imgui PUBLIC SDL2::SDL2)
|
||||
|
||||
@@ -5,21 +5,9 @@ if(NOT DISABLE_COMPANION)
|
||||
include(QtDefs)
|
||||
endif(NOT DISABLE_COMPANION)
|
||||
|
||||
# this prevents FindSDL from appending SDLmain lib to the results, which we don't want
|
||||
set(SDL2_BUILDING_LIBRARY YES)
|
||||
find_package("SDL2")
|
||||
|
||||
if(SDL2_FOUND)
|
||||
# find_package("SDL2") does not set a variable holding the path to the location of the SDL2 shared library
|
||||
find_file(SDL2_LIB_PATH
|
||||
NAMES
|
||||
libSDL2.so
|
||||
SDL2.dll
|
||||
SDL2.dylib
|
||||
HINTS
|
||||
"/usr/lib/x86_64-linux-gnu"
|
||||
${SDL2_LIBRARY_PATH})
|
||||
message(STATUS "SDL2 Lib: ${SDL2_LIB_PATH} Libs: ${SDL2_LIBRARIES}; Headers: ${SDL2_INCLUDE_DIRS}")
|
||||
find_package(SDL2 QUIET COMPONENTS SDL2 CONFIG)
|
||||
if(TARGET SDL2::SDL2)
|
||||
message(STATUS "SDL2 found")
|
||||
else()
|
||||
message(STATUS "SDL not found! Simulator audio, and joystick inputs, will not work.")
|
||||
endif()
|
||||
|
||||
@@ -44,12 +44,9 @@ if(WIN32)
|
||||
endif()
|
||||
endif()
|
||||
|
||||
if(SDL2_FOUND)
|
||||
include_directories(${SDL2_INCLUDE_DIRS})
|
||||
add_definitions(-DJOYSTICKS -DSIMU_AUDIO)
|
||||
if(TARGET SDL2::SDL2)
|
||||
set(SDL2_LIBRARIES SDL2::SDL2)
|
||||
endif()
|
||||
if(TARGET SDL2::SDL2)
|
||||
add_definitions(-DUSE_SDL)
|
||||
set(SDL2_LIBRARIES SDL2::SDL2)
|
||||
endif()
|
||||
|
||||
add_definitions(${APP_COMMON_DEFINES}) # set in top-level CMakeLists
|
||||
@@ -267,10 +264,21 @@ if(WIN32)
|
||||
set(icon_RC images/winicons/icon.rc)
|
||||
endif()
|
||||
|
||||
add_executable(${COMPANION_NAME}
|
||||
MACOSX_BUNDLE ${WIN_EXECUTABLE_TYPE} ${companion_SRCS} ${companion_HDRS} ${icon_RC})
|
||||
target_link_libraries(${COMPANION_NAME}
|
||||
PRIVATE ${CPN_COMMON_LIB} generaledit modeledit qcustomplot miniz updates)
|
||||
add_executable(${COMPANION_NAME} MACOSX_BUNDLE ${WIN_EXECUTABLE_TYPE}
|
||||
${companion_SRCS}
|
||||
${companion_HDRS}
|
||||
${icon_RC}
|
||||
)
|
||||
|
||||
target_link_libraries(${COMPANION_NAME} PRIVATE
|
||||
${CPN_COMMON_LIB}
|
||||
${SDL2_LIBRARIES}
|
||||
generaledit
|
||||
modeledit
|
||||
qcustomplot
|
||||
miniz
|
||||
updates
|
||||
)
|
||||
|
||||
PrintTargetReport("${COMPANION_NAME}")
|
||||
|
||||
@@ -278,10 +286,15 @@ PrintTargetReport("${COMPANION_NAME}")
|
||||
|
||||
set(simu_SRCS simulator.cpp )
|
||||
|
||||
add_executable(${SIMULATOR_NAME}
|
||||
MACOSX_BUNDLE ${WIN_EXECUTABLE_TYPE} ${simu_SRCS} ${icon_RC})
|
||||
target_link_libraries(${SIMULATOR_NAME}
|
||||
PRIVATE ${CPN_COMMON_LIB})
|
||||
add_executable(${SIMULATOR_NAME} MACOSX_BUNDLE ${WIN_EXECUTABLE_TYPE}
|
||||
${simu_SRCS}
|
||||
${icon_RC}
|
||||
)
|
||||
|
||||
target_link_libraries(${SIMULATOR_NAME} PRIVATE
|
||||
${CPN_COMMON_LIB}
|
||||
${SDL2_LIBRARIES}
|
||||
)
|
||||
|
||||
add_subdirectory(tests)
|
||||
|
||||
@@ -450,10 +463,14 @@ elseif(WIN32)
|
||||
endif()
|
||||
endif(OPENSSL_FOUND)
|
||||
|
||||
if(SDL2_FOUND AND DEFINED SDL2_LIB_PATH)
|
||||
install(FILES "${SDL2_LIB_PATH}"
|
||||
DESTINATION ${CMAKE_INSTALL_PREFIX}/${CMAKE_INSTALL_BINDIR}
|
||||
COMPONENT Runtime)
|
||||
if(TARGET SDL2::SDL2)
|
||||
# Get the SDL2 DLL location
|
||||
get_target_property(SDL2_DLL_PATH SDL2::SDL2 IMPORTED_LOCATION)
|
||||
if(SDL2_DLL_PATH)
|
||||
install(FILES "${SDL2_DLL_PATH}"
|
||||
DESTINATION ${CMAKE_INSTALL_PREFIX}/${CMAKE_INSTALL_BINDIR}
|
||||
COMPONENT Runtime)
|
||||
endif()
|
||||
endif()
|
||||
|
||||
elseif(APPLE)
|
||||
|
||||
@@ -24,7 +24,7 @@
|
||||
#include "mainwindow.h"
|
||||
#include "helpers.h"
|
||||
#include "storage.h"
|
||||
#if defined(JOYSTICKS)
|
||||
#if defined(USE_SDL)
|
||||
#include "joystick.h"
|
||||
#include "joystickdialog.h"
|
||||
#endif
|
||||
@@ -57,7 +57,7 @@ AppPreferencesDialog::AppPreferencesDialog(QWidget * parent, UpdateFactories * f
|
||||
connect(ui->opt_appDebugLog, &QCheckBox::toggled, this, &AppPreferencesDialog::toggleAppLogSettings);
|
||||
connect(ui->opt_fwTraceLog, &QCheckBox::toggled, this, &AppPreferencesDialog::toggleAppLogSettings);
|
||||
|
||||
#if !defined(JOYSTICKS)
|
||||
#if !defined(USE_SDL)
|
||||
ui->joystickCB->hide();
|
||||
ui->joystickCB->setDisabled(true);
|
||||
ui->joystickcalButton->hide();
|
||||
@@ -296,7 +296,7 @@ void AppPreferencesDialog::initSettings()
|
||||
ui->chkSimuScrollButtons->setChecked(g.simuScrollButtons());
|
||||
ui->joystickWarningCB->setChecked(g.disableJoystickWarning());
|
||||
|
||||
#if defined(JOYSTICKS)
|
||||
#if defined(USE_SDL)
|
||||
ui->joystickChkB->setChecked(g.jsSupport());
|
||||
if (ui->joystickChkB->isChecked()) {
|
||||
QStringList joystickNames;
|
||||
@@ -627,7 +627,7 @@ void AppPreferencesDialog::on_btnClearPos_clicked()
|
||||
g.profile[g.sessionId()].simulatorOptions(opts);
|
||||
}
|
||||
|
||||
#if defined(JOYSTICKS)
|
||||
#if defined(USE_SDL)
|
||||
void AppPreferencesDialog::on_joystickChkB_clicked() {
|
||||
if (ui->joystickChkB->isChecked()) {
|
||||
QStringList joystickNames;
|
||||
|
||||
@@ -74,7 +74,7 @@ class AppPreferencesDialog : public QDialog
|
||||
void on_btn_appLogsDir_clicked();
|
||||
void on_btnClearPos_clicked();
|
||||
|
||||
#if defined(JOYSTICKS)
|
||||
#if defined(USE_SDL)
|
||||
void on_joystickChkB_clicked();
|
||||
void on_joystickcalButton_clicked();
|
||||
#endif
|
||||
|
||||
@@ -25,7 +25,8 @@
|
||||
#include <QFile>
|
||||
#include <QMessageBox>
|
||||
#include <QSplashScreen>
|
||||
#if defined(JOYSTICKS) || defined(SIMU_AUDIO)
|
||||
|
||||
#if defined(USE_SDL)
|
||||
#include <SDL.h>
|
||||
#undef main
|
||||
#endif
|
||||
@@ -216,18 +217,11 @@ int main(int argc, char *argv[])
|
||||
|
||||
Translations::installTranslators();
|
||||
|
||||
#if defined(JOYSTICKS) || defined(SIMU_AUDIO)
|
||||
uint32_t sdlFlags = 0;
|
||||
#ifdef JOYSTICKS
|
||||
sdlFlags |= SDL_INIT_JOYSTICK;
|
||||
#endif
|
||||
#ifdef SIMU_AUDIO
|
||||
sdlFlags |= SDL_INIT_AUDIO;
|
||||
#endif
|
||||
#if defined(USE_SDL)
|
||||
#if defined(_WIN32) || defined(_WIN64)
|
||||
putenv("SDL_AUDIODRIVER=directsound");
|
||||
#endif
|
||||
if (SDL_Init(sdlFlags) < 0) {
|
||||
if (SDL_Init(SDL_INIT_JOYSTICK | SDL_INIT_AUDIO) < 0) {
|
||||
fprintf(stderr, "ERROR: couldn't initialize SDL: %s\n", SDL_GetError());
|
||||
}
|
||||
#endif
|
||||
@@ -269,7 +263,7 @@ int main(int argc, char *argv[])
|
||||
unregisterStorageFactories();
|
||||
gBoardFactories->unregisterBoardFactories();
|
||||
|
||||
#if defined(JOYSTICKS) || defined(SIMU_AUDIO)
|
||||
#if defined(USE_SDL)
|
||||
SDL_Quit();
|
||||
#endif
|
||||
|
||||
|
||||
@@ -24,9 +24,8 @@ set(${PROJECT_NAME}_NAMES
|
||||
simulateduiwidgetGeneric
|
||||
)
|
||||
|
||||
if(SDL2_FOUND)
|
||||
set(${PROJECT_NAME}_NAMES
|
||||
${${PROJECT_NAME}_NAMES}
|
||||
if(TARGET SDL2::SDL2)
|
||||
list(APPEND ${PROJECT_NAME}_NAMES
|
||||
joystick
|
||||
joystickdialog
|
||||
)
|
||||
@@ -61,6 +60,10 @@ target_link_libraries(${PROJECT_NAME}
|
||||
Qt::Svg
|
||||
)
|
||||
|
||||
if(TARGET SDL2::SDL2)
|
||||
target_link_libraries(${PROJECT_NAME} PUBLIC SDL2::SDL2)
|
||||
endif()
|
||||
|
||||
target_include_directories(${PROJECT_NAME}
|
||||
PRIVATE
|
||||
"${CMAKE_SOURCE_DIR}"
|
||||
|
||||
@@ -29,7 +29,7 @@
|
||||
#include "simulatorinterface.h"
|
||||
#include "telemetrysimu.h"
|
||||
#include "trainersimu.h"
|
||||
#ifdef JOYSTICKS
|
||||
#ifdef USE_SDL
|
||||
#include "joystickdialog.h"
|
||||
#endif
|
||||
#include "serialportsdialog.h"
|
||||
@@ -128,7 +128,7 @@ SimulatorMainWindow::SimulatorMainWindow(QWidget *parent, const QString & simula
|
||||
ui->actionReloadLua->setDisabled(true);
|
||||
if(!m_simulator->getCapability(SimulatorInterface::CAP_TELEM_FRSKY_SPORT))
|
||||
m_telemetryDockWidget->toggleViewAction()->setDisabled(true);
|
||||
#ifndef JOYSTICKS
|
||||
#ifndef USE_SDL
|
||||
ui->actionJoystickSettings->setDisabled(true);
|
||||
#endif
|
||||
|
||||
@@ -482,7 +482,7 @@ void SimulatorMainWindow::toggleRadioDocked(bool dock)
|
||||
|
||||
void SimulatorMainWindow::openJoystickDialog(bool)
|
||||
{
|
||||
#ifdef JOYSTICKS
|
||||
#ifdef USE_SDL
|
||||
joystickDialog * jd = new joystickDialog(this);
|
||||
if (jd->exec() == QDialog::Accepted && m_simulatorWidget)
|
||||
m_simulatorWidget->setupJoysticks();
|
||||
|
||||
@@ -33,7 +33,7 @@
|
||||
#include "simulateduiwidget.h"
|
||||
#include "storage.h"
|
||||
#include "virtualjoystickwidget.h"
|
||||
#ifdef JOYSTICKS
|
||||
#ifdef USE_SDL
|
||||
#include "joystick.h"
|
||||
#include "joystickdialog.h"
|
||||
#endif
|
||||
@@ -126,7 +126,7 @@ SimulatorWidget::~SimulatorWidget()
|
||||
delete radioUiWidget;
|
||||
delete vJoyLeft;
|
||||
delete vJoyRight;
|
||||
#ifdef JOYSTICKS
|
||||
#ifdef USE_SDL
|
||||
delete joystick;
|
||||
#endif
|
||||
firmware = nullptr;
|
||||
@@ -607,7 +607,7 @@ void SimulatorWidget::setupRadioWidgets()
|
||||
|
||||
void SimulatorWidget::setupJoysticks()
|
||||
{
|
||||
#ifdef JOYSTICKS
|
||||
#ifdef USE_SDL
|
||||
bool joysticksEnabled = false;
|
||||
|
||||
if (g.jsSupport()) {
|
||||
@@ -806,7 +806,7 @@ void SimulatorWidget::onRadioWidgetValueChange(const RadioWidget::RadioWidgetTyp
|
||||
|
||||
void SimulatorWidget::onjoystickAxisValueChanged(int axis, int value)
|
||||
{
|
||||
#ifdef JOYSTICKS
|
||||
#ifdef USE_SDL
|
||||
static const int ttlSticks = 4;
|
||||
const int ttlKnobs = Boards::getCapability(m_board, Board::Pots);
|
||||
const int ttlFaders = Boards::getCapability(m_board, Board::Sliders);
|
||||
@@ -855,7 +855,7 @@ void SimulatorWidget::onjoystickAxisValueChanged(int axis, int value)
|
||||
|
||||
void SimulatorWidget::onjoystickButtonValueChanged(int button, bool state)
|
||||
{
|
||||
#ifdef JOYSTICKS
|
||||
#ifdef USE_SDL
|
||||
|
||||
if (!joystick || button >= MAX_JS_BUTTONS)
|
||||
return;
|
||||
|
||||
@@ -38,7 +38,7 @@ class Firmware;
|
||||
class SimulatorInterface;
|
||||
class SimulatedUIWidget;
|
||||
class VirtualJoystickWidget;
|
||||
#ifdef JOYSTICKS
|
||||
#ifdef USE_SDL
|
||||
class Joystick;
|
||||
#endif
|
||||
|
||||
@@ -149,7 +149,7 @@ class SimulatorWidget : public QWidget
|
||||
bool deleteTempRadioData = false;
|
||||
bool saveTempRadioData = false;
|
||||
|
||||
#ifdef JOYSTICKS
|
||||
#ifdef USE_SDL
|
||||
Joystick * joystick = nullptr;
|
||||
int switchDirection[MAX_JS_BUTTONS];
|
||||
#endif
|
||||
|
||||
@@ -26,7 +26,8 @@
|
||||
#include <QString>
|
||||
#include <QTextStream>
|
||||
#include <QRegularExpression>
|
||||
#if defined(JOYSTICKS) || defined(SIMU_AUDIO)
|
||||
|
||||
#if defined(USE_SDL)
|
||||
#include <SDL.h>
|
||||
#undef main
|
||||
#endif
|
||||
@@ -278,18 +279,11 @@ int main(int argc, char *argv[])
|
||||
|
||||
Translations::installTranslators();
|
||||
|
||||
#if defined(JOYSTICKS) || defined(SIMU_AUDIO)
|
||||
uint32_t sdlFlags = 0;
|
||||
#ifdef JOYSTICKS
|
||||
sdlFlags |= SDL_INIT_JOYSTICK;
|
||||
#endif
|
||||
#ifdef SIMU_AUDIO
|
||||
sdlFlags |= SDL_INIT_AUDIO;
|
||||
#endif
|
||||
#if defined(USE_SDL)
|
||||
#if defined(_WIN32) || defined(_WIN64)
|
||||
putenv("SDL_AUDIODRIVER=directsound");
|
||||
#endif
|
||||
if (SDL_Init(sdlFlags) < 0) {
|
||||
if (SDL_Init(SDL_INIT_JOYSTICK | SDL_INIT_AUDIO) < 0) {
|
||||
showMessage(QApplication::translate("SimulatorMain", "WARNING: couldn't initialize SDL:\n%1").arg(SDL_GetError()), QMessageBox::Warning);
|
||||
}
|
||||
#endif
|
||||
@@ -403,7 +397,7 @@ int finish(int exitCode)
|
||||
unregisterStorageFactories();
|
||||
gBoardFactories->unregisterBoardFactories();
|
||||
|
||||
#if defined(JOYSTICKS) || defined(SIMU_AUDIO)
|
||||
#if defined(USE_SDL)
|
||||
SDL_Quit();
|
||||
#endif
|
||||
|
||||
|
||||
@@ -706,11 +706,6 @@ bool AudioQueue::isPlaying(uint8_t id)
|
||||
|
||||
void AudioQueue::playTone(uint16_t freq, uint16_t len, uint16_t pause, uint8_t flags, int8_t freqIncr, int8_t fragmentVolume)
|
||||
{
|
||||
#if defined(SIMU) && !defined(SIMU_AUDIO)
|
||||
#warning "NO audio"
|
||||
return;
|
||||
#endif
|
||||
|
||||
_audio_lock();
|
||||
|
||||
freq = limit<uint16_t>(BEEP_MIN_FREQ, freq, BEEP_MAX_FREQ);
|
||||
@@ -772,14 +767,6 @@ void AudioQueue::playFile(const char * filename, uint8_t flags, uint8_t id, int8
|
||||
|
||||
void AudioQueue::stopPlay(uint8_t id)
|
||||
{
|
||||
#if defined(SIMU)
|
||||
TRACE("stopPlay(id=%d)", id);
|
||||
#endif
|
||||
|
||||
#if defined(SIMU) && !defined(SIMU_AUDIO)
|
||||
return;
|
||||
#endif
|
||||
|
||||
_audio_lock();
|
||||
|
||||
fragmentsFifo.removePromptById(id);
|
||||
|
||||
+1
-4
@@ -88,7 +88,7 @@ constexpr uint8_t AUDIO_FILENAME_MAXLEN = (AUDIO_LUA_FILENAME_MAXLEN > AUDIO_MOD
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#if defined(SIMU) && defined(SIMU_AUDIO)
|
||||
#if defined(SIMU)
|
||||
#define AUDIO_BUFFER_COUNT (10) // simulator needs more buffers for smooth audio
|
||||
#elif defined(AUDIO_SPI)
|
||||
#define AUDIO_BUFFER_COUNT (2) // smaller than Taranis since there is also a buffer on the ADC chip
|
||||
@@ -421,9 +421,6 @@ class AudioFragmentFifo
|
||||
|
||||
class AudioQueue {
|
||||
|
||||
#if defined(SIMU_AUDIO)
|
||||
friend void fillAudioBuffer(void *, uint8_t *, int);
|
||||
#endif
|
||||
#if defined(CLI)
|
||||
friend void printAudioVars();
|
||||
#endif
|
||||
|
||||
@@ -36,14 +36,6 @@ set(SIMU_DRIVERS ${SIMU_DRIVERS}
|
||||
)
|
||||
include_directories(${CMAKE_CURRENT_BINARY_DIR})
|
||||
|
||||
if(SDL2_FOUND)
|
||||
include_directories(${SDL2_INCLUDE_DIRS})
|
||||
target_compile_options(radiolib_native PUBLIC -DSIMU_AUDIO)
|
||||
if(TARGET SDL2::SDL2)
|
||||
set(SDL2_LIBRARIES SDL2::SDL2)
|
||||
endif()
|
||||
endif()
|
||||
|
||||
if(SIMU_LUA_COMPILER)
|
||||
add_definitions(-DLUA_COMPILER)
|
||||
endif()
|
||||
@@ -99,7 +91,9 @@ if(Qt6Widgets_FOUND)
|
||||
list(APPEND SIMULATOR_SRC ${SIMU_SRC} opentxsimulator.cpp)
|
||||
|
||||
add_library(${SIMULATOR_TARGET} SHARED ${SIMULATOR_SRC})
|
||||
if(SDL2_FOUND)
|
||||
|
||||
if(TARGET SDL2::SDL2)
|
||||
set(SDL2_LIBRARIES SDL2::SDL2)
|
||||
target_sources(${SIMULATOR_TARGET} PRIVATE simuaudio.cpp)
|
||||
else()
|
||||
target_sources(${SIMULATOR_TARGET} PRIVATE no_audio.cpp)
|
||||
@@ -170,28 +164,26 @@ endif()
|
||||
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${WARNING_FLAGS}")
|
||||
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${WARNING_FLAGS}")
|
||||
|
||||
add_executable(simu
|
||||
EXCLUDE_FROM_ALL
|
||||
${SIMU_SRC}
|
||||
simuaudio.cpp
|
||||
display.cpp
|
||||
widgets.cpp
|
||||
knobs.cpp
|
||||
sdl_simu.cpp
|
||||
)
|
||||
if(TARGET SDL2:SDL2)
|
||||
add_executable(simu
|
||||
EXCLUDE_FROM_ALL
|
||||
${SIMU_SRC}
|
||||
simuaudio.cpp
|
||||
display.cpp
|
||||
widgets.cpp
|
||||
knobs.cpp
|
||||
sdl_simu.cpp
|
||||
)
|
||||
|
||||
include(FetchImgui)
|
||||
target_compile_options(simu PUBLIC -DSIMU)
|
||||
include(FetchImgui)
|
||||
target_compile_options(simu PUBLIC -DSIMU)
|
||||
|
||||
add_png_target(image_assets "assets/images/*.png")
|
||||
add_dependencies(simu image_assets)
|
||||
add_png_target(image_assets "assets/images/*.png")
|
||||
add_dependencies(simu image_assets)
|
||||
|
||||
set(STB_DIR ${RADIO_SRC_DIR}/thirdparty/stb)
|
||||
target_include_directories(simu PUBLIC ${STB_DIR})
|
||||
target_link_libraries(simu PUBLIC imgui)
|
||||
|
||||
target_link_libraries(simu PUBLIC
|
||||
${SDL2_LIBRARIES}
|
||||
)
|
||||
set(STB_DIR ${RADIO_SRC_DIR}/thirdparty/stb)
|
||||
target_include_directories(simu PUBLIC ${STB_DIR})
|
||||
target_link_libraries(simu PUBLIC imgui)
|
||||
endif()
|
||||
|
||||
PrintTargetReport("simu/libsimulator")
|
||||
|
||||
@@ -25,7 +25,7 @@
|
||||
#include <stdint.h>
|
||||
#include <SDL.h>
|
||||
|
||||
#define SIMU_AUDIO_FMT AUDIO_S16SYS
|
||||
#define AUDIO_FMT AUDIO_S16SYS
|
||||
|
||||
static SDL_AudioDeviceID _sdl_audio_device = 0;
|
||||
|
||||
@@ -33,7 +33,7 @@ void simuQueueAudio(const uint8_t* data, uint32_t len)
|
||||
{
|
||||
#if !defined(SOFTWARE_VOLUME)
|
||||
int volume = (simuAudioGetVolume() * SDL_MIX_MAXVOLUME ) / VOLUME_LEVEL_MAX;
|
||||
SDL_MixAudioFormat((uint8_t*)data, data, SIMU_AUDIO_FMT, len, volume);
|
||||
SDL_MixAudioFormat((uint8_t*)data, data, AUDIO_FMT, len, volume);
|
||||
#endif
|
||||
|
||||
SDL_QueueAudio(_sdl_audio_device, data, len);
|
||||
@@ -43,7 +43,7 @@ bool simuAudioInit()
|
||||
{
|
||||
SDL_AudioSpec wanted = {
|
||||
.freq = AUDIO_SAMPLE_RATE,
|
||||
.format = SIMU_AUDIO_FMT,
|
||||
.format = AUDIO_FMT,
|
||||
.channels = 1,
|
||||
.silence = 0,
|
||||
.samples = 1024,
|
||||
|
||||
@@ -25,12 +25,6 @@ fi
|
||||
COMMON_OPTIONS="${COMMON_OPTIONS} -DCMAKE_BUILD_TYPE=Release -DCMAKE_MESSAGE_LOG_LEVEL=WARNING -Wno-dev -DGVARS=YES -DHELI=YES -DLUA=YES"
|
||||
if [ "$(uname)" = "Darwin" ]; then
|
||||
COMMON_OPTIONS="${COMMON_OPTIONS} -DCMAKE_OSX_DEPLOYMENT_TARGET='10.15'"
|
||||
elif [ "$(uname)" != "Linux" ]; then # Assume Windows and MSYS2
|
||||
if [ "${MSYSTEM,,}" == "mingw32" ]; then # MSYS 32bit detected
|
||||
COMMON_OPTIONS="${COMMON_OPTIONS} -DSDL2_LIBRARY_PATH=/mingw32/bin/"
|
||||
else # fallback to 64bit
|
||||
COMMON_OPTIONS="${COMMON_OPTIONS} -DSDL2_LIBRARY_PATH=/mingw64/bin/"
|
||||
fi
|
||||
fi
|
||||
|
||||
# Generate EDGETX_VERSION_SUFFIX if not already set
|
||||
|
||||
@@ -209,7 +209,7 @@ if [[ $PAUSEAFTEREACHLINE == "true" ]]; then
|
||||
fi
|
||||
|
||||
echo "=== Step $((STEP++)): Running CMake for ${RADIO_TYPE} as an example ==="
|
||||
cmake -G "MSYS Makefiles" -Wno-dev -DCMAKE_PREFIX_PATH=$HOME/6.9.0/mingw_64 -DSDL2_LIBRARY_PATH=/mingw64/bin/ ${BUILD_OPTIONS} -DCMAKE_BUILD_TYPE=Release ../
|
||||
cmake -G "MSYS Makefiles" -Wno-dev -DCMAKE_PREFIX_PATH=$HOME/6.9.0/mingw_64 ${BUILD_OPTIONS} -DCMAKE_BUILD_TYPE=Release ../
|
||||
check_command $? "cmake -G MSYS Makefiles -Wno-dev -DCMAKE_PREFIX_PATH=$HOME/6.9.0/mingw_64 -DSDL2_LIBRARY_PATH=/mingw64/bin/ ${BUILD_OPTIONS} -DCMAKE_BUILD_TYPE=Release ../"
|
||||
if [[ $PAUSEAFTEREACHLINE == "true" ]]; then
|
||||
echo "Step finished. Please check the output above and press Enter to continue or Ctrl+C to stop."
|
||||
|
||||
Reference in New Issue
Block a user