Types
Microphone = ref object
- Source Edit
SlappyError = object of IOError
- Source Edit
StreamingSource = ref object
- A source that plays sequential PCM chunks via OpenAL buffer queuing. Source Edit
Procs
proc bits(mic: Microphone): int {.inline, ...raises: [], tags: [], forbids: [].}
- Gets the bits per sample for capture. Source Edit
proc channels(mic: Microphone): int {.inline, ...raises: [], tags: [], forbids: [].}
- Gets the number of capture channels. Source Edit
proc close(mic: Microphone) {....raises: [SlappyError], tags: [], forbids: [].}
- Closes the capture device and releases resources. Source Edit
proc close(ss: StreamingSource) {....raises: [], tags: [], forbids: [].}
- Stops playback and releases the OpenAL source. Source Edit
proc coneInnerAngle(source: Source): float32 {....raises: [], tags: [], forbids: [].}
- Gets inner cone angle in degrees. Source Edit
proc coneInnerAngle=(source: Source; v: float32) {....raises: [], tags: [], forbids: [].}
- Inner angle of the sound cone, in degrees. Default is 360. Source Edit
proc coneOuterAngle(source: Source): float32 {....raises: [], tags: [], forbids: [].}
- Gets outer cone angle in degrees. Source Edit
proc coneOuterAngle=(source: Source; v: float32) {....raises: [], tags: [], forbids: [].}
- Outer angle of the sound cone, in degrees. Default is 360. Source Edit
proc coneOuterGain(source: Source): float32 {....raises: [], tags: [], forbids: [].}
- Gets source gain outside the cone. Source Edit
proc coneOuterGain=(source: Source; v: float32) {....raises: [], tags: [], forbids: [].}
- The gain when outside the oriented cone. Source Edit
proc flush(ss: StreamingSource) {....raises: [], tags: [], forbids: [].}
- Stops playback and discards all queued audio. Source Edit
proc frequency(mic: Microphone): int {.inline, ...raises: [], tags: [], forbids: [].}
- Gets the capture frequency in Hz. Source Edit
proc halfDistance(source: Source): float32 {....raises: [], tags: [], forbids: [].}
- Gets reference distance for attenuation. Source Edit
proc halfDistance=(source: Source; v: float32) {....raises: [], tags: [], forbids: [].}
- The distance under which the volume for the source would normally drop by half (before being influenced by rolloff factor or maxDistance). Source Edit
proc listCaptureDevices(): seq[string] {....raises: [], tags: [], forbids: [].}
- Returns a list of available audio capture device names. Source Edit
proc maxDistance(source: Source): float32 {....raises: [], tags: [], forbids: [].}
- Gets max distance for attenuation. Source Edit
proc maxDistance=(source: Source; v: float32) {....raises: [], tags: [], forbids: [].}
- Set the Inverse Clamped Distance Model to set the distance where there will no longer be any attenuation of the source. Source Edit
proc newMicrophone(deviceName: string = ""; frequency: int = 44100; channels: int = 1; bits: int = 16; bufferSize: int = 44100 * 10): Microphone {. ...raises: [SlappyError], tags: [], forbids: [].}
- Opens an audio capture device for microphone input. Pass an empty deviceName for the default capture device. Source Edit
proc newSound(): Sound {....raises: [], tags: [], forbids: [].}
- Returns an empty sound handle. Source Edit
proc newSound(filePath: string; forceMono: bool = true): Sound {. ...raises: [SlappyError, IOError, OSError, SnappyError, ValueError], tags: [ReadIOEffect, WriteIOEffect], forbids: [].}
- Loads a sound buffer from wav, slappy, or ogg files. Files must be loaded as mono to use spatial sound features (default: true). Source Edit
proc newStreamingSource(frequency: int = 24000; channels: int = 1; bits: int = 16): StreamingSource {. ...raises: [SlappyError], tags: [], forbids: [].}
- Creates a streaming audio source for sequential PCM playback. Call queueData to append PCM chunks, then pump to reclaim processed buffers. Source Edit
proc playing(source: Source): bool {.inline, ...raises: [], tags: [], forbids: [].}
- Returns true when the source is currently playing. Source Edit
proc playing(ss: StreamingSource): bool {....raises: [], tags: [], forbids: [].}
- Returns true when the streaming source is currently playing. Source Edit
proc pos(a: Mat4): Vec3 {.inline, ...raises: [], tags: [], forbids: [].}
- Returns the position extracted from a matrix. Source Edit
proc pump(ss: StreamingSource) {....raises: [], tags: [], forbids: [].}
- Reclaims processed buffers to free resources. Call this periodically (e.g. each main loop iteration). Source Edit
proc queueData(ss: StreamingSource; data: seq[uint8]) {....raises: [], tags: [], forbids: [].}
- Queues a chunk of raw PCM data for sequential playback. Source Edit
proc read(mic: Microphone; sampleCount: int): seq[uint8] {....raises: [], tags: [], forbids: [].}
- Reads captured PCM samples as raw bytes. Source Edit
proc readAll(mic: Microphone): seq[uint8] {....raises: [], tags: [], forbids: [].}
- Reads all available captured samples as raw bytes. Source Edit
proc rolloffFactor(source: Source): float32 {....raises: [], tags: [], forbids: [].}
- Gets source rolloff factor. Source Edit
proc rolloffFactor=(source: Source; v: float32) {....raises: [], tags: [], forbids: [].}
- Set rolloff rate for the source. Default is 1.0. Source Edit
proc samplesAvailable(mic: Microphone): int {....raises: [], tags: [], forbids: [].}
- Returns the number of captured samples available for reading. Source Edit
proc slappyClose() {....raises: [SlappyError], tags: [], forbids: [].}
- Call this on exit. Source Edit
proc slappyInit() {....raises: [SlappyError], tags: [], forbids: [].}
- Call this on start of your program. Source Edit
proc slappyTick() {....raises: [], tags: [], forbids: [].}
- Updates all sources and sounds. Source Edit
proc start(mic: Microphone) {....raises: [], tags: [], forbids: [].}
- Starts audio capture on the microphone. Source Edit
proc stop(mic: Microphone) {....raises: [], tags: [], forbids: [].}
- Stops audio capture on the microphone. Source Edit
proc stop(source: Source) {....raises: [], tags: [], forbids: [].}
- Stops source playback. Source Edit
proc stop(ss: StreamingSource) {....raises: [], tags: [], forbids: [].}
- Stops playback immediately. Source Edit
proc toSound(mic: Microphone; data: seq[uint8]): Sound {....raises: [SlappyError], tags: [], forbids: [].}
- Creates a playable Sound from captured PCM data. Source Edit