Filter setup
This commit is contained in:
@@ -279,6 +279,10 @@ class NativeCFFI {
|
|||||||
@:cffi private static function lime_alc_process_context (context: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_resume_device (device:CFFIPointer):Void;
|
||||||
@:cffi private static function lime_alc_suspend_context (context:CFFIPointer):Void;
|
@:cffi private static function lime_alc_suspend_context (context:CFFIPointer):Void;
|
||||||
|
|
||||||
|
@:cffi private static function lime_al_gen_filter():CFFIPointer;
|
||||||
|
@:cffi private static function lime_al_filteri(filter:CFFIPointer, param:Int, value:Dynamic):Void;
|
||||||
|
@:cffi private static function lime_al_filterf(filter:CFFIPointer, param:Int, value:Float32):Void;
|
||||||
#end
|
#end
|
||||||
|
|
||||||
#if (lime_cffi && !macro && lime_cairo)
|
#if (lime_cffi && !macro && lime_cairo)
|
||||||
|
|||||||
@@ -79,6 +79,32 @@ class AL {
|
|||||||
public static inline var EXPONENT_DISTANCE:Int = 0xD005;
|
public static inline var EXPONENT_DISTANCE:Int = 0xD005;
|
||||||
public static inline var EXPONENT_DISTANCE_CLAMPED:Int = 0xD006;
|
public static inline var EXPONENT_DISTANCE_CLAMPED:Int = 0xD006;
|
||||||
|
|
||||||
|
public static inline var DIRECT_FILTER:Int = 0x20005;
|
||||||
|
|
||||||
|
/* Lowpass filter parameters */
|
||||||
|
public static inline var LOWPASS_GAIN:Int = 0x0001;
|
||||||
|
public static inline var LOWPASS_GAINHF:Int = 0x0002;
|
||||||
|
|
||||||
|
/* Highpass filter parameters */
|
||||||
|
public static inline var HIGHPASS_GAIN:Int = 0x0001;
|
||||||
|
public static inline var HIGHPASS_GAINLF:Int = 0x0002;
|
||||||
|
|
||||||
|
/* Bandpass filter parameters */
|
||||||
|
public static inline var BANDPASS_GAIN:Int = 0x0001;
|
||||||
|
public static inline var BANDPASS_GAINLF:Int = 0x0002;
|
||||||
|
public static inline var BANDPASS_GAINHF:Int = 0x0003;
|
||||||
|
|
||||||
|
/* Filter type */
|
||||||
|
public static inline var FILTER_FIRST_PARAMETER:Int = 0x0000;
|
||||||
|
public static inline var FILTER_LAST_PARAMETER:Int = 0x8000;
|
||||||
|
public static inline var FILTER_TYPE:Int = 0x8001;
|
||||||
|
|
||||||
|
/* Filter types, used with the AL_FILTER_TYPE property */
|
||||||
|
public static inline var FILTER_NULL:Int = 0x0000;
|
||||||
|
public static inline var FILTER_LOWPASS:Int = 0x0001;
|
||||||
|
public static inline var FILTER_HIGHPASS:Int = 0x0002;
|
||||||
|
public static inline var FILTER_BANDPASS:Int = 0x0003;
|
||||||
|
|
||||||
|
|
||||||
public static function bufferData (buffer:ALBuffer, format:Int, data:ArrayBufferView, size:Int, freq:Int):Void {
|
public static function bufferData (buffer:ALBuffer, format:Int, data:ArrayBufferView, size:Int, freq:Int):Void {
|
||||||
|
|
||||||
@@ -164,6 +190,15 @@ class AL {
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static function createFilter():ALFilter {
|
||||||
|
#if (lime_cffi && lime_openal && !macro)
|
||||||
|
return NativeCFFI.lime_al_gen_filter ();
|
||||||
|
#else
|
||||||
|
return null;
|
||||||
|
#end
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
public static function deleteBuffer (buffer:ALBuffer):Void {
|
public static function deleteBuffer (buffer:ALBuffer):Void {
|
||||||
|
|
||||||
@@ -786,6 +821,19 @@ class AL {
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static function filteri(filter:ALFilter, param:Int, value:Dynamic):Void {
|
||||||
|
#if (lime_cffi && lime_openal && !macro)
|
||||||
|
NativeCFFI.lime_al_filteri (filter, param, value);
|
||||||
|
#end
|
||||||
|
}
|
||||||
|
|
||||||
|
public static function filterf (filter:ALFilter, param:Int, value:Float):Void {
|
||||||
|
|
||||||
|
#if (lime_cffi && lime_openal && !macro)
|
||||||
|
NativeCFFI.lime_al_filterf (filter, param, value);
|
||||||
|
#end
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
public static function sourceiv (source:ALSource, param:Int, values:Array<Int>):Void {
|
public static function sourceiv (source:ALSource, param:Int, values:Array<Int>):Void {
|
||||||
|
|
||||||
|
|||||||
19
lime/media/openal/ALFilter.hx
Normal file
19
lime/media/openal/ALFilter.hx
Normal file
@@ -0,0 +1,19 @@
|
|||||||
|
package lime.media.openal;
|
||||||
|
|
||||||
|
|
||||||
|
import lime.system.CFFIPointer;
|
||||||
|
|
||||||
|
@:allow(lime.media.openal.AL)
|
||||||
|
|
||||||
|
|
||||||
|
abstract ALFilter(CFFIPointer) from CFFIPointer to CFFIPointer {
|
||||||
|
|
||||||
|
|
||||||
|
private inline function new (handle:CFFIPointer) {
|
||||||
|
|
||||||
|
this = handle;
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
@@ -24,7 +24,7 @@ namespace lime {
|
|||||||
|
|
||||||
void lime_al_delete_buffer (value buffer);
|
void lime_al_delete_buffer (value buffer);
|
||||||
void lime_al_delete_source (value source);
|
void lime_al_delete_source (value source);
|
||||||
|
void lime_al_delete_filter (value filter);
|
||||||
|
|
||||||
void gc_al_buffer (value buffer) {
|
void gc_al_buffer (value buffer) {
|
||||||
|
|
||||||
@@ -38,6 +38,10 @@ namespace lime {
|
|||||||
lime_al_delete_source (source);
|
lime_al_delete_source (source);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void gc_al_filter(value filter) {
|
||||||
|
lime_al_delete_filter(filter);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
void gc_alc_object (value object) {
|
void gc_alc_object (value object) {
|
||||||
@@ -193,6 +197,19 @@ namespace lime {
|
|||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void lime_al_delete_filter(value filter) {
|
||||||
|
|
||||||
|
if (!val_is_null(filter)) {
|
||||||
|
|
||||||
|
ALuint data = (ALuint)(uintptr_t)val_data(filter);
|
||||||
|
alDeleteFilters(1, &data);
|
||||||
|
val_gc(filter, 0);
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
void lime_al_delete_source (value source) {
|
void lime_al_delete_source (value source) {
|
||||||
@@ -230,6 +247,8 @@ namespace lime {
|
|||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
void lime_al_disable (int capability) {
|
void lime_al_disable (int capability) {
|
||||||
@@ -265,6 +284,26 @@ namespace lime {
|
|||||||
alEnable (capability);
|
alEnable (capability);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void lime_al_filteri(value filter, int param, value val) {
|
||||||
|
|
||||||
|
ALuint id = (ALuint)(uintptr_t)val_data(filter);
|
||||||
|
ALuint data;
|
||||||
|
|
||||||
|
data = val_int(val);
|
||||||
|
|
||||||
|
alFilteri(id, param, data);
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void lime_al_filterf(value filter, int param, float value) {
|
||||||
|
|
||||||
|
ALuint id = (ALuint)(uintptr_t)val_data(filter);
|
||||||
|
alFilterf(id, param, value);
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
value lime_al_gen_buffer () {
|
value lime_al_gen_buffer () {
|
||||||
@@ -302,6 +341,15 @@ namespace lime {
|
|||||||
return result;
|
return result;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
value lime_al_gen_filter() {
|
||||||
|
|
||||||
|
ALuint filter;
|
||||||
|
alGenFilters((ALuint)1, &filter);
|
||||||
|
return CFFIPointer((void*)(uintptr_t)filter, gc_al_filter);
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
value lime_al_gen_source () {
|
value lime_al_gen_source () {
|
||||||
@@ -1079,7 +1127,7 @@ namespace lime {
|
|||||||
ALuint id = (ALuint)(uintptr_t)val_data (source);
|
ALuint id = (ALuint)(uintptr_t)val_data (source);
|
||||||
ALuint data;
|
ALuint data;
|
||||||
|
|
||||||
if (param == AL_BUFFER) {
|
if (param == AL_BUFFER || param == AL_DIRECT_FILTER) {
|
||||||
|
|
||||||
data = (ALuint)(uintptr_t)val_data (val);
|
data = (ALuint)(uintptr_t)val_data (val);
|
||||||
|
|
||||||
@@ -1092,7 +1140,7 @@ namespace lime {
|
|||||||
alSourcei (id, param, data);
|
alSourcei (id, param, data);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void lime_al_sourceiv (value source, int param, value values) {
|
void lime_al_sourceiv (value source, int param, value values) {
|
||||||
|
|
||||||
@@ -1307,6 +1355,8 @@ namespace lime {
|
|||||||
alcSuspendContext (alcContext);
|
alcSuspendContext (alcContext);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
DEFINE_PRIME5v (lime_al_buffer_data);
|
DEFINE_PRIME5v (lime_al_buffer_data);
|
||||||
@@ -1318,15 +1368,19 @@ namespace lime {
|
|||||||
DEFINE_PRIME3v (lime_al_bufferiv);
|
DEFINE_PRIME3v (lime_al_bufferiv);
|
||||||
DEFINE_PRIME1v (lime_al_delete_buffer);
|
DEFINE_PRIME1v (lime_al_delete_buffer);
|
||||||
DEFINE_PRIME2v (lime_al_delete_buffers);
|
DEFINE_PRIME2v (lime_al_delete_buffers);
|
||||||
|
DEFINE_PRIME1v(lime_al_delete_filter);
|
||||||
DEFINE_PRIME1v (lime_al_delete_source);
|
DEFINE_PRIME1v (lime_al_delete_source);
|
||||||
DEFINE_PRIME2v (lime_al_delete_sources);
|
DEFINE_PRIME2v (lime_al_delete_sources);
|
||||||
DEFINE_PRIME1v (lime_al_disable);
|
DEFINE_PRIME1v (lime_al_disable);
|
||||||
DEFINE_PRIME1v (lime_al_distance_model);
|
DEFINE_PRIME1v (lime_al_distance_model);
|
||||||
DEFINE_PRIME1v (lime_al_doppler_factor);
|
DEFINE_PRIME1v (lime_al_doppler_factor);
|
||||||
DEFINE_PRIME1v (lime_al_doppler_velocity);
|
DEFINE_PRIME1v (lime_al_doppler_velocity);
|
||||||
DEFINE_PRIME1v (lime_al_enable);
|
DEFINE_PRIME1v (lime_al_enable);
|
||||||
|
DEFINE_PRIME3v (lime_al_filteri);
|
||||||
|
DEFINE_PRIME3v (lime_al_filterf);
|
||||||
DEFINE_PRIME0 (lime_al_gen_buffer);
|
DEFINE_PRIME0 (lime_al_gen_buffer);
|
||||||
DEFINE_PRIME1 (lime_al_gen_buffers);
|
DEFINE_PRIME1 (lime_al_gen_buffers);
|
||||||
|
DEFINE_PRIME0 (lime_al_gen_filter);
|
||||||
DEFINE_PRIME0 (lime_al_gen_source);
|
DEFINE_PRIME0 (lime_al_gen_source);
|
||||||
DEFINE_PRIME1 (lime_al_gen_sources);
|
DEFINE_PRIME1 (lime_al_gen_sources);
|
||||||
DEFINE_PRIME1 (lime_al_get_boolean);
|
DEFINE_PRIME1 (lime_al_get_boolean);
|
||||||
@@ -1401,7 +1455,6 @@ namespace lime {
|
|||||||
DEFINE_PRIME1v (lime_alc_resume_device);
|
DEFINE_PRIME1v (lime_alc_resume_device);
|
||||||
DEFINE_PRIME1v (lime_alc_suspend_context);
|
DEFINE_PRIME1v (lime_alc_suspend_context);
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user