Home My Page Projects Code Snippets Project Openings 3D graphics for Standard ML
Summary Activity SCM

SCM Repository

[sml3d] View of /trunk/sml3d/src/openal/al.sml
ViewVC logotype

View of /trunk/sml3d/src/openal/al.sml

Parent Directory Parent Directory | Revision Log Revision Log


Revision 891 - (download) (annotate)
Tue May 11 20:01:36 2010 UTC (9 years, 7 months ago) by jhr
File size: 1927 byte(s)
  Added audio-file loading support to OpenAL
(* al.sml
 *
 * COPYRIGHT (c) 2010 John Reppy (http://www.cs.uchicago.edu/~jhr)
 * All rights reserved.
 *)

structure AL :> AL =
  struct
    local
      open ALTypes
      open ALConsts
      open ALFuncs
    in

  (* common types *)
    type float = Real32.real
    type vec3f = {x : float, y : float, z : float}

  (* basic OpenAL types *)
    type device = alc_device
    type context = alc_context
    type source = al_uint
    type buffer = al_uint
    type capture_device = alc_device

  (*
   * State retrieval
   *)
    local
      fun get name = CString.toString(alGetString name)
    in
    fun vendorString () = get AL_VENDOR
    fun rendererString () = get AL_RENDERER
    fun versionString () = get AL_VERSION
    fun extensionsString () = get AL_EXTENSIONS
    fun extensions () = String.tokens Char.isSpace (extensionsString())
    end

  (*
   * Global Parameters
   *)
    val dopplerFactor   : float -> unit = alDopplerFactor
    val dopplerVelocity : float -> unit = alDopplerVelocity
    val speedOfSound    : float -> unit = alSpeedOfSound

  (* distance model *)
    type distance_model = al_enum
    val INVERSE_DISTANCE		: distance_model = AL_INVERSE_DISTANCE
    val INVERSE_DISTANCE_CLAMPED	: distance_model = AL_INVERSE_DISTANCE_CLAMPED
    val LINEAR_DISTANCE			: distance_model = AL_LINEAR_DISTANCE
    val LINEAR_DISTANCE_CLAMPED		: distance_model = AL_LINEAR_DISTANCE_CLAMPED
    val EXPONENT_DISTANCE		: distance_model = AL_EXPONENT_DISTANCE
    val EXPONENT_DISTANCE_CLAMPED	: distance_model = AL_EXPONENT_DISTANCE_CLAMPED
    fun distanceModel NONE = alDistanceModel AL_NONE
      | distanceModel (SOME m) = alDistanceModel m

    structure Error = Error
    structure Format = Format
    structure Buffer = Buffer
    structure Source = Source
    structure Listener = Listener
    structure Context = Context
    structure Device = Device
    structure IO = IO

    end (* local *)
  end


root@smlnj-gforge.cs.uchicago.edu
ViewVC Help
Powered by ViewVC 1.0.0