Compare commits
2 Commits
8.3.0-Dev
...
bc862887c6
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
bc862887c6 | ||
|
|
304ffb9438 |
@@ -170,6 +170,7 @@ namespace lime {
|
||||
}
|
||||
*/
|
||||
|
||||
|
||||
void lime_al_auxf (value aux, int param, float value) {
|
||||
|
||||
#ifdef LIME_OPENALSOFT
|
||||
@@ -3512,6 +3513,101 @@ namespace lime {
|
||||
}
|
||||
|
||||
|
||||
value lime_alc_capture_open_device (HxString devicename, int frequency, int format, int buffersize) {
|
||||
|
||||
ALCdevice* alcDevice = alcCaptureOpenDevice (devicename.__s, frequency, format, buffersize);
|
||||
|
||||
value ptr = CFFIPointer (alcDevice, gc_alc_object);
|
||||
alcObjects[alcDevice] = ptr;
|
||||
return ptr;
|
||||
|
||||
}
|
||||
|
||||
|
||||
HL_PRIM HL_CFFIPointer* HL_NAME(hl_alc_capture_open_device) (hl_vstring* devicename, int frequency, int format, int buffersize) {
|
||||
|
||||
ALCdevice* alcDevice = alcCaptureOpenDevice (devicename ? (char*)hl_to_utf8 ((const uchar*)devicename->bytes) : 0, frequency, format, buffersize);
|
||||
|
||||
HL_CFFIPointer* ptr = HLCFFIPointer (alcDevice, (hl_finalizer)hl_gc_alc_object);
|
||||
alcObjects[alcDevice] = ptr;
|
||||
return ptr;
|
||||
|
||||
}
|
||||
|
||||
|
||||
bool lime_alc_capture_close_device (value device) {
|
||||
|
||||
al_gc_mutex.Lock ();
|
||||
ALCdevice* alcDevice = (ALCdevice*)val_data (device);
|
||||
alcObjects.erase (alcDevice);
|
||||
al_gc_mutex.Unlock ();
|
||||
|
||||
return alcCaptureCloseDevice (alcDevice);
|
||||
|
||||
}
|
||||
|
||||
|
||||
HL_PRIM bool HL_NAME(hl_alc_capture_close_device) (HL_CFFIPointer* device) {
|
||||
|
||||
al_gc_mutex.Lock ();
|
||||
ALCdevice* alcDevice = (ALCdevice*)device->ptr;
|
||||
alcObjects.erase (alcDevice);
|
||||
al_gc_mutex.Unlock ();
|
||||
|
||||
return alcCaptureCloseDevice (alcDevice);
|
||||
|
||||
}
|
||||
|
||||
|
||||
void lime_alc_capture_start (value device) {
|
||||
|
||||
ALCdevice* alcDevice = (ALCdevice*)val_data (device);
|
||||
alcCaptureStart (alcDevice);
|
||||
|
||||
}
|
||||
|
||||
|
||||
HL_PRIM void HL_NAME(hl_alc_capture_start) (HL_CFFIPointer* device) {
|
||||
|
||||
ALCdevice* alcDevice = (ALCdevice*)device->ptr;
|
||||
alcCaptureStart (alcDevice);
|
||||
|
||||
}
|
||||
|
||||
|
||||
void lime_alc_capture_stop (value device) {
|
||||
|
||||
ALCdevice* alcDevice = (ALCdevice*)val_data (device);
|
||||
alcCaptureStop (alcDevice);
|
||||
|
||||
}
|
||||
|
||||
|
||||
HL_PRIM void HL_NAME(hl_alc_capture_stop) (HL_CFFIPointer* device) {
|
||||
|
||||
ALCdevice* alcDevice = (ALCdevice*)device->ptr;
|
||||
alcCaptureStop (alcDevice);
|
||||
|
||||
}
|
||||
|
||||
|
||||
void lime_alc_capture_samples (value device, value buffer, int samples) {
|
||||
|
||||
ALCdevice* alcDevice = (ALCdevice*)val_data (device);
|
||||
Bytes bytes (buffer);
|
||||
alcCaptureSamples (alcDevice, bytes.b, samples);
|
||||
|
||||
}
|
||||
|
||||
|
||||
HL_PRIM void HL_NAME(hl_alc_capture_samples) (HL_CFFIPointer* device, Bytes* buffer, int samples) {
|
||||
|
||||
ALCdevice* alcDevice = (ALCdevice*)device->ptr;
|
||||
alcCaptureSamples (alcDevice, buffer->b, samples);
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
DEFINE_PRIME3v (lime_al_auxf);
|
||||
@@ -3628,6 +3724,11 @@ namespace lime {
|
||||
DEFINE_PRIME1v (lime_alc_process_context);
|
||||
DEFINE_PRIME1v (lime_alc_resume_device);
|
||||
DEFINE_PRIME1v (lime_alc_suspend_context);
|
||||
DEFINE_PRIME4 (lime_alc_capture_open_device);
|
||||
DEFINE_PRIME1 (lime_alc_capture_close_device);
|
||||
DEFINE_PRIME1v (lime_alc_capture_start);
|
||||
DEFINE_PRIME1v (lime_alc_capture_stop);
|
||||
DEFINE_PRIME3v (lime_alc_capture_samples);
|
||||
|
||||
|
||||
#define _TBYTES _OBJ (_I32 _BYTES)
|
||||
@@ -3752,6 +3853,11 @@ namespace lime {
|
||||
DEFINE_HL_PRIM (_VOID, hl_alc_process_context, _TCFFIPOINTER);
|
||||
DEFINE_HL_PRIM (_VOID, hl_alc_resume_device, _TCFFIPOINTER);
|
||||
DEFINE_HL_PRIM (_VOID, hl_alc_suspend_context, _TCFFIPOINTER);
|
||||
DEFINE_HL_PRIM (_TCFFIPOINTER, hl_alc_capture_open_device, _STRING _I32 _I32 _I32);
|
||||
DEFINE_HL_PRIM (_BOOL, hl_alc_capture_close_device, _TCFFIPOINTER);
|
||||
DEFINE_HL_PRIM (_VOID, hl_alc_capture_start, _TCFFIPOINTER);
|
||||
DEFINE_HL_PRIM (_VOID, hl_alc_capture_stop, _TCFFIPOINTER);
|
||||
DEFINE_HL_PRIM (_VOID, hl_alc_capture_samples, _TCFFIPOINTER _TBYTES _I32);
|
||||
|
||||
|
||||
}
|
||||
|
||||
@@ -1668,6 +1668,16 @@ class NativeCFFI
|
||||
|
||||
@:cffi private static function lime_alc_suspend_context(context:CFFIPointer):Void;
|
||||
|
||||
@:cffi private static function lime_alc_capture_open_device(devicename:String, frequency:Int, format:Int, buffersize:Int):CFFIPointer;
|
||||
|
||||
@:cffi private static function lime_alc_capture_close_device(device:CFFIPointer):Bool;
|
||||
|
||||
@:cffi private static function lime_alc_capture_start(device:CFFIPointer):Void;
|
||||
|
||||
@:cffi private static function lime_alc_capture_stop(device:CFFIPointer):Void;
|
||||
|
||||
@:cffi private static function lime_alc_capture_samples(device:CFFIPointer, buffer:Dynamic, samples:Int):Void;
|
||||
|
||||
@:cffi private static function lime_al_gen_filter():CFFIPointer;
|
||||
|
||||
@:cffi private static function lime_al_filteri(filter:CFFIPointer, param:Int, value:Dynamic):Void;
|
||||
@@ -1835,6 +1845,16 @@ class NativeCFFI
|
||||
private static var lime_alc_resume_device = new cpp.Callable<cpp.Object->cpp.Void>(cpp.Prime._loadPrime("lime", "lime_alc_resume_device", "ov", false));
|
||||
private static var lime_alc_suspend_context = new cpp.Callable<cpp.Object->cpp.Void>(cpp.Prime._loadPrime("lime", "lime_alc_suspend_context", "ov",
|
||||
false));
|
||||
private static var lime_alc_capture_open_device = new cpp.Callable<String->Int->Int->Int->cpp.Object>(cpp.Prime._loadPrime("lime", "lime_alc_capture_open_device",
|
||||
"siiio", false));
|
||||
private static var lime_alc_capture_close_device = new cpp.Callable<cpp.Object->Bool>(cpp.Prime._loadPrime("lime", "lime_alc_capture_close_device", "ob",
|
||||
false));
|
||||
private static var lime_alc_capture_start = new cpp.Callable<cpp.Object->cpp.Void>(cpp.Prime._loadPrime("lime", "lime_alc_capture_start", "ov",
|
||||
false));
|
||||
private static var lime_alc_capture_stop = new cpp.Callable<cpp.Object->cpp.Void>(cpp.Prime._loadPrime("lime", "lime_alc_capture_stop", "ov",
|
||||
false));
|
||||
private static var lime_alc_capture_samples = new cpp.Callable<cpp.Object->cpp.Object->Int->cpp.Void>(cpp.Prime._loadPrime("lime", "lime_alc_capture_samples",
|
||||
"ooiv", false));
|
||||
private static var lime_al_gen_filter = new cpp.Callable<Void->cpp.Object>(cpp.Prime._loadPrime("lime", "lime_al_gen_filter", "o", false));
|
||||
private static var lime_al_filteri = new cpp.Callable<cpp.Object->Int->cpp.Object->cpp.Void>(cpp.Prime._loadPrime("lime", "lime_al_filteri", "oiov",
|
||||
false));
|
||||
@@ -1955,6 +1975,11 @@ class NativeCFFI
|
||||
private static var lime_alc_process_context = CFFI.load("lime", "lime_alc_process_context", 1);
|
||||
private static var lime_alc_resume_device = CFFI.load("lime", "lime_alc_resume_device", 1);
|
||||
private static var lime_alc_suspend_context = CFFI.load("lime", "lime_alc_suspend_context", 1);
|
||||
private static var lime_alc_capture_open_device = CFFI.load("lime", "lime_alc_capture_open_device", 4);
|
||||
private static var lime_alc_capture_close_device = CFFI.load("lime", "lime_alc_capture_close_device", 1);
|
||||
private static var lime_alc_capture_start = CFFI.load("lime", "lime_alc_capture_start", 1);
|
||||
private static var lime_alc_capture_stop = CFFI.load("lime", "lime_alc_capture_stop", 1);
|
||||
private static var lime_alc_capture_samples = CFFI.load("lime", "lime_alc_capture_samples", 3);
|
||||
private static var lime_al_gen_filter = CFFI.load("lime", "lime_al_gen_filter", 0);
|
||||
private static var lime_al_filteri = CFFI.load("lime", "lime_al_filteri", 3);
|
||||
private static var lime_al_filterf = CFFI.load("lime", "lime_al_filterf", 3);
|
||||
@@ -2311,6 +2336,22 @@ class NativeCFFI
|
||||
|
||||
@:hlNative("lime", "hl_alc_suspend_context") private static function lime_alc_suspend_context(context:ALContext):Void {}
|
||||
|
||||
@:hlNative("lime", "hl_alc_capture_open_device") private static function lime_alc_capture_open_device(devicename:String, frequency:Int, format:Int, buffersize:Int):CFFIPointer
|
||||
{
|
||||
return null;
|
||||
}
|
||||
|
||||
@:hlNative("lime", "hl_alc_capture_close_device") private static function lime_alc_capture_close_device(device:ALDevice):Bool
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
@:hlNative("lime", "hl_alc_capture_start") private static function lime_alc_capture_start(device:ALDevice):Void {}
|
||||
|
||||
@:hlNative("lime", "hl_alc_capture_stop") private static function lime_alc_capture_stop(device:ALDevice):Void {}
|
||||
|
||||
@:hlNative("lime", "hl_alc_capture_samples") private static function lime_alc_capture_samples(device:ALDevice, buffer:Bytes, samples:Int):Void {}
|
||||
|
||||
@:hlNative("lime", "hl_al_gen_filter") private static function lime_al_gen_filter():CFFIPointer
|
||||
{
|
||||
return null;
|
||||
|
||||
@@ -8,6 +8,7 @@ import lime.media.openal.ALContext;
|
||||
import lime.media.openal.ALDevice;
|
||||
import lime.media.openal.ALSource;
|
||||
import lime.utils.ArrayBufferView;
|
||||
import haxe.io.Bytes;
|
||||
|
||||
#if !lime_debug
|
||||
@:fileXml('tags="haxe,release"')
|
||||
@@ -587,5 +588,30 @@ class OpenALAudioContext
|
||||
{
|
||||
ALC.suspendContext(context);
|
||||
}
|
||||
|
||||
public function captureOpenDevice(deviceName:String, frequency:Int, format:Int, bufferSize:Int):ALDevice
|
||||
{
|
||||
return ALC.captureOpenDevice(deviceName, frequency, format, bufferSize);
|
||||
}
|
||||
|
||||
public function captureCloseDevice(device:ALDevice):Bool
|
||||
{
|
||||
return ALC.captureCloseDevice(device);
|
||||
}
|
||||
|
||||
public function captureStart(device:ALDevice):Void
|
||||
{
|
||||
ALC.captureStart(device);
|
||||
}
|
||||
|
||||
public function captureStop(device:ALDevice):Void
|
||||
{
|
||||
ALC.captureStop(device);
|
||||
}
|
||||
|
||||
public function captureSamples(device:ALDevice, buffer:Bytes, samples:Int):Void
|
||||
{
|
||||
ALC.captureSamples(device, buffer, samples);
|
||||
}
|
||||
}
|
||||
#end
|
||||
|
||||
@@ -4,6 +4,7 @@ package lime.media.openal;
|
||||
import lime._internal.backend.native.NativeCFFI;
|
||||
import lime.system.CFFI;
|
||||
import lime.system.CFFIPointer;
|
||||
import haxe.io.Bytes;
|
||||
|
||||
#if !lime_debug
|
||||
@:fileXml('tags="haxe,release"')
|
||||
@@ -33,6 +34,9 @@ class ALC
|
||||
public static inline var ENUMERATE_ALL_EXT:Int = 1;
|
||||
public static inline var DEFAULT_ALL_DEVICES_SPECIFIER:Int = 0x1012;
|
||||
public static inline var ALL_DEVICES_SPECIFIER:Int = 0x1013;
|
||||
public static inline var CAPTURE_DEVICE_SPECIFIER:Int = 0x310;
|
||||
public static inline var CAPTURE_DEFAULT_DEVICE_SPECIFIER:Int = 0x311;
|
||||
public static inline var CAPTURE_SAMPLES:Int = 0x312;
|
||||
|
||||
public static function closeDevice(device:ALDevice):Bool
|
||||
{
|
||||
@@ -202,5 +206,49 @@ class ALC
|
||||
NativeCFFI.lime_alc_suspend_context(context);
|
||||
#end
|
||||
}
|
||||
|
||||
public static function captureOpenDevice(deviceName:String, frequency:Int, format:Int, bufferSize:Int):ALDevice
|
||||
{
|
||||
#if (lime_cffi && lime_openal && !macro)
|
||||
var handle = NativeCFFI.lime_alc_capture_open_device(deviceName, frequency, format, bufferSize);
|
||||
|
||||
if (handle != null)
|
||||
{
|
||||
return new ALDevice(handle);
|
||||
}
|
||||
#end
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
public static function captureCloseDevice(device:ALDevice):Bool
|
||||
{
|
||||
#if (lime_cffi && lime_openal && !macro)
|
||||
return NativeCFFI.lime_alc_capture_close_device(device);
|
||||
#end
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
public static function captureStart(device:ALDevice):Void
|
||||
{
|
||||
#if (lime_cffi && lime_openal && !macro)
|
||||
NativeCFFI.lime_alc_capture_start(device);
|
||||
#end
|
||||
}
|
||||
|
||||
public static function captureStop(device:ALDevice):Void
|
||||
{
|
||||
#if (lime_cffi && lime_openal && !macro)
|
||||
NativeCFFI.lime_alc_capture_stop(device);
|
||||
#end
|
||||
}
|
||||
|
||||
public static function captureSamples(device:ALDevice, buffer:Bytes, samples:Int):Void
|
||||
{
|
||||
#if (lime_cffi && lime_openal && !macro)
|
||||
NativeCFFI.lime_alc_capture_samples(device, buffer, samples);
|
||||
#end
|
||||
}
|
||||
}
|
||||
#end
|
||||
|
||||
Reference in New Issue
Block a user