diff --git a/CMakeLists.txt b/CMakeLists.txt index d7cb53e..32f12cb 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -20,6 +20,9 @@ set(CMAKE_EXE_LINKER_FLAGS "-Wl,--no-as-needed -ldl") set(LIBUSB_INCLUDE_DIR /usr/include/libusb-1.0) set(LIBXML_INCLUDE_DIR /usr/include/libxml2) +FIND_PACKAGE(Lua 5.3 REQUIRED) +set(INCLUDE_DIRS ${LUA_INCLUDE_DIR}) + #FIND_PATH(LIBUSB_INCLUDE_DIR libusb.h # HINTS $ENV{LIBUSB_ROOT} # PATHS ${PC_LIBUSB_INCLUDEDIR} ${PC_LIBUSB_INCLUDE_DIRS} @@ -37,10 +40,10 @@ add_executable(monocoque src/monocoque/monocoque.c) if(USE_PULSEAUDIO) message("Using pulseaudio backend...") add_compile_definitions(USE_PULSEAUDIO=true) - target_link_libraries(monocoque m hidapi-hidraw pulse serialport xml2 argtable2 config gameloop helper devices slog simulatorapi uv xdg-basedir lua5.4) + target_link_libraries(monocoque m hidapi-hidraw pulse serialport xml2 argtable2 config gameloop helper devices slog simulatorapi uv xdg-basedir ${LUA_LIBRARY}) else() message("Using portaudio backend...") - target_link_libraries(monocoque m hidapi-hidraw portaudio serialport xml2 argtable2 config gameloop helper devices slog simulatorapi uv xdg-basedir lua5.4) + target_link_libraries(monocoque m hidapi-hidraw portaudio serialport xml2 argtable2 config gameloop helper devices slog simulatorapi uv xdg-basedir ${LUA_LIBRARY}) endif() target_include_directories(monocoque PUBLIC config ${LIBXML_INCLUDE_DIR}) diff --git a/src/monocoque/devices/serial/arduinoledlua.h b/src/monocoque/devices/serial/arduinoledlua.h index 1e8061f..65d027b 100644 --- a/src/monocoque/devices/serial/arduinoledlua.h +++ b/src/monocoque/devices/serial/arduinoledlua.h @@ -1,9 +1,9 @@ #ifndef _ARDUINOLEDLUA_H #define _ARDUINOLEDLUA_H -#include "lua5.4/lua.h" -#include "lua5.4/lauxlib.h" -#include "lua5.4/lualib.h" +#include "lua.h" +#include "lauxlib.h" +#include "lualib.h" #include "../../simulatorapi/simapi/simapi/simdata.h" diff --git a/src/monocoque/devices/simdevice.h b/src/monocoque/devices/simdevice.h index 339da3d..1908bc1 100644 --- a/src/monocoque/devices/simdevice.h +++ b/src/monocoque/devices/simdevice.h @@ -3,7 +3,7 @@ #include -#include "lua5.4/lua.h" +#include "lua.h" #include "usbdevice.h" #include "sounddevice.h" diff --git a/src/monocoque/devices/sounddevice.c b/src/monocoque/devices/sounddevice.c index 739fac9..e1ebcfa 100644 --- a/src/monocoque/devices/sounddevice.c +++ b/src/monocoque/devices/sounddevice.c @@ -24,7 +24,7 @@ int gear_sound_set(SoundDevice* sounddevice, SimData* simdata) } sounddevice->sounddata.last_gear = simdata->gear; - slogt("set gear frequency to %i", sounddevice->sounddata.frequency); + slogt("set gear frequency to %i", sounddevice->sounddata.curr_frequency); } // we could make a vtable for these different effects too @@ -32,10 +32,10 @@ int sounddev_engine_update(SimDevice* this, SimData* simdata) { SoundDevice* sounddevice = (void *) this->derived; - sounddevice->sounddata.curr_frequency = simdata->rpms/60; + sounddevice->sounddata.curr_frequency = simdata->rpms/60 + sounddevice->sounddata.frequency; //sounddevice->sounddata.table_size = 48000/(sounddevice->sounddata.frequency); - slogt("set engine frequency to %i", sounddevice->sounddata.frequency); + slogt("set engine frequency to %i", sounddevice->sounddata.curr_frequency); } double modulate(SoundDevice* sounddevice, double raw_effect, SoundEffectModulationType modulation) @@ -278,4 +278,3 @@ SoundDevice* new_sound_device(DeviceSettings* ds, MonocoqueSettings* ms) { return this; } -