### Install libmysofa to System Location Source: https://hoene.github.io/libmysofa Installs the compiled library and header files to the system's standard directory structure. This typically requires administrator privileges. ```shell cmake install . ``` -------------------------------- ### Install libmysofa to Custom Prefix Source: https://hoene.github.io/libmysofa Installs the library to a specified non-system location. Configure the installation path using `CMAKE_INSTALL_PREFIX` during the CMake configuration step. ```shell cd build cmake -DCMAKE_BUILD_TYPE=Debug .. -DCMAKE_INSTALL_PREFIX= make all test cmake install . ``` -------------------------------- ### Install Libmysofa to Custom Prefix Source: https://hoene.github.io/libmysofa Installs libmysofa to a specified non-system location. Configure the installation path using CMAKE_INSTALL_PREFIX during the CMake configuration step. ```shell cd build cmake -DCMAKE_BUILD_TYPE=Debug .. -DCMAKE_INSTALL_PREFIX= make all test cmake install . ``` -------------------------------- ### Compile Libmysofa on Ubuntu Source: https://hoene.github.io/libmysofa Installs necessary development components and compiles the libmysofa library using CMake. Includes options for debugging and address sanitization. ```shell sudo apt install zlib1g-dev libcunit1-dev libcunit1-dev git build-essential cmake nodejs cd build cmake -DCMAKE_BUILD_TYPE=Debug .. make -j8 all ctest -j8 ``` ```shell export ASAN_SYMBOLIZER_PATH=/usr/bin/llvm-symbolizer export ASAN_OPTIONS=symbolize=1 cmake -DCMAKE_BUILD_TYPE=Debug -DADDRESS_SANITIZE=ON -DVDEBUG=1 .. make all test ``` -------------------------------- ### Compile libmysofa on Ubuntu Source: https://hoene.github.io/libmysofa Installs necessary development components and compiles the libmysofa library. Use `make -j8 all` for building and `ctest -j8` for running tests. For a Debian package, use `cpack`. ```shell sudo apt install zlib1g-dev libcunit1-dev libcunit1-dev git build-essential cmake nodejs ``` ```shell cd build cmake -DCMAKE_BUILD_TYPE=Debug .. make -j8 all ctest -j8 ``` ```shell cd build && cpack ``` -------------------------------- ### Configure CMake Prefix Path Source: https://hoene.github.io/libmysofa Adds a non-system installation path to CMake's search for packages. Use this when libmysofa is installed to a custom location and not found automatically. ```cmake -DCMAKE_PREFIX_PATH= ``` -------------------------------- ### Getting HRTF filter coefficients (short) Source: https://hoene.github.io/libmysofa Retrieves HRTF filter coefficients for a given 3D coordinate (x, y, z) as short integers, along with delay information. ```APIDOC ## mysofa_getfilter_short ### Description Retrieves HRTF filter coefficients for a given 3D coordinate (x, y, z) as short integers, along with delay information. ### Function Signature ```c void mysofa_getfilter_short(struct MYSOFA_EASY *hrtf, float x, float y, float z, short *leftIR, short *rightIR, int *leftDelay, int *rightDelay); ``` ### Parameters - **hrtf** (struct MYSOFA_EASY *) - Pointer to the loaded `MYSOFA_EASY` structure. - **x** (float) - The x-coordinate of the listener's position. - **y** (float) - The y-coordinate of the listener's position. - **z** (float) - The z-coordinate of the listener's position. - **leftIR** (short *) - Buffer to store the left ear's impulse response coefficients. - **rightIR** (short *) - Buffer to store the right ear's impulse response coefficients. - **leftDelay** (int *) - Pointer to store the left ear's delay in samples. - **rightDelay** (int *) - Pointer to store the right ear's delay in samples. ``` -------------------------------- ### Getting HRTF Filters Source: https://hoene.github.io/libmysofa Provides functions to retrieve HRTF filters for specific coordinates, with options for short or float data types and interpolation. ```APIDOC ## mysofa_getfilter_short ### Description Retrieves HRTF filters as short integers for a given coordinate. ### Function Signature ```c void mysofa_getfilter_short(struct MYSOFA_EASY *hrtf, float x, float y, float z, short leftIR[], short rightIR[], int *leftDelay, int *rightDelay); ``` ## mysofa_getfilter_float ### Description Retrieves HRTF filters as float values for a given coordinate, with linear interpolation. ### Function Signature ```c void mysofa_getfilter_float(struct MYSOFA_EASY *hrtf, float x, float y, float z, float leftIR[], float rightIR[], float *leftDelay, float *rightDelay); ``` ## mysofa_getfilter_float_nointerp ### Description Retrieves HRTF filters as float values for a given coordinate, bypassing linear interpolation. ### Function Signature ```c void mysofa_getfilter_float_nointerp(struct MYSOFA_EASY *hrtf, float x, float y, float z, float leftIR[], float rightIR[], float *leftDelay, float *rightDelay); ``` ``` -------------------------------- ### Getting HRTF filter coefficients (float) Source: https://hoene.github.io/libmysofa Retrieves HRTF filter coefficients for a given 3D coordinate (x, y, z) as floating-point values, along with delay information in seconds. ```APIDOC ## mysofa_getfilter_float ### Description Retrieves HRTF filter coefficients for a given 3D coordinate (x, y, z) as floating-point values, along with delay information in seconds. ### Function Signature ```c void mysofa_getfilter_float(struct MYSOFA_EASY *hrtf, float x, float y, float z, float *leftIR, float *rightIR, float *leftDelay, float *rightDelay); ``` ### Parameters - **hrtf** (struct MYSOFA_EASY *) - Pointer to the loaded `MYSOFA_EASY` structure. - **x** (float) - The x-coordinate of the listener's position. - **y** (float) - The y-coordinate of the listener's position. - **z** (float) - The z-coordinate of the listener's position. - **leftIR** (float *) - Buffer to store the left ear's impulse response coefficients (normalized between -1 and 1). - **rightIR** (float *) - Buffer to store the right ear's impulse response coefficients (normalized between -1 and 1). - **leftDelay** (float *) - Pointer to store the left ear's delay in seconds. - **rightDelay** (float *) - Pointer to store the right ear's delay in seconds. ``` -------------------------------- ### Get HRTF filter coefficients (short) Source: https://hoene.github.io/libmysofa Retrieves the HRTF filter coefficients for a given 3D coordinate. The output includes impulse response arrays for left and right channels and their respective delays in samples. ```c short leftIR[filter_length]; short rightIR[filter_length]; int leftDelay; // unit is samples int rightDelay; // unit is samples mysofa_getfilter_short(hrtf, x, y, z, leftIR, rightIR, &leftDelay, &rightDelay); ``` -------------------------------- ### Specify Libmysofa Build Directory for CMake Source: https://hoene.github.io/libmysofa Informs CMake about the location of the libmysofa build tree when consuming its headers and libraries directly from the build directory. This is an alternative to installing the library. ```cmake -Dmysofa_DIR= ``` -------------------------------- ### Get HRTF filter coefficients (float) Source: https://hoene.github.io/libmysofa Retrieves HRTF filter coefficients as floating-point arrays for left and right channels, along with delays in seconds. This function applies linear interpolation between nearest neighbors. ```c float leftIR[filter_length]; // [-1. till 1] float rightIR[filter_length]; float leftDelay; // unit is sec. float rightDelay; // unit is sec. mysofa_getfilter_float(hrtf, x, y, z, leftIR, rightIR, &leftDelay, &rightDelay); ``` -------------------------------- ### Get HRTF filter coefficients (float, no interpolation) Source: https://hoene.github.io/libmysofa Retrieves HRTF filter coefficients as floating-point arrays without applying linear interpolation. This returns the exact filter coefficients nearest to the requested position. ```c mysofa_getfilter_float_nointerp(hrtf, x, y, z, leftIR, rightIR, &leftDelay, &rightDelay); ``` -------------------------------- ### Getting HRTF filter coefficients (float, no interpolation) Source: https://hoene.github.io/libmysofa Retrieves the exact HRTF filter coefficients nearest to the requested [x,y,z] position without applying linear interpolation. ```APIDOC ## mysofa_getfilter_float_nointerp ### Description Retrieves the exact HRTF filter coefficients nearest to the requested [x,y,z] position without applying linear interpolation. This bypasses the weighted sum of nearest neighbors coefficients used in `mysofa_getfilter_float`. ### Function Signature ```c void mysofa_getfilter_float_nointerp(struct MYSOFA_EASY *hrtf, float x, float y, float z, float *leftIR, float *rightIR, float *leftDelay, float *rightDelay); ``` ### Parameters - **hrtf** (struct MYSOFA_EASY *) - Pointer to the loaded `MYSOFA_EASY` structure. - **x** (float) - The x-coordinate of the listener's position. - **y** (float) - The y-coordinate of the listener's position. - **z** (float) - The z-coordinate of the listener's position. - **leftIR** (float *) - Buffer to store the left ear's impulse response coefficients. - **rightIR** (float *) - Buffer to store the right ear's impulse response coefficients. - **leftDelay** (float *) - Pointer to store the left ear's delay in seconds. - **rightDelay** (float *) - Pointer to store the right ear's delay in seconds. ``` -------------------------------- ### Build Libmysofa on Big Endian Architecture Source: https://hoene.github.io/libmysofa Provides Docker commands to set up an environment for building libmysofa on a big endian architecture (s390x) using QEMU for emulation. ```shell docker run --rm --privileged multiarch/qemu-user-static --reset -p yes docker run --rm -it s390x/ubuntu bash ``` -------------------------------- ### Opening SOFA Files Source: https://hoene.github.io/libmysofa Demonstrates how to open a SOFA file with different normalization and neighbor search options. ```APIDOC ## mysofa_open ### Description Opens a SOFA file and normalizes HRTF data. ### Function Signature ```c struct MYSOFA_EASY *mysofa_open(const char *filename, int samplerate, int *filter_length, int *err); ``` ## mysofa_open_no_norm ### Description Opens a SOFA file without normalizing HRTF data. ### Function Signature ```c struct MYSOFA_EASY *mysofa_open_no_norm(const char *filename, int samplerate, int *filter_length, int *err); ``` ## mysofa_open_advanced ### Description Opens a SOFA file with advanced control over neighbor search algorithm parameters. ### Function Signature ```c struct MYSOFA_EASY *mysofa_open_advanced(const char *filename, int samplerate, int *filter_length, int *err, bool norm, float neighbor_angle_step, float neighbor_radius_step); ``` ## mysofa_open_data ### Description Opens a SOFA file from a data buffer in memory. ### Function Signature ```c struct MYSOFA_EASY *mysofa_open_data(char *buffer, int buffer_size, int samplerate, int *filter_length, int *err); ``` ``` -------------------------------- ### Open SOFA file with advanced options Source: https://hoene.github.io/libmysofa Opens a SOFA file with fine-grained control over the neighbor search algorithm parameters. Adjust `neighbor_angle_step` and `neighbor_radius_step` based on the expected grid step of your SOFA files. ```c bool norm = true; // bool, apply normalization upon import float neighbor_angle_step = 5; // in degree, neighbor search angle step (common to azimuth and elevation) float neighbor_radius_step = 0.01; // in meters, neighbor search radius step hrtf = mysofa_open_advanced("file.sofa", 48000, &filter_length, &err, norm, neighbor_angle_step, neighbor_radius_step); ``` -------------------------------- ### Opening a SOFA file with advanced options Source: https://hoene.github.io/libmysofa Opens a SOFA file with advanced control over the neighbor search algorithm parameters for more fine-tuned import. ```APIDOC ## mysofa_open_advanced ### Description Opens a SOFA file with advanced control over the neighbor search algorithm parameters for more fine-tuned import. ### Function Signature ```c struct MYSOFA_EASY *mysofa_open_advanced(const char *filename, int samplerate, int *filter_length, int *err, bool norm, float neighbor_angle_step, float neighbor_radius_step); ``` ### Parameters - **filename** (const char *) - Path to the SOFA file. - **samplerate** (int) - The desired sample rate for the HRTF filters. - **filter_length** (int *) - Pointer to an integer that will store the length of the HRTF filters. - **err** (int *) - Pointer to an integer that will store any error code encountered during opening. - **norm** (bool) - Whether to apply normalization upon import. - **neighbor_angle_step** (float) - Neighbor search angle step in degrees. Affects azimuth and elevation. - **neighbor_radius_step** (float) - Neighbor search radius step in meters. ### Return Value - Returns a pointer to a `MYSOFA_EASY` structure on success. - Returns `NULL` if an error occurred, and the error code is stored in `err`. ``` -------------------------------- ### Opening a SOFA file with normalization Source: https://hoene.github.io/libmysofa Opens a SOFA file, loads HRTF data, and normalizes it. Returns a MYSOFA_EASY structure on success or an error code. ```APIDOC ## mysofa_open ### Description Opens a SOFA file, loads HRTF data, and normalizes it. Returns a MYSOFA_EASY structure on success or an error code. ### Function Signature ```c struct MYSOFA_EASY *mysofa_open(const char *filename, int samplerate, int *filter_length, int *err); ``` ### Parameters - **filename** (const char *) - Path to the SOFA file. - **samplerate** (int) - The desired sample rate for the HRTF filters. - **filter_length** (int *) - Pointer to an integer that will store the length of the HRTF filters. - **err** (int *) - Pointer to an integer that will store any error code encountered during opening. ### Return Value - Returns a pointer to a `MYSOFA_EASY` structure on success. - Returns `NULL` if an error occurred, and the error code is stored in `err`. ``` -------------------------------- ### Create Debian Package Source: https://hoene.github.io/libmysofa Generates a Debian package for libmysofa after compilation. ```shell cd build && cpack ``` -------------------------------- ### Open SOFA file with normalization Source: https://hoene.github.io/libmysofa Opens a SOFA file and normalizes the HRTF data. Requires including `mysofa.h`. Returns an error code if opening fails. ```c #include int filter_length; int err; struct MYSOFA_EASY *hrtf = NULL; hrtf = mysofa_open("file.sofa", 48000, &filter_length, &err); if(hrtf==NULL) return err; ``` -------------------------------- ### Opening a SOFA file with caching Source: https://hoene.github.io/libmysofa Opens a SOFA file using a caching mechanism. Multiple calls with the same filename and sample rate will reuse the loaded data, saving memory and load time. ```APIDOC ## mysofa_open_cached ### Description Opens a SOFA file using a caching mechanism. Multiple calls with the same filename and sample rate will reuse the loaded data, saving memory and load time. ### Function Signature ```c struct MYSOFA_EASY *mysofa_open_cached(const char *filename, int samplerate, int *filter_length, int *err); ``` ### Parameters - **filename** (const char *) - Path to the SOFA file. - **samplerate** (int) - The desired sample rate for the HRTF filters. - **filter_length** (int *) - Pointer to an integer that will store the length of the HRTF filters. - **err** (int *) - Pointer to an integer that will store any error code encountered during opening. ### Return Value - Returns a pointer to a `MYSOFA_EASY` structure on success. - Returns `NULL` if an error occurred, and the error code is stored in `err`. ### Notes Thread safety: If using multiple threads, ensure only one thread accesses `mysofa_open_cached` and `mysofa_close_cached` at a time using appropriate synchronization mechanisms. ``` -------------------------------- ### Open SOFA file with caching Source: https://hoene.github.io/libmysofa Opens a SOFA file and caches its content for potentially faster subsequent access. Multiple calls with the same file and sample rate will reuse the cached data. ```c hrtf1 = mysofa_open_cached("file.sofa", 48000, &filter_length, &err); hrtf2 = mysofa_open_cached("file.sofa", 48000, &filter_length, &err); hrtf3 = mysofa_open_cached("file.sofa", 8000, &filter_length, &err); hrtf3 = mysofa_open_cached("file2.sofa", 8000, &filter_length, &err); ``` -------------------------------- ### Open SOFA file from memory buffer Source: https://hoene.github.io/libmysofa Opens a SOFA file directly from a data buffer in memory. Useful when the SOFA file content is already loaded. ```c char buffer[9] = "TESTDATA"; int filter_length; int err; struct MYSOFA_EASY *hrtf = NULL; hrtf = mysofa_open_data(buffer, 9, 48000, &filter_length, &err); ``` -------------------------------- ### Compile libmysofa with AddressSanitizer Source: https://hoene.github.io/libmysofa Compiles the library with AddressSanitizer enabled to detect memory leaks and pointer issues. Ensure `llvm-symbolizer` is in your PATH or specified by `ASAN_SYMBOLIZER_PATH`. ```shell export ASAN_SYMBOLIZER_PATH=/usr/bin/llvm-symbolizer export ASAN_OPTIONS=symbolize=1 cmake -DCMAKE_BUILD_TYPE=Debug -DADDRESS_SANITIZE=ON -DVDEBUG=1 .. make all test ``` -------------------------------- ### Opening a SOFA file without normalization Source: https://hoene.github.io/libmysofa Opens a SOFA file and loads HRTF data without applying normalization. Useful for specific use cases requiring raw data. ```APIDOC ## mysofa_open_no_norm ### Description Opens a SOFA file and loads HRTF data without applying normalization. Useful for specific use cases requiring raw data. ### Function Signature ```c struct MYSOFA_EASY *mysofa_open_no_norm(const char *filename, int samplerate, int *filter_length, int *err); ``` ### Parameters - **filename** (const char *) - Path to the SOFA file. - **samplerate** (int) - The desired sample rate for the HRTF filters. - **filter_length** (int *) - Pointer to an integer that will store the length of the HRTF filters. - **err** (int *) - Pointer to an integer that will store any error code encountered during opening. ### Return Value - Returns a pointer to a `MYSOFA_EASY` structure on success. - Returns `NULL` if an error occurred, and the error code is stored in `err`. ``` -------------------------------- ### Opening a SOFA file from memory buffer Source: https://hoene.github.io/libmysofa Opens a SOFA file from a data buffer in memory, allowing processing of SOFA data without direct file access. ```APIDOC ## mysofa_open_data ### Description Opens a SOFA file from a data buffer in memory, allowing processing of SOFA data without direct file access. ### Function Signature ```c struct MYSOFA_EASY *mysofa_open_data(char *buffer, int buffer_size, int samplerate, int *filter_length, int *err); ``` ### Parameters - **buffer** (char *) - Pointer to the memory buffer containing SOFA data. - **buffer_size** (int) - The size of the data buffer in bytes. - **samplerate** (int) - The desired sample rate for the HRTF filters. - **filter_length** (int *) - Pointer to an integer that will store the length of the HRTF filters. - **err** (int *) - Pointer to an integer that will store any error code encountered during opening. ### Return Value - Returns a pointer to a `MYSOFA_EASY` structure on success. - Returns `NULL` if an error occurred, and the error code is stored in `err`. ``` -------------------------------- ### Open SOFA file without normalization Source: https://hoene.github.io/libmysofa Opens a SOFA file without applying normalization to the HRTF data. Use this if your data is already normalized or if you require raw data. ```c hrtf = mysofa_open_no_norm("file.sofa", 48000, &filter_length, &err); ``` -------------------------------- ### Cached SOFA File Handling Source: https://hoene.github.io/libmysofa Functions for opening and closing SOFA files with caching to improve performance for repeated access. ```APIDOC ## mysofa_open_cached ### Description Opens a SOFA file using a cache mechanism. ### Function Signature ```c struct MYSOFA_EASY *mysofa_open_cached(const char *filename, int samplerate, int *filter_length, int *err); ``` ## mysofa_close_cached ### Description Closes a cached SOFA file handle. ### Function Signature ```c void mysofa_close_cached(struct MYSOFA_EASY *hrtf); ``` ## mysofa_cache_release_all ### Description Releases all resources held by the SOFA file cache. ### Function Signature ```c void mysofa_cache_release_all(void); ``` ``` -------------------------------- ### Closing SOFA Files Source: https://hoene.github.io/libmysofa Shows how to free the resources associated with an opened SOFA file structure. ```APIDOC ## mysofa_close ### Description Frees the HRTF structure and associated resources. ### Function Signature ```c void mysofa_close(struct MYSOFA_EASY *hrtf); ``` ``` -------------------------------- ### Release all cached SOFA files Source: https://hoene.github.io/libmysofa Immediately releases all SOFA files currently held in the cache, regardless of their reference counts. Use with caution as this may invalidate pointers to cached data. ```c mysofa_cache_release_all ``` -------------------------------- ### Find Libmysofa Package in CMake Source: https://hoene.github.io/libmysofa Configures a CMake project to find and use the libmysofa library. This statement should be included in the consuming project's CMakeLists.txt file. ```cmake find_package( mysofa CONFIG [mysofa_version] [REQUIRED] ) ``` -------------------------------- ### Coordinate System Conversion Source: https://hoene.github.io/libmysofa Utility functions for converting between spherical and Cartesian coordinate systems. ```APIDOC ## mysofa_s2c ### Description Converts spherical coordinates (phi, theta, r) to Cartesian coordinates (x, y, z). ### Function Signature ```c void mysofa_s2c(float values[3]); ``` ## mysofa_c2s ### Description Converts Cartesian coordinates (x, y, z) to spherical coordinates (phi, theta, r). ### Function Signature ```c void mysofa_c2s(float values[3]); ``` ``` -------------------------------- ### Closing a SOFA structure Source: https://hoene.github.io/libmysofa Frees the memory associated with a `MYSOFA_EASY` structure, releasing resources after use. ```APIDOC ## mysofa_close ### Description Frees the memory associated with a `MYSOFA_EASY` structure, releasing resources after use. ### Function Signature ```c void mysofa_close(struct MYSOFA_EASY *hrtf); ``` ### Parameters - **hrtf** (struct MYSOFA_EASY *) - Pointer to the `MYSOFA_EASY` structure to be closed and freed. ``` -------------------------------- ### Link Against Libmysofa Target in CMake Source: https://hoene.github.io/libmysofa Links a CMake target against either the shared or static variant of the libmysofa library. This ensures that the necessary library files are included during the build process. ```cmake target_link_libraries( [PRIVATE|PUBLIC] mysofa::mysofa-shared ) ``` ```cmake target_link_libraries( [PRIVATE|PUBLIC] mysofa::mysofa-static ) ``` -------------------------------- ### Release All Cached SOFA Files Source: https://hoene.github.io/libmysofa Frees all SOFA data currently held in the cache. This should be called when the application is shutting down or when memory needs to be explicitly reclaimed. ```c mysofa_cache_release_all(); ``` -------------------------------- ### Free HRTF structure Source: https://hoene.github.io/libmysofa Releases the memory allocated for the HRTF structure. Call this function when you are finished with the `hrtf` object to prevent memory leaks. ```c mysofa_close(hrtf); ``` -------------------------------- ### Convert spherical to Cartesian coordinates Source: https://hoene.github.io/libmysofa Converts spherical coordinates (phi, theta, r) to Cartesian coordinates (x, y, z). The input array `values` should contain phi (azimuth), theta (elevation), and r (distance) in degrees and meters, respectively. The output (x, y, z) is stored in the same array. ```c void mysofa_s2c(float values[3]) ``` -------------------------------- ### Releasing all cached SOFA data Source: https://hoene.github.io/libmysofa Frees all SOFA data currently held in the cache, regardless of reference counts. Use with caution. ```APIDOC ## mysofa_cache_release_all ### Description Frees all SOFA data currently held in the cache, regardless of reference counts. Use with caution. ### Function Signature ```c void mysofa_cache_release_all(); ``` ``` -------------------------------- ### Convert Cartesian to spherical coordinates Source: https://hoene.github.io/libmysofa Converts Cartesian coordinates (x, y, z) to spherical coordinates (phi, theta, r). The input array `values` should contain x, y, and z. The output (phi, theta, r) is stored in the same array. ```c void mysofa_c2s(float values[3]) ``` -------------------------------- ### Close cached SOFA file Source: https://hoene.github.io/libmysofa Decrements the reference count for a cached SOFA file. The file is only truly unloaded from cache when all references are released. ```c mysofa_close_cached(hrtf1); mysofa_close_cached(hrtf2); mysofa_close_cached(hrtf3); mysofa_close_cached(hrtf4); ``` -------------------------------- ### Cartesian to Spherical coordinates conversion Source: https://hoene.github.io/libmysofa Converts Cartesian coordinates (x, y, z) to spherical coordinates (phi, theta, r). ```APIDOC ## mysofa_c2s ### Description Converts Cartesian coordinates (x, y, z) to spherical coordinates (phi, theta, r). ### Function Signature ```c void mysofa_c2s(float values[3]); ``` ### Parameters - **values** (float[3]) - Input array containing Cartesian coordinates [x, y, z]. Output spherical coordinates [phi, theta, r] are stored in the same array. - phi: Azimuth in degrees. - theta: Elevation in degrees. - r: Distance from the origin. ``` -------------------------------- ### Closing a cached SOFA structure Source: https://hoene.github.io/libmysofa Decrements the reference count for a cached SOFA structure. The structure is freed only when its reference count reaches zero. ```APIDOC ## mysofa_close_cached ### Description Decrements the reference count for a cached SOFA structure. The structure is freed only when its reference count reaches zero. ### Function Signature ```c void mysofa_close_cached(struct MYSOFA_EASY *hrtf); ``` ### Parameters - **hrtf** (struct MYSOFA_EASY *) - Pointer to the cached `MYSOFA_EASY` structure to close. ``` -------------------------------- ### Spherical to Cartesian coordinates conversion Source: https://hoene.github.io/libmysofa Converts spherical coordinates (phi, theta, r) to Cartesian coordinates (x, y, z). ```APIDOC ## mysofa_s2c ### Description Converts spherical coordinates (phi, theta, r) to Cartesian coordinates (x, y, z). ### Function Signature ```c void mysofa_s2c(float values[3]); ``` ### Parameters - **values** (float[3]) - Input array containing spherical coordinates [phi, theta, r]. Output Cartesian coordinates [x, y, z] are stored in the same array. - phi: Azimuth in degrees (counterclockwise from the X axis). - theta: Elevation in degrees (up from the X-Y plane). - r: Distance from the origin. ``` === COMPLETE CONTENT === This response contains all available snippets from this library. No additional content exists. Do not make further requests.