#line 150 "/home/travis/build/felix-lang/felix/src/packages/sdl.fdoc"
  
  
  //Module        : SDL_audio_h
  //Timestamp     : 2006/1/6 2:18:42 UTC
  //Timestamp     : 2006/1/6 13:18:42 (local)
  //Raw Header    : SDL_audio.h
  //Preprocessor  : gcc -E
  //Input file: sdl.flxcc.i
  //Flxcc Control : sdl.flxcc
  //Felix Version : 1.1.2_rc1
  
  
  open module SDL_audio_h
  {
    requires package "sdl";
    header '#include "SDL_audio.h"';
  
    const SDL_MIX_MAXVOLUME : int;
    const AUDIO_S16MSB : uint16;
    const AUDIO_U16MSB : uint16;
    const AUDIO_S16LSB : uint16;
    const AUDIO_U16LSB : uint16;
    const AUDIO_S16SYS : uint16;
    const AUDIO_U16SYS : uint16;
    const AUDIO_S16 : uint16;
    const AUDIO_U16 : uint16;
    const AUDIO_S8 : uint16;
    const AUDIO_U8 : uint16;
  
    //ABSTRACT TYPES
    type SDL_audiostatus = 'SDL_audiostatus';
    fun eq:SDL_audiostatus * SDL_audiostatus -> bool = "$1==$2";
  
    //CSTRUCTS
    cstruct SDL_AudioCVT {
      needed: int;
      src_format: uint16;
      dst_format: uint16;
      rate_incr: double;
      buf: &uint8;
      len: int;
      len_cvt: int;
      len_mult: int;
      len_ratio: double;
      filters: &SDL_audio_h_cft_2;
      filter_index: int;
    };
    cstruct SDL_AudioSpec {
      freq: int;
      format: uint16;
      channels: uint8;
      silence: uint8;
      samples: uint16;
      padding: uint16;
      size: uint32;
      callback_: SDL_audio_h_cft_1;
      userdata: address;
    };
  
    fun get_callback: SDL_AudioSpec -> SDL_audio_h_cft_1 = "$1.callback";
  
    //C FUNCTION POINTER TYPES
    header '''typedef void (*SDL_audio_h_cft_2)(struct SDL_AudioCVT *,  Uint16);''';
    type SDL_audio_h_cft_2 = 'SDL_audio_h_cft_2';
  
    header '''typedef void (*SDL_audio_h_cft_1)(void *,  Uint8 *, int);''';
    type SDL_audio_h_cft_1 = 'SDL_audio_h_cft_1';
  
    typedef flx_audio_callback_arg_t = &uint8 * int;
    typedef flx_audio_callback_t = flx_audio_callback_arg_t -> void;
    export type (flx_audio_callback_t) as "flx_audio_callback_t";
    export type (flx_audio_callback_arg_t) as "flx_audio_callback_arg_t";
  
    header """
      void SDL_audio_callback(void *obj, Uint8 *stream, int len);
    """;
  
    body """
      // audio callback thunk
      void SDL_audio_callback(void *obj, Uint8 *stream, int len) {
        flx_audio_callback_t callback = (flx_audio_callback_t)obj;
        flx::rtl::con_t *p =
          callback->
          clone()->
          call(0,flx_audio_callback_arg_t(stream,len))
        ;
        while(p) p = p->resume();
      }
    """;
  
  // not working yet
  //  callback proc SDL_audio_callback: SDL_audio_callback * &uint8 * int;
  
    //STRUCT or UNION TAG ALIASES
  
    /*
    //TYPE ALIASES
    typedef _struct_SDL_AudioSpec = SDL_AudioSpec;
    typedef _struct_SDL_AudioCVT = SDL_AudioCVT;
    */
  
    //ENUMERATION CONSTANTS
    const SDL_AUDIO_PAUSED: SDL_audiostatus = 'SDL_AUDIO_PAUSED';
    const SDL_AUDIO_STOPPED: SDL_audiostatus = 'SDL_AUDIO_STOPPED';
    const SDL_AUDIO_PLAYING: SDL_audiostatus = 'SDL_AUDIO_PLAYING';
  
    //PROCEDURES
    proc SDL_AudioQuit: 1;
    proc SDL_CloseAudio: 1;
    proc SDL_FreeWAV: &uint8;
    proc SDL_LockAudio: 1;
    proc SDL_MixAudio: &uint8 * &uint8 * uint32 * int;
    proc SDL_PauseAudio: int;
    proc SDL_UnlockAudio: 1;
  
    //FUNCTIONS
    fun SDL_AudioDriverName: &char * int -> &char;
    fun SDL_AudioInit: &char -> int;
    fun SDL_BuildAudioCVT: &SDL_AudioCVT * uint16 * uint8 * int * uint16 * uint8 * int -> int;
    fun SDL_ConvertAudio: &SDL_AudioCVT -> int;
    fun SDL_GetAudioStatus: 1 -> SDL_audiostatus;
    fun SDL_LoadWAV_RW: &SDL_RWops * int * &SDL_AudioSpec * &&uint8 * &uint32 -> &SDL_AudioSpec;
    fun SDL_OpenAudio: &SDL_AudioSpec * &SDL_AudioSpec -> int;
    fun SDL_LoadWAV: &char * &SDL_AudioSpec * &&uint8 * &uint32 -> &SDL_AudioSpec;
  }