Crate sdif_sys

Crate sdif_sys 

Source
Expand description

§sdif-sys

Raw FFI bindings to the IRCAM SDIF (Sound Description Interchange Format) library.

This crate provides low-level, unsafe bindings to the SDIF C library. For a safe, idiomatic Rust API, use the sdif-rs crate instead.

§Usage

These bindings are primarily intended for use by the sdif-rs crate. Direct usage requires careful attention to:

  • Calling SdifGenInit before any other SDIF functions
  • Calling SdifGenKill during cleanup
  • Managing SdifFileT pointer lifetimes
  • Following the correct sequence of read/write operations

§Example

use sdif_sys::*;
use std::ptr;
use std::ffi::CString;

unsafe {
    // Initialize the library (required before any operations)
    SdifGenInit(ptr::null());

    // Open a file for reading
    let path = CString::new("test.sdif").unwrap();
    let file = SdifFOpen(path.as_ptr(), SdifFileModeET_eReadFile);

    if !file.is_null() {
        // Read general header
        let bytes_read = SdifFReadGeneralHeader(file);

        // Read ASCII chunks (NVT, type definitions, etc.)
        let ascii_bytes = SdifFReadAllASCIIChunks(file);

        // Close the file
        SdifFClose(file);
    }

    // Cleanup
    SdifGenKill();
}

§Feature Flags

  • bundled: Compile SDIF from bundled source instead of linking to system library
  • static: Force static linking (implies bundled on most systems)

Structs§

SdifFileT

Constants§

SIG_1FQ0
1FQ0 - Fundamental Frequency
SIG_1HRM
1HRM - Harmonic Partials
SIG_1RES
1RES - Resonances
SIG_1STF
1STF - Short-Time Fourier
SIG_1TRC
1TRC - Sinusoidal Tracks (most common for additive synthesis)
SdifDataTypeET_eFloat4
SdifDataTypeET_eFloat8
SdifDataTypeET_eInt1
SdifDataTypeET_eInt2
SdifDataTypeET_eInt4
SdifDataTypeET_eText
SdifDataTypeET_eUInt1
SdifDataTypeET_eUInt2
SdifDataTypeET_eUInt4
SdifFileModeET_eModeMask
SdifFileModeET_ePredefinedTypes
SdifFileModeET_eReadFile
SdifFileModeET_eWriteFile

Functions§

SdifCreateFrameType
SdifCreateMatrixType
SdifFClose
SdifFCurrDataType
SdifFCurrFrameSignature
SdifFCurrMatrixSignature
SdifFCurrNbCol
SdifFCurrNbMatrix
SdifFCurrNbRow
SdifFCurrOneRowData
SdifFCurrTime
SdifFGetFrameTypesTable
SdifFGetMatrixTypesTable
SdifFGetSignature
SdifFNameValueList
SdifFOpen
SdifFReadAllASCIIChunks
SdifFReadFrameHeader
SdifFReadGeneralHeader
SdifFReadMatrixData
SdifFReadMatrixHeader
SdifFReadOneRow
SdifFSetCurrFrameHeader
SdifFSetCurrMatrixHeader
SdifFSkipFrameData
SdifFSkipMatrixData
SdifFWriteAllASCIIChunks
SdifFWriteFrameAndOneMatrix
SdifFWriteFrameHeader
SdifFWriteGeneralHeader
SdifFWriteMatrixData
SdifFWriteMatrixHeader
SdifFWritePadding
SdifFrameTypePutComponent
SdifGenInit
SdifGenKill
SdifMatrixTypeInsertTailColumnDef
SdifNameValuesLNewTable
SdifNameValuesLPutCurrNVT
SdifPutFrameType
SdifPutMatrixType
SdifSignatureConst
SdifSignatureToString
SdifSizeofDataType
SdifStringToSignature
signature_from_str
Convert a 4-character string to an SDIF signature.
signature_to_string
Convert an SDIF signature to a 4-character string.

Type Aliases§

SdifDataTypeET
SdifFileModeET
SdifFloat4
SdifFloat8
SdifSignature