package bogue

  1. Overview
  2. Docs

Module Bogue.MixerSource

Basic audio mixer for sound effects

This simple audio mixer makes it possible to play quick sounds, for instance when clicking on buttons, or for game sounds effects.

Only WAV files are supported. For playing MP3 music, and for more options, it is advisable to use the SDL_Mixer library.

Remark: This module is essentially independent of the rest of Bogue, so its source can, with very few modifications, be used for any SDL application.

Dependency graph
Sourcetype t
Sourcetype repeat =
  1. | Repeat of int
  2. | Forever
Sourceval test : unit -> unit
Sourceval init : unit -> string option

Initialize SDL audio.

  • returns

    the name of the audio driver.

Sourceval create_mixer : ?tracks:int -> ?freq:int -> string option -> t

Create the mixer an open sound device. Only s16le format is supported by the callback at this time.

Sourceval load_chunk : t -> string -> sound

Load a WAV file.

Sourceval play_chunk : ?track:int -> ?effects:(sound -> unit) list -> ?volume:float -> ?repeat:repeat -> t -> sound -> int option

Play chunk on the desired track number. If track is not specified, find an available track. By default repeat = Repeat 1.

  • returns

    chosen track number, or None

Sourceval change_volume : float -> sound -> unit

Multiply sound intensity by a float factor

Sourceval pause : t -> unit
Sourceval unpause : t -> unit
Sourceval close : t -> unit