No description
Find a file
2020-12-23 11:57:52 +02:00
sound Fixes #17 (#28) 2020-12-23 11:57:52 +02:00
.gitignore Initial commit 2015-12-09 15:21:24 +02:00
LICENSE Initial commit 2015-12-09 15:21:24 +02:00
README.md Fixes #18 2018-12-25 11:53:55 +02:00
sound.nimble No more C 2017-05-07 19:22:02 +03:00

sound nimble

Cross-platform sound mixer library

The library is using different "backends" depending on target platform:

  • Linux, MacOS, iOS: OpenAL. Supported formats: ogg+vorbis
  • Windows: XAudio2. Supported formats: ogg+vorbis
  • Android: SLES. Supported formats: ogg+vorbis
  • JavaScript, Asm.js: WebAudio. Supported formats: mp3 (and ogg+vorbis on some browsers)

Usage:

import sound.sound

when defined(android):
    var activity: jobject # You should get the reference to activity from somewhere.
    activity = androidGetActivity() # E.g. If you're using sdl.
    initSoundEngineWithActivity(activity)

var snd: Sound
when defined(android):
    # Supported URL schemes: android_asset, file
    snd = newSoundWithURL("android_asset://testfile.ogg") # The path is relative to assets folder
elif defined(js):
    snd = newSoundWithURL("testfile.ogg") # The url may be relative or absolute. The sound is loaded asynchronously.
else:
    # Supported URL schemes: file.
    snd = newSoundWithURL("file://" & getAppDir() & "/testfile.ogg")

snd.play()