### Install Project Files Source: https://github.com/danielswolf/rhubarb-lip-sync/blob/master/CMakeLists.txt Installs documentation and license files to the root of the installation directory. Ensure these files exist in the source tree. ```cmake install( FILES README.adoc LICENSE.md CHANGELOG.md DESTINATION . ) ``` -------------------------------- ### Install Documentation Source: https://github.com/danielswolf/rhubarb-lip-sync/blob/master/rhubarb/lib/cppformat/doc/CMakeLists.txt This command installs the generated HTML documentation to the specified destination directory. ```cmake install(DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/html DESTINATION share/doc/cppformat) ``` -------------------------------- ### Sign In Callback and Process Source: https://github.com/danielswolf/rhubarb-lip-sync/blob/master/rhubarb/lib/webrtc-8d2248ff/webrtc/examples/peerconnection/server/server_test.html Handles the response after signing into the server, establishing the client's ID and discovering initial peers. Starts the hanging GET request to listen for messages. ```javascript function signInCallback() { try { if (request.readyState == 4) { if (request.status == 200) { var peers = request.responseText.split("\n"); my_id = parseInt(peers[0].split(',')[1]); trace("My id: " + my_id); for (var i = 1; i < peers.length; ++i) { if (peers[i].length > 0) { trace("Peer " + i + ": " + peers[i]); var parsed = peers[i].split(','); other_peers[parseInt(parsed[1])] = parsed[0]; } } startHangingGet(); request = null; } } } catch (e) { trace("error: " + e.description); } } function signIn() { try { request = new XMLHttpRequest(); request.onreadystatechange = signInCallback; request.open("GET", server + "/sign_in?" + localName, true); request.send(); } catch (e) { trace("error: " + e.description); } } ``` -------------------------------- ### Initialize Vorbis Encoding Setup Source: https://github.com/danielswolf/rhubarb-lip-sync/blob/master/rhubarb/lib/vorbis-1.3.6/doc/vorbisenc/vorbis_encode_setup_init.html This function finalizes the high-level encoding structure into a complete setup. It must be called after vorbis_info_init and either vorbis_encode_setup_managed or vorbis_encode_setup_vbr. No further setup changes are permitted after this call. ```c extern int vorbis_encode_setup_init(vorbis_info *vi); ``` -------------------------------- ### Initialize Google Visualization and UI Elements Source: https://github.com/danielswolf/rhubarb-lip-sync/blob/master/rhubarb/lib/webrtc-8d2248ff/webrtc/tools/loopback_test/loopback_test.html Loads the Google Visualization library and gets references to various HTML elements used for controlling and displaying the test status. This setup is necessary before starting the test. ```javascript google.load('visualization', '1.0', {'packages':['controls']}); var durationInput = document.getElementById('duration'); var maxVideoBitrateInput = document.getElementById('max-video-bitrate'); var forceTurnInput = document.getElementById('force-turn'); var launcherButton = document.getElementById('launcher-button'); var autoModeInput = document.createElement('input'); var testStatus = document.getElementById('test-status'); var pcConstraintsInput = document.getElementById('pc-constraints'); launcherButton.onclick = start; ``` -------------------------------- ### SDP Example for Vorbis RTP Source: https://github.com/danielswolf/rhubarb-lip-sync/blob/master/rhubarb/lib/vorbis-1.3.6/doc/rfc5215.txt This example shows how to map Vorbis media type parameters into an SDP session description. It includes parameters for channels, sample rate, and bitrate. ```text v=0 o=jdoe 2890844526 2890844526 IN IP4 host.example.com s=Vorbis Audio t=0 0 ``` ```text a=rtpmap:96 vorbis/48000/2 a=fmtp:96 ``` ```text channels=2; bitrate=64000 ``` -------------------------------- ### Install libogg Target and pkg-config File Source: https://github.com/danielswolf/rhubarb-lip-sync/blob/master/rhubarb/lib/ogg-1.3.3/CMakeLists.txt Defines the installation rules for the libogg library, its headers, and its pkg-config file to the appropriate directories. ```cmake install(TARGETS ogg RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR} LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR} ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR} FRAMEWORK DESTINATION ${CMAKE_INSTALL_PREFIX} PUBLIC_HEADER DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}/ogg ) install(FILES ${CMAKE_CURRENT_BINARY_DIR}/ogg.pc DESTINATION ${CMAKE_INSTALL_LIBDIR}/pkgconfig ) ``` -------------------------------- ### Install utf8proc Targets and Headers Source: https://github.com/danielswolf/rhubarb-lip-sync/blob/master/rhubarb/lib/utf8proc-2.2.0/CMakeLists.txt Installs the utf8proc library targets to bin/lib directories and the header file to the include directory. ```cmake install(TARGETS utf8proc RUNTIME DESTINATION bin LIBRARY DESTINATION lib ARCHIVE DESTINATION lib) install( FILES "${PROJECT_SOURCE_DIR}/utf8proc.h" DESTINATION include) ``` -------------------------------- ### vorbis_encode_setup_vbr Source: https://github.com/danielswolf/rhubarb-lip-sync/blob/master/rhubarb/lib/vorbis-1.3.6/doc/vorbisenc/vorbis_encode_setup_vbr.html Performs the initial setup for variable bitrate (quality-based) encoding. This function allows for subsequent configuration using vorbis_encode_ctl before finalizing the setup with vorbis_encode_setup_init. ```APIDOC ## vorbis_encode_setup_vbr ### Description This function performs step-one of a three-step variable bitrate (quality-based) encode setup. It functions similarly to the one-step setup performed by [vorbis_encode_init_vbr()](vorbis_encode_init_vbr.html) but allows an application to make further encode setup tweaks using [vorbis_encode_ctl()](vorbis_encode_ctl.html) before finally calling [vorbis_encode_setup_init()](vorbis_encode_setup_init.html) to complete the setup process. Before this function is called, the [vorbis_info](../libvorbis/vorbis_info.html) struct should be initialized by using vorbis_info_init() from the libvorbis API. After encoding, vorbis_info_clear should be called. ### Function Signature ```c extern int vorbis_encode_setup_vbr(vorbis_info *vi, long channels, long rate, float base_quality); ``` ### Parameters #### Path Parameters - **vi** (vorbis_info *) - Pointer to an initialized [vorbis_info](../libvorbis/vorbis_info.html) struct. - **channels** (long) - The number of channels to be encoded. - **rate** (long) - The sampling rate of the source audio. - **base_quality** (float) - Desired quality level, currently from -0.1 to 1.0 (lo to hi). ### Return Values - **0** for success - **less than zero** for failure: - **OV_EFAULT**: Internal logic fault; indicates a bug or heap/stack corruption. - **OV_EINVAL**: Invalid setup request, eg, out of range argument. - **OV_EIMPL**: Unimplemented mode; unable to comply with quality level request. ``` -------------------------------- ### Install cppformat Library and Headers with CMake Source: https://github.com/danielswolf/rhubarb-lip-sync/blob/master/rhubarb/lib/cppformat/CMakeLists.txt Configures installation targets for the cppformat library and its header files when FMT_INSTALL is enabled. Specifies the installation directory for libraries. ```cmake if (FMT_INSTALL) set(FMT_LIB_DIR lib CACHE STRING "Installation directory for libraries, relative to ${CMAKE_INSTALL_PREFIX}.") install(TARGETS cppformat DESTINATION ${FMT_LIB_DIR}) install(FILES format.h DESTINATION include/cppformat) endif () ``` -------------------------------- ### Error Handling for Vorbis Setup Source: https://github.com/danielswolf/rhubarb-lip-sync/blob/master/rhubarb/lib/vorbis-1.3.6/doc/vorbisenc/examples.html Checks the return value of a setup function and exits if an error occurred, such as an unsupported mode or bitrate. ```c /* * do not continue if setup failed; this can happen if we ask for a * mode that libVorbis does not support (eg, too low a bitrate, etc, * will return 'OV_EIMPL') */ if(ret) exit(1); ``` -------------------------------- ### Ogg Sync Pageout Example Usage Source: https://github.com/danielswolf/rhubarb-lip-sync/blob/master/rhubarb/lib/ogg-1.3.3/doc/libogg/ogg_sync_pageout.html This code demonstrates a typical loop for reading and processing Ogg pages. It first attempts to get a page using ogg_sync_pageout. If successful (returns 1), it proceeds. If not, it reads data into the buffer using ogg_sync_buffer, writes the bytes read using ogg_sync_wrote, and then retries ogg_sync_pageout. This pattern ensures proper buffer management and page extraction. ```c if (ogg_sync_pageout(&oy, &og) != 1) { buffer = ogg_sync_buffer(&oy, 8192); bytes = fread(buffer, 1, 8192, stdin); ogg_sync_wrote(&oy, bytes); } ``` -------------------------------- ### Windows Binary Mode Setup Source: https://github.com/danielswolf/rhubarb-lip-sync/blob/master/rhubarb/lib/vorbis-1.3.6/doc/vorbisfile/seekingexample.html Conditionally include headers and set stdin/stdout to binary mode for Windows compatibility. ```c #ifdef _WIN32 #include #include #endif ``` -------------------------------- ### vorbis_encode_setup_managed Source: https://github.com/danielswolf/rhubarb-lip-sync/blob/master/rhubarb/lib/vorbis-1.3.6/doc/vorbisenc/vorbis_encode_setup_managed.html Performs the initial step of a three-step bitrate-managed encode setup. It allows for further configuration using vorbis_encode_ctl() before calling vorbis_encode_setup_init(). ```APIDOC ## vorbis_encode_setup_managed ### Description This function performs step-one of a three-step bitrate-managed encode setup. It functions similarly to the one-step setup performed by [vorbis_encode_init()](vorbis_encode_init.html) but allows an application to make further encode setup tweaks using [vorbis_encode_ctl()](vorbis_encode_ctl.html) before finally calling [vorbis_encode_setup_init()](vorbis_encode_setup_init.html) to complete the setup process. Before this function is called, the [vorbis_info](../libvorbis/vorbis_info.html) struct should be initialized by using vorbis_info_init() from the libvorbis API. After encoding, vorbis_info_clear should be called. The max_bitrate, nominal_bitrate, and min_bitrate settings are used to set constraints for the encoded file. This function uses these settings to select the appropriate encoding mode and set it up. ### Parameters - **vi** (*vorbis_info* *) - Pointer to an initialized [vorbis_info](../libvorbis/vorbis_info.html) struct. - **channels** (long) - The number of channels to be encoded. - **rate** (long) - The sampling rate of the source audio. - **max_bitrate** (long) - Desired maximum bitrate (limit). -1 indicates unset. - **nominal_bitrate** (long) - Desired average, or central, bitrate. -1 indicates unset. - **min_bitrate** (long) - Desired minimum bitrate. -1 indicates unset. ### Return Values - 0 for success - less than zero for failure: - OV_EFAULT - Internal logic fault; indicates a bug or heap/stack corruption. - OV_EINVAL - Invalid setup request, eg, out of range argument. - OV_EIMPL - Unimplemented mode; unable to comply with bitrate request. ``` -------------------------------- ### nameStartString Source: https://github.com/danielswolf/rhubarb-lip-sync/blob/master/rhubarb/lib/tclap-1.2.1/docs/html/classTCLAP_1_1Arg-members.html Returns the starting string for the argument name. ```APIDOC ## nameStartString ### Description Returns the starting string for the argument name. ### Method nameStartString() ### Returns std::string ### Example ```cpp // Example usage (conceptual) std::string name = arg.nameStartString(); ``` ``` -------------------------------- ### vorbis_encode_setup_init Source: https://github.com/danielswolf/rhubarb-lip-sync/blob/master/rhubarb/lib/vorbis-1.3.6/doc/vorbisenc/vorbis_encode_setup_init.html Finalizes the high-level encoding structure into a complete encoding setup. After this function is called, the application may make no further setup changes. ```APIDOC ## vorbis_encode_setup_init ### Description This function performs the last stage of three-step encoding setup. It finalizes the high-level encoding structure into a complete encoding setup after which the application may make no further setup changes. ### Parameters #### Path Parameters - **vi** (vorbis_info *) - Required - Pointer to an initialized vorbis_info struct. ### Return Values - **0** for success - **less than zero** for failure: - **OV_EFAULT**: Internal logic fault; indicates a bug or heap/stack corruption. - **OV_EINVAL**: Attempt to use vorbis_encode_setup_init() without first calling one of vorbis_encode_setup_managed() or vorbis_encode_setup_vbr() to initialize the high-level encoding setup. ``` -------------------------------- ### Connect to Server Source: https://github.com/danielswolf/rhubarb-lip-sync/blob/master/rhubarb/lib/webrtc-8d2248ff/webrtc/examples/peerconnection/server/server_test.html Initiates the connection process by getting user input for name and server address, then calls the signIn function. ```javascript function connect() { localName = document.getElementById("local").value.toLowerCase(); server = document.getElementById("server").value.toLowerCase(); if (localName.length == 0) { alert("I need a name please."); document.getElementById("local").focus(); } else { document.getElementById("connect").disabled = true; document.getElementById("disconnect").disabled = false; document.getElementById("send").disabled = false; signIn(); } } ``` -------------------------------- ### Start Loopback Test Source: https://github.com/danielswolf/rhubarb-lip-sync/blob/master/rhubarb/lib/webrtc-8d2248ff/webrtc/tools/loopback_test/loopback_test.html Initiates the loopback test. It validates input parameters, configures the UI to indicate the test is running, and requests user media. The test is automatically started if 'auto-mode' is enabled. ```javascript if (autoModeInput.checked) start(); function start() { var durationMs = parseInt(durationInput.value) * 1000; var maxVideoBitrateKbps = parseInt(maxVideoBitrateInput.value); var forceTurn = forceTurnInput.checked; var autoClose = autoModeInput.checked; var pcConstraints = pcConstraintsInput.value == "" ? null : JSON.parse(pcConstraintsInput.value); var updateStatusInterval; var testFinished = false; function updateStatus() { if (testFinished) { testStatus.innerHTML = 'Test finished'; if (updateStatusInterval) { clearInterval(updateStatusInterval); updateStatusInterval = null; } } else { if (!updateStatusInterval) { updateStatusInterval = setInterval(updateStatus, 1000); testStatus.innerHTML = 'Running'; } testStatus.innerHTML += '.'; } } if (!(isFinite(maxVideoBitrateKbps) && maxVideoBitrateKbps > 0)) { // TODO(andresp): Get a better way to show errors than alert. alert("Invalid max video bitrate"); return; } if (!(isFinite(durationMs) && durationMs > 0)) { alert("Invalid duration"); return; } durationInput.disabled = true; forceTurnInput.disabled = true; maxVideoBitrateInput.disabled = true; launcherButton.style.display = 'none'; testStatus.style.display = 'block'; getUserMedia({audio:true, video:true}, gotStream, function() {}); function gotStream(stream) { updateStatus(); var test = new LoopbackTest(stream, durationMs, forceTurn, pcConstraints, maxVideoBitrateKbps); test.run(onTestFinished.bind(test)); } function onTestFinished() { testFinished = true; updateStatus(); if (autoClose) { window.close(); } else { plotStats(this.getResults()); } } } ``` -------------------------------- ### Typical ov_read Usage Example Source: https://github.com/danielswolf/rhubarb-lip-sync/blob/master/rhubarb/lib/vorbis-1.3.6/doc/vorbisfile/ov_read.html This example demonstrates a typical call to ov_read() for reading audio data. It specifies a buffer size of 4096 bytes, requests signed 16-bit little-endian samples, and passes a pointer to store the current logical bitstream index. ```c bytes_read = ov_read(&vf, buffer, 4096,0,2,1,¤t_section) ``` -------------------------------- ### Encoder Setup Functions Source: https://github.com/danielswolf/rhubarb-lip-sync/blob/master/rhubarb/lib/vorbis-1.3.6/doc/vorbisenc/reference.html Functions for initializing and configuring the Vorbis encoder. ```APIDOC ## Encoder Setup This section details the functions available for configuring the Vorbis encoder. ### `vorbis_encode_ctl()` **Description**: Control function for the Vorbis encoder. ### `vorbis_encode_init()` **Description**: Initializes the Vorbis encoder. ### `vorbis_encode_init_vbr()` **Description**: Initializes the Vorbis encoder for Variable Bit Rate (VBR) encoding. ### `vorbis_encode_setup_init()` **Description**: Initializes the encoder setup structure. ### `vorbis_encode_setup_managed()` **Description**: Sets up the encoder for managed bitrate encoding. ### `vorbis_encode_setup_vbr()` **Description**: Sets up the encoder for Variable Bit Rate (VBR) encoding. ``` -------------------------------- ### Typical ov_read_filter Usage Example Source: https://github.com/danielswolf/rhubarb-lip-sync/blob/master/rhubarb/lib/vorbis-1.3.6/doc/vorbisfile/ov_read_filter.html This example demonstrates a typical usage of ov_read_filter for reading audio data. It specifies a buffer size, signed 16-bit little-endian samples, and passes a filter function and its data pointer. ```c bytes_read = ov_read_filter(&vf, buffer, 4096,0,2,1,¤t_section, filter, (void *)filter_data_ptr) ``` -------------------------------- ### SDP Example for Vorbis RTP Payload Source: https://github.com/danielswolf/rhubarb-lip-sync/blob/master/rhubarb/lib/vorbis-1.3.6/doc/rfc5215.txt This example demonstrates a basic SDP configuration for a single Vorbis RTP stream, including the 'rtpmap' and 'fmtp' attributes with a base64 encoded configuration string. ```sdp c=IN IP4 192.0.2.1 m=audio RTP/AVP 98 a=rtpmap:98 vorbis/44100/2 a=fmtp:98 configuration=AAAAAZ2f4g9NAh4aAXZvcmJpcwA...; ``` -------------------------------- ### flagStartString() Source: https://github.com/danielswolf/rhubarb-lip-sync/blob/master/rhubarb/lib/tclap-1.2.1/docs/html/functions_0x66.html Returns the string used to start a flag argument. ```APIDOC ## flagStartString() ### Description Retrieves the string that signifies the beginning of a flag in command-line arguments. ### Class - TCLAP::Arg ``` -------------------------------- ### IOStreams Formatting Example Source: https://github.com/danielswolf/rhubarb-lip-sync/blob/master/rhubarb/lib/cppformat/README.rst Demonstrates the verbosity of IOStreams for precise floating-point formatting. Use when complex stream manipulators are acceptable. ```c++ std::cout << std::setprecision(2) << std::fixed << 1.23456 << "\n"; ``` -------------------------------- ### MultiSwitchArg Custom Initialization Source: https://github.com/danielswolf/rhubarb-lip-sync/blob/master/rhubarb/lib/tclap-1.2.1/docs/manual.html This example demonstrates initializing a MultiSwitchArg with a custom default value, which is returned if the switch is not found on the command line. ```cpp MultiSwitchArg quiet("q","quiet","Reduce the volume of output",5); cmd.add( quiet ); ``` -------------------------------- ### Main Function and Initialization Source: https://github.com/danielswolf/rhubarb-lip-sync/blob/master/rhubarb/lib/vorbis-1.3.6/doc/vorbisfile/seekingexample.html Main function setup, including OggVorbis_File structure declaration, progress tracking variables, and Windows binary mode setting. ```c int main(int argc, char **argv){ OggVorbis_File vf; int eof=0; int current_section; #ifdef _WIN32 _setmode( _fileno( stdin ), _O_BINARY ); #endif ``` -------------------------------- ### Huffman Codeword Assignment Example Source: https://github.com/danielswolf/rhubarb-lip-sync/blob/master/rhubarb/lib/vorbis-1.3.6/doc/Vorbis_I_spec.html Demonstrates the process of assigning binary Huffman codewords to codebook entries based on their lengths, starting with the lowest possible value for each length. This is critical for entropy decoding. ```text 1 entry 0: length 2 codeword 00 2 entry 1: length 4 codeword 0100 3 entry 2: length 4 codeword 0101 4 entry 3: length 4 codeword 0110 5 entry 4: length 4 codeword 0111 6 entry 5: length 2 codeword 10 7 entry 6: length 3 codeword 110 8 entry 7: length 3 codeword 111 ``` -------------------------------- ### Get Previous UTF-8 Code Point with utf8::prior Source: https://github.com/danielswolf/rhubarb-lip-sync/blob/master/rhubarb/lib/utfcpp-2.3.5/README.md Use `utf8::prior` to iterate backward through a UTF-8 string and retrieve the previous code point. It requires a bidirectional iterator and a start iterator for boundary checking. This function is generally preferred over `utf8::previous`. ```cpp template uint32_t prior(octet_iterator& it, octet_iterator start); ``` ```cpp char* twochars = "\xe6\x97\xa5\xd1\x88"; unsigned char* w = twochars + 3; int cp = prior (w, twochars); assert (cp == 0x65e5); assert (w == twochars); ``` -------------------------------- ### Help and Version Flags Source: https://github.com/danielswolf/rhubarb-lip-sync/blob/master/rhubarb/lib/tclap-1.2.1/docs/manual.html Illustrates the automatic inclusion of --help and --version flags for displaying usage information and program version. ```bash % test1 --help USAGE: test1 [-r] -n [--] [-v] [-h] Where: -r, --reverse Print name backwards -n --name (required) (value required) Name to print --, --ignore_rest Ignores the rest of the labeled arguments following this flag. -v, --version Displays version information and exits. -h, --help Displays usage information and exits. Command description message ``` -------------------------------- ### Initialize CmdLine with Help, Version, and Ignore Rest Arguments Source: https://github.com/danielswolf/rhubarb-lip-sync/blob/master/rhubarb/lib/tclap-1.2.1/docs/html/CmdLine_8h_source.html Initializes the CmdLine object by adding standard arguments for help, version display, and ignoring any remaining arguments. This setup is typically done in the constructor. ```cpp v = new HelpVisitor( this, &_output ); SwitchArg* help = new SwitchArg("h","help", "Displays usage information and exits.", false, v); add( help ); deleteOnExit(help); deleteOnExit(v); v = new VersionVisitor( this, &_output ); SwitchArg* vers = new SwitchArg("","version", "Displays version information and exits.", false, v); add( vers ); deleteOnExit(vers); deleteOnExit(v); v = new IgnoreRestVisitor(); SwitchArg* ignore = new SwitchArg( Arg::flagStartString(), Arg::ignoreNameString(), "Ignores the rest of the labeled arguments following this flag.", false, v); add( ignore ); deleteOnExit(ignore); deleteOnExit(v); ``` -------------------------------- ### Format String Examples Source: https://github.com/danielswolf/rhubarb-lip-sync/blob/master/rhubarb/lib/cppformat/doc/syntax.md Illustrates different ways to reference arguments within format strings, including explicit argument IDs and implicit sequential referencing. ```c++ "First, thou shalt count to {0}" // References the first argument ``` ```c++ "Bring me a {}" // Implicitly references the first argument ``` ```c++ "From {} to {}" // Same as "From {0} to {1}" ``` -------------------------------- ### Install C++ Format with Homebrew Source: https://github.com/danielswolf/rhubarb-lip-sync/blob/master/rhubarb/lib/cppformat/doc/usage.md Install the C++ Format library on macOS using the Homebrew package manager. ```bash brew install cppformat ``` -------------------------------- ### Build GNU Make Makefile Source: https://github.com/danielswolf/rhubarb-lip-sync/blob/master/rhubarb/lib/whereami/README.md This command demonstrates how to build the library using the provided GNU Make Makefile. ```bash $ make -C _gnu-make/ ``` -------------------------------- ### Set up MSBuild environment for Windows SDK Source: https://github.com/danielswolf/rhubarb-lip-sync/blob/master/rhubarb/lib/cppformat/CMakeLists.txt Creates a batch script to set up the build environment using SetEnv.cmd and then runs msbuild. Useful for building Visual Studio projects with the SDK toolchain. ```cmake include(FindSetEnv) if (WINSDK_SETENV) set(MSBUILD_SETUP "call \"${WINSDK_SETENV}\"") endif () # Set FrameworkPathOverride to get rid of MSB3644 warnings. set(netfxpath "C:\\ Program Files\\Reference Assemblies\\Microsoft\\Framework\\.NETFramework\\v4.0") file(WRITE run-msbuild.bat " ${MSBUILD_SETUP} ${CMAKE_MAKE_PROGRAM} -p:FrameworkPathOverride=\"${netfxpath}\" %*") ``` -------------------------------- ### Install Rhubarb Target Source: https://github.com/danielswolf/rhubarb-lip-sync/blob/master/rhubarb/CMakeLists.txt Installs the 'rhubarb' target to the runtime directory. This ensures the main executable is placed correctly in the build output. ```cmake install( TARGETS rhubarb RUNTIME DESTINATION . ) ``` -------------------------------- ### Compile for iOS from Command Line Source: https://github.com/danielswolf/rhubarb-lip-sync/blob/master/rhubarb/lib/whereami/README.md This command demonstrates how to compile the library for iOS using make, specifying the target architecture and SDK, and includes a post-build step for code signing. ```bash $ make -C _gnu-make/ binsubdir=ios CC="$(xcrun --sdk iphoneos --find clang) -isysroot $(xcrun --sdk iphoneos --show-sdk-path) -arch armv7 -arch armv7s -arch arm64" postbuild="codesign -s 'iPhone Developer'" ``` -------------------------------- ### OggVorbis_File Initialization and Cleanup Source: https://github.com/danielswolf/rhubarb-lip-sync/blob/master/rhubarb/lib/vorbis-1.3.6/doc/vorbisfile/OggVorbis_File.html Before using an OggVorbis_File structure, it must be initialized using ov_open(), ov_fopen(), or ov_open_callbacks(). After use, it must be deallocated with ov_clear(). Note that ov_open() is discouraged on Windows. ```APIDOC Initialization: - ov_open(const char *path, OggVorbis_File *vf, const unsigned char *initial_bytes, int nbytes) - ov_fopen(FILE *f, OggVorbis_File *vf) - ov_open_callbacks(void *datasource, OggVorbis_File *vf, const unsigned char *initial_bytes, int nbytes, ov_callbacks cb) Cleanup: - ov_clear(OggVorbis_File *vf) ``` -------------------------------- ### Hanging GET Callback and Timeout Handling Source: https://github.com/danielswolf/rhubarb-lip-sync/blob/master/rhubarb/lib/webrtc-8d2248ff/webrtc/examples/peerconnection/server/server_test.html Handles the response from a long-polling GET request to the server, processing notifications or peer messages. Includes timeout logic to re-issue the request. ```javascript function hangingGetCallback() { try { if (hangingGet.readyState != 4) return; if (hangingGet.status != 200) { trace("server error: " + hangingGet.statusText); disconnect(); } else { var peer_id = GetIntHeader(hangingGet, "Pragma"); if (peer_id == my_id) { handleServerNotification(hangingGet.responseText); } else { handlePeerMessage(peer_id, hangingGet.responseText); } } if (hangingGet) { hangingGet.abort(); hangingGet = null; } if (my_id != -1) window.setTimeout(startHangingGet, 0); } catch (e) { trace("Hanging get error: " + e.description); } } function startHangingGet() { try { hangingGet = new XMLHttpRequest(); hangingGet.onreadystatechange = hangingGetCallback; hangingGet.ontimeout = onHangingGetTimeout; hangingGet.open("GET", server + "/wait?peer_id=" + my_id, true); hangingGet.send(); } catch (e) { trace("error" + e.description); } } function onHangingGetTimeout() { trace("hanging get timeout. issuing again."); hangingGet.abort(); hangingGet = null; if (my_id != -1) window.setTimeout(startHangingGet, 0); } ``` -------------------------------- ### Setup/Teardown Functions Source: https://github.com/danielswolf/rhubarb-lip-sync/blob/master/rhubarb/lib/vorbis-1.3.6/doc/vorbisfile/reference.html Functions for opening and closing Vorbis files. ```APIDOC ## ov_fopen() ### Description Opens an Ogg Vorbis file for reading. ### Endpoint ov_fopen(const char *filename) ## ov_open() ### Description Opens an Ogg Vorbis stream from a file descriptor. ### Endpoint ov_open(int fd) ## ov_open_callbacks() ### Description Opens an Ogg Vorbis stream using custom callback functions. ### Endpoint ov_open_callbacks(void *datasource, ov_callbacks callbacks, OggVorbis_File *vf, const char *initial_ Đây là một ví dụ về cách bạn có thể tạo một tệp JSON hợp lệ theo lược đồ được cung cấp, dựa trên văn bản nguồn được cung cấp. Vui lòng lưu ý rằng tôi đã bỏ qua các chi tiết cụ thể về các tham số và phần thân yêu cầu/phản hồi vì chúng không được cung cấp rõ ràng trong văn bản nguồn. Nếu bạn có thêm thông tin, tôi có thể cập nhật nó. ```json { "page_title": "Vorbisfile API Reference", "page_description": "Documentation for the Vorbisfile library, version 1.3.2.", "page_summary": "This document provides a reference for the Vorbisfile API, covering data structures, setup/teardown functions, decoding, seeking, and file information retrieval.", "codeSnippets": [ { "title": "Setup/Teardown Functions", "description": "Functions for opening and closing Vorbis files.", "language": "APIDOC", "codeList": [ { "language": "APIDOC", "code": "## ov_fopen()\n\n### Description\nOpens an Ogg Vorbis file for reading.\n\n### Endpoint\nov_fopen(const char *filename)\n\n## ov_open()\n\n### Description\nOpens an Ogg Vorbis stream from a file descriptor.\n\n### Endpoint\nov_open(int fd)\n\n## ov_open_callbacks()\n\n### Description\nOpens an Ogg Vorbis stream using custom callback functions.\n\n### Endpoint\nov_open_callbacks(void *datasource, ov_callbacks callbacks, OggVorbis_File *vf, const char *initial_" }, { "language": "APIDOC", "code": "## ov_clear()\n\n### Description\nCloses an open Ogg Vorbis stream and frees associated resources.\n\n### Endpoint\nov_clear(OggVorbis_File *vf)\n\n## ov_test()\n\n### Description\nTests if a file is a valid Ogg Vorbis stream without opening it.\n\n### Endpoint\nov_test(const char *filename)\n\n## ov_test_callbacks()\n\n### Description\nTests if a stream opened with callbacks is a valid Ogg Vorbis stream.\n\n### Endpoint\nov_test_callbacks(void *datasource, ov_callbacks callbacks)\n\n## ov_test_open()\n\n### Description\nTests if a file descriptor points to a valid Ogg Vorbis stream.\n\n### Endpoint\nov_test_open(int fd)" } ] }, { "title": "Decoding Functions", "description": "Functions for reading audio data from a Vorbis stream.", "language": "APIDOC", "codeList": [ { "language": "APIDOC", "code": "## ov_read()\n\n### Description\nReads decoded audio samples from the stream into a buffer.\n\n### Endpoint\nov_read(OggVorbis_File *vf, char *buffer, int length, int bigendian, int word, int sனம்\n }, { "language": "APIDOC", "code": "## ov_read_float()\n\n### Description\nReads decoded audio samples from the stream into a buffer as floating-point values.\n\n### Endpoint\nov_read_float(OggVorbis_File *vf, float ***buffer, int samples, int *index)\n\n## ov_read_filter()\n\n### Description\nReads decoded audio samples from the stream using a filter.\n\n### Endpoint\nov_read_filter(OggVorbis_File *vf, char *buffer, int length, int bigendian, int word, int signed, int *index, int filter)\n\n## ov_crosslap()\n\n### Description\nPerforms a crossfade between two Vorbis streams.\n\n### Endpoint\nov_crosslap(OggVorbis_File *vf1, OggVorbis_File *vf2)" } ] }, { "title": "Seeking Functions", "description": "Functions for seeking to specific positions within the Vorbis stream.", "language": "APIDOC", "codeList": [ { "language": "APIDOC", "code": "## ov_raw_seek()\n\n### Description\nSeeks to a specific raw byte position in the stream.\n\n### Endpoint\nov_raw_seek(OggVorbis_File *vf, long offset)\n\n## ov_pcm_seek()\n\n### Description\nSeeks to a specific PCM sample position in the stream.\n\n### Endpoint\nov_pcm_seek(OggVorbis_File *vf, ogg_int64_t pcm)\n\n## ov_time_seek()\n\n### Description\nSeeks to a specific time position in the stream.\n\n### Endpoint\nov_time_seek(OggVorbis_File *vf, double seconds)\n\n## ov_pcm_seek_page()\n\n### Description\nSeeks to the beginning of the PCM sample page.\n\n### Endpoint\nov_pcm_seek_page(OggVorbis_File *vf, ogg_int64_t pcm)\n\n## ov_time_seek_page()\n\n### Description\nSeeks to the beginning of the time page.\n\n### Endpoint\nov_time_seek_page(OggVorbis_File *vf, double seconds)" }, { "language": "APIDOC", "code": "## ov_raw_seek_lap()\n\n### Description\nPerforms a raw seek with overlap.\n\n### Endpoint\nov_raw_seek_lap(OggVorbis_File *vf, long offset)\n\n## ov_pcm_seek_lap()\n\n### Description\nPerforms a PCM seek with overlap.\n\n### Endpoint\nov_pcm_seek_lap(OggVorbis_File *vf, ogg_int64_t pcm)\n\n## ov_time_seek_lap()\n\n### Description\nPerforms a time seek with overlap.\n\n### Endpoint\nov_time_seek_lap(OggVorbis_File *vf, double seconds)\n\n## ov_pcm_seek_page_lap()\n\n### Description\nPerforms a PCM seek to page with overlap.\n\n### Endpoint\nov_pcm_seek_page_lap(OggVorbis_File *vf, ogg_int64_t pcm)\n\n## ov_time_seek_page_lap()\n\n### Description\nPerforms a time seek to page with overlap.\n\n### Endpoint\nov_time_seek_page_lap(OggVorbis_File *vf, double seconds)" } ] }, { "title": "File Information Functions", "description": "Functions for retrieving information about the Vorbis stream.", "language": "APIDOC", "codeList": [ { "language": "APIDOC", "code": "## ov_bitrate()\n\n### Description\nReturns the current bitrate of the stream.\n\n### Endpoint\nov_bitrate(OggVorbis_File *vf)\n\n## ov_bitrate_instant()\n\n### Description\nReturns the instant bitrate of the stream.\n\n### Endpoint\nov_bitrate_instant(OggVorbis_File *vf)\n\n## ov_streams()\n\n### Description\nReturns the number of logical streams in the Ogg file.\n\n### Endpoint\nov_streams(OggVorbis_File *vf)\n\n## ov_seekable()\n\n### Description\nReturns whether the stream is seekable.\n\n### Endpoint\nov_seekable(OggVorbis_File *vf)\n\n## ov_serialnumber()\n\n### Description\nReturns the serial number of the current logical stream.\n\n### Endpoint\nov_serialnumber(OggVorbis_File *vf)\n\n## ov_raw_total()\n\n### Description\nReturns the total number of raw bytes in the stream.\n\n### Endpoint\nov_raw_total(OggVorbis_File *vf)\n\n## ov_pcm_total()\n\n### Description\nReturns the total number of PCM samples in the stream.\n\n### Endpoint\nov_pcm_total(OggVorbis_File *vf)\n\n## ov_time_total()\n\n### Description\nReturns the total duration of the stream in seconds.\n\n### Endpoint\nov_time_total(OggVorbis_File *vf)\n\n## ov_raw_tell()\n\n### Description\nReturns the current raw byte position in the stream.\n\n### Endpoint\nov_raw_tell(OggVorbis_File *vf)\n\n## ov_pcm_tell()\n\n### Description\nReturns the current PCM sample position in the stream.\n\n### Endpoint\nov_pcm_tell(OggVorbis_File *vf)\n\n## ov_time_tell()\n\n### Description\nReturns the current time position in the stream.\n\n### Endpoint\nov_time_tell(OggVorbis_File *vf)\n\n## ov_info()\n\n### Description\nRetrieves information about the Vorbis stream.\n\n### Endpoint\nov_info(OggVorbis_File *vf, int index)\n\n## ov_comment()\n\n### Description\nRetrieves comments from the Vorbis stream.\n\n### Endpoint\nov_comment(OggVorbis_File *vf, int index)" } ] } ] } ```) ``` -------------------------------- ### Vorbis Setup Header Structure Source: https://github.com/danielswolf/rhubarb-lip-sync/blob/master/rhubarb/lib/vorbis-1.3.6/doc/04-codec.tex Outlines the sequential decoding order of components within the Vorbis setup header, concluding with a framing bit. This header contains critical codec configuration data. ```text The setup header contains, in order, the lists of codebook configurations, time-domain transform configurations (placeholders in Vorbis I), floor configurations, residue configurations, channel mapping configurations and mode configurations. It finishes with a framing bit of '1'. Header decode proceeds in the following order: ``` -------------------------------- ### Huffman Codeword Lengths Example Source: https://github.com/danielswolf/rhubarb-lip-sync/blob/master/rhubarb/lib/vorbis-1.3.6/doc/Vorbis_I_spec.html Illustrates the assignment of codeword lengths to codebook entries, forming the basis for Huffman decision tree construction. This example shows a typical set of lengths for a codebook. ```text 1 entry 0: length 2 2 entry 1: length 4 3 entry 2: length 4 4 entry 3: length 4 5 entry 4: length 4 6 entry 5: length 2 7 entry 6: length 3 8 entry 7: length 3 ``` -------------------------------- ### Initialize OggVorbis_File Structure Source: https://github.com/danielswolf/rhubarb-lip-sync/blob/master/rhubarb/lib/vorbis-1.3.6/doc/vorbisfile/chainingexample.html Declare the primary OggVorbis_File structure and other variables for tracking progress. ```c int main(){ OggVorbis_File ov; int i; ``` -------------------------------- ### Initialize Vorbis Info for Average Bitrate (ABR) Encoding Source: https://github.com/danielswolf/rhubarb-lip-sync/blob/master/rhubarb/lib/vorbis-1.3.6/doc/vorbisenc/examples.html Prepares a vorbis_info structure for ABR encoding. This example sets up for 44kHz stereo, targeting an average bitrate of 128kbps. ```c vorbis_info_init(&vi); /* * Encoding using an average bitrate mode (ABR). * example: 44kHz stereo coupled, average 128kbps ABR */ ret = vorbis_encode_init(&vi,2,44100,-1,128000,-1); /* * do not continue if setup failed; this can happen if we ask for a * mode that libVorbis does not support (eg, too low a bitrate, etc, * will return 'OV_EIMPL') */ if(ret) exit(1); ``` -------------------------------- ### TCLAP Functions Starting with 'g' Source: https://github.com/danielswolf/rhubarb-lip-sync/blob/master/rhubarb/lib/tclap-1.2.1/docs/html/functions_func_0x67.html This section details various functions available in tclap classes that start with the letter 'g'. These functions are typically used for retrieving information about command-line arguments, command line objects, and exceptions. ```APIDOC ## getArgList() ### Description Retrieves the list of arguments associated with the command line. ### Method `getArgList()` ### Returns A reference to the list of arguments. ## getDelimiter() ### Description Gets the delimiter used for separating arguments. ### Method `getDelimiter()` ### Returns The delimiter string. ## getDescription() ### Description Retrieves the description of an argument. ### Method `getDescription()` ### Returns The argument's description string. ## getExceptionHandling() ### Description Gets the exception handling strategy for the command line. ### Method `getExceptionHandling()` ### Returns The exception handling object. ## getExitStatus() ### Description Retrieves the exit status code from an exception. ### Method `getExitStatus()` ### Returns The integer exit status code. ## getFlag() ### Description Gets the flag associated with an argument. ### Method `getFlag()` ### Returns The argument's flag string. ## getMessage() ### Description Retrieves a message associated with the command line or an interface. ### Method `getMessage()` ### Returns The message string. ## getMutexList() ### Description Retrieves the list of mutexes. ### Method `getMutexList()` ### Returns A list of mutexes. ## getName() ### Description Gets the name of an argument. ### Method `getName()` ### Returns The argument's name string. ## getOutput() ### Description Retrieves the output handler for the command line or interface. ### Method `getOutput()` ### Returns The output handler object. ## getProgramName() ### Description Gets the name of the program. ### Method `getProgramName()` ### Returns The program name string. ## getValue() ### Description Retrieves the value of an argument. ### Method `getValue()` ### Returns The argument's value. ## getVersion() ### Description Retrieves the version of the command line interface. ### Method `getVersion()` ### Returns The version string. ## getXorHandler() ### Description Gets the XOR handler for managing exclusive argument groups. ### Method `getXorHandler()` ### Returns The XOR handler object. ## getXorList() ### Description Retrieves the list of XOR groups. ### Method `getXorList()` ### Returns A list of XOR groups. ## gotOptional() ### Description Checks if an optional argument has been provided. ### Method `gotOptional()` ### Returns `true` if an optional argument was provided, `false` otherwise. ``` -------------------------------- ### Clone and Build Benchmark Repository Source: https://github.com/danielswolf/rhubarb-lip-sync/blob/master/rhubarb/lib/cppformat/README.rst Clone the format-benchmarks repository and configure it with CMake to run performance tests. ```bash git clone --recursive https://github.com/cppformat/format-benchmark.git cd format-benchmark cmake . ``` -------------------------------- ### TCLAP::Arg Members starting with 'i' Source: https://github.com/danielswolf/rhubarb-lip-sync/blob/master/rhubarb/lib/tclap-1.2.1/docs/html/functions_0x69.html This section details member functions of the TCLAP::Arg class that start with 'i', providing insights into argument behavior such as ignoring names, ignoring the rest of the arguments, and checking if an argument is required or has been set. ```APIDOC ## ignoreNameString() ### Description Allows an argument to ignore its name string. ### Method `ignoreNameString()` ### Class `TCLAP::Arg` ``` ```APIDOC ## ignoreRest() ### Description Specifies that the argument should ignore the rest of the command-line arguments. ### Method `ignoreRest()` ### Class `TCLAP::Arg` ``` ```APIDOC ## IgnoreRestVisitor() ### Description Constructor for the IgnoreRestVisitor, used to handle arguments that should ignore the rest of the command line. ### Method `IgnoreRestVisitor()` ### Class `TCLAP::IgnoreRestVisitor` ``` ```APIDOC ## isIgnoreable() ### Description Checks if the argument can be ignored. ### Method `isIgnoreable()` ### Class `TCLAP::Arg` ``` ```APIDOC ## isRequired() ### Description Determines if the argument is mandatory. ### Method `isRequired()` ### Classes `TCLAP::Arg`, `TCLAP::MultiArg< T >` ``` ```APIDOC ## isSet() ### Description Checks if the argument has been set on the command line. ### Method `isSet()` ### Class `TCLAP::Arg` ``` ```APIDOC ## isValueRequired() ### Description Indicates whether a value is required for this argument. ### Method `isValueRequired()` ### Class `TCLAP::Arg` ``` -------------------------------- ### Convert to Different Bases Source: https://github.com/danielswolf/rhubarb-lip-sync/blob/master/rhubarb/lib/cppformat/doc/syntax.md Demonstrates converting integers to different bases (decimal, hexadecimal, octal, binary) and how to include prefixes. ```c++ format("int: {0:d}; hex: {0:x}; oct: {0:o}; bin: {0:b}", 42); // Result: "int: 42; hex: 2a; oct: 52; bin: 101010" ``` ```c++ // with 0x or 0 or 0b as prefix: format("int: {0:d}; hex: {0:#x}; oct: {0:#o}; bin: {0:#b}", 42); // Result: "int: 42; hex: 0x2a; oct: 052; bin: 0b101010" ``` -------------------------------- ### TCLAP::ArgTraits< T > Source: https://github.com/danielswolf/rhubarb-lip-sync/blob/master/rhubarb/lib/tclap-1.2.1/docs/html/structTCLAP_1_1ArgTraits.html Arg traits are used to get compile type specialization when parsing argument values. Using an ArgTraits, you can specify the way that values get assigned to any particular type during parsing. The two supported types are StringLike and ValueLike. ```APIDOC ## Struct Template TCLAP::ArgTraits< T > ### Description Arg traits are used to get compile type specialization when parsing argument values. Using an ArgTraits, you can specify the way that values get assigned to any particular type during parsing. The two supported types are StringLike and ValueLike. ### Definition `#include ` ### Public Types - **ValueCategory** (typedef T::ValueCategory): Alias for the value category type. ### Public Member Functions - **~ArgTraits()** (virtual): Virtual destructor for ArgTraits. ``` -------------------------------- ### Residue 1 Encoding Example Source: https://github.com/danielswolf/rhubarb-lip-sync/blob/master/rhubarb/lib/vorbis-1.3.6/doc/08-residue.tex Demonstrates residue encoding 1, which represents partition vector scalars in order without interleaving based on codebook dimensions. This example uses a partition vector of size eight and codebooks of varying dimensions. ```latex original residue vector: [ 0 1 2 3 4 5 6 7 ] codebook dimensions = 8 encoded as: [ 0 1 2 3 4 5 6 7 ] codebook dimensions = 4 encoded as: [ 0 1 2 3 ], [ 4 5 6 7 ] codebook dimensions = 2 encoded as: [ 0 1 ], [ 2 3 ], [ 4 5 ], [ 6 7 ] codebook dimensions = 1 encoded as: [ 0 ], [ 1 ], [ 2 ], [ 3 ], [ 4 ], [ 5 ], [ 6 ], [ 7 ] ```