
#===============================================================================
# SoLoud Wrapper for RPG Maker
#-----------------------------------------------------------------------------
# Author  : Gabriel "Gab!" Teles
# License : ZLib/LibPNG
# Website : http://www.mundorpgmaker.com.br/
#-----------------------------------------------------------------------------
# Only joins "DL/*.rb" to SoLoud Ruby Wrapper in order to run on RPG Maker. 
# SoLoud wrapper for Ruby
# This file is autogenerated; any changes will be overwritten
#===============================================================================

module DL
  SEM = Mutex.new

  def set_callback_internal(proc_entry, addr_entry, argc, ty, abi = nil, &cbp)
    raise(ArgumentError, "arity should not be less than 0.") if (argc < 0)
    addr = nil

    SEM.synchronize{
      ary = proc_entry[ty]
      (0...MAX_CALLBACK).each{|n|
        idx = (n * DLSTACK_SIZE) + argc
        if( ary[idx].nil? )
          ary[idx] = cbp
          addr = addr_entry[ty][idx]
          break
        end
      }
    }

    addr
  end

  def set_cdecl_callback(ty, argc, &cbp)
    set_callback_internal(CdeclCallbackProcs, CdeclCallbackAddrs, argc, ty, &cbp)
  end

  def set_stdcall_callback(ty, argc, &cbp)
    set_callback_internal(StdcallCallbackProcs, StdcallCallbackAddrs, argc, ty, &cbp)
  end

  def remove_callback_internal(proc_entry, addr_entry, addr, ctype = nil)    
    index = nil
    if( ctype )
      addr_entry[ctype].each_with_index{|xaddr, idx|
        if( xaddr == addr )
          index = idx
        end
      }
    else
      addr_entry.each{|ty,entry|
        entry.each_with_index{|xaddr, idx|
          if( xaddr == addr )
            index = idx
          end
        }
      }
    end
    if( index and proc_entry[ctype][index] )
      proc_entry[ctype][index] = nil
      return true
    else
      return false
    end
  end

  def remove_cdecl_callback(addr, ctype = nil)
    remove_callback_internal(CdeclCallbackProcs, CdeclCallbackAddrs, addr, ctype)
  end

  def remove_stdcall_callback(addr, ctype = nil)
    remove_callback_internal(StdcallCallbackProcs, StdcallCallbackAddrs, addr, ctype)
  end

  alias set_callback set_cdecl_callback
  alias remove_callback remove_cdecl_callback

  class Stack
    def self.[](*types)
      new(types)
    end

    def initialize(types)
      parse_types(types)
    end

    def size()
      @size
    end

    def types()
      @types
    end

    def pack(ary)
      case SIZEOF_VOIDP
      when SIZEOF_LONG
        ary.pack(@template).unpack('l!*')
      when SIZEOF_LONG_LONG
        ary.pack(@template).unpack('q*')
      else
        raise(RuntimeError, "sizeof(void*)?")
      end
    end

    def unpack(ary)
      case SIZEOF_VOIDP
      when SIZEOF_LONG
        ary.pack('l!*').unpack(@template)
      when SIZEOF_LONG_LONG
        ary.pack('q*').unpack(@template)
      else
        raise(RuntimeError, "sizeof(void*)?")
      end
    end

    private

    def align(addr, align)
      d = addr % align
      if( d == 0 )
        addr
      else
        addr + (align - d)
      end
    end

    ALIGN_MAP = {
      TYPE_VOIDP => ALIGN_VOIDP,
      TYPE_CHAR  => ALIGN_VOIDP,
      TYPE_SHORT => ALIGN_VOIDP,
      TYPE_INT   => ALIGN_VOIDP,
      TYPE_LONG  => ALIGN_VOIDP,
      TYPE_FLOAT => ALIGN_FLOAT,
      TYPE_DOUBLE => ALIGN_DOUBLE,
    }

    PACK_MAP = {
      TYPE_VOIDP => ((SIZEOF_VOIDP == SIZEOF_LONG_LONG)? "q" : "l!"),
      TYPE_CHAR  => "c",
      TYPE_SHORT => "s!",
      TYPE_INT   => "i!",
      TYPE_LONG  => "l!",
      TYPE_FLOAT => "f",
      TYPE_DOUBLE => "d",
    }

    SIZE_MAP = {
      TYPE_VOIDP => SIZEOF_VOIDP,
      TYPE_CHAR  => SIZEOF_CHAR,
      TYPE_SHORT => SIZEOF_SHORT,
      TYPE_INT   => SIZEOF_INT,
      TYPE_LONG  => SIZEOF_LONG,
      TYPE_FLOAT => SIZEOF_FLOAT,
      TYPE_DOUBLE => SIZEOF_DOUBLE,
    }
    if defined?(TYPE_LONG_LONG)
      ALIGN_MAP[TYPE_LONG_LONG] = ALIGN_LONG_LONG
      PACK_MAP[TYPE_LONG_LONG] = "q"
      SIZE_MAP[TYPE_LONG_LONG] = SIZEOF_LONG_LONG
    end

    def parse_types(types)
      @types = types
      @template = ""
      addr      = 0
      types.each{|t|
        addr = add_padding(addr, ALIGN_MAP[t])
        @template << PACK_MAP[t]
        addr += SIZE_MAP[t]
      }
      addr = add_padding(addr, ALIGN_MAP[SIZEOF_VOIDP])
      if( addr % SIZEOF_VOIDP == 0 )
        @size = addr / SIZEOF_VOIDP
      else
        @size = (addr / SIZEOF_VOIDP) + 1
      end
    end

    def add_padding(addr, align)
      orig_addr = addr
      addr = align(orig_addr, align)
      d = addr - orig_addr
      if( d > 0 )
        @template << "x#{d}"
      end
      addr
    end
  end

  module PackInfo
    ALIGN_MAP = {
      TYPE_VOIDP => ALIGN_VOIDP,
      TYPE_CHAR  => ALIGN_CHAR,
      TYPE_SHORT => ALIGN_SHORT,
      TYPE_INT   => ALIGN_INT,
      TYPE_LONG  => ALIGN_LONG,
      TYPE_FLOAT => ALIGN_FLOAT,
      TYPE_DOUBLE => ALIGN_DOUBLE,
      -TYPE_CHAR  => ALIGN_CHAR,
      -TYPE_SHORT => ALIGN_SHORT,
      -TYPE_INT   => ALIGN_INT,
      -TYPE_LONG  => ALIGN_LONG,
    }

    PACK_MAP = {
      TYPE_VOIDP => ((SIZEOF_VOIDP == SIZEOF_LONG_LONG) ? "q" : "l!"),
      TYPE_CHAR  => "c",
      TYPE_SHORT => "s!",
      TYPE_INT   => "i!",
      TYPE_LONG  => "l!",
      TYPE_FLOAT => "f",
      TYPE_DOUBLE => "d",
      -TYPE_CHAR  => "c",
      -TYPE_SHORT => "s!",
      -TYPE_INT   => "i!",
      -TYPE_LONG  => "l!",
    }

    SIZE_MAP = {
      TYPE_VOIDP => SIZEOF_VOIDP,
      TYPE_CHAR  => SIZEOF_CHAR,
      TYPE_SHORT => SIZEOF_SHORT,
      TYPE_INT   => SIZEOF_INT,
      TYPE_LONG  => SIZEOF_LONG,
      TYPE_FLOAT => SIZEOF_FLOAT,
      TYPE_DOUBLE => SIZEOF_DOUBLE,
      -TYPE_CHAR  => SIZEOF_CHAR,
      -TYPE_SHORT => SIZEOF_SHORT,
      -TYPE_INT   => SIZEOF_INT,
      -TYPE_LONG  => SIZEOF_LONG,
    }
    if defined?(TYPE_LONG_LONG)
      ALIGN_MAP[TYPE_LONG_LONG] = ALIGN_MAP[-TYPE_LONG_LONG] = ALIGN_LONG_LONG
      PACK_MAP[TYPE_LONG_LONG] = PACK_MAP[-TYPE_LONG_LONG] = "q"
      SIZE_MAP[TYPE_LONG_LONG] = SIZE_MAP[-TYPE_LONG_LONG] = SIZEOF_LONG_LONG
    end

    def align(addr, align)
      d = addr % align
      if( d == 0 )
        addr
      else
        addr + (align - d)
      end
    end
    module_function :align
  end

  class Packer
    include PackInfo

    def self.[](*types)
      new(types)
    end

    def initialize(types)
      parse_types(types)
    end

    def size()
      @size
    end

    def pack(ary)
      case SIZEOF_VOIDP
      when SIZEOF_LONG
        ary.pack(@template)
      when SIZEOF_LONG_LONG
        ary.pack(@template)
      else
        raise(RuntimeError, "sizeof(void*)?")
      end
    end

    def unpack(ary)
      case SIZEOF_VOIDP
      when SIZEOF_LONG
        ary.join().unpack(@template)
      when SIZEOF_LONG_LONG
        ary.join().unpack(@template)
      else
        raise(RuntimeError, "sizeof(void*)?")
      end
    end

    private

    def parse_types(types)
      @template = ""
      addr     = 0
      types.each{|t|
        orig_addr = addr
        if( t.is_a?(Array) )
          addr = align(orig_addr, ALIGN_MAP[TYPE_VOIDP])
        else
          addr = align(orig_addr, ALIGN_MAP[t])
        end
        d = addr - orig_addr
        if( d > 0 )
          @template << "x#{d}"
        end
        if( t.is_a?(Array) )
          @template << (PACK_MAP[t[0]] * t[1])
          addr += (SIZE_MAP[t[0]] * t[1])
        else
          @template << PACK_MAP[t]
          addr += SIZE_MAP[t]
        end
      }
      addr = align(addr, ALIGN_MAP[TYPE_VOIDP])
      @size = addr
    end
  end

  module ValueUtil
    def unsigned_value(val, ty)
      case ty.abs
      when TYPE_CHAR
        [val].pack("c").unpack("C")[0]
      when TYPE_SHORT
        [val].pack("s!").unpack("S!")[0]
      when TYPE_INT
        [val].pack("i!").unpack("I!")[0]
      when TYPE_LONG
        [val].pack("l!").unpack("L!")[0]
      when TYPE_LONG_LONG
        [val].pack("q").unpack("Q")[0]
      else
        val
      end
    end

    def signed_value(val, ty)
      case ty.abs
      when TYPE_CHAR
        [val].pack("C").unpack("c")[0]
      when TYPE_SHORT
        [val].pack("S!").unpack("s!")[0]
      when TYPE_INT
        [val].pack("I!").unpack("i!")[0]
      when TYPE_LONG
        [val].pack("L!").unpack("l!")[0]
      when TYPE_LONG_LONG
        [val].pack("Q").unpack("q")[0]
      else
        val
      end
    end

    def wrap_args(args, tys, funcs, &block)
      result = []
      tys ||= []
      args.each_with_index{|arg, idx|
        result.push(wrap_arg(arg, tys[idx], funcs, &block))
      }
      result
    end

    def wrap_arg(arg, ty, funcs = [], &block)
        funcs ||= []
        case arg
        when nil
          return 0
        when CPtr
          return arg.to_i
        when IO
          case ty
          when TYPE_VOIDP
            return CPtr[arg].to_i
          else
            return arg.to_i
          end
        when Function
          if( block )
            arg.bind_at_call(&block)
            funcs.push(arg)
          elsif !arg.bound?
            raise(RuntimeError, "block must be given.")
          end
          return arg.to_i
        when String
          if( ty.is_a?(Array) )
            return arg.unpack('C*')
          else
            case SIZEOF_VOIDP
            when SIZEOF_LONG
              return [arg].pack("p").unpack("l!")[0]
            when SIZEOF_LONG_LONG
              return [arg].pack("p").unpack("q")[0]
            else
              raise(RuntimeError, "sizeof(void*)?")
            end
          end
        when Float, Integer
          return arg
        when Array
          if( ty.is_a?(Array) ) # used only by struct
            case ty[0]
            when TYPE_VOIDP
              return arg.collect{|v| Integer(v)}
            when TYPE_CHAR
              if( arg.is_a?(String) )
                return val.unpack('C*')
              end
            end
            return arg
          else
            return arg
          end
        else
          if( arg.respond_to?(:to_ptr) )
            return arg.to_ptr.to_i
          else
            begin
              return Integer(arg)
            rescue
              raise(ArgumentError, "unknown argument type: #{arg.class}")
            end
          end
        end
    end
  end

  class Function < Object
    include DL
    include ValueUtil

    def initialize cfunc, argtypes, abi = nil, &block
      @cfunc = cfunc
      @stack = Stack.new(argtypes.collect{|ty| ty.abs})
      if( @cfunc.ctype < 0 )
        @cfunc.ctype = @cfunc.ctype.abs
        @unsigned = true
      else
        @unsigned = false
      end
      if block_given?
        bind(&block)
      end
    end

    def to_i()
      @cfunc.to_i
    end

    def name
      @cfunc.name
    end

    def call(*args, &block)
      funcs = []
      _args = wrap_args(args, @stack.types, funcs, &block)
      r = @cfunc.call(@stack.pack(_args))
      funcs.each{|f| f.unbind_at_call()}
      return wrap_result(r)
    end

    def wrap_result(r)
      case @cfunc.ctype
      when TYPE_VOIDP
        r = CPtr.new(r)
      else
        if( @unsigned )
          r = unsigned_value(r, @cfunc.ctype)
        end
      end
      r
    end

    def bind(&block)
      if( !block )
        raise(RuntimeError, "block must be given.")
      end
      if( @cfunc.ptr == 0 )
        cb = Proc.new{|*args|
          ary = @stack.unpack(args)
          @stack.types.each_with_index{|ty, idx|
            case ty
            when TYPE_VOIDP
              ary[idx] = CPtr.new(ary[idx])
            end
          }
          r = block.call(*ary)
          wrap_arg(r, @cfunc.ctype, [])
        }
        case @cfunc.calltype
        when :cdecl
          @cfunc.ptr = set_cdecl_callback(@cfunc.ctype, @stack.size, &cb)
        when :stdcall
          @cfunc.ptr = set_stdcall_callback(@cfunc.ctype, @stack.size, &cb)
        else
          raise(RuntimeError, "unsupported calltype: #{@cfunc.calltype}")
        end
        if( @cfunc.ptr == 0 )
          raise(RuntimeException, "can't bind C function.")
        end
      end
    end

    def unbind()
      if( @cfunc.ptr != 0 )
        case @cfunc.calltype
        when :cdecl
          remove_cdecl_callback(@cfunc.ptr, @cfunc.ctype)
        when :stdcall
          remove_stdcall_callback(@cfunc.ptr, @cfunc.ctype)
        else
          raise(RuntimeError, "unsupported calltype: #{@cfunc.calltype}")
        end
        @cfunc.ptr = 0
      end
    end

    def bound?()
      @cfunc.ptr != 0
    end

    def bind_at_call(&block)
      bind(&block)
    end

    def unbind_at_call()
    end
  end

  class TempFunction < Function
    def bind_at_call(&block)
      bind(&block)
    end

    def unbind_at_call()
      unbind()
    end
  end

  class CarriedFunction < Function
    def initialize(cfunc, argtypes, n)
      super(cfunc, argtypes)
      @carrier = []
      @index = n
      @mutex = Mutex.new
    end

    def create_carrier(data)
      ary = []
      userdata = [ary, data]
      @mutex.lock()
      @carrier.push(userdata)
      return dlwrap(userdata)
    end

    def bind_at_call(&block)
      userdata = @carrier[-1]
      userdata[0].push(block)
      bind{|*args|
        ptr = args[@index]
        if( !ptr )
          raise(RuntimeError, "The index of userdata should be lower than #{args.size}.")
        end
        userdata = dlunwrap(Integer(ptr))
        args[@index] = userdata[1]
        userdata[0][0].call(*args)
      }
      @mutex.unlock()
    end
  end

  class CStruct
    def CStruct.entity_class()
      CStructEntity
    end
  end

  class CUnion
    def CUnion.entity_class()
      CUnionEntity
    end
  end

  module CStructBuilder
    def create(klass, types, members)
      new_class = Class.new(klass){
        define_method(:initialize){|addr|
          @entity = klass.entity_class.new(addr, types)
          @entity.assign_names(members)
        }
        define_method(:to_ptr){ @entity }
        define_method(:to_i){ @entity.to_i }
        members.each{|name|
          define_method(name){ @entity[name] }
          define_method(name + "="){|val| @entity[name] = val }
        }
      }
      size = klass.entity_class.size(types)
      new_class.module_eval(<<-EOS, __FILE__, __LINE__+1)
        def new_class.size()
          #{size}
        end
        def new_class.malloc()
          addr = DL.malloc(#{size})
          new(addr)
        end
      EOS
      return new_class
    end
    module_function :create
  end

  class CStructEntity < CPtr
    include PackInfo
    include ValueUtil

    def CStructEntity.malloc(types, func = nil)
      addr = DL.malloc(CStructEntity.size(types))
      CStructEntity.new(addr, types, func)
    end

    def CStructEntity.size(types)
      offset = 0
      max_align = 0
      types.each_with_index{|t,i|
        orig_offset = offset
        if( t.is_a?(Array) )
          align = PackInfo::ALIGN_MAP[t[0]]
          offset = PackInfo.align(orig_offset, align)
          size = offset - orig_offset
          offset += (PackInfo::SIZE_MAP[t[0]] * t[1])
        else
          align = PackInfo::ALIGN_MAP[t]
          offset = PackInfo.align(orig_offset, align)
          size = offset - orig_offset
          offset += PackInfo::SIZE_MAP[t]
        end
        if (max_align < align)
          max_align = align
        end
      }
      offset = PackInfo.align(offset, max_align)
      offset
    end

    def initialize(addr, types, func = nil)
      set_ctypes(types)
      super(addr, @size, func)
    end

    def assign_names(members)
      @members = members
    end

    def set_ctypes(types)
      @ctypes = types
      @offset = []
      offset = 0
      max_align = 0
      types.each_with_index{|t,i|
        orig_offset = offset
        if( t.is_a?(Array) )
          align = ALIGN_MAP[t[0]]
        else
          align = ALIGN_MAP[t]
        end
        offset = PackInfo.align(orig_offset, align)
        @offset[i] = offset
        if( t.is_a?(Array) )
          offset += (SIZE_MAP[t[0]] * t[1])
        else
          offset += SIZE_MAP[t]
        end
        if (max_align < align)
          max_align = align
        end
      }
      offset = PackInfo.align(offset, max_align)
      @size = offset
    end

    def [](name)
      idx = @members.index(name)
      if( idx.nil? )
        raise(ArgumentError, "no such member: #{name}")
      end
      ty = @ctypes[idx]
      if( ty.is_a?(Array) )
        r = super(@offset[idx], SIZE_MAP[ty[0]] * ty[1])
      else
        r = super(@offset[idx], SIZE_MAP[ty.abs])
      end
      packer = Packer.new([ty])
      val = packer.unpack([r])
      case ty
      when Array
        case ty[0]
        when TYPE_VOIDP
          val = val.collect{|v| CPtr.new(v)}
        end
      when TYPE_VOIDP
        val = CPtr.new(val[0])
      else
        val = val[0]
      end
      if( ty.is_a?(Integer) && (ty < 0) )
        return unsigned_value(val, ty)
      elsif( ty.is_a?(Array) && (ty[0] < 0) )
        return val.collect{|v| unsigned_value(v,ty[0])}
      else
        return val
      end
    end

    def []=(name, val)
      idx = @members.index(name)
      if( idx.nil? )
        raise(ArgumentError, "no such member: #{name}")
      end
      ty  = @ctypes[idx]
      packer = Packer.new([ty])
      val = wrap_arg(val, ty, [])
      buff = packer.pack([val].flatten())
      super(@offset[idx], buff.size, buff)
      if( ty.is_a?(Integer) && (ty < 0) )
        return unsigned_value(val, ty)
      elsif( ty.is_a?(Array) && (ty[0] < 0) )
        return val.collect{|v| unsigned_value(v,ty[0])}
      else
        return val
      end
    end

    def to_s()
      super(@size)
    end
  end

  class CUnionEntity < CStructEntity
    include PackInfo

    def CUnionEntity.malloc(types, func=nil)
      addr = DL.malloc(CUnionEntity.size(types))
      CUnionEntity.new(addr, types, func)
    end

    def CUnionEntity.size(types)
      size   = 0
      types.each_with_index{|t,i|
        if( t.is_a?(Array) )
          tsize = PackInfo::SIZE_MAP[t[0]] * t[1]
        else
          tsize = PackInfo::SIZE_MAP[t]
        end
        if( tsize > size )
          size = tsize
        end
      }
    end

    def set_ctypes(types)
      @ctypes = types
      @offset = []
      @size   = 0
      types.each_with_index{|t,i|
        @offset[i] = 0
        if( t.is_a?(Array) )
          size = SIZE_MAP[t[0]] * t[1]
        else
          size = SIZE_MAP[t]
        end
        if( size > @size )
          @size = size
        end
      }
    end
  end

  module CParser
    def parse_struct_signature(signature, tymap=nil)
      if( signature.is_a?(String) )
        signature = signature.split(/\s*,\s*/)
      end
      mems = []
      tys  = []
      signature.each{|msig|
        tks = msig.split(/\s+(\*)?/)
        ty = tks[0..-2].join(" ")
        member = tks[-1]

        case ty
        when /\[(\d+)\]/
          n = $1.to_i
          ty.gsub!(/\s*\[\d+\]/,"")
          ty = [ty, n]
        when /\[\]/
          ty.gsub!(/\s*\[\]/, "*")
        end

        case member
        when /\[(\d+)\]/
          ty = [ty, $1.to_i]
          member.gsub!(/\s*\[\d+\]/,"")
        when /\[\]/
          ty = ty + "*"
          member.gsub!(/\s*\[\]/, "")
        end

        mems.push(member)
        tys.push(parse_ctype(ty,tymap))
      }
      return tys, mems
    end

    def parse_signature(signature, tymap=nil)
      tymap ||= {}
      signature = signature.gsub(/\s+/, " ").strip
      case signature
      when /^([\w@\*\s]+)\(([\w\*\s\,\[\]]*)\)$/
        ret = $1
        (args = $2).strip!
        ret = ret.split(/\s+/)
        args = args.split(/\s*,\s*/)
        func = ret.pop
        if( func =~ /^\*/ )
          func.gsub!(/^\*+/,"")
          ret.push("*")
        end
        ret  = ret.join(" ")
        return [func, parse_ctype(ret, tymap), args.collect{|arg| parse_ctype(arg, tymap)}]
      else
        raise(RuntimeError,"can't parse the function prototype: #{signature}")
      end
    end

    def parse_ctype(ty, tymap=nil)
      tymap ||= {}
      case ty
      when Array
        return [parse_ctype(ty[0], tymap), ty[1]]
      when "void"
        return TYPE_VOID
      when "char"
        return TYPE_CHAR
      when "unsigned char"
        return  -TYPE_CHAR
      when "short"
        return TYPE_SHORT
      when "unsigned short"
        return -TYPE_SHORT
      when "int"
        return TYPE_INT
      when "unsigned int", 'uint'
        return -TYPE_INT
      when "long"
        return TYPE_LONG
      when "unsigned long"
        return -TYPE_LONG
      when "long long"
        if( defined?(TYPE_LONG_LONG) )
          return TYPE_LONG_LONG
        else
          raise(RuntimeError, "unsupported type: #{ty}")
        end
      when "unsigned long long"
        if( defined?(TYPE_LONG_LONG) )
          return -TYPE_LONG_LONG
        else
          raise(RuntimeError, "unsupported type: #{ty}")
        end
      when "float"
        return TYPE_FLOAT
      when "double"
        return TYPE_DOUBLE
      when /\*/, /\[\s*\]/
        return TYPE_VOIDP
      else
        if( tymap[ty] )
          return parse_ctype(tymap[ty], tymap)
        else
          raise(DLError, "unknown type: #{ty}")
        end
      end
    end
  end

  class CompositeHandler
    def initialize(handlers)
      @handlers = handlers
    end

    def handlers()
      @handlers
    end

    def sym(symbol)
      @handlers.each{|handle|
        if( handle )
          begin
            addr = handle.sym(symbol)
            return addr
          rescue DLError
          end
        end
      }
      return nil
    end

    def [](symbol)
      sym(symbol)
    end
  end

  module Importer
    include DL
    include CParser
    extend Importer

    def dlload(*libs)
      handles = libs.collect{|lib|
        case lib
        when nil
          nil
        when Handle
          lib
        when Importer
          lib.handlers
        else
          begin
            DL.dlopen(lib)
          rescue DLError
            raise(DLError, "can't load #{lib}")
          end
        end
      }.flatten()
      @handler = CompositeHandler.new(handles)
      @func_map = {}
      @type_alias = {}
    end

    def typealias(alias_type, orig_type)
      @type_alias[alias_type] = orig_type
    end

    def sizeof(ty)
      case ty
      when String
        ty = parse_ctype(ty, @type_alias).abs()
        case ty
        when TYPE_CHAR
          return SIZEOF_CHAR
        when TYPE_SHORT
          return SIZEOF_SHORT
        when TYPE_INT
          return SIZEOF_INT
        when TYPE_LONG
          return SIZEOF_LONG
        when TYPE_LONG_LONG
          return SIZEOF_LONG_LON
        when TYPE_FLOAT
          return SIZEOF_FLOAT
        when TYPE_DOUBLE
          return SIZEOF_DOUBLE
        when TYPE_VOIDP
          return SIZEOF_VOIDP
        else
          raise(DLError, "unknown type: #{ty}")
        end
      when Class
        if( ty.instance_methods().include?(:to_ptr) )
          return ty.size()
        end
      end
      return CPtr[ty].size()
    end

    def parse_bind_options(opts)
      h = {}
      while( opt = opts.shift() )
        case opt
        when :stdcall, :cdecl
          h[:call_type] = opt
        when :carried, :temp, :temporal, :bind
          h[:callback_type] = opt
          h[:carrier] = opts.shift()
        else
          h[opt] = true
        end
      end
      h
    end
    private :parse_bind_options

    def extern(signature, *opts)
      symname, ctype, argtype = parse_signature(signature, @type_alias)
      opt = parse_bind_options(opts)
      f = import_function(symname, ctype, argtype, opt[:call_type])
      name = symname.gsub(/@.+/,'')
      @func_map[name] = f
      
      begin
        /^(.+?):(\d+)/ =~ caller.first
        file, line = $1, $2.to_i
      rescue
        file, line = __FILE__, __LINE__+3
      end
      module_eval(<<-EOS, file, line)
        def #{name}(*args, &block)
          @func_map['#{name}'].call(*args,&block)
        end
      EOS
      module_function(name)
      f
    end

    def bind(signature, *opts, &blk)
      name, ctype, argtype = parse_signature(signature, @type_alias)
      h = parse_bind_options(opts)
      case h[:callback_type]
      when :bind, nil
        f = bind_function(name, ctype, argtype, h[:call_type], &blk)
      when :temp, :temporal
        f = create_temp_function(name, ctype, argtype, h[:call_type])
      when :carried
        f = create_carried_function(name, ctype, argtype, h[:call_type], h[:carrier])
      else
        raise(RuntimeError, "unknown callback type: #{h[:callback_type]}")
      end
      @func_map[name] = f
      begin
        /^(.+?):(\d+)/ =~ caller.first
        file, line = $1, $2.to_i
      rescue
        file, line = __FILE__, __LINE__+3
      end
      module_eval(<<-EOS, file, line)
        def #{name}(*args,&block)
          @func_map['#{name}'].call(*args,&block)
        end
      EOS
      module_function(name)
      f
    end

    def struct(signature)
      tys, mems = parse_struct_signature(signature, @type_alias)
      DL::CStructBuilder.create(CStruct, tys, mems)
    end

    def union(signature)
      tys, mems = parse_struct_signature(signature, @type_alias)
      DL::CStructBuilder.create(CUnion, tys, mems)
    end

    def [](name)
      @func_map[name]
    end

    def create_value(ty, val=nil)
      s = struct([ty + " value"])
      ptr = s.malloc()
      if( val )
        ptr.value = val
      end
      return ptr
    end
    alias value create_value

    def import_value(ty, addr)
      s = struct([ty + " value"])
      ptr = s.new(addr)
      return ptr
    end

    def handler
      @handler or raise "call dlload before importing symbols and functions"
    end

    def import_symbol(name)
      addr = handler.sym(name)
      if( !addr )
        raise(DLError, "cannot find the symbol: #{name}")
      end
      CPtr.new(addr)
    end

    def import_function(name, ctype, argtype, call_type = nil)
      addr = handler.sym(name)
      if( !addr )
        raise(DLError, "cannot find the function: #{name}()")
      end
      Function.new(CFunc.new(addr, ctype, name, call_type || :cdecl), argtype)
    end

    def bind_function(name, ctype, argtype, call_type = nil, &block)
      f = Function.new(CFunc.new(0, ctype, name, call_type || :cdecl), argtype)
      f.bind(&block)
      f
    end

    def create_temp_function(name, ctype, argtype, call_type = nil)
      TempFunction.new(CFunc.new(0, ctype, name, call_type || :cdecl), argtype)
    end

    def create_carried_function(name, ctype, argtype, call_type = nil, n = 0)
      CarriedFunction.new(CFunc.new(0, ctype, name, call_type || :cdecl), argtype, n)
    end
  end
end

module SoLoud
    module CAPI
    	extend DL::Importer
    	dlload 'system/soloud_x86.dll'

		# Enumerations
		SOLOUD_AUTO=0
		SOLOUD_SDL1=1
		SOLOUD_SDL2=2
		SOLOUD_PORTAUDIO=3
		SOLOUD_WINMM=4
		SOLOUD_XAUDIO2=5
		SOLOUD_WASAPI=6
		SOLOUD_ALSA=7
		SOLOUD_JACK=8
		SOLOUD_OSS=9
		SOLOUD_OPENAL=10
		SOLOUD_COREAUDIO=11
		SOLOUD_OPENSLES=12
		SOLOUD_VITA_HOMEBREW=13
		SOLOUD_MINIAUDIO=14
		SOLOUD_NOSOUND=15
		SOLOUD_NULLDRIVER=16
		SOLOUD_BACKEND_MAX=17
		SOLOUD_CLIP_ROUNDOFF=1
		SOLOUD_ENABLE_VISUALIZATION=2
		SOLOUD_LEFT_HANDED_3D=4
		SOLOUD_NO_FPU_REGISTER_CHANGE=8
		BASSBOOSTFILTER_WET=0
		BASSBOOSTFILTER_BOOST=1
		BIQUADRESONANTFILTER_LOWPASS=0
		BIQUADRESONANTFILTER_HIGHPASS=1
		BIQUADRESONANTFILTER_BANDPASS=2
		BIQUADRESONANTFILTER_WET=0
		BIQUADRESONANTFILTER_TYPE=1
		BIQUADRESONANTFILTER_FREQUENCY=2
		BIQUADRESONANTFILTER_RESONANCE=3
		ECHOFILTER_WET=0
		ECHOFILTER_DELAY=1
		ECHOFILTER_DECAY=2
		ECHOFILTER_FILTER=3
		FLANGERFILTER_WET=0
		FLANGERFILTER_DELAY=1
		FLANGERFILTER_FREQ=2
		FREEVERBFILTER_WET=0
		FREEVERBFILTER_FREEZE=1
		FREEVERBFILTER_ROOMSIZE=2
		FREEVERBFILTER_DAMP=3
		FREEVERBFILTER_WIDTH=4
		LOFIFILTER_WET=0
		LOFIFILTER_SAMPLERATE=1
		LOFIFILTER_BITDEPTH=2
		NOISE_WHITE=0
		NOISE_PINK=1
		NOISE_BROWNISH=2
		NOISE_BLUEISH=3
		ROBOTIZEFILTER_WET=0
		ROBOTIZEFILTER_FREQ=1
		ROBOTIZEFILTER_WAVE=2
		SFXR_COIN=0
		SFXR_LASER=1
		SFXR_EXPLOSION=2
		SFXR_POWERUP=3
		SFXR_HURT=4
		SFXR_JUMP=5
		SFXR_BLIP=6
		SPEECH_KW_SAW=0
		SPEECH_KW_TRIANGLE=1
		SPEECH_KW_SIN=2
		SPEECH_KW_SQUARE=3
		SPEECH_KW_PULSE=4
		SPEECH_KW_NOISE=5
		SPEECH_KW_WARBLE=6
		VIC_PAL=0
		VIC_NTSC=1
		VIC_BASS=0
		VIC_ALTO=1
		VIC_SOPRANO=2
		VIC_NOISE=3
		VIC_MAX_REGS=4
		WAVESHAPERFILTER_WET=0
		WAVESHAPERFILTER_AMOUNT=1

		# Raw DLL functions
		extern "void Soloud_destroy(Soloud *)"
		extern "Soloud * Soloud_create()"
		extern "int Soloud_init(Soloud *)"
		extern "int Soloud_initEx(Soloud *, unsigned int, unsigned int, unsigned int, unsigned int, unsigned int)"
		extern "void Soloud_deinit(Soloud *)"
		extern "unsigned int Soloud_getVersion(Soloud *)"
		extern "const char * Soloud_getErrorString(Soloud *, int)"
		extern "unsigned int Soloud_getBackendId(Soloud *)"
		extern "const char * Soloud_getBackendString(Soloud *)"
		extern "unsigned int Soloud_getBackendChannels(Soloud *)"
		extern "unsigned int Soloud_getBackendSamplerate(Soloud *)"
		extern "unsigned int Soloud_getBackendBufferSize(Soloud *)"
		extern "int Soloud_setSpeakerPosition(Soloud *, unsigned int, float, float, float)"
		extern "int Soloud_getSpeakerPosition(Soloud *, unsigned int, float *, float *, float *)"
		extern "unsigned int Soloud_play(Soloud *, AudioSource *)"
		extern "unsigned int Soloud_playEx(Soloud *, AudioSource *, float, float, int, unsigned int)"
		extern "unsigned int Soloud_playClocked(Soloud *, double, AudioSource *)"
		extern "unsigned int Soloud_playClockedEx(Soloud *, double, AudioSource *, float, float, unsigned int)"
		extern "unsigned int Soloud_play3d(Soloud *, AudioSource *, float, float, float)"
		extern "unsigned int Soloud_play3dEx(Soloud *, AudioSource *, float, float, float, float, float, float, float, int, unsigned int)"
		extern "unsigned int Soloud_play3dClocked(Soloud *, double, AudioSource *, float, float, float)"
		extern "unsigned int Soloud_play3dClockedEx(Soloud *, double, AudioSource *, float, float, float, float, float, float, float, unsigned int)"
		extern "unsigned int Soloud_playBackground(Soloud *, AudioSource *)"
		extern "unsigned int Soloud_playBackgroundEx(Soloud *, AudioSource *, float, int, unsigned int)"
		extern "int Soloud_seek(Soloud *, unsigned int, double)"
		extern "void Soloud_stop(Soloud *, unsigned int)"
		extern "void Soloud_stopAll(Soloud *)"
		extern "void Soloud_stopAudioSource(Soloud *, AudioSource *)"
		extern "int Soloud_countAudioSource(Soloud *, AudioSource *)"
		extern "void Soloud_setFilterParameter(Soloud *, unsigned int, unsigned int, unsigned int, float)"
		extern "float Soloud_getFilterParameter(Soloud *, unsigned int, unsigned int, unsigned int)"
		extern "void Soloud_fadeFilterParameter(Soloud *, unsigned int, unsigned int, unsigned int, float, double)"
		extern "void Soloud_oscillateFilterParameter(Soloud *, unsigned int, unsigned int, unsigned int, float, float, double)"
		extern "double Soloud_getStreamTime(Soloud *, unsigned int)"
		extern "double Soloud_getStreamPosition(Soloud *, unsigned int)"
		extern "int Soloud_getPause(Soloud *, unsigned int)"
		extern "float Soloud_getVolume(Soloud *, unsigned int)"
		extern "float Soloud_getOverallVolume(Soloud *, unsigned int)"
		extern "float Soloud_getPan(Soloud *, unsigned int)"
		extern "float Soloud_getSamplerate(Soloud *, unsigned int)"
		extern "int Soloud_getProtectVoice(Soloud *, unsigned int)"
		extern "unsigned int Soloud_getActiveVoiceCount(Soloud *)"
		extern "unsigned int Soloud_getVoiceCount(Soloud *)"
		extern "int Soloud_isValidVoiceHandle(Soloud *, unsigned int)"
		extern "float Soloud_getRelativePlaySpeed(Soloud *, unsigned int)"
		extern "float Soloud_getPostClipScaler(Soloud *)"
		extern "float Soloud_getGlobalVolume(Soloud *)"
		extern "unsigned int Soloud_getMaxActiveVoiceCount(Soloud *)"
		extern "int Soloud_getLooping(Soloud *, unsigned int)"
		extern "double Soloud_getLoopPoint(Soloud *, unsigned int)"
		extern "void Soloud_setLoopPoint(Soloud *, unsigned int, double)"
		extern "void Soloud_setLooping(Soloud *, unsigned int, int)"
		extern "int Soloud_setMaxActiveVoiceCount(Soloud *, unsigned int)"
		extern "void Soloud_setInaudibleBehavior(Soloud *, unsigned int, int, int)"
		extern "void Soloud_setGlobalVolume(Soloud *, float)"
		extern "void Soloud_setPostClipScaler(Soloud *, float)"
		extern "void Soloud_setPause(Soloud *, unsigned int, int)"
		extern "void Soloud_setPauseAll(Soloud *, int)"
		extern "int Soloud_setRelativePlaySpeed(Soloud *, unsigned int, float)"
		extern "void Soloud_setProtectVoice(Soloud *, unsigned int, int)"
		extern "void Soloud_setSamplerate(Soloud *, unsigned int, float)"
		extern "void Soloud_setPan(Soloud *, unsigned int, float)"
		extern "void Soloud_setPanAbsolute(Soloud *, unsigned int, float, float)"
		extern "void Soloud_setPanAbsoluteEx(Soloud *, unsigned int, float, float, float, float, float, float)"
		extern "void Soloud_setVolume(Soloud *, unsigned int, float)"
		extern "void Soloud_setDelaySamples(Soloud *, unsigned int, unsigned int)"
		extern "void Soloud_fadeVolume(Soloud *, unsigned int, float, double)"
		extern "void Soloud_fadePan(Soloud *, unsigned int, float, double)"
		extern "void Soloud_fadeRelativePlaySpeed(Soloud *, unsigned int, float, double)"
		extern "void Soloud_fadeGlobalVolume(Soloud *, float, double)"
		extern "void Soloud_schedulePause(Soloud *, unsigned int, double)"
		extern "void Soloud_scheduleStop(Soloud *, unsigned int, double)"
		extern "void Soloud_oscillateVolume(Soloud *, unsigned int, float, float, double)"
		extern "void Soloud_oscillatePan(Soloud *, unsigned int, float, float, double)"
		extern "void Soloud_oscillateRelativePlaySpeed(Soloud *, unsigned int, float, float, double)"
		extern "void Soloud_oscillateGlobalVolume(Soloud *, float, float, double)"
		extern "void Soloud_setGlobalFilter(Soloud *, unsigned int, Filter *)"
		extern "void Soloud_setVisualizationEnable(Soloud *, int)"
		extern "float * Soloud_calcFFT(Soloud *)"
		extern "float * Soloud_getWave(Soloud *)"
		extern "float Soloud_getApproximateVolume(Soloud *, unsigned int)"
		extern "unsigned int Soloud_getLoopCount(Soloud *, unsigned int)"
		extern "float Soloud_getInfo(Soloud *, unsigned int, unsigned int)"
		extern "unsigned int Soloud_createVoiceGroup(Soloud *)"
		extern "int Soloud_destroyVoiceGroup(Soloud *, unsigned int)"
		extern "int Soloud_addVoiceToGroup(Soloud *, unsigned int, unsigned int)"
		extern "int Soloud_isVoiceGroup(Soloud *, unsigned int)"
		extern "int Soloud_isVoiceGroupEmpty(Soloud *, unsigned int)"
		extern "void Soloud_update3dAudio(Soloud *)"
		extern "int Soloud_set3dSoundSpeed(Soloud *, float)"
		extern "float Soloud_get3dSoundSpeed(Soloud *)"
		extern "void Soloud_set3dListenerParameters(Soloud *, float, float, float, float, float, float, float, float, float)"
		extern "void Soloud_set3dListenerParametersEx(Soloud *, float, float, float, float, float, float, float, float, float, float, float, float)"
		extern "void Soloud_set3dListenerPosition(Soloud *, float, float, float)"
		extern "void Soloud_set3dListenerAt(Soloud *, float, float, float)"
		extern "void Soloud_set3dListenerUp(Soloud *, float, float, float)"
		extern "void Soloud_set3dListenerVelocity(Soloud *, float, float, float)"
		extern "void Soloud_set3dSourceParameters(Soloud *, unsigned int, float, float, float)"
		extern "void Soloud_set3dSourceParametersEx(Soloud *, unsigned int, float, float, float, float, float, float)"
		extern "void Soloud_set3dSourcePosition(Soloud *, unsigned int, float, float, float)"
		extern "void Soloud_set3dSourceVelocity(Soloud *, unsigned int, float, float, float)"
		extern "void Soloud_set3dSourceMinMaxDistance(Soloud *, unsigned int, float, float)"
		extern "void Soloud_set3dSourceAttenuation(Soloud *, unsigned int, unsigned int, float)"
		extern "void Soloud_set3dSourceDopplerFactor(Soloud *, unsigned int, float)"
		extern "void Soloud_mix(Soloud *, float *, unsigned int)"
		extern "void Soloud_mixSigned16(Soloud *, short *, unsigned int)"
		extern "void BassboostFilter_destroy(BassboostFilter *)"
		extern "int BassboostFilter_getParamCount(BassboostFilter *)"
		extern "const char * BassboostFilter_getParamName(BassboostFilter *, unsigned int)"
		extern "unsigned int BassboostFilter_getParamType(BassboostFilter *, unsigned int)"
		extern "float BassboostFilter_getParamMax(BassboostFilter *, unsigned int)"
		extern "float BassboostFilter_getParamMin(BassboostFilter *, unsigned int)"
		extern "int BassboostFilter_setParams(BassboostFilter *, float)"
		extern "BassboostFilter * BassboostFilter_create()"
		extern "void BiquadResonantFilter_destroy(BiquadResonantFilter *)"
		extern "int BiquadResonantFilter_getParamCount(BiquadResonantFilter *)"
		extern "const char * BiquadResonantFilter_getParamName(BiquadResonantFilter *, unsigned int)"
		extern "unsigned int BiquadResonantFilter_getParamType(BiquadResonantFilter *, unsigned int)"
		extern "float BiquadResonantFilter_getParamMax(BiquadResonantFilter *, unsigned int)"
		extern "float BiquadResonantFilter_getParamMin(BiquadResonantFilter *, unsigned int)"
		extern "BiquadResonantFilter * BiquadResonantFilter_create()"
		extern "int BiquadResonantFilter_setParams(BiquadResonantFilter *, int, float, float)"
		extern "void Bus_destroy(Bus *)"
		extern "Bus * Bus_create()"
		extern "void Bus_setFilter(Bus *, unsigned int, Filter *)"
		extern "unsigned int Bus_play(Bus *, AudioSource *)"
		extern "unsigned int Bus_playEx(Bus *, AudioSource *, float, float, int)"
		extern "unsigned int Bus_playClocked(Bus *, double, AudioSource *)"
		extern "unsigned int Bus_playClockedEx(Bus *, double, AudioSource *, float, float)"
		extern "unsigned int Bus_play3d(Bus *, AudioSource *, float, float, float)"
		extern "unsigned int Bus_play3dEx(Bus *, AudioSource *, float, float, float, float, float, float, float, int)"
		extern "unsigned int Bus_play3dClocked(Bus *, double, AudioSource *, float, float, float)"
		extern "unsigned int Bus_play3dClockedEx(Bus *, double, AudioSource *, float, float, float, float, float, float, float)"
		extern "int Bus_setChannels(Bus *, unsigned int)"
		extern "void Bus_setVisualizationEnable(Bus *, int)"
		extern "void Bus_annexSound(Bus *, unsigned int)"
		extern "float * Bus_calcFFT(Bus *)"
		extern "float * Bus_getWave(Bus *)"
		extern "float Bus_getApproximateVolume(Bus *, unsigned int)"
		extern "unsigned int Bus_getActiveVoiceCount(Bus *)"
		extern "void Bus_setVolume(Bus *, float)"
		extern "void Bus_setLooping(Bus *, int)"
		extern "void Bus_set3dMinMaxDistance(Bus *, float, float)"
		extern "void Bus_set3dAttenuation(Bus *, unsigned int, float)"
		extern "void Bus_set3dDopplerFactor(Bus *, float)"
		extern "void Bus_set3dListenerRelative(Bus *, int)"
		extern "void Bus_set3dDistanceDelay(Bus *, int)"
		extern "void Bus_set3dCollider(Bus *, AudioCollider *)"
		extern "void Bus_set3dColliderEx(Bus *, AudioCollider *, int)"
		extern "void Bus_set3dAttenuator(Bus *, AudioAttenuator *)"
		extern "void Bus_setInaudibleBehavior(Bus *, int, int)"
		extern "void Bus_setLoopPoint(Bus *, double)"
		extern "double Bus_getLoopPoint(Bus *)"
		extern "void Bus_stop(Bus *)"
		extern "void DCRemovalFilter_destroy(DCRemovalFilter *)"
		extern "DCRemovalFilter * DCRemovalFilter_create()"
		extern "int DCRemovalFilter_setParams(DCRemovalFilter *)"
		extern "int DCRemovalFilter_setParamsEx(DCRemovalFilter *, float)"
		extern "int DCRemovalFilter_getParamCount(DCRemovalFilter *)"
		extern "const char * DCRemovalFilter_getParamName(DCRemovalFilter *, unsigned int)"
		extern "unsigned int DCRemovalFilter_getParamType(DCRemovalFilter *, unsigned int)"
		extern "float DCRemovalFilter_getParamMax(DCRemovalFilter *, unsigned int)"
		extern "float DCRemovalFilter_getParamMin(DCRemovalFilter *, unsigned int)"
		extern "void EchoFilter_destroy(EchoFilter *)"
		extern "int EchoFilter_getParamCount(EchoFilter *)"
		extern "const char * EchoFilter_getParamName(EchoFilter *, unsigned int)"
		extern "unsigned int EchoFilter_getParamType(EchoFilter *, unsigned int)"
		extern "float EchoFilter_getParamMax(EchoFilter *, unsigned int)"
		extern "float EchoFilter_getParamMin(EchoFilter *, unsigned int)"
		extern "EchoFilter * EchoFilter_create()"
		extern "int EchoFilter_setParams(EchoFilter *, float)"
		extern "int EchoFilter_setParamsEx(EchoFilter *, float, float, float)"
		extern "void FFTFilter_destroy(FFTFilter *)"
		extern "FFTFilter * FFTFilter_create()"
		extern "int FFTFilter_getParamCount(FFTFilter *)"
		extern "const char * FFTFilter_getParamName(FFTFilter *, unsigned int)"
		extern "unsigned int FFTFilter_getParamType(FFTFilter *, unsigned int)"
		extern "float FFTFilter_getParamMax(FFTFilter *, unsigned int)"
		extern "float FFTFilter_getParamMin(FFTFilter *, unsigned int)"
		extern "void FlangerFilter_destroy(FlangerFilter *)"
		extern "int FlangerFilter_getParamCount(FlangerFilter *)"
		extern "const char * FlangerFilter_getParamName(FlangerFilter *, unsigned int)"
		extern "unsigned int FlangerFilter_getParamType(FlangerFilter *, unsigned int)"
		extern "float FlangerFilter_getParamMax(FlangerFilter *, unsigned int)"
		extern "float FlangerFilter_getParamMin(FlangerFilter *, unsigned int)"
		extern "FlangerFilter * FlangerFilter_create()"
		extern "int FlangerFilter_setParams(FlangerFilter *, float, float)"
		extern "void FreeverbFilter_destroy(FreeverbFilter *)"
		extern "int FreeverbFilter_getParamCount(FreeverbFilter *)"
		extern "const char * FreeverbFilter_getParamName(FreeverbFilter *, unsigned int)"
		extern "unsigned int FreeverbFilter_getParamType(FreeverbFilter *, unsigned int)"
		extern "float FreeverbFilter_getParamMax(FreeverbFilter *, unsigned int)"
		extern "float FreeverbFilter_getParamMin(FreeverbFilter *, unsigned int)"
		extern "FreeverbFilter * FreeverbFilter_create()"
		extern "int FreeverbFilter_setParams(FreeverbFilter *, float, float, float, float)"
		extern "void LofiFilter_destroy(LofiFilter *)"
		extern "int LofiFilter_getParamCount(LofiFilter *)"
		extern "const char * LofiFilter_getParamName(LofiFilter *, unsigned int)"
		extern "unsigned int LofiFilter_getParamType(LofiFilter *, unsigned int)"
		extern "float LofiFilter_getParamMax(LofiFilter *, unsigned int)"
		extern "float LofiFilter_getParamMin(LofiFilter *, unsigned int)"
		extern "LofiFilter * LofiFilter_create()"
		extern "int LofiFilter_setParams(LofiFilter *, float, float)"
		extern "void Monotone_destroy(Monotone *)"
		extern "Monotone * Monotone_create()"
		extern "int Monotone_setParams(Monotone *, int)"
		extern "int Monotone_setParamsEx(Monotone *, int, int)"
		extern "int Monotone_load(Monotone *, const char *)"
		extern "int Monotone_loadMem(Monotone *, const unsigned char *, unsigned int)"
		extern "int Monotone_loadMemEx(Monotone *, const unsigned char *, unsigned int, int, int)"
		extern "int Monotone_loadFile(Monotone *, File *)"
		extern "void Monotone_setVolume(Monotone *, float)"
		extern "void Monotone_setLooping(Monotone *, int)"
		extern "void Monotone_set3dMinMaxDistance(Monotone *, float, float)"
		extern "void Monotone_set3dAttenuation(Monotone *, unsigned int, float)"
		extern "void Monotone_set3dDopplerFactor(Monotone *, float)"
		extern "void Monotone_set3dListenerRelative(Monotone *, int)"
		extern "void Monotone_set3dDistanceDelay(Monotone *, int)"
		extern "void Monotone_set3dCollider(Monotone *, AudioCollider *)"
		extern "void Monotone_set3dColliderEx(Monotone *, AudioCollider *, int)"
		extern "void Monotone_set3dAttenuator(Monotone *, AudioAttenuator *)"
		extern "void Monotone_setInaudibleBehavior(Monotone *, int, int)"
		extern "void Monotone_setLoopPoint(Monotone *, double)"
		extern "double Monotone_getLoopPoint(Monotone *)"
		extern "void Monotone_setFilter(Monotone *, unsigned int, Filter *)"
		extern "void Monotone_stop(Monotone *)"
		extern "void Noise_destroy(Noise *)"
		extern "Noise * Noise_create()"
		extern "void Noise_setOctaveScale(Noise *, float, float, float, float, float, float, float, float, float, float)"
		extern "void Noise_setType(Noise *, int)"
		extern "void Noise_setVolume(Noise *, float)"
		extern "void Noise_setLooping(Noise *, int)"
		extern "void Noise_set3dMinMaxDistance(Noise *, float, float)"
		extern "void Noise_set3dAttenuation(Noise *, unsigned int, float)"
		extern "void Noise_set3dDopplerFactor(Noise *, float)"
		extern "void Noise_set3dListenerRelative(Noise *, int)"
		extern "void Noise_set3dDistanceDelay(Noise *, int)"
		extern "void Noise_set3dCollider(Noise *, AudioCollider *)"
		extern "void Noise_set3dColliderEx(Noise *, AudioCollider *, int)"
		extern "void Noise_set3dAttenuator(Noise *, AudioAttenuator *)"
		extern "void Noise_setInaudibleBehavior(Noise *, int, int)"
		extern "void Noise_setLoopPoint(Noise *, double)"
		extern "double Noise_getLoopPoint(Noise *)"
		extern "void Noise_setFilter(Noise *, unsigned int, Filter *)"
		extern "void Noise_stop(Noise *)"
		extern "void Openmpt_destroy(Openmpt *)"
		extern "Openmpt * Openmpt_create()"
		extern "int Openmpt_load(Openmpt *, const char *)"
		extern "int Openmpt_loadMem(Openmpt *, const unsigned char *, unsigned int)"
		extern "int Openmpt_loadMemEx(Openmpt *, const unsigned char *, unsigned int, int, int)"
		extern "int Openmpt_loadFile(Openmpt *, File *)"
		extern "void Openmpt_setVolume(Openmpt *, float)"
		extern "void Openmpt_setLooping(Openmpt *, int)"
		extern "void Openmpt_set3dMinMaxDistance(Openmpt *, float, float)"
		extern "void Openmpt_set3dAttenuation(Openmpt *, unsigned int, float)"
		extern "void Openmpt_set3dDopplerFactor(Openmpt *, float)"
		extern "void Openmpt_set3dListenerRelative(Openmpt *, int)"
		extern "void Openmpt_set3dDistanceDelay(Openmpt *, int)"
		extern "void Openmpt_set3dCollider(Openmpt *, AudioCollider *)"
		extern "void Openmpt_set3dColliderEx(Openmpt *, AudioCollider *, int)"
		extern "void Openmpt_set3dAttenuator(Openmpt *, AudioAttenuator *)"
		extern "void Openmpt_setInaudibleBehavior(Openmpt *, int, int)"
		extern "void Openmpt_setLoopPoint(Openmpt *, double)"
		extern "double Openmpt_getLoopPoint(Openmpt *)"
		extern "void Openmpt_setFilter(Openmpt *, unsigned int, Filter *)"
		extern "void Openmpt_stop(Openmpt *)"
		extern "void Queue_destroy(Queue *)"
		extern "Queue * Queue_create()"
		extern "int Queue_play(Queue *, AudioSource *)"
		extern "unsigned int Queue_getQueueCount(Queue *)"
		extern "int Queue_isCurrentlyPlaying(Queue *, AudioSource *)"
		extern "int Queue_setParamsFromAudioSource(Queue *, AudioSource *)"
		extern "int Queue_setParams(Queue *, float)"
		extern "int Queue_setParamsEx(Queue *, float, unsigned int)"
		extern "void Queue_setVolume(Queue *, float)"
		extern "void Queue_setLooping(Queue *, int)"
		extern "void Queue_set3dMinMaxDistance(Queue *, float, float)"
		extern "void Queue_set3dAttenuation(Queue *, unsigned int, float)"
		extern "void Queue_set3dDopplerFactor(Queue *, float)"
		extern "void Queue_set3dListenerRelative(Queue *, int)"
		extern "void Queue_set3dDistanceDelay(Queue *, int)"
		extern "void Queue_set3dCollider(Queue *, AudioCollider *)"
		extern "void Queue_set3dColliderEx(Queue *, AudioCollider *, int)"
		extern "void Queue_set3dAttenuator(Queue *, AudioAttenuator *)"
		extern "void Queue_setInaudibleBehavior(Queue *, int, int)"
		extern "void Queue_setLoopPoint(Queue *, double)"
		extern "double Queue_getLoopPoint(Queue *)"
		extern "void Queue_setFilter(Queue *, unsigned int, Filter *)"
		extern "void Queue_stop(Queue *)"
		extern "void RobotizeFilter_destroy(RobotizeFilter *)"
		extern "int RobotizeFilter_getParamCount(RobotizeFilter *)"
		extern "const char * RobotizeFilter_getParamName(RobotizeFilter *, unsigned int)"
		extern "unsigned int RobotizeFilter_getParamType(RobotizeFilter *, unsigned int)"
		extern "float RobotizeFilter_getParamMax(RobotizeFilter *, unsigned int)"
		extern "float RobotizeFilter_getParamMin(RobotizeFilter *, unsigned int)"
		extern "void RobotizeFilter_setParams(RobotizeFilter *, float, int)"
		extern "RobotizeFilter * RobotizeFilter_create()"
		extern "void Sfxr_destroy(Sfxr *)"
		extern "Sfxr * Sfxr_create()"
		extern "void Sfxr_resetParams(Sfxr *)"
		extern "int Sfxr_loadParams(Sfxr *, const char *)"
		extern "int Sfxr_loadParamsMem(Sfxr *, unsigned char *, unsigned int)"
		extern "int Sfxr_loadParamsMemEx(Sfxr *, unsigned char *, unsigned int, int, int)"
		extern "int Sfxr_loadParamsFile(Sfxr *, File *)"
		extern "int Sfxr_loadPreset(Sfxr *, int, int)"
		extern "void Sfxr_setVolume(Sfxr *, float)"
		extern "void Sfxr_setLooping(Sfxr *, int)"
		extern "void Sfxr_set3dMinMaxDistance(Sfxr *, float, float)"
		extern "void Sfxr_set3dAttenuation(Sfxr *, unsigned int, float)"
		extern "void Sfxr_set3dDopplerFactor(Sfxr *, float)"
		extern "void Sfxr_set3dListenerRelative(Sfxr *, int)"
		extern "void Sfxr_set3dDistanceDelay(Sfxr *, int)"
		extern "void Sfxr_set3dCollider(Sfxr *, AudioCollider *)"
		extern "void Sfxr_set3dColliderEx(Sfxr *, AudioCollider *, int)"
		extern "void Sfxr_set3dAttenuator(Sfxr *, AudioAttenuator *)"
		extern "void Sfxr_setInaudibleBehavior(Sfxr *, int, int)"
		extern "void Sfxr_setLoopPoint(Sfxr *, double)"
		extern "double Sfxr_getLoopPoint(Sfxr *)"
		extern "void Sfxr_setFilter(Sfxr *, unsigned int, Filter *)"
		extern "void Sfxr_stop(Sfxr *)"
		extern "void Speech_destroy(Speech *)"
		extern "Speech * Speech_create()"
		extern "int Speech_setText(Speech *, const char *)"
		extern "int Speech_setParams(Speech *)"
		extern "int Speech_setParamsEx(Speech *, unsigned int, float, float, int)"
		extern "void Speech_setVolume(Speech *, float)"
		extern "void Speech_setLooping(Speech *, int)"
		extern "void Speech_set3dMinMaxDistance(Speech *, float, float)"
		extern "void Speech_set3dAttenuation(Speech *, unsigned int, float)"
		extern "void Speech_set3dDopplerFactor(Speech *, float)"
		extern "void Speech_set3dListenerRelative(Speech *, int)"
		extern "void Speech_set3dDistanceDelay(Speech *, int)"
		extern "void Speech_set3dCollider(Speech *, AudioCollider *)"
		extern "void Speech_set3dColliderEx(Speech *, AudioCollider *, int)"
		extern "void Speech_set3dAttenuator(Speech *, AudioAttenuator *)"
		extern "void Speech_setInaudibleBehavior(Speech *, int, int)"
		extern "void Speech_setLoopPoint(Speech *, double)"
		extern "double Speech_getLoopPoint(Speech *)"
		extern "void Speech_setFilter(Speech *, unsigned int, Filter *)"
		extern "void Speech_stop(Speech *)"
		extern "void TedSid_destroy(TedSid *)"
		extern "TedSid * TedSid_create()"
		extern "int TedSid_load(TedSid *, const char *)"
		extern "int TedSid_loadToMem(TedSid *, const char *)"
		extern "int TedSid_loadMem(TedSid *, const unsigned char *, unsigned int)"
		extern "int TedSid_loadMemEx(TedSid *, const unsigned char *, unsigned int, int, int)"
		extern "int TedSid_loadFileToMem(TedSid *, File *)"
		extern "int TedSid_loadFile(TedSid *, File *)"
		extern "void TedSid_setVolume(TedSid *, float)"
		extern "void TedSid_setLooping(TedSid *, int)"
		extern "void TedSid_set3dMinMaxDistance(TedSid *, float, float)"
		extern "void TedSid_set3dAttenuation(TedSid *, unsigned int, float)"
		extern "void TedSid_set3dDopplerFactor(TedSid *, float)"
		extern "void TedSid_set3dListenerRelative(TedSid *, int)"
		extern "void TedSid_set3dDistanceDelay(TedSid *, int)"
		extern "void TedSid_set3dCollider(TedSid *, AudioCollider *)"
		extern "void TedSid_set3dColliderEx(TedSid *, AudioCollider *, int)"
		extern "void TedSid_set3dAttenuator(TedSid *, AudioAttenuator *)"
		extern "void TedSid_setInaudibleBehavior(TedSid *, int, int)"
		extern "void TedSid_setLoopPoint(TedSid *, double)"
		extern "double TedSid_getLoopPoint(TedSid *)"
		extern "void TedSid_setFilter(TedSid *, unsigned int, Filter *)"
		extern "void TedSid_stop(TedSid *)"
		extern "void Vic_destroy(Vic *)"
		extern "Vic * Vic_create()"
		extern "void Vic_setModel(Vic *, int)"
		extern "int Vic_getModel(Vic *)"
		extern "void Vic_setRegister(Vic *, int, unsigned char)"
		extern "unsigned char Vic_getRegister(Vic *, int)"
		extern "void Vic_setVolume(Vic *, float)"
		extern "void Vic_setLooping(Vic *, int)"
		extern "void Vic_set3dMinMaxDistance(Vic *, float, float)"
		extern "void Vic_set3dAttenuation(Vic *, unsigned int, float)"
		extern "void Vic_set3dDopplerFactor(Vic *, float)"
		extern "void Vic_set3dListenerRelative(Vic *, int)"
		extern "void Vic_set3dDistanceDelay(Vic *, int)"
		extern "void Vic_set3dCollider(Vic *, AudioCollider *)"
		extern "void Vic_set3dColliderEx(Vic *, AudioCollider *, int)"
		extern "void Vic_set3dAttenuator(Vic *, AudioAttenuator *)"
		extern "void Vic_setInaudibleBehavior(Vic *, int, int)"
		extern "void Vic_setLoopPoint(Vic *, double)"
		extern "double Vic_getLoopPoint(Vic *)"
		extern "void Vic_setFilter(Vic *, unsigned int, Filter *)"
		extern "void Vic_stop(Vic *)"
		extern "void Vizsn_destroy(Vizsn *)"
		extern "Vizsn * Vizsn_create()"
		extern "void Vizsn_setText(Vizsn *, char *)"
		extern "void Vizsn_setVolume(Vizsn *, float)"
		extern "void Vizsn_setLooping(Vizsn *, int)"
		extern "void Vizsn_set3dMinMaxDistance(Vizsn *, float, float)"
		extern "void Vizsn_set3dAttenuation(Vizsn *, unsigned int, float)"
		extern "void Vizsn_set3dDopplerFactor(Vizsn *, float)"
		extern "void Vizsn_set3dListenerRelative(Vizsn *, int)"
		extern "void Vizsn_set3dDistanceDelay(Vizsn *, int)"
		extern "void Vizsn_set3dCollider(Vizsn *, AudioCollider *)"
		extern "void Vizsn_set3dColliderEx(Vizsn *, AudioCollider *, int)"
		extern "void Vizsn_set3dAttenuator(Vizsn *, AudioAttenuator *)"
		extern "void Vizsn_setInaudibleBehavior(Vizsn *, int, int)"
		extern "void Vizsn_setLoopPoint(Vizsn *, double)"
		extern "double Vizsn_getLoopPoint(Vizsn *)"
		extern "void Vizsn_setFilter(Vizsn *, unsigned int, Filter *)"
		extern "void Vizsn_stop(Vizsn *)"
		extern "void Wav_destroy(Wav *)"
		extern "Wav * Wav_create()"
		extern "int Wav_load(Wav *, const char *)"
		extern "int Wav_loadMem(Wav *, const unsigned char *, unsigned int)"
		extern "int Wav_loadMemEx(Wav *, const unsigned char *, unsigned int, int, int)"
		extern "int Wav_loadFile(Wav *, File *)"
		extern "int Wav_loadRawWave8(Wav *, unsigned char *, unsigned int)"
		extern "int Wav_loadRawWave8Ex(Wav *, unsigned char *, unsigned int, float, unsigned int)"
		extern "int Wav_loadRawWave16(Wav *, short *, unsigned int)"
		extern "int Wav_loadRawWave16Ex(Wav *, short *, unsigned int, float, unsigned int)"
		extern "int Wav_loadRawWave(Wav *, float *, unsigned int)"
		extern "int Wav_loadRawWaveEx(Wav *, float *, unsigned int, float, unsigned int, int, int)"
		extern "double Wav_getLength(Wav *)"
		extern "void Wav_setVolume(Wav *, float)"
		extern "void Wav_setLooping(Wav *, int)"
		extern "void Wav_set3dMinMaxDistance(Wav *, float, float)"
		extern "void Wav_set3dAttenuation(Wav *, unsigned int, float)"
		extern "void Wav_set3dDopplerFactor(Wav *, float)"
		extern "void Wav_set3dListenerRelative(Wav *, int)"
		extern "void Wav_set3dDistanceDelay(Wav *, int)"
		extern "void Wav_set3dCollider(Wav *, AudioCollider *)"
		extern "void Wav_set3dColliderEx(Wav *, AudioCollider *, int)"
		extern "void Wav_set3dAttenuator(Wav *, AudioAttenuator *)"
		extern "void Wav_setInaudibleBehavior(Wav *, int, int)"
		extern "void Wav_setLoopPoint(Wav *, double)"
		extern "double Wav_getLoopPoint(Wav *)"
		extern "void Wav_setFilter(Wav *, unsigned int, Filter *)"
		extern "void Wav_stop(Wav *)"
		extern "void WaveShaperFilter_destroy(WaveShaperFilter *)"
		extern "int WaveShaperFilter_setParams(WaveShaperFilter *, float)"
		extern "WaveShaperFilter * WaveShaperFilter_create()"
		extern "int WaveShaperFilter_getParamCount(WaveShaperFilter *)"
		extern "const char * WaveShaperFilter_getParamName(WaveShaperFilter *, unsigned int)"
		extern "unsigned int WaveShaperFilter_getParamType(WaveShaperFilter *, unsigned int)"
		extern "float WaveShaperFilter_getParamMax(WaveShaperFilter *, unsigned int)"
		extern "float WaveShaperFilter_getParamMin(WaveShaperFilter *, unsigned int)"
		extern "void WavStream_destroy(WavStream *)"
		extern "WavStream * WavStream_create()"
		extern "int WavStream_load(WavStream *, const char *)"
		extern "int WavStream_loadMem(WavStream *, const unsigned char *, unsigned int)"
		extern "int WavStream_loadMemEx(WavStream *, const unsigned char *, unsigned int, int, int)"
		extern "int WavStream_loadToMem(WavStream *, const char *)"
		extern "int WavStream_loadFile(WavStream *, File *)"
		extern "int WavStream_loadFileToMem(WavStream *, File *)"
		extern "double WavStream_getLength(WavStream *)"
		extern "void WavStream_setVolume(WavStream *, float)"
		extern "void WavStream_setLooping(WavStream *, int)"
		extern "void WavStream_set3dMinMaxDistance(WavStream *, float, float)"
		extern "void WavStream_set3dAttenuation(WavStream *, unsigned int, float)"
		extern "void WavStream_set3dDopplerFactor(WavStream *, float)"
		extern "void WavStream_set3dListenerRelative(WavStream *, int)"
		extern "void WavStream_set3dDistanceDelay(WavStream *, int)"
		extern "void WavStream_set3dCollider(WavStream *, AudioCollider *)"
		extern "void WavStream_set3dColliderEx(WavStream *, AudioCollider *, int)"
		extern "void WavStream_set3dAttenuator(WavStream *, AudioAttenuator *)"
		extern "void WavStream_setInaudibleBehavior(WavStream *, int, int)"
		extern "void WavStream_setLoopPoint(WavStream *, double)"
		extern "double WavStream_getLoopPoint(WavStream *)"
		extern "void WavStream_setFilter(WavStream *, unsigned int, Filter *)"
		extern "void WavStream_stop(WavStream *)"
	end


	# OOP wrappers

	class Soloud
		@objhandle=nil
		attr_accessor :objhandle
		AUTO=0
		SDL1=1
		SDL2=2
		PORTAUDIO=3
		WINMM=4
		XAUDIO2=5
		WASAPI=6
		ALSA=7
		JACK=8
		OSS=9
		OPENAL=10
		COREAUDIO=11
		OPENSLES=12
		VITA_HOMEBREW=13
		MINIAUDIO=14
		NOSOUND=15
		NULLDRIVER=16
		BACKEND_MAX=17
		CLIP_ROUNDOFF=1
		ENABLE_VISUALIZATION=2
		LEFT_HANDED_3D=4
		NO_FPU_REGISTER_CHANGE=8
		def initialize(*args)
			@objhandle = SoLoud::CAPI.Soloud_create()
		end
		def destroy()
			SoLoud::CAPI.Soloud_destroy(@objhandle)
		end
	def init(aFlags=CLIP_ROUNDOFF, aBackend=AUTO, aSamplerate=AUTO, aBufferSize=AUTO, aChannels=2)
		SoLoud::CAPI.Soloud_initEx(@objhandle, aFlags, aBackend, aSamplerate, aBufferSize, aChannels)
		end
	def deinit()
		SoLoud::CAPI.Soloud_deinit(@objhandle)
		end
	def get_version()
		SoLoud::CAPI.Soloud_getVersion(@objhandle)
		end
	def get_error_string(aErrorCode)
		SoLoud::CAPI.Soloud_getErrorString(@objhandle, aErrorCode)
		end
	def get_backend_id()
		SoLoud::CAPI.Soloud_getBackendId(@objhandle)
		end
	def get_backend_string()
		SoLoud::CAPI.Soloud_getBackendString(@objhandle)
		end
	def get_backend_channels()
		SoLoud::CAPI.Soloud_getBackendChannels(@objhandle)
		end
	def get_backend_samplerate()
		SoLoud::CAPI.Soloud_getBackendSamplerate(@objhandle)
		end
	def get_backend_buffer_size()
		SoLoud::CAPI.Soloud_getBackendBufferSize(@objhandle)
		end
	def set_speaker_position(aChannel, aX, aY, aZ)
		SoLoud::CAPI.Soloud_setSpeakerPosition(@objhandle, aChannel, aX, aY, aZ)
		end
	def get_speaker_position(aChannel, aX, aY, aZ)
		SoLoud::CAPI.Soloud_getSpeakerPosition(@objhandle, aChannel, aX, aY, aZ)
		end
	def play(aSound, aVolume=-1.0, aPan=0.0, aPaused=0, aBus=0)
		SoLoud::CAPI.Soloud_playEx(@objhandle, aSound.objhandle, aVolume, aPan, aPaused, aBus)
		end
	def play_clocked(aSoundTime, aSound, aVolume=-1.0, aPan=0.0, aBus=0)
		SoLoud::CAPI.Soloud_playClockedEx(@objhandle, aSoundTime, aSound.objhandle, aVolume, aPan, aBus)
		end
	def play_3d(aSound, aPosX, aPosY, aPosZ, aVelX=0.0, aVelY=0.0, aVelZ=0.0, aVolume=1.0, aPaused=0, aBus=0)
		SoLoud::CAPI.Soloud_play3dEx(@objhandle, aSound.objhandle, aPosX, aPosY, aPosZ, aVelX, aVelY, aVelZ, aVolume, aPaused, aBus)
		end
	def play_3d_clocked(aSoundTime, aSound, aPosX, aPosY, aPosZ, aVelX=0.0, aVelY=0.0, aVelZ=0.0, aVolume=1.0, aBus=0)
		SoLoud::CAPI.Soloud_play3dClockedEx(@objhandle, aSoundTime, aSound.objhandle, aPosX, aPosY, aPosZ, aVelX, aVelY, aVelZ, aVolume, aBus)
		end
	def play_background(aSound, aVolume=-1.0, aPaused=0, aBus=0)
		SoLoud::CAPI.Soloud_playBackgroundEx(@objhandle, aSound.objhandle, aVolume, aPaused, aBus)
		end
	def seek(aVoiceHandle, aSeconds)
		SoLoud::CAPI.Soloud_seek(@objhandle, aVoiceHandle, aSeconds)
		end
	def stop(aVoiceHandle)
		SoLoud::CAPI.Soloud_stop(@objhandle, aVoiceHandle)
		end
	def stop_all()
		SoLoud::CAPI.Soloud_stopAll(@objhandle)
		end
	def stop_audio_source(aSound)
		SoLoud::CAPI.Soloud_stopAudioSource(@objhandle, aSound.objhandle)
		end
	def count_audio_source(aSound)
		SoLoud::CAPI.Soloud_countAudioSource(@objhandle, aSound.objhandle)
		end
	def set_filter_parameter(aVoiceHandle, aFilterId, aAttributeId, aValue)
		SoLoud::CAPI.Soloud_setFilterParameter(@objhandle, aVoiceHandle, aFilterId, aAttributeId, aValue)
		end
	def get_filter_parameter(aVoiceHandle, aFilterId, aAttributeId)
		SoLoud::CAPI.Soloud_getFilterParameter(@objhandle, aVoiceHandle, aFilterId, aAttributeId)
		end
	def fade_filter_parameter(aVoiceHandle, aFilterId, aAttributeId, aTo, aTime)
		SoLoud::CAPI.Soloud_fadeFilterParameter(@objhandle, aVoiceHandle, aFilterId, aAttributeId, aTo, aTime)
		end
	def oscillate_filter_parameter(aVoiceHandle, aFilterId, aAttributeId, aFrom, aTo, aTime)
		SoLoud::CAPI.Soloud_oscillateFilterParameter(@objhandle, aVoiceHandle, aFilterId, aAttributeId, aFrom, aTo, aTime)
		end
	def get_stream_time(aVoiceHandle)
		SoLoud::CAPI.Soloud_getStreamTime(@objhandle, aVoiceHandle)
		end
	def get_stream_position(aVoiceHandle)
		SoLoud::CAPI.Soloud_getStreamPosition(@objhandle, aVoiceHandle)
		end
	def get_pause(aVoiceHandle)
		SoLoud::CAPI.Soloud_getPause(@objhandle, aVoiceHandle)
		end
	def get_volume(aVoiceHandle)
		SoLoud::CAPI.Soloud_getVolume(@objhandle, aVoiceHandle)
		end
	def get_overall_volume(aVoiceHandle)
		SoLoud::CAPI.Soloud_getOverallVolume(@objhandle, aVoiceHandle)
		end
	def get_pan(aVoiceHandle)
		SoLoud::CAPI.Soloud_getPan(@objhandle, aVoiceHandle)
		end
	def get_samplerate(aVoiceHandle)
		SoLoud::CAPI.Soloud_getSamplerate(@objhandle, aVoiceHandle)
		end
	def get_protect_voice(aVoiceHandle)
		SoLoud::CAPI.Soloud_getProtectVoice(@objhandle, aVoiceHandle)
		end
	def get_active_voice_count()
		SoLoud::CAPI.Soloud_getActiveVoiceCount(@objhandle)
		end
	def get_voice_count()
		SoLoud::CAPI.Soloud_getVoiceCount(@objhandle)
		end
	def is_valid_voice_handle(aVoiceHandle)
		SoLoud::CAPI.Soloud_isValidVoiceHandle(@objhandle, aVoiceHandle)
		end
	def get_relative_play_speed(aVoiceHandle)
		SoLoud::CAPI.Soloud_getRelativePlaySpeed(@objhandle, aVoiceHandle)
		end
	def get_post_clip_scaler()
		SoLoud::CAPI.Soloud_getPostClipScaler(@objhandle)
		end
	def get_global_volume()
		SoLoud::CAPI.Soloud_getGlobalVolume(@objhandle)
		end
	def get_max_active_voice_count()
		SoLoud::CAPI.Soloud_getMaxActiveVoiceCount(@objhandle)
		end
	def get_looping(aVoiceHandle)
		SoLoud::CAPI.Soloud_getLooping(@objhandle, aVoiceHandle)
		end
	def get_loop_point(aVoiceHandle)
		SoLoud::CAPI.Soloud_getLoopPoint(@objhandle, aVoiceHandle)
		end
	def set_loop_point(aVoiceHandle, aLoopPoint)
		SoLoud::CAPI.Soloud_setLoopPoint(@objhandle, aVoiceHandle, aLoopPoint)
		end
	def set_looping(aVoiceHandle, aLooping)
		SoLoud::CAPI.Soloud_setLooping(@objhandle, aVoiceHandle, aLooping)
		end
	def set_max_active_voice_count(aVoiceCount)
		SoLoud::CAPI.Soloud_setMaxActiveVoiceCount(@objhandle, aVoiceCount)
		end
	def set_inaudible_behavior(aVoiceHandle, aMustTick, aKill)
		SoLoud::CAPI.Soloud_setInaudibleBehavior(@objhandle, aVoiceHandle, aMustTick, aKill)
		end
	def set_global_volume(aVolume)
		SoLoud::CAPI.Soloud_setGlobalVolume(@objhandle, aVolume)
		end
	def set_post_clip_scaler(aScaler)
		SoLoud::CAPI.Soloud_setPostClipScaler(@objhandle, aScaler)
		end
	def set_pause(aVoiceHandle, aPause)
		SoLoud::CAPI.Soloud_setPause(@objhandle, aVoiceHandle, aPause)
		end
	def set_pause_all(aPause)
		SoLoud::CAPI.Soloud_setPauseAll(@objhandle, aPause)
		end
	def set_relative_play_speed(aVoiceHandle, aSpeed)
		SoLoud::CAPI.Soloud_setRelativePlaySpeed(@objhandle, aVoiceHandle, aSpeed)
		end
	def set_protect_voice(aVoiceHandle, aProtect)
		SoLoud::CAPI.Soloud_setProtectVoice(@objhandle, aVoiceHandle, aProtect)
		end
	def set_samplerate(aVoiceHandle, aSamplerate)
		SoLoud::CAPI.Soloud_setSamplerate(@objhandle, aVoiceHandle, aSamplerate)
		end
	def set_pan(aVoiceHandle, aPan)
		SoLoud::CAPI.Soloud_setPan(@objhandle, aVoiceHandle, aPan)
		end
	def set_pan_absolute(aVoiceHandle, aLVolume, aRVolume, aLBVolume=0, aRBVolume=0, aCVolume=0, aSVolume=0)
		SoLoud::CAPI.Soloud_setPanAbsoluteEx(@objhandle, aVoiceHandle, aLVolume, aRVolume, aLBVolume, aRBVolume, aCVolume, aSVolume)
		end
	def set_volume(aVoiceHandle, aVolume)
		SoLoud::CAPI.Soloud_setVolume(@objhandle, aVoiceHandle, aVolume)
		end
	def set_delay_samples(aVoiceHandle, aSamples)
		SoLoud::CAPI.Soloud_setDelaySamples(@objhandle, aVoiceHandle, aSamples)
		end
	def fade_volume(aVoiceHandle, aTo, aTime)
		SoLoud::CAPI.Soloud_fadeVolume(@objhandle, aVoiceHandle, aTo, aTime)
		end
	def fade_pan(aVoiceHandle, aTo, aTime)
		SoLoud::CAPI.Soloud_fadePan(@objhandle, aVoiceHandle, aTo, aTime)
		end
	def fade_relative_play_speed(aVoiceHandle, aTo, aTime)
		SoLoud::CAPI.Soloud_fadeRelativePlaySpeed(@objhandle, aVoiceHandle, aTo, aTime)
		end
	def fade_global_volume(aTo, aTime)
		SoLoud::CAPI.Soloud_fadeGlobalVolume(@objhandle, aTo, aTime)
		end
	def schedule_pause(aVoiceHandle, aTime)
		SoLoud::CAPI.Soloud_schedulePause(@objhandle, aVoiceHandle, aTime)
		end
	def schedule_stop(aVoiceHandle, aTime)
		SoLoud::CAPI.Soloud_scheduleStop(@objhandle, aVoiceHandle, aTime)
		end
	def oscillate_volume(aVoiceHandle, aFrom, aTo, aTime)
		SoLoud::CAPI.Soloud_oscillateVolume(@objhandle, aVoiceHandle, aFrom, aTo, aTime)
		end
	def oscillate_pan(aVoiceHandle, aFrom, aTo, aTime)
		SoLoud::CAPI.Soloud_oscillatePan(@objhandle, aVoiceHandle, aFrom, aTo, aTime)
		end
	def oscillate_relative_play_speed(aVoiceHandle, aFrom, aTo, aTime)
		SoLoud::CAPI.Soloud_oscillateRelativePlaySpeed(@objhandle, aVoiceHandle, aFrom, aTo, aTime)
		end
	def oscillate_global_volume(aFrom, aTo, aTime)
		SoLoud::CAPI.Soloud_oscillateGlobalVolume(@objhandle, aFrom, aTo, aTime)
		end
	def set_global_filter(aFilterId, aFilter)
		SoLoud::CAPI.Soloud_setGlobalFilter(@objhandle, aFilterId, aFilter.objhandle)
		end
	def set_visualization_enable(aEnable)
		SoLoud::CAPI.Soloud_setVisualizationEnable(@objhandle, aEnable)
		end
	def calc_fft()
		SoLoud::CAPI.Soloud_calcFFT(@objhandle)
		end
	def get_wave()
		SoLoud::CAPI.Soloud_getWave(@objhandle)
		end
	def get_approximate_volume(aChannel)
		SoLoud::CAPI.Soloud_getApproximateVolume(@objhandle, aChannel)
		end
	def get_loop_count(aVoiceHandle)
		SoLoud::CAPI.Soloud_getLoopCount(@objhandle, aVoiceHandle)
		end
	def get_info(aVoiceHandle, aInfoKey)
		SoLoud::CAPI.Soloud_getInfo(@objhandle, aVoiceHandle, aInfoKey)
		end
	def create_voice_group()
		SoLoud::CAPI.Soloud_createVoiceGroup(@objhandle)
		end
	def destroy_voice_group(aVoiceGroupHandle)
		SoLoud::CAPI.Soloud_destroyVoiceGroup(@objhandle, aVoiceGroupHandle)
		end
	def add_voice_to_group(aVoiceGroupHandle, aVoiceHandle)
		SoLoud::CAPI.Soloud_addVoiceToGroup(@objhandle, aVoiceGroupHandle, aVoiceHandle)
		end
	def is_voice_group(aVoiceGroupHandle)
		SoLoud::CAPI.Soloud_isVoiceGroup(@objhandle, aVoiceGroupHandle)
		end
	def is_voice_group_empty(aVoiceGroupHandle)
		SoLoud::CAPI.Soloud_isVoiceGroupEmpty(@objhandle, aVoiceGroupHandle)
		end
	def update_3d_audio()
		SoLoud::CAPI.Soloud_update3dAudio(@objhandle)
		end
	def set_3d_sound_speed(aSpeed)
		SoLoud::CAPI.Soloud_set3dSoundSpeed(@objhandle, aSpeed)
		end
	def get_3d_sound_speed()
		SoLoud::CAPI.Soloud_get3dSoundSpeed(@objhandle)
		end
	def set_3d_listener_parameters(aPosX, aPosY, aPosZ, aAtX, aAtY, aAtZ, aUpX, aUpY, aUpZ, aVelocityX=0.0, aVelocityY=0.0, aVelocityZ=0.0)
		SoLoud::CAPI.Soloud_set3dListenerParametersEx(@objhandle, aPosX, aPosY, aPosZ, aAtX, aAtY, aAtZ, aUpX, aUpY, aUpZ, aVelocityX, aVelocityY, aVelocityZ)
		end
	def set_3d_listener_position(aPosX, aPosY, aPosZ)
		SoLoud::CAPI.Soloud_set3dListenerPosition(@objhandle, aPosX, aPosY, aPosZ)
		end
	def set_3d_listener_at(aAtX, aAtY, aAtZ)
		SoLoud::CAPI.Soloud_set3dListenerAt(@objhandle, aAtX, aAtY, aAtZ)
		end
	def set_3d_listener_up(aUpX, aUpY, aUpZ)
		SoLoud::CAPI.Soloud_set3dListenerUp(@objhandle, aUpX, aUpY, aUpZ)
		end
	def set_3d_listener_velocity(aVelocityX, aVelocityY, aVelocityZ)
		SoLoud::CAPI.Soloud_set3dListenerVelocity(@objhandle, aVelocityX, aVelocityY, aVelocityZ)
		end
	def set_3d_source_parameters(aVoiceHandle, aPosX, aPosY, aPosZ, aVelocityX=0.0, aVelocityY=0.0, aVelocityZ=0.0)
		SoLoud::CAPI.Soloud_set3dSourceParametersEx(@objhandle, aVoiceHandle, aPosX, aPosY, aPosZ, aVelocityX, aVelocityY, aVelocityZ)
		end
	def set_3d_source_position(aVoiceHandle, aPosX, aPosY, aPosZ)
		SoLoud::CAPI.Soloud_set3dSourcePosition(@objhandle, aVoiceHandle, aPosX, aPosY, aPosZ)
		end
	def set_3d_source_velocity(aVoiceHandle, aVelocityX, aVelocityY, aVelocityZ)
		SoLoud::CAPI.Soloud_set3dSourceVelocity(@objhandle, aVoiceHandle, aVelocityX, aVelocityY, aVelocityZ)
		end
	def set_3d_source_min_max_distance(aVoiceHandle, aMinDistance, aMaxDistance)
		SoLoud::CAPI.Soloud_set3dSourceMinMaxDistance(@objhandle, aVoiceHandle, aMinDistance, aMaxDistance)
		end
	def set_3d_source_attenuation(aVoiceHandle, aAttenuationModel, aAttenuationRolloffFactor)
		SoLoud::CAPI.Soloud_set3dSourceAttenuation(@objhandle, aVoiceHandle, aAttenuationModel, aAttenuationRolloffFactor)
		end
	def set_3d_source_doppler_factor(aVoiceHandle, aDopplerFactor)
		SoLoud::CAPI.Soloud_set3dSourceDopplerFactor(@objhandle, aVoiceHandle, aDopplerFactor)
		end
	def mix(aBuffer, aSamples)
		SoLoud::CAPI.Soloud_mix(@objhandle, aBuffer, aSamples)
		end
	def mix_signed16(aBuffer, aSamples)
		SoLoud::CAPI.Soloud_mixSigned16(@objhandle, aBuffer, aSamples)
		end
	end

	class BassboostFilter
		@objhandle=nil
		attr_accessor :objhandle
		WET=0
		BOOST=1
		def initialize(*args)
			@objhandle = SoLoud::CAPI.BassboostFilter_create()
		end
		def destroy()
			SoLoud::CAPI.BassboostFilter_destroy(@objhandle)
		end
	def get_param_count()
		SoLoud::CAPI.BassboostFilter_getParamCount(@objhandle)
		end
	def get_param_name(aParamIndex)
		SoLoud::CAPI.BassboostFilter_getParamName(@objhandle, aParamIndex)
		end
	def get_param_type(aParamIndex)
		SoLoud::CAPI.BassboostFilter_getParamType(@objhandle, aParamIndex)
		end
	def get_param_max(aParamIndex)
		SoLoud::CAPI.BassboostFilter_getParamMax(@objhandle, aParamIndex)
		end
	def get_param_min(aParamIndex)
		SoLoud::CAPI.BassboostFilter_getParamMin(@objhandle, aParamIndex)
		end
	def set_params(aBoost)
		SoLoud::CAPI.BassboostFilter_setParams(@objhandle, aBoost)
		end
	end

	class BiquadResonantFilter
		@objhandle=nil
		attr_accessor :objhandle
		LOWPASS=0
		HIGHPASS=1
		BANDPASS=2
		WET=0
		TYPE=1
		FREQUENCY=2
		RESONANCE=3
		def initialize(*args)
			@objhandle = SoLoud::CAPI.BiquadResonantFilter_create()
		end
		def destroy()
			SoLoud::CAPI.BiquadResonantFilter_destroy(@objhandle)
		end
	def get_param_count()
		SoLoud::CAPI.BiquadResonantFilter_getParamCount(@objhandle)
		end
	def get_param_name(aParamIndex)
		SoLoud::CAPI.BiquadResonantFilter_getParamName(@objhandle, aParamIndex)
		end
	def get_param_type(aParamIndex)
		SoLoud::CAPI.BiquadResonantFilter_getParamType(@objhandle, aParamIndex)
		end
	def get_param_max(aParamIndex)
		SoLoud::CAPI.BiquadResonantFilter_getParamMax(@objhandle, aParamIndex)
		end
	def get_param_min(aParamIndex)
		SoLoud::CAPI.BiquadResonantFilter_getParamMin(@objhandle, aParamIndex)
		end
	def set_params(aType, aFrequency, aResonance)
		SoLoud::CAPI.BiquadResonantFilter_setParams(@objhandle, aType, aFrequency, aResonance)
		end
	end

	class Bus
		@objhandle=nil
		attr_accessor :objhandle
		def initialize(*args)
			@objhandle = SoLoud::CAPI.Bus_create()
		end
		def destroy()
			SoLoud::CAPI.Bus_destroy(@objhandle)
		end
	def set_filter(aFilterId, aFilter)
		SoLoud::CAPI.Bus_setFilter(@objhandle, aFilterId, aFilter.objhandle)
		end
	def play(aSound, aVolume=1.0, aPan=0.0, aPaused=0)
		SoLoud::CAPI.Bus_playEx(@objhandle, aSound.objhandle, aVolume, aPan, aPaused)
		end
	def play_clocked(aSoundTime, aSound, aVolume=1.0, aPan=0.0)
		SoLoud::CAPI.Bus_playClockedEx(@objhandle, aSoundTime, aSound.objhandle, aVolume, aPan)
		end
	def play_3d(aSound, aPosX, aPosY, aPosZ, aVelX=0.0, aVelY=0.0, aVelZ=0.0, aVolume=1.0, aPaused=0)
		SoLoud::CAPI.Bus_play3dEx(@objhandle, aSound.objhandle, aPosX, aPosY, aPosZ, aVelX, aVelY, aVelZ, aVolume, aPaused)
		end
	def play_3d_clocked(aSoundTime, aSound, aPosX, aPosY, aPosZ, aVelX=0.0, aVelY=0.0, aVelZ=0.0, aVolume=1.0)
		SoLoud::CAPI.Bus_play3dClockedEx(@objhandle, aSoundTime, aSound.objhandle, aPosX, aPosY, aPosZ, aVelX, aVelY, aVelZ, aVolume)
		end
	def set_channels(aChannels)
		SoLoud::CAPI.Bus_setChannels(@objhandle, aChannels)
		end
	def set_visualization_enable(aEnable)
		SoLoud::CAPI.Bus_setVisualizationEnable(@objhandle, aEnable)
		end
	def annex_sound(aVoiceHandle)
		SoLoud::CAPI.Bus_annexSound(@objhandle, aVoiceHandle)
		end
	def calc_fft()
		SoLoud::CAPI.Bus_calcFFT(@objhandle)
		end
	def get_wave()
		SoLoud::CAPI.Bus_getWave(@objhandle)
		end
	def get_approximate_volume(aChannel)
		SoLoud::CAPI.Bus_getApproximateVolume(@objhandle, aChannel)
		end
	def get_active_voice_count()
		SoLoud::CAPI.Bus_getActiveVoiceCount(@objhandle)
		end
	def set_volume(aVolume)
		SoLoud::CAPI.Bus_setVolume(@objhandle, aVolume)
		end
	def set_looping(aLoop)
		SoLoud::CAPI.Bus_setLooping(@objhandle, aLoop)
		end
	def set_3d_min_max_distance(aMinDistance, aMaxDistance)
		SoLoud::CAPI.Bus_set3dMinMaxDistance(@objhandle, aMinDistance, aMaxDistance)
		end
	def set_3d_attenuation(aAttenuationModel, aAttenuationRolloffFactor)
		SoLoud::CAPI.Bus_set3dAttenuation(@objhandle, aAttenuationModel, aAttenuationRolloffFactor)
		end
	def set_3d_doppler_factor(aDopplerFactor)
		SoLoud::CAPI.Bus_set3dDopplerFactor(@objhandle, aDopplerFactor)
		end
	def set_3d_listener_relative(aListenerRelative)
		SoLoud::CAPI.Bus_set3dListenerRelative(@objhandle, aListenerRelative)
		end
	def set_3d_distance_delay(aDistanceDelay)
		SoLoud::CAPI.Bus_set3dDistanceDelay(@objhandle, aDistanceDelay)
		end
	def set_3d_collider(aCollider, aUserData=0)
		SoLoud::CAPI.Bus_set3dColliderEx(@objhandle, aCollider.objhandle, aUserData)
		end
	def set_3d_attenuator(aAttenuator)
		SoLoud::CAPI.Bus_set3dAttenuator(@objhandle, aAttenuator.objhandle)
		end
	def set_inaudible_behavior(aMustTick, aKill)
		SoLoud::CAPI.Bus_setInaudibleBehavior(@objhandle, aMustTick, aKill)
		end
	def set_loop_point(aLoopPoint)
		SoLoud::CAPI.Bus_setLoopPoint(@objhandle, aLoopPoint)
		end
	def get_loop_point()
		SoLoud::CAPI.Bus_getLoopPoint(@objhandle)
		end
	def stop()
		SoLoud::CAPI.Bus_stop(@objhandle)
		end
	end

	class DCRemovalFilter
		@objhandle=nil
		attr_accessor :objhandle
		def initialize(*args)
			@objhandle = SoLoud::CAPI.DCRemovalFilter_create()
		end
		def destroy()
			SoLoud::CAPI.DCRemovalFilter_destroy(@objhandle)
		end
	def set_params(aLength=0.1)
		SoLoud::CAPI.DCRemovalFilter_setParamsEx(@objhandle, aLength)
		end
	def get_param_count()
		SoLoud::CAPI.DCRemovalFilter_getParamCount(@objhandle)
		end
	def get_param_name(aParamIndex)
		SoLoud::CAPI.DCRemovalFilter_getParamName(@objhandle, aParamIndex)
		end
	def get_param_type(aParamIndex)
		SoLoud::CAPI.DCRemovalFilter_getParamType(@objhandle, aParamIndex)
		end
	def get_param_max(aParamIndex)
		SoLoud::CAPI.DCRemovalFilter_getParamMax(@objhandle, aParamIndex)
		end
	def get_param_min(aParamIndex)
		SoLoud::CAPI.DCRemovalFilter_getParamMin(@objhandle, aParamIndex)
		end
	end

	class EchoFilter
		@objhandle=nil
		attr_accessor :objhandle
		WET=0
		DELAY=1
		DECAY=2
		FILTER=3
		def initialize(*args)
			@objhandle = SoLoud::CAPI.EchoFilter_create()
		end
		def destroy()
			SoLoud::CAPI.EchoFilter_destroy(@objhandle)
		end
	def get_param_count()
		SoLoud::CAPI.EchoFilter_getParamCount(@objhandle)
		end
	def get_param_name(aParamIndex)
		SoLoud::CAPI.EchoFilter_getParamName(@objhandle, aParamIndex)
		end
	def get_param_type(aParamIndex)
		SoLoud::CAPI.EchoFilter_getParamType(@objhandle, aParamIndex)
		end
	def get_param_max(aParamIndex)
		SoLoud::CAPI.EchoFilter_getParamMax(@objhandle, aParamIndex)
		end
	def get_param_min(aParamIndex)
		SoLoud::CAPI.EchoFilter_getParamMin(@objhandle, aParamIndex)
		end
	def set_params(aDelay, aDecay=0.7, aFilter=0.0)
		SoLoud::CAPI.EchoFilter_setParamsEx(@objhandle, aDelay, aDecay, aFilter)
		end
	end

	class FFTFilter
		@objhandle=nil
		attr_accessor :objhandle
		def initialize(*args)
			@objhandle = SoLoud::CAPI.FFTFilter_create()
		end
		def destroy()
			SoLoud::CAPI.FFTFilter_destroy(@objhandle)
		end
	def get_param_count()
		SoLoud::CAPI.FFTFilter_getParamCount(@objhandle)
		end
	def get_param_name(aParamIndex)
		SoLoud::CAPI.FFTFilter_getParamName(@objhandle, aParamIndex)
		end
	def get_param_type(aParamIndex)
		SoLoud::CAPI.FFTFilter_getParamType(@objhandle, aParamIndex)
		end
	def get_param_max(aParamIndex)
		SoLoud::CAPI.FFTFilter_getParamMax(@objhandle, aParamIndex)
		end
	def get_param_min(aParamIndex)
		SoLoud::CAPI.FFTFilter_getParamMin(@objhandle, aParamIndex)
		end
	end

	class FlangerFilter
		@objhandle=nil
		attr_accessor :objhandle
		WET=0
		DELAY=1
		FREQ=2
		def initialize(*args)
			@objhandle = SoLoud::CAPI.FlangerFilter_create()
		end
		def destroy()
			SoLoud::CAPI.FlangerFilter_destroy(@objhandle)
		end
	def get_param_count()
		SoLoud::CAPI.FlangerFilter_getParamCount(@objhandle)
		end
	def get_param_name(aParamIndex)
		SoLoud::CAPI.FlangerFilter_getParamName(@objhandle, aParamIndex)
		end
	def get_param_type(aParamIndex)
		SoLoud::CAPI.FlangerFilter_getParamType(@objhandle, aParamIndex)
		end
	def get_param_max(aParamIndex)
		SoLoud::CAPI.FlangerFilter_getParamMax(@objhandle, aParamIndex)
		end
	def get_param_min(aParamIndex)
		SoLoud::CAPI.FlangerFilter_getParamMin(@objhandle, aParamIndex)
		end
	def set_params(aDelay, aFreq)
		SoLoud::CAPI.FlangerFilter_setParams(@objhandle, aDelay, aFreq)
		end
	end

	class FreeverbFilter
		@objhandle=nil
		attr_accessor :objhandle
		WET=0
		FREEZE=1
		ROOMSIZE=2
		DAMP=3
		WIDTH=4
		def initialize(*args)
			@objhandle = SoLoud::CAPI.FreeverbFilter_create()
		end
		def destroy()
			SoLoud::CAPI.FreeverbFilter_destroy(@objhandle)
		end
	def get_param_count()
		SoLoud::CAPI.FreeverbFilter_getParamCount(@objhandle)
		end
	def get_param_name(aParamIndex)
		SoLoud::CAPI.FreeverbFilter_getParamName(@objhandle, aParamIndex)
		end
	def get_param_type(aParamIndex)
		SoLoud::CAPI.FreeverbFilter_getParamType(@objhandle, aParamIndex)
		end
	def get_param_max(aParamIndex)
		SoLoud::CAPI.FreeverbFilter_getParamMax(@objhandle, aParamIndex)
		end
	def get_param_min(aParamIndex)
		SoLoud::CAPI.FreeverbFilter_getParamMin(@objhandle, aParamIndex)
		end
	def set_params(aMode, aRoomSize, aDamp, aWidth)
		SoLoud::CAPI.FreeverbFilter_setParams(@objhandle, aMode, aRoomSize, aDamp, aWidth)
		end
	end

	class LofiFilter
		@objhandle=nil
		attr_accessor :objhandle
		WET=0
		SAMPLERATE=1
		BITDEPTH=2
		def initialize(*args)
			@objhandle = SoLoud::CAPI.LofiFilter_create()
		end
		def destroy()
			SoLoud::CAPI.LofiFilter_destroy(@objhandle)
		end
	def get_param_count()
		SoLoud::CAPI.LofiFilter_getParamCount(@objhandle)
		end
	def get_param_name(aParamIndex)
		SoLoud::CAPI.LofiFilter_getParamName(@objhandle, aParamIndex)
		end
	def get_param_type(aParamIndex)
		SoLoud::CAPI.LofiFilter_getParamType(@objhandle, aParamIndex)
		end
	def get_param_max(aParamIndex)
		SoLoud::CAPI.LofiFilter_getParamMax(@objhandle, aParamIndex)
		end
	def get_param_min(aParamIndex)
		SoLoud::CAPI.LofiFilter_getParamMin(@objhandle, aParamIndex)
		end
	def set_params(aSampleRate, aBitdepth)
		SoLoud::CAPI.LofiFilter_setParams(@objhandle, aSampleRate, aBitdepth)
		end
	end

	class Monotone
		@objhandle=nil
		attr_accessor :objhandle
		def initialize(*args)
			@objhandle = SoLoud::CAPI.Monotone_create()
		end
		def destroy()
			SoLoud::CAPI.Monotone_destroy(@objhandle)
		end
	def set_params(aHardwareChannels, aWaveform=SoLoud::Misc::WAVE_SQUARE)
		SoLoud::CAPI.Monotone_setParamsEx(@objhandle, aHardwareChannels, aWaveform)
		end
	def load(aFilename)
		SoLoud::CAPI.Monotone_load(@objhandle, aFilename)
		end
	def load_mem(aMem, aLength, aCopy=false, aTakeOwnership=true)
		SoLoud::CAPI.Monotone_loadMemEx(@objhandle, aMem, aLength, aCopy, aTakeOwnership)
		end
	def load_file(aFile)
		SoLoud::CAPI.Monotone_loadFile(@objhandle, aFile)
		end
	def set_volume(aVolume)
		SoLoud::CAPI.Monotone_setVolume(@objhandle, aVolume)
		end
	def set_looping(aLoop)
		SoLoud::CAPI.Monotone_setLooping(@objhandle, aLoop)
		end
	def set_3d_min_max_distance(aMinDistance, aMaxDistance)
		SoLoud::CAPI.Monotone_set3dMinMaxDistance(@objhandle, aMinDistance, aMaxDistance)
		end
	def set_3d_attenuation(aAttenuationModel, aAttenuationRolloffFactor)
		SoLoud::CAPI.Monotone_set3dAttenuation(@objhandle, aAttenuationModel, aAttenuationRolloffFactor)
		end
	def set_3d_doppler_factor(aDopplerFactor)
		SoLoud::CAPI.Monotone_set3dDopplerFactor(@objhandle, aDopplerFactor)
		end
	def set_3d_listener_relative(aListenerRelative)
		SoLoud::CAPI.Monotone_set3dListenerRelative(@objhandle, aListenerRelative)
		end
	def set_3d_distance_delay(aDistanceDelay)
		SoLoud::CAPI.Monotone_set3dDistanceDelay(@objhandle, aDistanceDelay)
		end
	def set_3d_collider(aCollider, aUserData=0)
		SoLoud::CAPI.Monotone_set3dColliderEx(@objhandle, aCollider.objhandle, aUserData)
		end
	def set_3d_attenuator(aAttenuator)
		SoLoud::CAPI.Monotone_set3dAttenuator(@objhandle, aAttenuator.objhandle)
		end
	def set_inaudible_behavior(aMustTick, aKill)
		SoLoud::CAPI.Monotone_setInaudibleBehavior(@objhandle, aMustTick, aKill)
		end
	def set_loop_point(aLoopPoint)
		SoLoud::CAPI.Monotone_setLoopPoint(@objhandle, aLoopPoint)
		end
	def get_loop_point()
		SoLoud::CAPI.Monotone_getLoopPoint(@objhandle)
		end
	def set_filter(aFilterId, aFilter)
		SoLoud::CAPI.Monotone_setFilter(@objhandle, aFilterId, aFilter.objhandle)
		end
	def stop()
		SoLoud::CAPI.Monotone_stop(@objhandle)
		end
	end

	class Noise
		@objhandle=nil
		attr_accessor :objhandle
		WHITE=0
		PINK=1
		BROWNISH=2
		BLUEISH=3
		def initialize(*args)
			@objhandle = SoLoud::CAPI.Noise_create()
		end
		def destroy()
			SoLoud::CAPI.Noise_destroy(@objhandle)
		end
	def set_octave_scale(aOct0, aOct1, aOct2, aOct3, aOct4, aOct5, aOct6, aOct7, aOct8, aOct9)
		SoLoud::CAPI.Noise_setOctaveScale(@objhandle, aOct0, aOct1, aOct2, aOct3, aOct4, aOct5, aOct6, aOct7, aOct8, aOct9)
		end
	def set_type(aType)
		SoLoud::CAPI.Noise_setType(@objhandle, aType)
		end
	def set_volume(aVolume)
		SoLoud::CAPI.Noise_setVolume(@objhandle, aVolume)
		end
	def set_looping(aLoop)
		SoLoud::CAPI.Noise_setLooping(@objhandle, aLoop)
		end
	def set_3d_min_max_distance(aMinDistance, aMaxDistance)
		SoLoud::CAPI.Noise_set3dMinMaxDistance(@objhandle, aMinDistance, aMaxDistance)
		end
	def set_3d_attenuation(aAttenuationModel, aAttenuationRolloffFactor)
		SoLoud::CAPI.Noise_set3dAttenuation(@objhandle, aAttenuationModel, aAttenuationRolloffFactor)
		end
	def set_3d_doppler_factor(aDopplerFactor)
		SoLoud::CAPI.Noise_set3dDopplerFactor(@objhandle, aDopplerFactor)
		end
	def set_3d_listener_relative(aListenerRelative)
		SoLoud::CAPI.Noise_set3dListenerRelative(@objhandle, aListenerRelative)
		end
	def set_3d_distance_delay(aDistanceDelay)
		SoLoud::CAPI.Noise_set3dDistanceDelay(@objhandle, aDistanceDelay)
		end
	def set_3d_collider(aCollider, aUserData=0)
		SoLoud::CAPI.Noise_set3dColliderEx(@objhandle, aCollider.objhandle, aUserData)
		end
	def set_3d_attenuator(aAttenuator)
		SoLoud::CAPI.Noise_set3dAttenuator(@objhandle, aAttenuator.objhandle)
		end
	def set_inaudible_behavior(aMustTick, aKill)
		SoLoud::CAPI.Noise_setInaudibleBehavior(@objhandle, aMustTick, aKill)
		end
	def set_loop_point(aLoopPoint)
		SoLoud::CAPI.Noise_setLoopPoint(@objhandle, aLoopPoint)
		end
	def get_loop_point()
		SoLoud::CAPI.Noise_getLoopPoint(@objhandle)
		end
	def set_filter(aFilterId, aFilter)
		SoLoud::CAPI.Noise_setFilter(@objhandle, aFilterId, aFilter.objhandle)
		end
	def stop()
		SoLoud::CAPI.Noise_stop(@objhandle)
		end
	end

	class Openmpt
		@objhandle=nil
		attr_accessor :objhandle
		def initialize(*args)
			@objhandle = SoLoud::CAPI.Openmpt_create()
		end
		def destroy()
			SoLoud::CAPI.Openmpt_destroy(@objhandle)
		end
	def load(aFilename)
		SoLoud::CAPI.Openmpt_load(@objhandle, aFilename)
		end
	def load_mem(aMem, aLength, aCopy=false, aTakeOwnership=true)
		SoLoud::CAPI.Openmpt_loadMemEx(@objhandle, aMem, aLength, aCopy, aTakeOwnership)
		end
	def load_file(aFile)
		SoLoud::CAPI.Openmpt_loadFile(@objhandle, aFile)
		end
	def set_volume(aVolume)
		SoLoud::CAPI.Openmpt_setVolume(@objhandle, aVolume)
		end
	def set_looping(aLoop)
		SoLoud::CAPI.Openmpt_setLooping(@objhandle, aLoop)
		end
	def set_3d_min_max_distance(aMinDistance, aMaxDistance)
		SoLoud::CAPI.Openmpt_set3dMinMaxDistance(@objhandle, aMinDistance, aMaxDistance)
		end
	def set_3d_attenuation(aAttenuationModel, aAttenuationRolloffFactor)
		SoLoud::CAPI.Openmpt_set3dAttenuation(@objhandle, aAttenuationModel, aAttenuationRolloffFactor)
		end
	def set_3d_doppler_factor(aDopplerFactor)
		SoLoud::CAPI.Openmpt_set3dDopplerFactor(@objhandle, aDopplerFactor)
		end
	def set_3d_listener_relative(aListenerRelative)
		SoLoud::CAPI.Openmpt_set3dListenerRelative(@objhandle, aListenerRelative)
		end
	def set_3d_distance_delay(aDistanceDelay)
		SoLoud::CAPI.Openmpt_set3dDistanceDelay(@objhandle, aDistanceDelay)
		end
	def set_3d_collider(aCollider, aUserData=0)
		SoLoud::CAPI.Openmpt_set3dColliderEx(@objhandle, aCollider.objhandle, aUserData)
		end
	def set_3d_attenuator(aAttenuator)
		SoLoud::CAPI.Openmpt_set3dAttenuator(@objhandle, aAttenuator.objhandle)
		end
	def set_inaudible_behavior(aMustTick, aKill)
		SoLoud::CAPI.Openmpt_setInaudibleBehavior(@objhandle, aMustTick, aKill)
		end
	def set_loop_point(aLoopPoint)
		SoLoud::CAPI.Openmpt_setLoopPoint(@objhandle, aLoopPoint)
		end
	def get_loop_point()
		SoLoud::CAPI.Openmpt_getLoopPoint(@objhandle)
		end
	def set_filter(aFilterId, aFilter)
		SoLoud::CAPI.Openmpt_setFilter(@objhandle, aFilterId, aFilter.objhandle)
		end
	def stop()
		SoLoud::CAPI.Openmpt_stop(@objhandle)
		end
	end

	class Queue
		@objhandle=nil
		attr_accessor :objhandle
		def initialize(*args)
			@objhandle = SoLoud::CAPI.Queue_create()
		end
		def destroy()
			SoLoud::CAPI.Queue_destroy(@objhandle)
		end
	def play(aSound)
		SoLoud::CAPI.Queue_play(@objhandle, aSound.objhandle)
		end
	def get_queue_count()
		SoLoud::CAPI.Queue_getQueueCount(@objhandle)
		end
	def is_currently_playing(aSound)
		SoLoud::CAPI.Queue_isCurrentlyPlaying(@objhandle, aSound.objhandle)
		end
	def set_params_from_audio_source(aSound)
		SoLoud::CAPI.Queue_setParamsFromAudioSource(@objhandle, aSound.objhandle)
		end
	def set_params(aSamplerate, aChannels=2)
		SoLoud::CAPI.Queue_setParamsEx(@objhandle, aSamplerate, aChannels)
		end
	def set_volume(aVolume)
		SoLoud::CAPI.Queue_setVolume(@objhandle, aVolume)
		end
	def set_looping(aLoop)
		SoLoud::CAPI.Queue_setLooping(@objhandle, aLoop)
		end
	def set_3d_min_max_distance(aMinDistance, aMaxDistance)
		SoLoud::CAPI.Queue_set3dMinMaxDistance(@objhandle, aMinDistance, aMaxDistance)
		end
	def set_3d_attenuation(aAttenuationModel, aAttenuationRolloffFactor)
		SoLoud::CAPI.Queue_set3dAttenuation(@objhandle, aAttenuationModel, aAttenuationRolloffFactor)
		end
	def set_3d_doppler_factor(aDopplerFactor)
		SoLoud::CAPI.Queue_set3dDopplerFactor(@objhandle, aDopplerFactor)
		end
	def set_3d_listener_relative(aListenerRelative)
		SoLoud::CAPI.Queue_set3dListenerRelative(@objhandle, aListenerRelative)
		end
	def set_3d_distance_delay(aDistanceDelay)
		SoLoud::CAPI.Queue_set3dDistanceDelay(@objhandle, aDistanceDelay)
		end
	def set_3d_collider(aCollider, aUserData=0)
		SoLoud::CAPI.Queue_set3dColliderEx(@objhandle, aCollider.objhandle, aUserData)
		end
	def set_3d_attenuator(aAttenuator)
		SoLoud::CAPI.Queue_set3dAttenuator(@objhandle, aAttenuator.objhandle)
		end
	def set_inaudible_behavior(aMustTick, aKill)
		SoLoud::CAPI.Queue_setInaudibleBehavior(@objhandle, aMustTick, aKill)
		end
	def set_loop_point(aLoopPoint)
		SoLoud::CAPI.Queue_setLoopPoint(@objhandle, aLoopPoint)
		end
	def get_loop_point()
		SoLoud::CAPI.Queue_getLoopPoint(@objhandle)
		end
	def set_filter(aFilterId, aFilter)
		SoLoud::CAPI.Queue_setFilter(@objhandle, aFilterId, aFilter.objhandle)
		end
	def stop()
		SoLoud::CAPI.Queue_stop(@objhandle)
		end
	end

	class RobotizeFilter
		@objhandle=nil
		attr_accessor :objhandle
		WET=0
		FREQ=1
		WAVE=2
		def initialize(*args)
			@objhandle = SoLoud::CAPI.RobotizeFilter_create()
		end
		def destroy()
			SoLoud::CAPI.RobotizeFilter_destroy(@objhandle)
		end
	def get_param_count()
		SoLoud::CAPI.RobotizeFilter_getParamCount(@objhandle)
		end
	def get_param_name(aParamIndex)
		SoLoud::CAPI.RobotizeFilter_getParamName(@objhandle, aParamIndex)
		end
	def get_param_type(aParamIndex)
		SoLoud::CAPI.RobotizeFilter_getParamType(@objhandle, aParamIndex)
		end
	def get_param_max(aParamIndex)
		SoLoud::CAPI.RobotizeFilter_getParamMax(@objhandle, aParamIndex)
		end
	def get_param_min(aParamIndex)
		SoLoud::CAPI.RobotizeFilter_getParamMin(@objhandle, aParamIndex)
		end
	def set_params(aFreq, aWaveform)
		SoLoud::CAPI.RobotizeFilter_setParams(@objhandle, aFreq, aWaveform)
		end
	end

	class Sfxr
		@objhandle=nil
		attr_accessor :objhandle
		COIN=0
		LASER=1
		EXPLOSION=2
		POWERUP=3
		HURT=4
		JUMP=5
		BLIP=6
		def initialize(*args)
			@objhandle = SoLoud::CAPI.Sfxr_create()
		end
		def destroy()
			SoLoud::CAPI.Sfxr_destroy(@objhandle)
		end
	def reset_params()
		SoLoud::CAPI.Sfxr_resetParams(@objhandle)
		end
	def load_params(aFilename)
		SoLoud::CAPI.Sfxr_loadParams(@objhandle, aFilename)
		end
	def load_params_mem(aMem, aLength, aCopy=false, aTakeOwnership=true)
		SoLoud::CAPI.Sfxr_loadParamsMemEx(@objhandle, aMem, aLength, aCopy, aTakeOwnership)
		end
	def load_params_file(aFile)
		SoLoud::CAPI.Sfxr_loadParamsFile(@objhandle, aFile)
		end
	def load_preset(aPresetNo, aRandSeed)
		SoLoud::CAPI.Sfxr_loadPreset(@objhandle, aPresetNo, aRandSeed)
		end
	def set_volume(aVolume)
		SoLoud::CAPI.Sfxr_setVolume(@objhandle, aVolume)
		end
	def set_looping(aLoop)
		SoLoud::CAPI.Sfxr_setLooping(@objhandle, aLoop)
		end
	def set_3d_min_max_distance(aMinDistance, aMaxDistance)
		SoLoud::CAPI.Sfxr_set3dMinMaxDistance(@objhandle, aMinDistance, aMaxDistance)
		end
	def set_3d_attenuation(aAttenuationModel, aAttenuationRolloffFactor)
		SoLoud::CAPI.Sfxr_set3dAttenuation(@objhandle, aAttenuationModel, aAttenuationRolloffFactor)
		end
	def set_3d_doppler_factor(aDopplerFactor)
		SoLoud::CAPI.Sfxr_set3dDopplerFactor(@objhandle, aDopplerFactor)
		end
	def set_3d_listener_relative(aListenerRelative)
		SoLoud::CAPI.Sfxr_set3dListenerRelative(@objhandle, aListenerRelative)
		end
	def set_3d_distance_delay(aDistanceDelay)
		SoLoud::CAPI.Sfxr_set3dDistanceDelay(@objhandle, aDistanceDelay)
		end
	def set_3d_collider(aCollider, aUserData=0)
		SoLoud::CAPI.Sfxr_set3dColliderEx(@objhandle, aCollider.objhandle, aUserData)
		end
	def set_3d_attenuator(aAttenuator)
		SoLoud::CAPI.Sfxr_set3dAttenuator(@objhandle, aAttenuator.objhandle)
		end
	def set_inaudible_behavior(aMustTick, aKill)
		SoLoud::CAPI.Sfxr_setInaudibleBehavior(@objhandle, aMustTick, aKill)
		end
	def set_loop_point(aLoopPoint)
		SoLoud::CAPI.Sfxr_setLoopPoint(@objhandle, aLoopPoint)
		end
	def get_loop_point()
		SoLoud::CAPI.Sfxr_getLoopPoint(@objhandle)
		end
	def set_filter(aFilterId, aFilter)
		SoLoud::CAPI.Sfxr_setFilter(@objhandle, aFilterId, aFilter.objhandle)
		end
	def stop()
		SoLoud::CAPI.Sfxr_stop(@objhandle)
		end
	end

	class Speech
		@objhandle=nil
		attr_accessor :objhandle
		KW_SAW=0
		KW_TRIANGLE=1
		KW_SIN=2
		KW_SQUARE=3
		KW_PULSE=4
		KW_NOISE=5
		KW_WARBLE=6
		def initialize(*args)
			@objhandle = SoLoud::CAPI.Speech_create()
		end
		def destroy()
			SoLoud::CAPI.Speech_destroy(@objhandle)
		end
	def set_text(aText)
		SoLoud::CAPI.Speech_setText(@objhandle, aText)
		end
	def set_params(aBaseFrequency=1330, aBaseSpeed=10.0, aBaseDeclination=0.5, aBaseWaveform=KW_TRIANGLE)
		SoLoud::CAPI.Speech_setParamsEx(@objhandle, aBaseFrequency, aBaseSpeed, aBaseDeclination, aBaseWaveform)
		end
	def set_volume(aVolume)
		SoLoud::CAPI.Speech_setVolume(@objhandle, aVolume)
		end
	def set_looping(aLoop)
		SoLoud::CAPI.Speech_setLooping(@objhandle, aLoop)
		end
	def set_3d_min_max_distance(aMinDistance, aMaxDistance)
		SoLoud::CAPI.Speech_set3dMinMaxDistance(@objhandle, aMinDistance, aMaxDistance)
		end
	def set_3d_attenuation(aAttenuationModel, aAttenuationRolloffFactor)
		SoLoud::CAPI.Speech_set3dAttenuation(@objhandle, aAttenuationModel, aAttenuationRolloffFactor)
		end
	def set_3d_doppler_factor(aDopplerFactor)
		SoLoud::CAPI.Speech_set3dDopplerFactor(@objhandle, aDopplerFactor)
		end
	def set_3d_listener_relative(aListenerRelative)
		SoLoud::CAPI.Speech_set3dListenerRelative(@objhandle, aListenerRelative)
		end
	def set_3d_distance_delay(aDistanceDelay)
		SoLoud::CAPI.Speech_set3dDistanceDelay(@objhandle, aDistanceDelay)
		end
	def set_3d_collider(aCollider, aUserData=0)
		SoLoud::CAPI.Speech_set3dColliderEx(@objhandle, aCollider.objhandle, aUserData)
		end
	def set_3d_attenuator(aAttenuator)
		SoLoud::CAPI.Speech_set3dAttenuator(@objhandle, aAttenuator.objhandle)
		end
	def set_inaudible_behavior(aMustTick, aKill)
		SoLoud::CAPI.Speech_setInaudibleBehavior(@objhandle, aMustTick, aKill)
		end
	def set_loop_point(aLoopPoint)
		SoLoud::CAPI.Speech_setLoopPoint(@objhandle, aLoopPoint)
		end
	def get_loop_point()
		SoLoud::CAPI.Speech_getLoopPoint(@objhandle)
		end
	def set_filter(aFilterId, aFilter)
		SoLoud::CAPI.Speech_setFilter(@objhandle, aFilterId, aFilter.objhandle)
		end
	def stop()
		SoLoud::CAPI.Speech_stop(@objhandle)
		end
	end

	class TedSid
		@objhandle=nil
		attr_accessor :objhandle
		def initialize(*args)
			@objhandle = SoLoud::CAPI.TedSid_create()
		end
		def destroy()
			SoLoud::CAPI.TedSid_destroy(@objhandle)
		end
	def load(aFilename)
		SoLoud::CAPI.TedSid_load(@objhandle, aFilename)
		end
	def load_to_mem(aFilename)
		SoLoud::CAPI.TedSid_loadToMem(@objhandle, aFilename)
		end
	def load_mem(aMem, aLength, aCopy=false, aTakeOwnership=true)
		SoLoud::CAPI.TedSid_loadMemEx(@objhandle, aMem, aLength, aCopy, aTakeOwnership)
		end
	def load_file_to_mem(aFile)
		SoLoud::CAPI.TedSid_loadFileToMem(@objhandle, aFile)
		end
	def load_file(aFile)
		SoLoud::CAPI.TedSid_loadFile(@objhandle, aFile)
		end
	def set_volume(aVolume)
		SoLoud::CAPI.TedSid_setVolume(@objhandle, aVolume)
		end
	def set_looping(aLoop)
		SoLoud::CAPI.TedSid_setLooping(@objhandle, aLoop)
		end
	def set_3d_min_max_distance(aMinDistance, aMaxDistance)
		SoLoud::CAPI.TedSid_set3dMinMaxDistance(@objhandle, aMinDistance, aMaxDistance)
		end
	def set_3d_attenuation(aAttenuationModel, aAttenuationRolloffFactor)
		SoLoud::CAPI.TedSid_set3dAttenuation(@objhandle, aAttenuationModel, aAttenuationRolloffFactor)
		end
	def set_3d_doppler_factor(aDopplerFactor)
		SoLoud::CAPI.TedSid_set3dDopplerFactor(@objhandle, aDopplerFactor)
		end
	def set_3d_listener_relative(aListenerRelative)
		SoLoud::CAPI.TedSid_set3dListenerRelative(@objhandle, aListenerRelative)
		end
	def set_3d_distance_delay(aDistanceDelay)
		SoLoud::CAPI.TedSid_set3dDistanceDelay(@objhandle, aDistanceDelay)
		end
	def set_3d_collider(aCollider, aUserData=0)
		SoLoud::CAPI.TedSid_set3dColliderEx(@objhandle, aCollider.objhandle, aUserData)
		end
	def set_3d_attenuator(aAttenuator)
		SoLoud::CAPI.TedSid_set3dAttenuator(@objhandle, aAttenuator.objhandle)
		end
	def set_inaudible_behavior(aMustTick, aKill)
		SoLoud::CAPI.TedSid_setInaudibleBehavior(@objhandle, aMustTick, aKill)
		end
	def set_loop_point(aLoopPoint)
		SoLoud::CAPI.TedSid_setLoopPoint(@objhandle, aLoopPoint)
		end
	def get_loop_point()
		SoLoud::CAPI.TedSid_getLoopPoint(@objhandle)
		end
	def set_filter(aFilterId, aFilter)
		SoLoud::CAPI.TedSid_setFilter(@objhandle, aFilterId, aFilter.objhandle)
		end
	def stop()
		SoLoud::CAPI.TedSid_stop(@objhandle)
		end
	end

	class Vic
		@objhandle=nil
		attr_accessor :objhandle
		PAL=0
		NTSC=1
		BASS=0
		ALTO=1
		SOPRANO=2
		NOISE=3
		MAX_REGS=4
		def initialize(*args)
			@objhandle = SoLoud::CAPI.Vic_create()
		end
		def destroy()
			SoLoud::CAPI.Vic_destroy(@objhandle)
		end
	def set_model(model)
		SoLoud::CAPI.Vic_setModel(@objhandle, model)
		end
	def get_model()
		SoLoud::CAPI.Vic_getModel(@objhandle)
		end
	def set_register(reg, value)
		SoLoud::CAPI.Vic_setRegister(@objhandle, reg, value)
		end
	def get_register(reg)
		SoLoud::CAPI.Vic_getRegister(@objhandle, reg)
		end
	def set_volume(aVolume)
		SoLoud::CAPI.Vic_setVolume(@objhandle, aVolume)
		end
	def set_looping(aLoop)
		SoLoud::CAPI.Vic_setLooping(@objhandle, aLoop)
		end
	def set_3d_min_max_distance(aMinDistance, aMaxDistance)
		SoLoud::CAPI.Vic_set3dMinMaxDistance(@objhandle, aMinDistance, aMaxDistance)
		end
	def set_3d_attenuation(aAttenuationModel, aAttenuationRolloffFactor)
		SoLoud::CAPI.Vic_set3dAttenuation(@objhandle, aAttenuationModel, aAttenuationRolloffFactor)
		end
	def set_3d_doppler_factor(aDopplerFactor)
		SoLoud::CAPI.Vic_set3dDopplerFactor(@objhandle, aDopplerFactor)
		end
	def set_3d_listener_relative(aListenerRelative)
		SoLoud::CAPI.Vic_set3dListenerRelative(@objhandle, aListenerRelative)
		end
	def set_3d_distance_delay(aDistanceDelay)
		SoLoud::CAPI.Vic_set3dDistanceDelay(@objhandle, aDistanceDelay)
		end
	def set_3d_collider(aCollider, aUserData=0)
		SoLoud::CAPI.Vic_set3dColliderEx(@objhandle, aCollider.objhandle, aUserData)
		end
	def set_3d_attenuator(aAttenuator)
		SoLoud::CAPI.Vic_set3dAttenuator(@objhandle, aAttenuator.objhandle)
		end
	def set_inaudible_behavior(aMustTick, aKill)
		SoLoud::CAPI.Vic_setInaudibleBehavior(@objhandle, aMustTick, aKill)
		end
	def set_loop_point(aLoopPoint)
		SoLoud::CAPI.Vic_setLoopPoint(@objhandle, aLoopPoint)
		end
	def get_loop_point()
		SoLoud::CAPI.Vic_getLoopPoint(@objhandle)
		end
	def set_filter(aFilterId, aFilter)
		SoLoud::CAPI.Vic_setFilter(@objhandle, aFilterId, aFilter.objhandle)
		end
	def stop()
		SoLoud::CAPI.Vic_stop(@objhandle)
		end
	end

	class Vizsn
		@objhandle=nil
		attr_accessor :objhandle
		def initialize(*args)
			@objhandle = SoLoud::CAPI.Vizsn_create()
		end
		def destroy()
			SoLoud::CAPI.Vizsn_destroy(@objhandle)
		end
	def set_text(aText)
		SoLoud::CAPI.Vizsn_setText(@objhandle, aText)
		end
	def set_volume(aVolume)
		SoLoud::CAPI.Vizsn_setVolume(@objhandle, aVolume)
		end
	def set_looping(aLoop)
		SoLoud::CAPI.Vizsn_setLooping(@objhandle, aLoop)
		end
	def set_3d_min_max_distance(aMinDistance, aMaxDistance)
		SoLoud::CAPI.Vizsn_set3dMinMaxDistance(@objhandle, aMinDistance, aMaxDistance)
		end
	def set_3d_attenuation(aAttenuationModel, aAttenuationRolloffFactor)
		SoLoud::CAPI.Vizsn_set3dAttenuation(@objhandle, aAttenuationModel, aAttenuationRolloffFactor)
		end
	def set_3d_doppler_factor(aDopplerFactor)
		SoLoud::CAPI.Vizsn_set3dDopplerFactor(@objhandle, aDopplerFactor)
		end
	def set_3d_listener_relative(aListenerRelative)
		SoLoud::CAPI.Vizsn_set3dListenerRelative(@objhandle, aListenerRelative)
		end
	def set_3d_distance_delay(aDistanceDelay)
		SoLoud::CAPI.Vizsn_set3dDistanceDelay(@objhandle, aDistanceDelay)
		end
	def set_3d_collider(aCollider, aUserData=0)
		SoLoud::CAPI.Vizsn_set3dColliderEx(@objhandle, aCollider.objhandle, aUserData)
		end
	def set_3d_attenuator(aAttenuator)
		SoLoud::CAPI.Vizsn_set3dAttenuator(@objhandle, aAttenuator.objhandle)
		end
	def set_inaudible_behavior(aMustTick, aKill)
		SoLoud::CAPI.Vizsn_setInaudibleBehavior(@objhandle, aMustTick, aKill)
		end
	def set_loop_point(aLoopPoint)
		SoLoud::CAPI.Vizsn_setLoopPoint(@objhandle, aLoopPoint)
		end
	def get_loop_point()
		SoLoud::CAPI.Vizsn_getLoopPoint(@objhandle)
		end
	def set_filter(aFilterId, aFilter)
		SoLoud::CAPI.Vizsn_setFilter(@objhandle, aFilterId, aFilter.objhandle)
		end
	def stop()
		SoLoud::CAPI.Vizsn_stop(@objhandle)
		end
	end

	class Wav
		@objhandle=nil
		attr_accessor :objhandle
		def initialize(*args)
			@objhandle = SoLoud::CAPI.Wav_create()
		end
		def destroy()
			SoLoud::CAPI.Wav_destroy(@objhandle)
		end
	def load(aFilename)
		SoLoud::CAPI.Wav_load(@objhandle, aFilename)
		end
	def load_mem(aMem, aLength, aCopy=false, aTakeOwnership=true)
		SoLoud::CAPI.Wav_loadMemEx(@objhandle, aMem, aLength, aCopy, aTakeOwnership)
		end
	def load_file(aFile)
		SoLoud::CAPI.Wav_loadFile(@objhandle, aFile)
		end
	def load_raw_wave8(aMem, aLength, aSamplerate=44100.0, aChannels=1)
		SoLoud::CAPI.Wav_loadRawWave8Ex(@objhandle, aMem, aLength, aSamplerate, aChannels)
		end
	def load_raw_wave16(aMem, aLength, aSamplerate=44100.0, aChannels=1)
		SoLoud::CAPI.Wav_loadRawWave16Ex(@objhandle, aMem, aLength, aSamplerate, aChannels)
		end
	def load_raw_wave(aMem, aLength, aSamplerate=44100.0, aChannels=1, aCopy=false, aTakeOwnership=true)
		SoLoud::CAPI.Wav_loadRawWaveEx(@objhandle, aMem, aLength, aSamplerate, aChannels, aCopy, aTakeOwnership)
		end
	def get_length()
		SoLoud::CAPI.Wav_getLength(@objhandle)
		end
	def set_volume(aVolume)
		SoLoud::CAPI.Wav_setVolume(@objhandle, aVolume)
		end
	def set_looping(aLoop)
		SoLoud::CAPI.Wav_setLooping(@objhandle, aLoop)
		end
	def set_3d_min_max_distance(aMinDistance, aMaxDistance)
		SoLoud::CAPI.Wav_set3dMinMaxDistance(@objhandle, aMinDistance, aMaxDistance)
		end
	def set_3d_attenuation(aAttenuationModel, aAttenuationRolloffFactor)
		SoLoud::CAPI.Wav_set3dAttenuation(@objhandle, aAttenuationModel, aAttenuationRolloffFactor)
		end
	def set_3d_doppler_factor(aDopplerFactor)
		SoLoud::CAPI.Wav_set3dDopplerFactor(@objhandle, aDopplerFactor)
		end
	def set_3d_listener_relative(aListenerRelative)
		SoLoud::CAPI.Wav_set3dListenerRelative(@objhandle, aListenerRelative)
		end
	def set_3d_distance_delay(aDistanceDelay)
		SoLoud::CAPI.Wav_set3dDistanceDelay(@objhandle, aDistanceDelay)
		end
	def set_3d_collider(aCollider, aUserData=0)
		SoLoud::CAPI.Wav_set3dColliderEx(@objhandle, aCollider.objhandle, aUserData)
		end
	def set_3d_attenuator(aAttenuator)
		SoLoud::CAPI.Wav_set3dAttenuator(@objhandle, aAttenuator.objhandle)
		end
	def set_inaudible_behavior(aMustTick, aKill)
		SoLoud::CAPI.Wav_setInaudibleBehavior(@objhandle, aMustTick, aKill)
		end
	def set_loop_point(aLoopPoint)
		SoLoud::CAPI.Wav_setLoopPoint(@objhandle, aLoopPoint)
		end
	def get_loop_point()
		SoLoud::CAPI.Wav_getLoopPoint(@objhandle)
		end
	def set_filter(aFilterId, aFilter)
		SoLoud::CAPI.Wav_setFilter(@objhandle, aFilterId, aFilter.objhandle)
		end
	def stop()
		SoLoud::CAPI.Wav_stop(@objhandle)
		end
	end

	class WaveShaperFilter
		@objhandle=nil
		attr_accessor :objhandle
		WET=0
		AMOUNT=1
		def initialize(*args)
			@objhandle = SoLoud::CAPI.WaveShaperFilter_create()
		end
		def destroy()
			SoLoud::CAPI.WaveShaperFilter_destroy(@objhandle)
		end
	def set_params(aAmount)
		SoLoud::CAPI.WaveShaperFilter_setParams(@objhandle, aAmount)
		end
	def get_param_count()
		SoLoud::CAPI.WaveShaperFilter_getParamCount(@objhandle)
		end
	def get_param_name(aParamIndex)
		SoLoud::CAPI.WaveShaperFilter_getParamName(@objhandle, aParamIndex)
		end
	def get_param_type(aParamIndex)
		SoLoud::CAPI.WaveShaperFilter_getParamType(@objhandle, aParamIndex)
		end
	def get_param_max(aParamIndex)
		SoLoud::CAPI.WaveShaperFilter_getParamMax(@objhandle, aParamIndex)
		end
	def get_param_min(aParamIndex)
		SoLoud::CAPI.WaveShaperFilter_getParamMin(@objhandle, aParamIndex)
		end
	end

	class WavStream
		@objhandle=nil
		attr_accessor :objhandle
		def initialize(*args)
			@objhandle = SoLoud::CAPI.WavStream_create()
		end
		def destroy()
			SoLoud::CAPI.WavStream_destroy(@objhandle)
		end
	def load(aFilename)
		SoLoud::CAPI.WavStream_load(@objhandle, aFilename)
		end
	def load_mem(aData, aDataLen, aCopy=false, aTakeOwnership=true)
		SoLoud::CAPI.WavStream_loadMemEx(@objhandle, aData, aDataLen, aCopy, aTakeOwnership)
		end
	def load_to_mem(aFilename)
		SoLoud::CAPI.WavStream_loadToMem(@objhandle, aFilename)
		end
	def load_file(aFile)
		SoLoud::CAPI.WavStream_loadFile(@objhandle, aFile)
		end
	def load_file_to_mem(aFile)
		SoLoud::CAPI.WavStream_loadFileToMem(@objhandle, aFile)
		end
	def get_length()
		SoLoud::CAPI.WavStream_getLength(@objhandle)
		end
	def set_volume(aVolume)
		SoLoud::CAPI.WavStream_setVolume(@objhandle, aVolume)
		end
	def set_looping(aLoop)
		SoLoud::CAPI.WavStream_setLooping(@objhandle, aLoop)
		end
	def set_3d_min_max_distance(aMinDistance, aMaxDistance)
		SoLoud::CAPI.WavStream_set3dMinMaxDistance(@objhandle, aMinDistance, aMaxDistance)
		end
	def set_3d_attenuation(aAttenuationModel, aAttenuationRolloffFactor)
		SoLoud::CAPI.WavStream_set3dAttenuation(@objhandle, aAttenuationModel, aAttenuationRolloffFactor)
		end
	def set_3d_doppler_factor(aDopplerFactor)
		SoLoud::CAPI.WavStream_set3dDopplerFactor(@objhandle, aDopplerFactor)
		end
	def set_3d_listener_relative(aListenerRelative)
		SoLoud::CAPI.WavStream_set3dListenerRelative(@objhandle, aListenerRelative)
		end
	def set_3d_distance_delay(aDistanceDelay)
		SoLoud::CAPI.WavStream_set3dDistanceDelay(@objhandle, aDistanceDelay)
		end
	def set_3d_collider(aCollider, aUserData=0)
		SoLoud::CAPI.WavStream_set3dColliderEx(@objhandle, aCollider.objhandle, aUserData)
		end
	def set_3d_attenuator(aAttenuator)
		SoLoud::CAPI.WavStream_set3dAttenuator(@objhandle, aAttenuator.objhandle)
		end
	def set_inaudible_behavior(aMustTick, aKill)
		SoLoud::CAPI.WavStream_setInaudibleBehavior(@objhandle, aMustTick, aKill)
		end
	def set_loop_point(aLoopPoint)
		SoLoud::CAPI.WavStream_setLoopPoint(@objhandle, aLoopPoint)
		end
	def get_loop_point()
		SoLoud::CAPI.WavStream_getLoopPoint(@objhandle)
		end
	def set_filter(aFilterId, aFilter)
		SoLoud::CAPI.WavStream_setFilter(@objhandle, aFilterId, aFilter.objhandle)
		end
	def stop()
		SoLoud::CAPI.WavStream_stop(@objhandle)
		end
	end
end
