ALC bindings for HL
This commit is contained in:
@@ -8,6 +8,8 @@ import lime.graphics.opengl.GLRenderbuffer;
|
|||||||
import lime.graphics.opengl.GLShader;
|
import lime.graphics.opengl.GLShader;
|
||||||
import lime.graphics.opengl.GLTexture;
|
import lime.graphics.opengl.GLTexture;
|
||||||
import lime.media.openal.ALAuxiliaryEffectSlot;
|
import lime.media.openal.ALAuxiliaryEffectSlot;
|
||||||
|
import lime.media.openal.ALContext;
|
||||||
|
import lime.media.openal.ALDevice;
|
||||||
import lime.system.CFFIPointer;
|
import lime.system.CFFIPointer;
|
||||||
import lime.utils.DataPointer;
|
import lime.utils.DataPointer;
|
||||||
|
|
||||||
@@ -288,7 +290,20 @@ class NativeCFFI {
|
|||||||
@:cffi private static function lime_alc_suspend_context (context:CFFIPointer):Void;
|
@:cffi private static function lime_alc_suspend_context (context:CFFIPointer):Void;
|
||||||
|
|
||||||
#if hl
|
#if hl
|
||||||
@:hlNative("lime", "lime_alc_open_device") private static function hl_lime_alc_open_device (devicename:hl.Bytes):lime.media.openal.ALDevice { return null; };
|
@:hlNative("lime", "lime_alc_close_device") private static function hl_lime_alc_close_device (device:ALDevice):Bool { return false; }
|
||||||
|
@:hlNative("lime", "lime_alc_create_context") private static function hl_lime_alc_create_context (device:ALDevice, attrlist:hl.Bytes):ALContext { return null; }
|
||||||
|
@:hlNative("lime", "lime_alc_destroy_context") private static function hl_lime_alc_destroy_context (context:ALContext):Void {}
|
||||||
|
@:hlNative("lime", "lime_alc_get_contexts_device") private static function hl_lime_alc_get_contexts_device (context:ALContext):ALDevice { return null; }
|
||||||
|
@:hlNative("lime", "lime_alc_get_current_context") private static function hl_lime_alc_get_current_context ():ALContext { return null; }
|
||||||
|
@:hlNative("lime", "lime_alc_get_error") private static function hl_lime_alc_get_error (device:ALDevice):Int { return 0; }
|
||||||
|
@:hlNative("lime", "lime_alc_get_integerv") private static function hl_lime_alc_get_integerv (device:ALDevice, param:Int, size:Int, values:hl.Bytes):Void {}
|
||||||
|
@:hlNative("lime", "lime_alc_get_string") private static function hl_lime_alc_get_string (device:ALDevice, param:Int):hl.Bytes { return null; }
|
||||||
|
@:hlNative("lime", "lime_alc_make_context_current") private static function hl_lime_alc_make_context_current (context:ALContext):Bool { return false; }
|
||||||
|
@:hlNative("lime", "lime_alc_open_device") private static function hl_lime_alc_open_device (devicename:hl.Bytes):ALDevice { return null; }
|
||||||
|
@:hlNative("lime", "lime_alc_pause_device") private static function hl_lime_alc_pause_device (device:ALDevice):Void {}
|
||||||
|
@:hlNative("lime", "lime_alc_process_context") private static function hl_lime_alc_process_context (context:ALContext):Void {}
|
||||||
|
@:hlNative("lime", "lime_alc_resume_device") private static function hl_lime_alc_resume_device (device:ALDevice):Void {}
|
||||||
|
@:hlNative("lime", "lime_alc_suspend_context") private static function hl_lime_alc_suspend_context (context:ALContext):Void {}
|
||||||
#end
|
#end
|
||||||
|
|
||||||
@:cffi private static function lime_al_gen_filter():CFFIPointer;
|
@:cffi private static function lime_al_gen_filter():CFFIPointer;
|
||||||
|
|||||||
@@ -40,9 +40,11 @@ class ALC {
|
|||||||
|
|
||||||
public static function closeDevice (device:ALDevice):Bool {
|
public static function closeDevice (device:ALDevice):Bool {
|
||||||
|
|
||||||
#if (lime_cffi && lime_openal && !macro)
|
#if (lime_cffi && lime_openal && !macro) #if !hl
|
||||||
return NativeCFFI.lime_alc_close_device (device);
|
return NativeCFFI.lime_alc_close_device (device);
|
||||||
#else
|
#else
|
||||||
|
return NativeCFFI.hl_lime_alc_close_device (device);
|
||||||
|
#end #else
|
||||||
return false;
|
return false;
|
||||||
#end
|
#end
|
||||||
|
|
||||||
@@ -51,7 +53,7 @@ class ALC {
|
|||||||
|
|
||||||
public static function createContext (device:ALDevice, attrlist:Array<Int> = null):ALContext {
|
public static function createContext (device:ALDevice, attrlist:Array<Int> = null):ALContext {
|
||||||
|
|
||||||
#if (lime_cffi && lime_openal && !macro)
|
#if (lime_cffi && lime_openal && !macro) #if !hl
|
||||||
var handle:Dynamic = NativeCFFI.lime_alc_create_context (device, attrlist);
|
var handle:Dynamic = NativeCFFI.lime_alc_create_context (device, attrlist);
|
||||||
|
|
||||||
if (handle != null) {
|
if (handle != null) {
|
||||||
@@ -59,7 +61,10 @@ class ALC {
|
|||||||
return new ALContext (handle);
|
return new ALContext (handle);
|
||||||
|
|
||||||
}
|
}
|
||||||
#end
|
#else
|
||||||
|
var attrlist = (attrlist != null ? hl.Bytes.fromValue (attrlist, null) : null);
|
||||||
|
return NativeCFFI.hl_lime_alc_create_context (device, attrlist);
|
||||||
|
#end #end
|
||||||
|
|
||||||
return null;
|
return null;
|
||||||
|
|
||||||
@@ -68,9 +73,11 @@ class ALC {
|
|||||||
|
|
||||||
public static function destroyContext (context:ALContext):Void {
|
public static function destroyContext (context:ALContext):Void {
|
||||||
|
|
||||||
#if (lime_cffi && lime_openal && !macro)
|
#if (lime_cffi && lime_openal && !macro) #if !hl
|
||||||
NativeCFFI.lime_alc_destroy_context (context);
|
NativeCFFI.lime_alc_destroy_context (context);
|
||||||
#end
|
#else
|
||||||
|
NativeCFFI.hl_lime_alc_destroy_context (context);
|
||||||
|
#end #end
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -86,7 +93,7 @@ class ALC {
|
|||||||
|
|
||||||
}
|
}
|
||||||
#else
|
#else
|
||||||
|
return NativeCFFI.hl_lime_alc_get_contexts_device (context);
|
||||||
#end
|
#end
|
||||||
#end
|
#end
|
||||||
|
|
||||||
@@ -97,7 +104,7 @@ class ALC {
|
|||||||
|
|
||||||
public static function getCurrentContext ():ALContext {
|
public static function getCurrentContext ():ALContext {
|
||||||
|
|
||||||
#if (lime_cffi && lime_openal && !macro)
|
#if (lime_cffi && lime_openal && !macro) #if !hl
|
||||||
var handle:Dynamic = NativeCFFI.lime_alc_get_current_context ();
|
var handle:Dynamic = NativeCFFI.lime_alc_get_current_context ();
|
||||||
|
|
||||||
if (handle != null) {
|
if (handle != null) {
|
||||||
@@ -105,7 +112,9 @@ class ALC {
|
|||||||
return new ALContext (handle);
|
return new ALContext (handle);
|
||||||
|
|
||||||
}
|
}
|
||||||
#end
|
#else
|
||||||
|
return NativeCFFI.hl_lime_alc_get_current_context ();
|
||||||
|
#end #end
|
||||||
|
|
||||||
return null;
|
return null;
|
||||||
|
|
||||||
@@ -114,9 +123,11 @@ class ALC {
|
|||||||
|
|
||||||
public static function getError (device:ALDevice):Int {
|
public static function getError (device:ALDevice):Int {
|
||||||
|
|
||||||
#if (lime_cffi && lime_openal && !macro)
|
#if (lime_cffi && lime_openal && !macro) #if !hl
|
||||||
return NativeCFFI.lime_alc_get_error (device);
|
return NativeCFFI.lime_alc_get_error (device);
|
||||||
#else
|
#else
|
||||||
|
return NativeCFFI.lime_alc_get_error (device);
|
||||||
|
#end #else
|
||||||
return 0;
|
return 0;
|
||||||
#end
|
#end
|
||||||
|
|
||||||
@@ -141,9 +152,18 @@ class ALC {
|
|||||||
|
|
||||||
public static function getIntegerv (device:ALDevice, param:Int, size:Int):Array<Int> {
|
public static function getIntegerv (device:ALDevice, param:Int, size:Int):Array<Int> {
|
||||||
|
|
||||||
#if (lime_cffi && lime_openal && !macro)
|
#if (lime_cffi && lime_openal && !macro) #if !hl
|
||||||
return NativeCFFI.lime_alc_get_integerv (device, param, size);
|
return NativeCFFI.lime_alc_get_integerv (device, param, size);
|
||||||
#else
|
#else
|
||||||
|
// TODO: Make this work
|
||||||
|
var bytes = new hl.Bytes (size);
|
||||||
|
NativeCFFI.hl_lime_alc_get_integerv (device, param, size, bytes);
|
||||||
|
var result = new Array ();
|
||||||
|
for (i in 0...size) {
|
||||||
|
result[i] = bytes.getI32 (i);
|
||||||
|
}
|
||||||
|
return result;
|
||||||
|
#end #else
|
||||||
return null;
|
return null;
|
||||||
#end
|
#end
|
||||||
|
|
||||||
@@ -152,9 +172,12 @@ class ALC {
|
|||||||
|
|
||||||
public static function getString (device:ALDevice, param:Int):String {
|
public static function getString (device:ALDevice, param:Int):String {
|
||||||
|
|
||||||
#if (lime_cffi && lime_openal && !macro)
|
#if (lime_cffi && lime_openal && !macro) #if !hl
|
||||||
return NativeCFFI.lime_alc_get_string (device, param);
|
return NativeCFFI.lime_alc_get_string (device, param);
|
||||||
#else
|
#else
|
||||||
|
// TODO: Is this correct?
|
||||||
|
return cast NativeCFFI.hl_lime_alc_get_string (device, param);
|
||||||
|
#end #else
|
||||||
return null;
|
return null;
|
||||||
#end
|
#end
|
||||||
|
|
||||||
@@ -163,9 +186,11 @@ class ALC {
|
|||||||
|
|
||||||
public static function makeContextCurrent (context:ALContext):Bool {
|
public static function makeContextCurrent (context:ALContext):Bool {
|
||||||
|
|
||||||
#if (lime_cffi && lime_openal && !macro)
|
#if (lime_cffi && lime_openal && !macro) #if !hl
|
||||||
return NativeCFFI.lime_alc_make_context_current (context);
|
return NativeCFFI.lime_alc_make_context_current (context);
|
||||||
#else
|
#else
|
||||||
|
return NativeCFFI.hl_lime_alc_make_context_current (context);
|
||||||
|
#end #else
|
||||||
return false;
|
return false;
|
||||||
#end
|
#end
|
||||||
|
|
||||||
@@ -194,36 +219,44 @@ class ALC {
|
|||||||
|
|
||||||
public static function pauseDevice (device:ALDevice):Void {
|
public static function pauseDevice (device:ALDevice):Void {
|
||||||
|
|
||||||
#if (lime_cffi && lime_openal && !macro)
|
#if (lime_cffi && lime_openal && !macro) #if !hl
|
||||||
NativeCFFI.lime_alc_pause_device (device);
|
NativeCFFI.lime_alc_pause_device (device);
|
||||||
#end
|
#else
|
||||||
|
NativeCFFI.hl_lime_alc_pause_device (device);
|
||||||
|
#end #end
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
public static function processContext (context:ALContext):Void {
|
public static function processContext (context:ALContext):Void {
|
||||||
|
|
||||||
#if (lime_cffi && lime_openal && !macro)
|
#if (lime_cffi && lime_openal && !macro) #if !hl
|
||||||
NativeCFFI.lime_alc_process_context (context);
|
NativeCFFI.lime_alc_process_context (context);
|
||||||
#end
|
#else
|
||||||
|
NativeCFFI.hl_lime_alc_process_context (context);
|
||||||
|
#end #end
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
public static function resumeDevice (device:ALDevice):Void {
|
public static function resumeDevice (device:ALDevice):Void {
|
||||||
|
|
||||||
#if (lime_cffi && lime_openal && !macro)
|
#if (lime_cffi && lime_openal && !macro) #if !hl
|
||||||
NativeCFFI.lime_alc_resume_device (device);
|
NativeCFFI.lime_alc_resume_device (device);
|
||||||
#end
|
#else
|
||||||
|
NativeCFFI.hl_lime_alc_resume_device (device);
|
||||||
|
#end #end
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
public static function suspendContext (context:ALContext):Void {
|
public static function suspendContext (context:ALContext):Void {
|
||||||
|
|
||||||
#if (lime_cffi && lime_openal && !macro)
|
#if (lime_cffi && lime_openal && !macro) #if !hl
|
||||||
NativeCFFI.lime_alc_suspend_context (context);
|
NativeCFFI.lime_alc_suspend_context (context);
|
||||||
#end
|
#else
|
||||||
|
NativeCFFI.hl_lime_alc_suspend_context (context);
|
||||||
|
#end #end
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
package lime.media.openal;
|
package lime.media.openal; #if !hl
|
||||||
|
|
||||||
|
|
||||||
import lime.system.CFFIPointer;
|
import lime.system.CFFIPointer;
|
||||||
@@ -18,3 +18,8 @@ abstract ALContext(CFFIPointer) from CFFIPointer to CFFIPointer {
|
|||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
#else
|
||||||
|
typedef ALContext = hl.Abstract<"alc_context">;
|
||||||
|
#end
|
||||||
File diff suppressed because it is too large
Load Diff
Reference in New Issue
Block a user