Function sunvox_sys::sv_audio_callback [] [src]

pub unsafe extern "C" fn sv_audio_callback(
    buf: *mut c_void,
    frames: c_int,
    latency: c_int,
    out_time: c_uint
) -> c_int

Gets the next piece of SunVox audio.

With sv_audio_callback() you can ignore the built-in SunVox sound output mechanism and use some other sound system. Set the SV_INIT_FLAG_USER_AUDIO_CALLBACK flag when calling sv_init() if you want to use this function.

Parameters

  • buf: Destination buffer. If SV_INIT_FLAG_AUDIO_INT16 was passed to sv_init(), this is a buffer of c_shorts. If SV_INIT_FLAG_AUDIO_FLOAT32 was passed, this is a buffer of c_floats. Stereo data will be interleaved in this buffer: LRLR... ; where the LR is one frame (Left+Right channels).
  • frames: Number of frames in destination buffer.
  • latency: Audio latency (in frames).
  • out_time: Output time (in ticks).

The out_time parameter is elaborated on a little bit in this thread: http://www.warmplace.ru/forum/viewtopic.php?f=12&t=4152

For normal use, pass the value of sv_get_ticks(), as detailed in that thread.