Add bindings for device pause/resume for OpenAL

This commit is contained in:
Joshua Granick
2016-09-09 14:10:49 -07:00
parent 86d998e129
commit b3856128dc
3 changed files with 57 additions and 0 deletions

View File

@@ -116,6 +116,13 @@ class ALCAudioContext {
}
public function pauseDevice (device:ALDevice):Void {
ALC.pauseDevice (device);
}
public function processContext (context:ALContext):Void {
ALC.processContext (context);
@@ -123,6 +130,13 @@ class ALCAudioContext {
}
public function resumeDevice (device:ALDevice):Void {
ALC.resumeDevice (device);
}
public function suspendContext (context:ALContext):Void {
ALC.suspendContext (context);

View File

@@ -182,6 +182,15 @@ class ALC {
}
public static function pauseDevice (device:ALDevice):Void {
#if (lime_cffi && lime_openal && !macro)
lime_alc_pause_device (device);
#end
}
public static function processContext (context:ALContext):Void {
#if (lime_cffi && lime_openal && !macro)
@@ -191,6 +200,15 @@ class ALC {
}
public static function resumeDevice (device:ALDevice):Void {
#if (lime_cffi && lime_openal && !macro)
lime_alc_resume_device (device);
#end
}
public static function suspendContext (context:ALContext):Void {
#if (lime_cffi && lime_openal && !macro)
@@ -211,7 +229,9 @@ class ALC {
@:cffi private static function lime_alc_get_string (device:CFFIPointer, param:Int):Dynamic;
@:cffi private static function lime_alc_make_context_current (context:CFFIPointer):Bool;
@:cffi private static function lime_alc_open_device (devicename:String):CFFIPointer;
@:cffi private static function lime_alc_pause_device (device:CFFIPointer):Void;
@:cffi private static function lime_alc_process_context (context:CFFIPointer):Void;
@:cffi private static function lime_alc_resume_device (device:CFFIPointer):Void;
@:cffi private static function lime_alc_suspend_context (context:CFFIPointer):Void;
#end

View File

@@ -4,6 +4,7 @@
#else
#include "AL/al.h"
#include "AL/alc.h"
#include "AL/alext.h"
#endif
#include <hx/CFFIPrimePatch.h>
@@ -1111,6 +1112,16 @@ namespace lime {
}
void lime_alc_pause_device (value device) {
#ifdef LIME_OPENALSOFT
ALCdevice* alcDevice = (ALCdevice*)val_data (device);
alcDevicePauseSOFT (alcDevice);
#endif
}
void lime_alc_process_context (value context) {
ALCcontext* alcContext = (ALCcontext*)val_data (context);
@@ -1119,6 +1130,16 @@ namespace lime {
}
void lime_alc_resume_device (value device) {
#ifdef LIME_OPENALSOFT
ALCdevice* alcDevice = (ALCdevice*)val_data (device);
alcDeviceResumeSOFT (alcDevice);
#endif
}
void lime_alc_suspend_context (value context) {
ALCcontext* alcContext = (ALCcontext*)val_data (context);
@@ -1214,7 +1235,9 @@ namespace lime {
DEFINE_PRIME2 (lime_alc_get_string);
DEFINE_PRIME1 (lime_alc_make_context_current);
DEFINE_PRIME1 (lime_alc_open_device);
DEFINE_PRIME1v (lime_alc_pause_device);
DEFINE_PRIME1v (lime_alc_process_context);
DEFINE_PRIME1v (lime_alc_resume_device);
DEFINE_PRIME1v (lime_alc_suspend_context);