fix(simu): SDL sound init in libsimulator (#6456)
Co-authored-by: raphaelcoeffic <1050031+raphaelcoeffic@users.noreply.github.com>
This commit is contained in:
co-authored by
raphaelcoeffic
parent
a64831e6b4
commit
284e2296ca
@@ -49,7 +49,7 @@ endif()
|
||||
|
||||
if(SDL2_FOUND)
|
||||
include_directories(${SDL2_INCLUDE_DIRS})
|
||||
add_definitions(-DJOYSTICKS)
|
||||
add_definitions(-DJOYSTICKS -DSIMU_AUDIO)
|
||||
if(TARGET SDL2::SDL2)
|
||||
set(SDL2_LIBRARIES SDL2::SDL2)
|
||||
endif()
|
||||
|
||||
@@ -35,6 +35,10 @@
|
||||
#include "model_audio.h"
|
||||
#include "hal/audio_driver.h"
|
||||
|
||||
#if defined(SIMU) && !defined(SIMU_AUDIO)
|
||||
void audioConsumeCurrentBuffer() {}
|
||||
#endif
|
||||
|
||||
extern mutex_handle_t audioMutex;
|
||||
|
||||
// Only first quadrant values - other quadrants calulated taking advantage of symmetry in sine wave.
|
||||
|
||||
@@ -7,19 +7,11 @@ endif()
|
||||
|
||||
target_compile_options(radiolib_native PUBLIC -DSIMU)
|
||||
|
||||
if(SDL2_FOUND)
|
||||
option(SIMU_AUDIO "Enable simulator audio." ON)
|
||||
if(SIMU_AUDIO)
|
||||
target_compile_options(radiolib_native PUBLIC -DSIMU_AUDIO)
|
||||
endif()
|
||||
endif()
|
||||
|
||||
set(SIMU_DRIVERS
|
||||
simpgmspace.cpp
|
||||
simufatfs.cpp
|
||||
simudisk.cpp
|
||||
simulcd.cpp
|
||||
simuaudio.cpp
|
||||
switch_driver.cpp
|
||||
adc_driver.cpp
|
||||
module_drivers.cpp
|
||||
@@ -47,7 +39,8 @@ include_directories(${CMAKE_CURRENT_BINARY_DIR})
|
||||
|
||||
if(SDL2_FOUND)
|
||||
include_directories(${SDL2_INCLUDE_DIRS})
|
||||
add_definitions(-DJOYSTICKS)
|
||||
target_compile_options(radiolib_native PUBLIC -DSIMU_AUDIO)
|
||||
list(APPEND SIMU_DRIVERS simuaudio.cpp)
|
||||
if(TARGET SDL2::SDL2)
|
||||
set(SDL2_LIBRARIES SDL2::SDL2)
|
||||
endif()
|
||||
|
||||
@@ -21,5 +21,10 @@
|
||||
|
||||
#pragma once
|
||||
|
||||
#if defined(SIMU_AUDIO)
|
||||
bool simuAudioInit();
|
||||
void simuAudioDeInit();
|
||||
#else
|
||||
static inline bool simuAudioInit() { return false; }
|
||||
static inline void simuAudioDeInit() {}
|
||||
#endif
|
||||
|
||||
Reference in New Issue
Block a user