Sha256: f20e4e50affb5fd3a25a4eeeb884eda1ab8c43a7f5e01f5303d9d4fff8553645

Contents?: true

Size: 832 Bytes

Versions: 2

Compression:

Stored size: 832 Bytes

Contents

#include "say.h"

static ALCdevice  *say_audio_device  = NULL;
static ALCcontext *say_audio_context = NULL;

void say_audio_context_ensure() {
  if (!say_audio_device) {
    say_audio_device = alcOpenDevice(NULL);
    if (!say_audio_device) {
      say_error_set("could not open audio device");
      return;
    }
  }

  if (!say_audio_context) {
    say_audio_context = alcCreateContext(say_audio_device, NULL);
    if (!say_audio_context) {
      say_error_set("could not create audio context");
      return;
    }

    alcMakeContextCurrent(say_audio_context);
  }
}

void say_audio_context_clean_up() {
  alcMakeContextCurrent(NULL);

  if (say_audio_context)
    alcDestroyContext(say_audio_context);

  if (say_audio_device)
    alcCloseDevice(say_audio_device);

  say_audio_context = NULL;
  say_audio_device  = NULL;  
}

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
ray-0.2.1 ext/say_audio_context.c
ray-0.2.0 ext/say_audio_context.c