semicongine/audio/mixer_module

Search:
Group by:

Types

AccessMode {.size: 4.} = enum
  SND_PCM_ACCESS_RW_INTERLEAVED = 3
Level = 0.0'f32 .. 1.0'f32
Mixer = object
  sounds*: Table[string, SoundData]
OpenMode {.size: 8.} = enum
  SND_PCM_BLOCK = 0, SND_PCM_NONBLOCK = 1
PCMFormat {.size: 4.} = enum
  SND_PCM_FORMAT_S16_LE = 2
Sample = array[2, int16]
snd_pcm_hw_params_p = ptr object
snd_pcm_p = ptr object
SoundData = seq[Sample]
StreamMode {.size: 4.} = enum
  SND_PCM_STREAM_PLAYBACK = 0

Vars

mixer = createShared(Mixer, Positive(1))

Procs

proc addSound(mixer: var Mixer; name: string; sound: SoundData) {.
    ...raises: [Exception], tags: [RootEffect], forbids: [].}
proc addTrack(mixer: var Mixer; name: string; level: Level = 1.0'f32) {.
    ...raises: [Exception], tags: [RootEffect], forbids: [].}
proc CloseSoundDevice(soundDevice: NativeSoundDevice) {....raises: [], tags: [],
    forbids: [].}
proc fadeTo(mixer: var Mixer; track: string; level: Level; time: float) {.
    ...raises: [KeyError], tags: [], forbids: [].}
proc getLevel(mixer: var Mixer): Level {....raises: [], tags: [], forbids: [].}
proc getLevel(mixer: var Mixer; playbackId: uint64): (Level, Level) {.
    ...raises: [KeyError], tags: [], forbids: [].}
proc getLevel(mixer: var Mixer; track: string): Level {....raises: [KeyError],
    tags: [], forbids: [].}
proc isPlaying(mixer: var Mixer): bool {....raises: [], tags: [], forbids: [].}
proc isPlaying(mixer: var Mixer; track: string): bool {....raises: [KeyError],
    tags: [], forbids: [].}
proc OpenSoundDevice(sampleRate: uint32; buffers: seq[ptr SoundData]): NativeSoundDevice {.
    ...raises: [Exception], tags: [], forbids: [].}
proc pause(mixer: var Mixer) {....raises: [], tags: [], forbids: [].}
proc pause(mixer: var Mixer; playbackId: uint64) {....raises: [KeyError], tags: [],
    forbids: [].}
proc pause(mixer: var Mixer; playbackId: uint64; value: bool) {.
    ...raises: [KeyError], tags: [], forbids: [].}
proc pause(mixer: var Mixer; track: string) {....raises: [KeyError], tags: [],
    forbids: [].}
proc pause(mixer: var Mixer; track: string; value: bool) {....raises: [KeyError],
    tags: [], forbids: [].}
proc pause(mixer: var Mixer; value: bool) {....raises: [], tags: [], forbids: [].}
proc play(mixer: var Mixer; soundName: string; track = "";
          stopOtherSounds = false; loop = false; level: Level = 1.0'f32): uint64 {.
    ...raises: [KeyError], tags: [], forbids: [].}
proc play(mixer: var Mixer; soundName: string; track = "";
          stopOtherSounds = false; loop = false; levelLeft, levelRight: Level): uint64 {.
    ...raises: [KeyError], tags: [], forbids: [].}
proc setLevel(mixer: var Mixer; level: Level) {....raises: [], tags: [],
    forbids: [].}
proc setLevel(mixer: var Mixer; playbackId: uint64; level: Level) {.
    ...raises: [KeyError], tags: [], forbids: [].}
proc setLevel(mixer: var Mixer; playbackId: uint64; levelLeft, levelRight: Level) {.
    ...raises: [KeyError], tags: [], forbids: [].}
proc setLevel(mixer: var Mixer; track: string; level: Level) {.
    ...raises: [KeyError], tags: [], forbids: [].}
proc snd_pcm_close(pcm: snd_pcm_p): cint {.importc, cdecl,
    dynlib: "libasound.so.2", ...raises: [], tags: [], forbids: [].}
proc snd_pcm_hw_params(pcm: snd_pcm_p; params: snd_pcm_hw_params_p): cint {.
    importc, cdecl, dynlib: "libasound.so.2", ...raises: [], tags: [], forbids: [].}
proc snd_pcm_hw_params_any(pcm: snd_pcm_p; params: snd_pcm_hw_params_p): cint {.
    importc, cdecl, dynlib: "libasound.so.2", ...raises: [], tags: [], forbids: [].}
proc snd_pcm_hw_params_free(hw_params: snd_pcm_hw_params_p) {.importc, cdecl,
    dynlib: "libasound.so.2", ...raises: [], tags: [], forbids: [].}
proc snd_pcm_hw_params_malloc(hw_params_ptr: ptr snd_pcm_hw_params_p): cint {.
    importc, cdecl, dynlib: "libasound.so.2", ...raises: [], tags: [], forbids: [].}
proc snd_pcm_hw_params_set_access(pcm: snd_pcm_p; params: snd_pcm_hw_params_p;
                                  mode: AccessMode): cint {.importc, cdecl,
    dynlib: "libasound.so.2", ...raises: [], tags: [], forbids: [].}
proc snd_pcm_hw_params_set_buffer_size(pcm: snd_pcm_p;
                                       params: snd_pcm_hw_params_p;
                                       size: snd_pcm_uframes_t): cint {.importc,
    cdecl, dynlib: "libasound.so.2", ...raises: [], tags: [], forbids: [].}
proc snd_pcm_hw_params_set_channels(pcm: snd_pcm_p; params: snd_pcm_hw_params_p;
                                    val: cuint): cint {.importc, cdecl,
    dynlib: "libasound.so.2", ...raises: [], tags: [], forbids: [].}
proc snd_pcm_hw_params_set_format(pcm: snd_pcm_p; params: snd_pcm_hw_params_p;
                                  format: PCMFormat): cint {.importc, cdecl,
    dynlib: "libasound.so.2", ...raises: [], tags: [], forbids: [].}
proc snd_pcm_hw_params_set_rate(pcm: snd_pcm_p; params: snd_pcm_hw_params_p;
                                val: cuint; dir: cint): cint {.importc, cdecl,
    dynlib: "libasound.so.2", ...raises: [], tags: [], forbids: [].}
proc snd_pcm_open(pcm_ref: ptr snd_pcm_p; name: cstring; streamMode: StreamMode;
                  openmode: OpenMode): cint {.importc, cdecl,
    dynlib: "libasound.so.2", ...raises: [], tags: [], forbids: [].}
proc snd_pcm_recover(pcm: snd_pcm_p; err: cint; silent: cint): cint {.importc,
    cdecl, dynlib: "libasound.so.2", ...raises: [], tags: [], forbids: [].}
proc snd_pcm_writei(pcm: snd_pcm_p; buffer: pointer; size: snd_pcm_uframes_t): snd_pcm_sframes_t {.
    importc, cdecl, dynlib: "libasound.so.2", ...raises: [], tags: [], forbids: [].}
proc startMixerThread() {....raises: [ResourceExhaustedError, Exception],
                          tags: [RootEffect], forbids: [].}
proc stop(mixer: var Mixer) {....raises: [], tags: [], forbids: [].}
proc stop(mixer: var Mixer; playbackId: uint64) {....raises: [], tags: [],
    forbids: [].}
proc stop(mixer: var Mixer; track: string) {....raises: [KeyError], tags: [],
    forbids: [].}
proc unpause(mixer: var Mixer) {....raises: [], tags: [], forbids: [].}
proc unpause(mixer: var Mixer; playbackId: uint64) {....raises: [KeyError],
    tags: [], forbids: [].}
proc unpause(mixer: var Mixer; track: string) {....raises: [KeyError], tags: [],
    forbids: [].}
proc WriteSoundData(soundDevice: NativeSoundDevice; buffer: int) {.
    ...raises: [Exception], tags: [], forbids: [].}