### Install Example Targets Source: https://github.com/dpjudas/surrealengine/blob/master/Thirdparty/openal-soft/CMakeLists.txt Installs the specified example targets (executables, libraries, archives) to their respective installation directories. This ensures that example programs are available after the main library is installed. ```cmake install(TARGETS ${EXTRA_INSTALLS} RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR} BUNDLE DESTINATION ${CMAKE_INSTALL_BINDIR} LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR} ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR}) ``` -------------------------------- ### Add Executable for alloopback Example Source: https://github.com/dpjudas/surrealengine/blob/master/Thirdparty/openal-soft/CMakeLists.txt Builds the 'alloopback' example executable if SDL2 is found and ALSOFT_EXAMPLES is enabled. It links against necessary flags, SDL2 library, the common example library, and the math library. ```cmake add_executable(alloopback examples/alloopback.c) target_link_libraries(alloopback PRIVATE ${LINKER_FLAGS} SDL2::SDL2 ex-common ${MATH_LIB}) set_target_properties(alloopback PROPERTIES ${DEFAULT_TARGET_PROPS}) ``` -------------------------------- ### Add Executable for altonegen Example Source: https://github.com/dpjudas/surrealengine/blob/master/Thirdparty/openal-soft/CMakeLists.txt Builds the 'altonegen' example executable if ALSOFT_EXAMPLES is enabled. It links against necessary flags, math libraries, the common example library, and Unicode support. ```cmake add_executable(altonegen examples/altonegen.c) target_link_libraries(altonegen PRIVATE ${LINKER_FLAGS} ${MATH_LIB} ex-common ${UNICODE_FLAG}) set_target_properties(altonegen PROPERTIES ${DEFAULT_TARGET_PROPS}) ``` -------------------------------- ### Add Executable for alrecord Example Source: https://github.com/dpjudas/surrealengine/blob/master/Thirdparty/openal-soft/CMakeLists.txt Builds the 'alrecord' example executable if ALSOFT_EXAMPLES is enabled. It links against necessary flags and the common example library, along with Unicode support. ```cmake add_executable(alrecord examples/alrecord.c) target_link_libraries(alrecord PRIVATE ${LINKER_FLAGS} ex-common ${UNICODE_FLAG}) set_target_properties(alrecord PROPERTIES ${DEFAULT_TARGET_PROPS}) ``` -------------------------------- ### Install Crypto++ with vcpkg Source: https://github.com/dpjudas/surrealengine/blob/master/Thirdparty/openmpt/include/cryptopp/Install.txt Steps to clone the vcpkg repository, bootstrap it, integrate it with the system, and then install the Crypto++ library. ```bash git clone https://github.com/Microsoft/vcpkg.git cd vcpkg ./bootstrap-vcpkg.sh ./vcpkg integrate install ./vcpkg install cryptopp ``` -------------------------------- ### Install OpenAL Soft using vcpkg Source: https://github.com/dpjudas/surrealengine/blob/master/Thirdparty/openal-soft/README.md Steps to clone the vcpkg repository, bootstrap it, integrate it with your system, and then install openal-soft. ```bash git clone https://github.com/Microsoft/vcpkg.git cd vcpkg ./bootstrap-vcpkg.sh ./vcpkg integrate install ./vcpkg install openal-soft ``` -------------------------------- ### Install Sample Configuration Source: https://github.com/dpjudas/surrealengine/blob/master/Thirdparty/openal-soft/CMakeLists.txt Installs a sample configuration file for OpenAL. This is controlled by the ALSOFT_INSTALL_CONFIG CMake variable. ```cmake if(ALSOFT_INSTALL_CONFIG) install(FILES alsoftrc.sample DESTINATION ${CMAKE_INSTALL_DATADIR}/openal) message(STATUS "Installing sample configuration") endif() ``` -------------------------------- ### Basic Build, Test, and Install Source: https://github.com/dpjudas/surrealengine/blob/master/Thirdparty/openmpt/include/cryptopp/Install.txt Standard commands to build the static library, run tests, and install the library. Assumes default sane flags. ```bash make make test sudo make install ``` -------------------------------- ### Add Executable for allatency Example Source: https://github.com/dpjudas/surrealengine/blob/master/Thirdparty/openal-soft/CMakeLists.txt Builds the 'allatency' example executable if SndFile is found and ALSOFT_EXAMPLES is enabled. It links against necessary flags, SndFile library, the common example library, and Unicode support. ```cmake add_executable(allatency examples/allatency.c) target_link_libraries(allatency PRIVATE ${LINKER_FLAGS} SndFile::SndFile ex-common ${UNICODE_FLAG}) set_target_properties(allatency PROPERTIES ${DEFAULT_TARGET_PROPS}) ``` -------------------------------- ### Add Executable for alreverb Example Source: https://github.com/dpjudas/surrealengine/blob/master/Thirdparty/openal-soft/CMakeLists.txt Builds the 'alreverb' example executable if SndFile is found and ALSOFT_EXAMPLES is enabled. It links against necessary flags, SndFile library, the common example library, and Unicode support. ```cmake add_executable(alreverb examples/alreverb.c) target_link_libraries(alreverb PRIVATE ${LINKER_FLAGS} SndFile::SndFile ex-common ${UNICODE_FLAG}) set_target_properties(alreverb PROPERTIES ${DEFAULT_TARGET_PROPS}) ``` -------------------------------- ### Add Executable for alstreamcb Example Source: https://github.com/dpjudas/surrealengine/blob/master/Thirdparty/openal-soft/CMakeLists.txt Builds the 'alstreamcb' example executable if SndFile is found and ALSOFT_EXAMPLES is enabled. It links against necessary flags, SndFile library, the common example library, and Unicode support. This example uses C++. ```cmake add_executable(alstreamcb examples/alstreamcb.cpp) target_link_libraries(alstreamcb PRIVATE ${LINKER_FLAGS} SndFile::SndFile ex-common ${UNICODE_FLAG}) set_target_properties(alstreamcb PROPERTIES ${DEFAULT_TARGET_PROPS}) ``` -------------------------------- ### Add Executable for almultireverb Example Source: https://github.com/dpjudas/surrealengine/blob/master/Thirdparty/openal-soft/CMakeLists.txt Builds the 'almultireverb' example executable if SndFile is found and ALSOFT_EXAMPLES is enabled. It links against necessary flags, SndFile library, the common example library, math library, and Unicode support. ```cmake add_executable(almultireverb examples/almultireverb.c) target_link_libraries(almultireverb PRIVATE ${LINKER_FLAGS} SndFile::SndFile ex-common ${MATH_LIB} ${UNICODE_FLAG}) set_target_properties(almultireverb PROPERTIES ${DEFAULT_TARGET_PROPS}) ``` -------------------------------- ### Add Executable for alhrtf Example Source: https://github.com/dpjudas/surrealengine/blob/master/Thirdparty/openal-soft/CMakeLists.txt Builds the 'alhrtf' example executable if SndFile is found and ALSOFT_EXAMPLES is enabled. It links against necessary flags, SndFile library, the common example library, math library, and Unicode support. ```cmake add_executable(alhrtf examples/alhrtf.c) target_link_libraries(alhrtf PRIVATE ${LINKER_FLAGS} SndFile::SndFile ex-common ${MATH_LIB} ${UNICODE_FLAG}) set_target_properties(alhrtf PROPERTIES ${DEFAULT_TARGET_PROPS}) ``` -------------------------------- ### Install Crypto++ Library Source: https://github.com/dpjudas/surrealengine/blob/master/Thirdparty/openmpt/include/cryptopp/Install.txt Installs the Crypto++ library to a user-specified directory. Ensure to define CRYPTOPP_DATA_DIR if using a custom prefix to locate test data. ```makefile make install PREFIX=/usr/local ``` -------------------------------- ### Build with a Different Compiler (Solaris Studio) Source: https://github.com/dpjudas/surrealengine/blob/master/Thirdparty/openmpt/include/cryptopp/Install.txt Example of setting the CXX environment variable to use the Solaris Studio compiler. ```bash CXX=/opt/solarisstudio12.4/bin/CC make ``` -------------------------------- ### Check FFmpeg Library Versions Source: https://github.com/dpjudas/surrealengine/blob/master/Thirdparty/openal-soft/CMakeLists.txt Verifies that the installed FFmpeg libraries (avformat, avcodec, avutil, swscale, swresample) meet the minimum required version for certain example programs. If any library is too old, a status message is printed, and FFVER_OK is set to FALSE. ```cmake set(FFVER_OK FALSE) if(FFMPEG_FOUND) set(FFVER_OK TRUE) if(AVFORMAT_VERSION VERSION_LESS "59.27.100") message(STATUS "libavformat is too old! (${AVFORMAT_VERSION}, wanted 59.27.100)") set(FFVER_OK FALSE) endif() if(AVCODEC_VERSION VERSION_LESS "59.37.100") message(STATUS "libavcodec is too old! (${AVCODEC_VERSION}, wanted 59.37.100)") set(FFVER_OK FALSE) endif() if(AVUTIL_VERSION VERSION_LESS "57.28.100") message(STATUS "libavutil is too old! (${AVUTIL_VERSION}, wanted 57.28.100)") set(FFVER_OK FALSE) endif() if(SWSCALE_VERSION VERSION_LESS "6.7.100") message(STATUS "libswscale is too old! (${SWSCALE_VERSION}, wanted 6.7.100)") set(FFVER_OK FALSE) endif() if(SWRESAMPLE_VERSION VERSION_LESS "4.7.100") message(STATUS "libswresample is too old! (${SWRESAMPLE_VERSION}, wanted 4.7.100)") set(FFVER_OK FALSE) endif() endif() ``` -------------------------------- ### Seeking and Starting Playback Source: https://github.com/dpjudas/surrealengine/blob/master/Thirdparty/openmpt/include/SignalsmithStretch/SignalsmithStretch/README.md How to use the `seek` method to reposition within the input audio and manage initial playback. ```APIDOC ## Seeking Reposition within the input audio using the `seek` method. ```cpp stretch.seek(inputBuffers, inputSamples, playbackRateHint); ``` It's recommended to provide at least (one block-length + one interval) of input data. At the start, call `seek` with `inputSamples = stretch.inputLatency()` to align processing time with the start of input. ``` -------------------------------- ### Add Executable for alplay Example Source: https://github.com/dpjudas/surrealengine/blob/master/Thirdparty/openal-soft/CMakeLists.txt Builds the 'alplay' example executable if SndFile is found and ALSOFT_EXAMPLES is enabled. It links against necessary flags, SndFile library, the common example library, and Unicode support. ```cmake add_executable(alplay examples/alplay.c) target_link_libraries(alplay PRIVATE ${LINKER_FLAGS} SndFile::SndFile ex-common ${UNICODE_FLAG}) set_target_properties(alplay PROPERTIES ${DEFAULT_TARGET_PROPS}) ``` -------------------------------- ### Add Executable for alstream Example Source: https://github.com/dpjudas/surrealengine/blob/master/Thirdparty/openal-soft/CMakeLists.txt Builds the 'alstream' example executable if SndFile is found and ALSOFT_EXAMPLES is enabled. It links against necessary flags, SndFile library, the common example library, and Unicode support. ```cmake add_executable(alstream examples/alstream.c) target_link_libraries(alstream PRIVATE ${LINKER_FLAGS} SndFile::SndFile ex-common ${UNICODE_FLAG}) set_target_properties(alstream PROPERTIES ${DEFAULT_TARGET_PROPS}) ``` -------------------------------- ### Install OpenAL Library and Headers Source: https://github.com/dpjudas/surrealengine/blob/master/Thirdparty/openal-soft/CMakeLists.txt Configures and installs the main OpenAL library and its headers. This is controlled by the ALSOFT_INSTALL CMake variable. ```cmake if(ALSOFT_INSTALL) configure_package_config_file(OpenALConfig.cmake.in OpenALConfig.cmake INSTALL_DESTINATION ${CMAKE_INSTALL_LIBDIR}/cmake/OpenAL) install(TARGETS OpenAL EXPORT OpenAL RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR} LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR} ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR} FRAMEWORK DESTINATION ${CMAKE_INSTALL_LIBDIR} INCLUDES DESTINATION ${CMAKE_INSTALL_INCLUDEDIR} ${CMAKE_INSTALL_INCLUDEDIR}/AL) export(TARGETS OpenAL NAMESPACE OpenAL:: FILE OpenALTargets.cmake) install(EXPORT OpenAL DESTINATION ${CMAKE_INSTALL_LIBDIR}/cmake/OpenAL NAMESPACE OpenAL:: FILE OpenALTargets.cmake) install(DIRECTORY include/AL DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}) install(FILES "${OpenAL_BINARY_DIR}/openal.pc" DESTINATION "${CMAKE_INSTALL_LIBDIR}/pkgconfig") install(FILES "${OpenAL_BINARY_DIR}/OpenALConfig.cmake" DESTINATION "${CMAKE_INSTALL_LIBDIR}/cmake/OpenAL") if(TARGET soft_oal) install(TARGETS soft_oal RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR}) endif() message(STATUS "Installing library and headers") else() message(STATUS "NOT installing library and headers") endif() ``` -------------------------------- ### AudioDevice::Create - Audio Playback Setup Source: https://context7.com/dpjudas/surrealengine/llms.txt Initializes the audio device with a specified sample rate and number of voices. Sounds are registered and played on channels, while music is streamed via an AudioSource. Includes volume and update functions. ```cpp #include "Audio/AudioDevice.h" #include "Audio/AudioSource.h" // Create an audio device: 44100 Hz, 32 voices, 4 music buffers of 16384 samples. std::unique_ptr audio = AudioDevice::Create(44100, 32, 4, 16384); // Register a sound asset so the device can prepare hardware buffers. audio->AddSound(myUSound); // Play a sound on channel 3 at a world location. vec3 location(512.0f, 0.0f, 128.0f); audio->PlaySound( /*channel=*/3, myUSound, location, /*volume=*/0.8f, /*radius=*/1200.0f, /*pitch=*/1.0f ); // Update a looping sound's position each frame. audio->UpdateSound(3, myUSound, location, 0.8f, 1200.0f, 1.0f); // Stream background music. auto src = AudioSource::CreateFromFile("Music/Mechanism8.umx"); audio->PlayMusic(std::move(src)); audio->SetMusicVolume(0.75f); audio->SetSoundVolume(1.0f); // Called once per game tick to flush OpenAL buffers. audio->Update(); // Clean up. audio->StopSound(3); audio->RemoveSound(myUSound); ``` -------------------------------- ### Include and Initialize SignalsmithStretch Source: https://github.com/dpjudas/surrealengine/blob/master/Thirdparty/openmpt/include/SignalsmithStretch/SignalsmithStretch/README.md Include the necessary header and create an instance of the SignalsmithStretch class. This is the basic setup for using the library. ```cpp #include "signalsmith-stretch.h" signalsmith::stretch::SignalsmithStretch stretch; ``` -------------------------------- ### Add Executable for alconvolve Example Source: https://github.com/dpjudas/surrealengine/blob/master/Thirdparty/openal-soft/CMakeLists.txt Builds the 'alconvolve' example executable if SndFile is found and ALSOFT_EXAMPLES is enabled. It links against necessary flags, a 'common' library (potentially different from ex-common), SndFile library, the common example library, and Unicode support. ```cmake add_executable(alconvolve examples/alconvolve.c) target_link_libraries(alconvolve PRIVATE ${LINKER_FLAGS} common SndFile::SndFile ex-common ${UNICODE_FLAG}) set_target_properties(alconvolve PROPERTIES ${DEFAULT_TARGET_PROPS}) ``` -------------------------------- ### Engine Constructor and Run Method Source: https://context7.com/dpjudas/surrealengine/llms.txt Initializes the Surreal Engine subsystems and starts the main game loop. ```APIDOC ## Engine Constructor / Engine::Run ### Description `Engine` is the central singleton (`engine` global pointer). Constructing it with a `GameLaunchInfo` initializes all subsystems (packages, renderer, audio, collision, VM). `Run()` enters the main loop, ticking the VM, processing input, and rendering frames until `quit` is set. ### Constructor ```cpp Engine(const GameLaunchInfo& launchInfo) ``` Initializes the engine with the provided game launch information. ### Method ```cpp void Engine::Run() ``` Enters the main engine loop. This method blocks until the engine is quit. ### Example ```cpp #include "Engine.h" #include "GameFolder.h" int main() { // Build launch info manually or via GameFolderSelection. GameLaunchInfo info; info.gameRootFolder = "/opt/games/UnrealTournament"; info.gameExecutableName = "UnrealTournament"; info.engineVersion = 436; info.gameVersionString = "436"; info.gameName = "Unreal Tournament"; // Engine constructor initialises PackageManager, RenderSubsystem, // AudioDevice, CollisionSystem, and the UnrealScript VM. Engine eng(info); // Blocks until the user closes the window or the game calls "quit". eng.Run(); return 0; } ``` ``` -------------------------------- ### GameFolderSelection::UpdateList and GetLaunchInfo Source: https://context7.com/dpjudas/surrealengine/llms.txt Enumerates detected UE1 games by scanning standard installation paths and populates a list of game launch information. ```APIDOC ## GameFolderSelection::UpdateList / GetLaunchInfo ### Description Scans standard installation paths (registry on Windows, common directories on Linux) and populates `GameFolderSelection::Games` with `GameLaunchInfo` structs for all discovered UE1 games. `GetLaunchInfo` retrieves specific launch details for a detected game. ### Methods - **`GameFolderSelection::UpdateList()`**: Refreshes the list of detected games. - **`GameFolderSelection::GetLaunchInfo(int index)`**: Retrieves `GameLaunchInfo` for the game at the specified index. ### Data Members - **`GameFolderSelection::Games`**: A static vector containing `GameLaunchInfo` structs for all detected games. ### `GameLaunchInfo` Structure - **`gameName`** (std::string) - The name of the game (e.g., "Unreal Tournament"). - **`gameVersionString`** (std::string) - The version string of the game (e.g., "436"). - **`gameRootFolder`** (std::string) - The root installation directory of the game. - **`engineVersion`** (int) - The engine version number (e.g., 436). - **`IsUnrealTournament()`** (bool) - Returns true if the game is Unreal Tournament. - **`IsUnreal1()`** (bool) - Returns true if the game is Unreal Gold. - **`IsDeusEx()`** (bool) - Returns true if the game is Deus Ex. ### Example ```cpp #include "GameFolder.h" // Refresh the list of detected games. GameFolderSelection::UpdateList(); for (int i = 0; i < (int)GameFolderSelection::Games.size(); i++) { const GameLaunchInfo& info = GameFolderSelection::Games[i]; std::cout << i << ": " << info.gameName << " v" << info.gameVersionString << " at " << info.gameRootFolder << "\n"; } // Retrieve launch info for the first detected game. if (!GameFolderSelection::Games.empty()) { GameLaunchInfo launchInfo = GameFolderSelection::GetLaunchInfo(0); bool isUT = launchInfo.IsUnrealTournament(); // true for UT99 bool isUG = launchInfo.IsUnreal1(); // true for Unreal Gold bool isDX = launchInfo.IsDeusEx(); // true for Deus Ex int engVer = launchInfo.engineVersion; // e.g. 436, 469 } ``` ``` -------------------------------- ### Install AmbDec Presets Source: https://github.com/dpjudas/surrealengine/blob/master/Thirdparty/openal-soft/CMakeLists.txt Installs Ambisonic Decoder (AmbDec) presets. This is controlled by the ALSOFT_INSTALL_AMBDEC_PRESETS CMake variable. ```cmake if(ALSOFT_INSTALL_AMBDEC_PRESETS) install(DIRECTORY presets DESTINATION ${CMAKE_INSTALL_DATADIR}/openal) message(STATUS "Installing AmbDec presets") endif() ``` -------------------------------- ### CMake Cross-Compilation Example Source: https://github.com/dpjudas/surrealengine/blob/master/Thirdparty/openal-soft/XCompile.txt Example of how to invoke CMake with a custom toolchain file for cross-compilation. Replace 'i686-w64-mingw32' with your specific host prefix. ```cmake cmake .. -DCMAKE_TOOLCHAIN_FILE=../XCompile.txt -DHOST=i686-w64-mingw32 ``` -------------------------------- ### Install sofa-info Executable Source: https://github.com/dpjudas/surrealengine/blob/master/Thirdparty/openal-soft/CMakeLists.txt Configures and builds the 'sofa-info' executable, which is part of the utility programs. It sets compile definitions, include directories, and link libraries. ```cmake set(SOFAINFO_SRCS utils/sofa-info.cpp) add_executable(sofa-info ${SOFAINFO_SRCS}) target_compile_definitions(sofa-info PRIVATE ${CPP_DEFS}) target_include_directories(sofa-info PRIVATE ${OpenAL_SOURCE_DIR}/utils) target_compile_options(sofa-info PRIVATE ${C_FLAGS}) target_link_libraries(sofa-info PRIVATE ${LINKER_FLAGS} sofa-support ${UNICODE_FLAG}) set_target_properties(sofa-info PROPERTIES ${DEFAULT_TARGET_PROPS}) ``` -------------------------------- ### Build openal-info Utility Source: https://github.com/dpjudas/surrealengine/blob/master/Thirdparty/openal-soft/CMakeLists.txt Builds the 'openal-info' command-line utility, which provides information about the OpenAL installation. Requires ALSOFT_UTILS to be enabled. ```cmake set(UNICODE_FLAG ) if(MINGW) set(UNICODE_FLAG ${UNICODE_FLAG} -municode) endif() set(EXTRA_INSTALLS ) if(ALSOFT_UTILS) add_executable(openal-info utils/openal-info.c) target_include_directories(openal-info PRIVATE ${OpenAL_SOURCE_DIR}/common) target_compile_options(openal-info PRIVATE ${C_FLAGS}) target_link_libraries(openal-info PRIVATE ${LINKER_FLAGS} OpenAL ${UNICODE_FLAG}) set_target_properties(openal-info PROPERTIES ${DEFAULT_TARGET_PROPS}) if(ALSOFT_INSTALL_EXAMPLES) set(EXTRA_INSTALLS ${EXTRA_INSTALLS} openal-info) endif() ``` -------------------------------- ### Define Executable Target and Link Library Source: https://github.com/dpjudas/surrealengine/blob/master/SurrealGPU/CMakeLists.txt Defines an executable target named 'surrealgpu_example' and links it against the 'surrealgpu' library. This is a common pattern for creating runnable examples or applications. ```cmake # add_executable(surrealgpu_example WIN32 MACOSX_BUNDLE ${EXAMPLE_SOURCES}) # target_link_libraries(surrealgpu_example surrealgpu) ``` -------------------------------- ### Set Installation Prefix Source: https://github.com/dpjudas/surrealengine/blob/master/Thirdparty/openal-soft/XCompile.txt Configures the installation prefix for the cross-compiled software. It is set to the target environment's root path and forced to ensure it takes precedence. ```cmake SET(CMAKE_INSTALL_PREFIX "${CMAKE_FIND_ROOT_PATH}" CACHE STRING "Install path prefix, prepended onto install directories." FORCE) ``` -------------------------------- ### GameFolderSelection::UpdateList / GetLaunchInfo - Enumerate Detected Games Source: https://context7.com/dpjudas/surrealengine/llms.txt Scans standard installation paths to populate a list of discovered UE1 games with GameLaunchInfo structs. Retrieve launch info for a specific detected game. ```cpp #include "GameFolder.h" // Refresh the list of detected games. GameFolderSelection::UpdateList(); for (int i = 0; i < (int)GameFolderSelection::Games.size(); i++) { const GameLaunchInfo& info = GameFolderSelection::Games[i]; std::cout << i << ": " << info.gameName << " v" << info.gameVersionString << " at " << info.gameRootFolder << "\n"; } // Retrieve launch info for the first detected game. if (!GameFolderSelection::Games.empty()) { GameLaunchInfo launchInfo = GameFolderSelection::GetLaunchInfo(0); bool isUT = launchInfo.IsUnrealTournament(); // true for UT99 bool isUG = launchInfo.IsUnreal1(); // true for Unreal Gold bool isDX = launchInfo.IsDeusEx(); // true for Deus Ex int engVer = launchInfo.engineVersion; // e.g. 436, 469 } ``` -------------------------------- ### Initialization and Configuration Source: https://github.com/dpjudas/surrealengine/blob/master/Thirdparty/openmpt/include/SignalsmithStretch/SignalsmithStretch/README.md Demonstrates how to initialize the SignalsmithStretch object and configure it using presets or manual settings. ```APIDOC ## Initialization Include the header and create an instance of the SignalsmithStretch class. ```cpp #include "signalsmith-stretch.h" signalsmith::stretch::SignalsmithStretch stretch; ``` ## Configuration Configure the stretcher using preset methods or manual settings. ### Presets ```cpp stretch.presetDefault(channels, sampleRate); stretch.presetCheaper(channels, sampleRate); ``` ### Manual Configuration ```cpp stretch.configure(channels, blockSamples, intervalSamples); // Query current configuration int block = stretch.blockSamples(); int interval = stretch.intervalSamples(); ``` ``` -------------------------------- ### Build Static and Shared Libraries (Alternative) Source: https://github.com/dpjudas/surrealengine/blob/master/Thirdparty/openmpt/include/cryptopp/Install.txt An alternative set of commands to build the static library, shared object, and the test executable. ```bash make libcryptopp.a libcryptopp.so cryptest.exe ``` -------------------------------- ### Install HRTF Data Files Source: https://github.com/dpjudas/surrealengine/blob/master/Thirdparty/openal-soft/CMakeLists.txt Installs HRTF (Head-Related Transfer Function) data files. This is controlled by the ALSOFT_INSTALL_HRTF_DATA CMake variable. ```cmake if(ALSOFT_INSTALL_HRTF_DATA) install(DIRECTORY hrtf DESTINATION ${CMAKE_INSTALL_DATADIR}/openal) message(STATUS "Installing HRTF data files") endif() ``` -------------------------------- ### Engine Constructor / Run - Initialize and Run Game Loop Source: https://context7.com/dpjudas/surrealengine/llms.txt Initializes all engine subsystems by constructing the central `Engine` singleton. Enters the main game loop, processing input and rendering frames until quit is signaled. ```cpp #include "Engine.h" #include "GameFolder.h" int main() { // Build launch info manually or via GameFolderSelection. GameLaunchInfo info; info.gameRootFolder = "/opt/games/UnrealTournament"; info.gameExecutableName = "UnrealTournament"; info.engineVersion = 436; info.gameVersionString = "436"; info.gameName = "Unreal Tournament"; // Engine constructor initialises PackageManager, RenderSubsystem, // AudioDevice, CollisionSystem, and the UnrealScript VM. Engine eng(info); // Blocks until the user closes the window or the game calls "quit". eng.Run(); return 0; } ``` -------------------------------- ### FindUE1GameInPath - Locate UE1 Installation by SHA-1 Hash Source: https://context7.com/dpjudas/surrealengine/llms.txt Scans a directory for known UE1 game executables and matches their SHA-1 checksums. Returns the identified game type and executable name. This is used for auto-detecting installed games. ```cpp #include "UE1GameDatabase.h" // Point at the root folder of an existing Unreal Tournament install. std::string gameRoot = "/home/user/games/UnrealTournament"; auto [gameType, exeName] = FindUE1GameInPath(gameRoot); if (gameType == KnownUE1Games::UE1_GAME_NOT_FOUND) { std::cerr << "No known UE1 game found in: " << gameRoot << std::endl; } else { // gameType == KnownUE1Games::UT99_436 // exeName == "UnrealTournament.exe" std::cout << "Detected game executable: " << exeName << std::endl; } ``` -------------------------------- ### Build with Only Specific CXXFLAGS Source: https://github.com/dpjudas/surrealengine/blob/master/Thirdparty/openmpt/include/cryptopp/Install.txt Overrides makefile flags to use only the specified CXXFLAGS, for example, building with just '-std=c++11'. ```bash make CXXFLAGS="-std=c++11" ``` -------------------------------- ### Build with C++11 Standard (Alternative) Source: https://github.com/dpjudas/surrealengine/blob/master/Thirdparty/openmpt/include/cryptopp/Install.txt An alternative method to set CXXFLAGS for C++11 compilation. ```bash CXXFLAGS="-DNDEBUG -g2 -O3 -std=c++11" make ``` -------------------------------- ### Build with C++11 Standard Source: https://github.com/dpjudas/surrealengine/blob/master/Thirdparty/openmpt/include/cryptopp/Install.txt Configure CXXFLAGS to enable C++11 support during the build process. ```bash export CXXFLAGS="-DNDEBUG -g2 -O3 -std=c++11" make ``` -------------------------------- ### Create Static Library Source: https://github.com/dpjudas/surrealengine/blob/master/Thirdparty/openmpt/CMakeLists.txt Defines the static library 'openmpt' using the specified source files and sets the C++ standard to 20. ```cmake add_library(openmpt STATIC ${LIBOPENMPT_SOURCES}) set_target_properties(openmpt PROPERTIES CXX_STANDARD 20) ``` -------------------------------- ### Calculate SHA1 Hash in C++ Source: https://github.com/dpjudas/surrealengine/blob/master/Thirdparty/TinySHA1/README.md Include the TinySHA1.hpp header to use the SHA1 class. This example demonstrates processing bytes and retrieving the digest. ```cpp #include "TinySHA1.hpp" void testSHA1(const std::string& val) { sha1::SHA1 s; s.processBytes(val.c_str(), val.size()); uint32_t digest[5]; s.getDigest(digest); char tmp[48]; snprintf(tmp, 45, "%08x %08x %08x %08x %08x", digest[0], digest[1], digest[2], digest[3], digest[4]); std::cout<<"Calculated : ("<<""< 0) return ExportTable[objref - 1]; else if (objref < 0) return ImportTable[-objref - 1]; else return null; } ``` -------------------------------- ### Add Static Library for Common Functions Source: https://github.com/dpjudas/surrealengine/blob/master/Thirdparty/openal-soft/CMakeLists.txt Defines a static library 'ex-common' to hold common functions used across multiple example targets. It includes source and header files, defines preprocessor macros, sets include directories, and links against OpenAL and RT libraries. ```cmake add_library(ex-common STATIC EXCLUDE_FROM_ALL examples/common/alhelpers.c examples/common/alhelpers.h) target_compile_definitions(ex-common PUBLIC ${CPP_DEFS}) target_include_directories(ex-common PUBLIC ${OpenAL_SOURCE_DIR}/common) target_compile_options(ex-common PUBLIC ${C_FLAGS}) target_link_libraries(ex-common PUBLIC OpenAL PRIVATE ${RT_LIB}) set_target_properties(ex-common PROPERTIES ${DEFAULT_TARGET_PROPS}) ``` -------------------------------- ### INI and Localization Helpers Source: https://context7.com/dpjudas/surrealengine/llms.txt Read and write configuration values from `.ini` files and `.int` localization tables using `PackageManager` helpers. Localize strings for internationalization. ```cpp PackageManager* pkgs = engine->packages.get(); // Read a value from UnrealTournament.ini. std::string renderer = pkgs->GetIniValue( "UnrealTournament", // ini filename (without .ini) "Engine.Engine", // section "GameRenderDevice", // key "SurrealVulkan" // default ); // Write a value back. pkgs->SetIniValue("UnrealTournament", "Engine.Engine", "GameRenderDevice", "SurrealD3D11"); pkgs->SaveAllIniFiles(); // Localise a string. std::string msg = pkgs->Localize("Engine", "General", "Loading"); // Read an array value. Array paths = pkgs->GetIniValues( "UnrealTournament", "Core.System", "Paths", { "../Maps/*.unr" } ); ``` -------------------------------- ### Build sofa-support Library Source: https://github.com/dpjudas/surrealengine/blob/master/Thirdparty/openal-soft/CMakeLists.txt Builds a static library 'sofa-support' for handling SOFA (Spatially Oriented Acoustic Data) files, provided that MYSOFA is found. This library is used by other utilities. ```cmake if(MYSOFA_FOUND) set(SOFA_SUPPORT_SRCS utils/sofa-support.cpp utils/sofa-support.h) add_library(sofa-support STATIC EXCLUDE_FROM_ALL ${SOFA_SUPPORT_SRCS}) target_compile_definitions(sofa-support PRIVATE ${CPP_DEFS}) target_include_directories(sofa-support PUBLIC ${OpenAL_SOURCE_DIR}/common) target_compile_options(sofa-support PRIVATE ${C_FLAGS}) target_link_libraries(sofa-support PUBLIC common MySOFA::MySOFA PRIVATE ${LINKER_FLAGS}) set_target_properties(sofa-support PROPERTIES ${DEFAULT_TARGET_PROPS}) ``` -------------------------------- ### Configure SignalsmithStretch with Presets Source: https://github.com/dpjudas/surrealengine/blob/master/Thirdparty/openmpt/include/SignalsmithStretch/SignalsmithStretch/README.md Use preset methods to easily configure the stretch object with default or cheaper settings. These methods take the number of channels and sample rate as arguments. ```cpp stretch.presetDefault(channels, sampleRate); stretch.presetCheaper(channels, sampleRate); ``` -------------------------------- ### Run Basic System and Algorithm Checks Source: https://github.com/dpjudas/surrealengine/blob/master/Thirdparty/openmpt/include/cryptopp/Install.txt Execute the validation suite to perform basic system checks and exercise algorithms like AES and SHA. The output should indicate 0 failed tests. ```bash ./cryptest.exe v ``` -------------------------------- ### Create Crypto++ Distribution ZIP Source: https://github.com/dpjudas/surrealengine/blob/master/Thirdparty/openmpt/include/cryptopp/Install.txt Builds a ZIP file suitable for distributing the Crypto++ library. ```makefile make dist ``` ```makefile make zip ``` -------------------------------- ### Configure MSVC Runtime Library Source: https://github.com/dpjudas/surrealengine/blob/master/SurrealGPU/CMakeLists.txt Sets the MSVC runtime library for the 'surrealgpu' and 'surrealgpu_example' targets. This configuration ensures the correct multithreaded runtime is used, with a debug version for debug configurations. ```cmake #if(MSVC) # set_property(TARGET surrealgpu PROPERTY MSVC_RUNTIME_LIBRARY "MultiThreaded$<$:Debug>") # set_property(TARGET surrealgpu_example PROPERTY MSVC_RUNTIME_LIBRARY "MultiThreaded$<$:Debug>") #endif() ``` -------------------------------- ### Build Crypto++ with Address Sanitizer Source: https://github.com/dpjudas/surrealengine/blob/master/Thirdparty/openmpt/include/cryptopp/Install.txt Builds the Crypto++ library with the Address Sanitizer (Asan) enabled. This is mutually exclusive with Undefined Behavior Sanitizer. ```makefile make asan ``` -------------------------------- ### Build with LLVM libc++ Source: https://github.com/dpjudas/surrealengine/blob/master/Thirdparty/openmpt/include/cryptopp/Install.txt Set CXXFLAGS to use LLVM's libc++ standard library with C++11. ```bash export CXXFLAGS="-std=c++11 -stdlib=libc++" make ``` -------------------------------- ### Build Static and Shared Libraries Source: https://github.com/dpjudas/surrealengine/blob/master/Thirdparty/openmpt/include/cryptopp/Install.txt Commands to build both the static and shared library versions of Crypto++. Also builds the test executable. ```bash make static dynamic cryptest.exe ``` -------------------------------- ### Build OpenAL Soft with CMake Source: https://github.com/dpjudas/surrealengine/blob/master/Thirdparty/openal-soft/README.md Instructs CMake to build the project using the toolchain selected during configuration. This command should be run from the build directory. ```bash cmake --build . ```