Android: First commit of a new Audio system for Android that uses OpenAL Soft with the OpenSL backend. Requres Android 2.3 or higher. Source files for OpenAL Soft won't be included (similar to Native Bullet). The current Android audio renderer is still enabled.

git-svn-id: https://jmonkeyengine.googlecode.com/svn/trunk@10606 75d07b2b-3a1a-0410-a2c5-0572b91ccdca
3.0
iwg..om 12 years ago
parent efd7a8e7e8
commit b5f4541eec
  1. 384
      engine/src/android/com/jme3/audio/android/AL.java
  2. 1367
      engine/src/android/com/jme3/audio/android/AndroidOpenALSoftAudioRenderer.java
  3. 55
      engine/src/openal-soft-native/android/Android.mk
  4. 4
      engine/src/openal-soft-native/android/Application.mk
  5. 333
      engine/src/openal-soft-native/android/com_jme3_audio_android_AndroidOpenALSoftAudioRenderer.cpp
  6. 207
      engine/src/openal-soft-native/android/com_jme3_audio_android_AndroidOpenALSoftAudioRenderer.h
  7. 147
      engine/src/openal-soft-native/android/config.h

@ -0,0 +1,384 @@
package com.jme3.audio.android;
/**
*
* @author iwgeric
*/
public class AL {
/* ********** */
/* FROM ALC.h */
/* ********** */
// typedef struct ALCdevice_struct ALCdevice;
// typedef struct ALCcontext_struct ALCcontext;
/**
* No error
*/
static final int ALC_NO_ERROR = 0;
/**
* No device
*/
static final int ALC_INVALID_DEVICE = 0xA001;
/**
* invalid context ID
*/
static final int ALC_INVALID_CONTEXT = 0xA002;
/**
* bad enum
*/
static final int ALC_INVALID_ENUM = 0xA003;
/**
* bad value
*/
static final int ALC_INVALID_VALUE = 0xA004;
/**
* Out of memory.
*/
static final int ALC_OUT_OF_MEMORY = 0xA005;
/**
* The Specifier string for default device
*/
static final int ALC_DEFAULT_DEVICE_SPECIFIER = 0x1004;
static final int ALC_DEVICE_SPECIFIER = 0x1005;
static final int ALC_EXTENSIONS = 0x1006;
static final int ALC_MAJOR_VERSION = 0x1000;
static final int ALC_MINOR_VERSION = 0x1001;
static final int ALC_ATTRIBUTES_SIZE = 0x1002;
static final int ALC_ALL_ATTRIBUTES = 0x1003;
/**
* Capture extension
*/
static final int ALC_EXT_CAPTURE = 1;
static final int ALC_CAPTURE_DEVICE_SPECIFIER = 0x310;
static final int ALC_CAPTURE_DEFAULT_DEVICE_SPECIFIER = 0x311;
static final int ALC_CAPTURE_SAMPLES = 0x312;
/**
* ALC_ENUMERATE_ALL_EXT enums
*/
static final int ALC_ENUMERATE_ALL_EXT = 1;
static final int ALC_DEFAULT_ALL_DEVICES_SPECIFIER = 0x1012;
static final int ALC_ALL_DEVICES_SPECIFIER = 0x1013;
/* ********** */
/* FROM AL.h */
/* ********** */
/** Boolean False. */
static final int AL_FALSE = 0;
/** Boolean True. */
static final int AL_TRUE = 1;
/* "no distance model" or "no buffer" */
static final int AL_NONE = 0;
/** Indicate Source has relative coordinates. */
static final int AL_SOURCE_RELATIVE = 0x202;
/**
* Directional source, inner cone angle, in degrees.
* Range: [0-360]
* Default: 360
*/
static final int AL_CONE_INNER_ANGLE = 0x1001;
/**
* Directional source, outer cone angle, in degrees.
* Range: [0-360]
* Default: 360
*/
static final int AL_CONE_OUTER_ANGLE = 0x1002;
/**
* Specify the pitch to be applied at source.
* Range: [0.5-2.0]
* Default: 1.0
*/
static final int AL_PITCH = 0x1003;
/**
* Specify the current location in three dimensional space.
* OpenAL, like OpenGL, uses a right handed coordinate system,
* where in a frontal default view X (thumb) points right,
* Y points up (index finger), and Z points towards the
* viewer/camera (middle finger).
* To switch from a left handed coordinate system, flip the
* sign on the Z coordinate.
* Listener position is always in the world coordinate system.
*/
static final int AL_POSITION = 0x1004;
/** Specify the current direction. */
static final int AL_DIRECTION = 0x1005;
/** Specify the current velocity in three dimensional space. */
static final int AL_VELOCITY = 0x1006;
/**
* Indicate whether source is looping.
* Type: ALboolean?
* Range: [AL_TRUE, AL_FALSE]
* Default: FALSE.
*/
static final int AL_LOOPING = 0x1007;
/**
* Indicate the buffer to provide sound samples.
* Type: ALuint.
* Range: any valid Buffer id.
*/
static final int AL_BUFFER = 0x1009;
/**
* Indicate the gain (volume amplification) applied.
* Type: ALfloat.
* Range: ]0.0- ]
* A value of 1.0 means un-attenuated/unchanged.
* Each division by 2 equals an attenuation of -6dB.
* Each multiplicaton with 2 equals an amplification of +6dB.
* A value of 0.0 is meaningless with respect to a logarithmic
* scale; it is interpreted as zero volume - the channel
* is effectively disabled.
*/
static final int AL_GAIN = 0x100A;
/*
* Indicate minimum source attenuation
* Type: ALfloat
* Range: [0.0 - 1.0]
*
* Logarthmic
*/
static final int AL_MIN_GAIN = 0x100D;
/**
* Indicate maximum source attenuation
* Type: ALfloat
* Range: [0.0 - 1.0]
*
* Logarthmic
*/
static final int AL_MAX_GAIN = 0x100E;
/**
* Indicate listener orientation.
*
* at/up
*/
static final int AL_ORIENTATION = 0x100F;
/**
* Source state information.
*/
static final int AL_SOURCE_STATE = 0x1010;
static final int AL_INITIAL = 0x1011;
static final int AL_PLAYING = 0x1012;
static final int AL_PAUSED = 0x1013;
static final int AL_STOPPED = 0x1014;
/**
* Buffer Queue params
*/
static final int AL_BUFFERS_QUEUED = 0x1015;
static final int AL_BUFFERS_PROCESSED = 0x1016;
/**
* Source buffer position information
*/
static final int AL_SEC_OFFSET = 0x1024;
static final int AL_SAMPLE_OFFSET = 0x1025;
static final int AL_BYTE_OFFSET = 0x1026;
/*
* Source type (Static, Streaming or undetermined)
* Source is Static if a Buffer has been attached using AL_BUFFER
* Source is Streaming if one or more Buffers have been attached using alSourceQueueBuffers
* Source is undetermined when it has the NULL buffer attached
*/
static final int AL_SOURCE_TYPE = 0x1027;
static final int AL_STATIC = 0x1028;
static final int AL_STREAMING = 0x1029;
static final int AL_UNDETERMINED = 0x1030;
/** Sound samples: format specifier. */
static final int AL_FORMAT_MONO8 = 0x1100;
static final int AL_FORMAT_MONO16 = 0x1101;
static final int AL_FORMAT_STEREO8 = 0x1102;
static final int AL_FORMAT_STEREO16 = 0x1103;
/**
* source specific reference distance
* Type: ALfloat
* Range: 0.0 - +inf
*
* At 0.0, no distance attenuation occurs. Default is
* 1.0.
*/
static final int AL_REFERENCE_DISTANCE = 0x1020;
/**
* source specific rolloff factor
* Type: ALfloat
* Range: 0.0 - +inf
*
*/
static final int AL_ROLLOFF_FACTOR = 0x1021;
/**
* Directional source, outer cone gain.
*
* Default: 0.0
* Range: [0.0 - 1.0]
* Logarithmic
*/
static final int AL_CONE_OUTER_GAIN = 0x1022;
/**
* Indicate distance above which sources are not
* attenuated using the inverse clamped distance model.
*
* Default: +inf
* Type: ALfloat
* Range: 0.0 - +inf
*/
static final int AL_MAX_DISTANCE = 0x1023;
/**
* Sound samples: frequency, in units of Hertz [Hz].
* This is the number of samples per second. Half of the
* sample frequency marks the maximum significant
* frequency component.
*/
static final int AL_FREQUENCY = 0x2001;
static final int AL_BITS = 0x2002;
static final int AL_CHANNELS = 0x2003;
static final int AL_SIZE = 0x2004;
/**
* Buffer state.
*
* Not supported for public use (yet).
*/
static final int AL_UNUSED = 0x2010;
static final int AL_PENDING = 0x2011;
static final int AL_PROCESSED = 0x2012;
/** Errors: No Error. */
static final int AL_NO_ERROR = 0;
/**
* Invalid Name paramater passed to AL call.
*/
static final int AL_INVALID_NAME = 0xA001;
/**
* Invalid parameter passed to AL call.
*/
static final int AL_INVALID_ENUM = 0xA002;
/**
* Invalid enum parameter value.
*/
static final int AL_INVALID_VALUE = 0xA003;
/**
* Illegal call.
*/
static final int AL_INVALID_OPERATION = 0xA004;
/**
* No mojo.
*/
static final int AL_OUT_OF_MEMORY = 0xA005;
/** Context strings: Vendor Name. */
static final int AL_VENDOR = 0xB001;
static final int AL_VERSION = 0xB002;
static final int AL_RENDERER = 0xB003;
static final int AL_EXTENSIONS = 0xB004;
/** Global tweakage. */
/**
* Doppler scale. Default 1.0
*/
static final int AL_DOPPLER_FACTOR = 0xC000;
/**
* Tweaks speed of propagation.
*/
static final int AL_DOPPLER_VELOCITY = 0xC001;
/**
* Speed of Sound in units per second
*/
static final int AL_SPEED_OF_SOUND = 0xC003;
/**
* Distance models
*
* used in conjunction with DistanceModel
*
* implicit: NONE, which disances distance attenuation.
*/
static final int AL_DISTANCE_MODEL = 0xD000;
static final int AL_INVERSE_DISTANCE = 0xD001;
static final int AL_INVERSE_DISTANCE_CLAMPED = 0xD002;
static final int AL_LINEAR_DISTANCE = 0xD003;
static final int AL_LINEAR_DISTANCE_CLAMPED = 0xD004;
static final int AL_EXPONENT_DISTANCE = 0xD005;
static final int AL_EXPONENT_DISTANCE_CLAMPED = 0xD006;
public static String GetALErrorMsg(int errorCode) {
String errorText;
switch (errorCode) {
case AL_NO_ERROR:
errorText = "No Error";
break;
case AL_INVALID_NAME:
errorText = "Invalid Name";
break;
case AL_INVALID_ENUM:
errorText = "Invalid Enum";
break;
case AL_INVALID_VALUE:
errorText = "Invalid Value";
break;
case AL_INVALID_OPERATION:
errorText = "Invalid Operation";
break;
case AL_OUT_OF_MEMORY:
errorText = "Out of Memory";
break;
default:
errorText = "Unknown Error Code: " + String.valueOf(errorCode);
}
return errorText;
}
}

@ -0,0 +1,55 @@
TARGET_PLATFORM := android-9
ROOT_PATH := $(call my-dir)
########################################################################################################
include $(CLEAR_VARS)
LOCAL_MODULE := openalsoftjme
LOCAL_ARM_MODE := arm
LOCAL_PATH := $(ROOT_PATH)
LOCAL_C_INCLUDES := $(LOCAL_PATH) $(LOCAL_PATH)/include $(LOCAL_PATH)/OpenAL32/Include
LOCAL_CFLAGS := -ffast-math -DAL_BUILD_LIBRARY -DAL_ALEXT_PROTOTYPES
LOCAL_LDLIBS := -llog -Wl,-s
LOCAL_LDLIBS += -lOpenSLES
# LOCAL_CFLAGS += -DPOST_FROYO #-I$(ANDROID_NDK_ROOT)/platforms/android-9/arch-arm/usr/include/
# LOCAL_LDLIBS += -ldl -L$(ANDROID_NDK_ROOT)/platforms/android-9/arch-arm/usr/lib/
LOCAL_SRC_FILES := OpenAL32/alAuxEffectSlot.c \
OpenAL32/alBuffer.c \
OpenAL32/alEffect.c \
OpenAL32/alError.c \
OpenAL32/alExtension.c \
OpenAL32/alFilter.c \
OpenAL32/alListener.c \
OpenAL32/alSource.c \
OpenAL32/alState.c \
OpenAL32/alThunk.c \
Alc/ALc.c \
Alc/ALu.c \
Alc/alcChorus.c \
Alc/alcConfig.c \
Alc/alcDedicated.c \
Alc/alcEcho.c \
Alc/alcFlanger.c \
Alc/alcModulator.c \
Alc/alcReverb.c \
Alc/alcRing.c \
Alc/alcThread.c \
Alc/bs2b.c \
Alc/helpers.c \
Alc/panning.c \
Alc/hrtf.c \
Alc/mixer.c \
Alc/mixer_c.c \
Alc/backends/loopback.c \
Alc/backends/null.c \
Alc/backends/opensl.c \
com_jme3_audio_android_AndroidOpenALSoftAudioRenderer.cpp
# Alc/backends/alsa.c \
# Alc/backends/android.c \
include $(BUILD_SHARED_LIBRARY)

@ -0,0 +1,4 @@
APP_OPTIM := release
APP_ABI := all
#APP_ABI := armeabi-v7a
#APP_ABI += armeabi

@ -0,0 +1,333 @@
#include "com_jme3_audio_android_AndroidOpenALSoftAudioRenderer.h"
#include "AL/alc.h"
#include "AL/al.h"
#include "AL/alext.h"
// for __android_log_print(ANDROID_LOG_INFO, "YourApp", "formatted message");
#include <android/log.h>
#include <jni.h>
#include <stddef.h>
#include <stdio.h>
#include <assert.h>
#include <string.h>
#include <time.h>
#ifdef __cplusplus
extern "C" {
#endif
static jboolean created = JNI_FALSE;
#define BUFFER_COUNT 1
ALuint* buffers[BUFFER_COUNT] = { 0 };
ALuint* source = 0;
int getError() {
int errorcode = alGetError();
// __android_log_print(ANDROID_LOG_INFO, "OpenAL Soft", "getError: %d", errorcode);
return errorcode;
}
/* InitAL opens the default device and sets up a context using default
* attributes, making the program ready to call OpenAL functions. */
int InitAL()
{
ALCdevice *device;
ALCcontext *ctx;
/* Open and initialize a device with default settings */
device = alcOpenDevice(NULL);
if(!device)
{
fprintf(stderr, "Could not open a device!\n");
return 1;
}
ctx = alcCreateContext(device, NULL);
// __android_log_print(ANDROID_LOG_INFO, "OpenAL Soft", "NULL: %d", NULL);
// __android_log_print(ANDROID_LOG_INFO, "OpenAL Soft", "Created context: %d", ctx);
// __android_log_print(ANDROID_LOG_INFO, "OpenAL Soft", "Created context addr: %d", &ctx);
if(ctx == NULL || alcMakeContextCurrent(ctx) == ALC_FALSE)
{
if(ctx != NULL)
alcDestroyContext(ctx);
alcCloseDevice(device);
fprintf(stderr, "Could not set a context!\n");
return 1;
}
printf("Opened \"%s\"\n", alcGetString(device, ALC_DEVICE_SPECIFIER));
__android_log_print(ANDROID_LOG_INFO, "OpenAL Soft", "Opened %s", alcGetString(device, ALC_DEVICE_SPECIFIER));
return 0;
}
/* CloseAL closes the device belonging to the current context, and destroys the
* context. */
void CloseAL()
{
ALCdevice *device;
ALCcontext *ctx;
ALCboolean result;
// __android_log_print(ANDROID_LOG_INFO, "OpenAL Soft", "Getting current context");
ctx = alcGetCurrentContext();
// getError();
if(ctx == NULL){
__android_log_print(ANDROID_LOG_INFO, "OpenAL Soft", "No context found");
return;
}
// __android_log_print(ANDROID_LOG_INFO, "OpenAL Soft", "Getting current context device");
device = alcGetContextsDevice(ctx);
if(device == NULL) {
__android_log_print(ANDROID_LOG_INFO, "OpenAL Soft", "No device found");
return;
} else {
// __android_log_print(ANDROID_LOG_INFO, "OpenAL Soft", "alcGetContextsDevice device: %d", device);
// __android_log_print(ANDROID_LOG_INFO, "OpenAL Soft", "alcGetContextsDevice device addr: %d", &device);
}
// getError();
// __android_log_print(ANDROID_LOG_INFO, "OpenAL Soft", "Setting context to NULL");
result = alcMakeContextCurrent(NULL);
// __android_log_print(ANDROID_LOG_INFO, "OpenAL Soft", "alcMakeContextCurrent returned");
// __android_log_print(ANDROID_LOG_INFO, "OpenAL Soft", "alcMakeContextCurrent returned with result: %d", result);
if(!result) {
__android_log_print(ANDROID_LOG_INFO, "OpenAL Soft", "alcMakeContextCurrent failed");
return;
}
// __android_log_print(ANDROID_LOG_INFO, "OpenAL Soft", "Destroying context: %d", ctx);
// __android_log_print(ANDROID_LOG_INFO, "OpenAL Soft", "Destroying context addr: %d", &ctx);
alcDestroyContext(ctx);
// __android_log_print(ANDROID_LOG_INFO, "OpenAL Soft", "Closing device");
result = alcCloseDevice(device);
// __android_log_print(ANDROID_LOG_INFO, "OpenAL Soft", "alcCloseDevice result: %d", result);
}
JNIEXPORT jboolean JNICALL Java_com_jme3_audio_android_AndroidOpenALSoftAudioRenderer_alIsCreated
(JNIEnv* env, jclass)
{
return created;
}
JNIEXPORT jboolean JNICALL Java_com_jme3_audio_android_AndroidOpenALSoftAudioRenderer_alCreate
(JNIEnv* env, jclass)
{
__android_log_print(ANDROID_LOG_INFO, "OpenAL Soft", "Starting Audio Engine");
InitAL();
created = JNI_TRUE;
return created;
}
JNIEXPORT jboolean JNICALL Java_com_jme3_audio_android_AndroidOpenALSoftAudioRenderer_alDestroy
(JNIEnv* env, jclass)
{
// __android_log_print(ANDROID_LOG_INFO, "OpenAL Soft", "alDestroy");
CloseAL();
created = JNI_FALSE;
return created;
}
JNIEXPORT jstring JNICALL Java_com_jme3_audio_android_AndroidOpenALSoftAudioRenderer_alcGetString
(JNIEnv* env, jclass, jint param)
{
// __android_log_print(ANDROID_LOG_INFO, "OpenAL Soft", "alcGetString for param: %d", param);
ALCdevice *device;
ALCcontext *ctx;
ctx = alcGetCurrentContext();
if(ctx != NULL) {
device = alcGetContextsDevice(ctx);
// __android_log_print(ANDROID_LOG_INFO, "OpenAL Soft", "alcGetString param value: %s", alcGetString(device, param));
return env->NewStringUTF(alcGetString(device, param));
}
}
JNIEXPORT jstring JNICALL Java_com_jme3_audio_android_AndroidOpenALSoftAudioRenderer_alGetString
(JNIEnv* env, jclass, jint param)
{
// __android_log_print(ANDROID_LOG_INFO, "OpenAL Soft", "alGetString for param: %d", param);
// __android_log_print(ANDROID_LOG_INFO, "OpenAL Soft", "alGetString param value: %s", alGetString(param));
return env->NewStringUTF(alGetString(param));
}
JNIEXPORT jint JNICALL Java_com_jme3_audio_android_AndroidOpenALSoftAudioRenderer_alGenSources
(JNIEnv *, jclass)
{
ALuint source;
alGenSources(1, &source);
// __android_log_print(ANDROID_LOG_INFO, "OpenAL Soft", "alGenSources: %d", source);
return source;
}
JNIEXPORT jint JNICALL Java_com_jme3_audio_android_AndroidOpenALSoftAudioRenderer_alGetError
(JNIEnv *, jclass)
{
return getError();
}
JNIEXPORT void JNICALL Java_com_jme3_audio_android_AndroidOpenALSoftAudioRenderer_alDeleteSources
(JNIEnv* env, jclass, jint numSources, jobject intbufSources)
{
// __android_log_print(ANDROID_LOG_INFO, "OpenAL Soft", "alDeleteSources numSources: %d", numSources);
ALuint* pIntBufSources = (ALuint*) env->GetDirectBufferAddress(intbufSources);
alDeleteSources((ALsizei)numSources, pIntBufSources);
}
JNIEXPORT void JNICALL Java_com_jme3_audio_android_AndroidOpenALSoftAudioRenderer_alGenBuffers
(JNIEnv* env, jclass, jint numBuffers, jobject intbufBuffers)
{
ALuint* pIntBufBuffers = (ALuint*) env->GetDirectBufferAddress(intbufBuffers);
alGenBuffers((ALsizei)numBuffers, pIntBufBuffers);
// for (int i=0; i<numBuffers; i++) {
// __android_log_print(ANDROID_LOG_INFO, "OpenAL Soft", "alGenBuffers[%d]: %d", i, *(pIntBufBuffers+i));
// }
}
JNIEXPORT void JNICALL Java_com_jme3_audio_android_AndroidOpenALSoftAudioRenderer_alDeleteBuffers
(JNIEnv* env, jclass, jint numBuffers, jobject intbufBuffers)
{
// __android_log_print(ANDROID_LOG_INFO, "OpenAL Soft", "alDeleteBuffers numBuffers: %d", numBuffers);
ALuint* pIntBufBuffers = (ALuint*) env->GetDirectBufferAddress(intbufBuffers);
// __android_log_print(ANDROID_LOG_INFO, "OpenAL Soft", "alDeleteBuffers Buffers: %d", *pIntBufBuffers);
// for (int i=0; i<numBuffers; i++) {
// if(alIsBuffer(*(pIntBufBuffers+i)) == AL_TRUE) {
// __android_log_print(ANDROID_LOG_INFO, "OpenAL Soft", "alDeleteBuffers[%d]: %d", i, *(pIntBufBuffers+i));
// __android_log_print(ANDROID_LOG_INFO, "OpenAL Soft", "alDeleteBuffers buffer is a known buffer");
// }
// }
alDeleteBuffers((ALsizei)numBuffers, pIntBufBuffers);
}
JNIEXPORT void JNICALL Java_com_jme3_audio_android_AndroidOpenALSoftAudioRenderer_alSourceStop
(JNIEnv *, jclass, jint source)
{
// __android_log_print(ANDROID_LOG_INFO, "OpenAL Soft", "alSourceStop for source: %d", source);
alSourceStop((ALuint)source);
}
JNIEXPORT void JNICALL Java_com_jme3_audio_android_AndroidOpenALSoftAudioRenderer_alSourcei
(JNIEnv *, jclass, jint source, jint param, jint value)
{
// __android_log_print(ANDROID_LOG_INFO, "OpenAL Soft", "alSourcei for source: %d, param: %d, value: %d", source, param, value);
alSourcei((ALuint)source, (ALenum)param, (ALint)value);
}
JNIEXPORT void JNICALL Java_com_jme3_audio_android_AndroidOpenALSoftAudioRenderer_alBufferData
(JNIEnv* env, jclass, jint buffer, jint format, jobject bufferData, jint bufferSize, jint frequency)
{
// __android_log_print(ANDROID_LOG_INFO, "OpenAL Soft", "alBufferData for source: %d, format: %d, size: %d, frequency: %d", buffer, format, bufferSize, frequency);
ALuint* pBufferData = (ALuint*) env->GetDirectBufferAddress(bufferData);
alBufferData((ALuint)buffer, (ALenum)format, pBufferData, (ALsizei)bufferSize, (ALsizei)frequency);
}
JNIEXPORT void JNICALL Java_com_jme3_audio_android_AndroidOpenALSoftAudioRenderer_alSourcePlay
(JNIEnv *, jclass, jint source)
{
// __android_log_print(ANDROID_LOG_INFO, "OpenAL Soft", "alSourcePlay for source: %d", source);
alSourcePlay((ALuint)source);
}
JNIEXPORT void JNICALL Java_com_jme3_audio_android_AndroidOpenALSoftAudioRenderer_alSourcePause
(JNIEnv *, jclass, jint source)
{
// __android_log_print(ANDROID_LOG_INFO, "OpenAL Soft", "alSourcePause for source: %d", source);
alSourcePause((ALuint)source);
}
JNIEXPORT void JNICALL Java_com_jme3_audio_android_AndroidOpenALSoftAudioRenderer_alSourcef
(JNIEnv *, jclass, jint source, jint param, jfloat value)
{
// __android_log_print(ANDROID_LOG_INFO, "OpenAL Soft", "alSourcef for source: %d, param: %d, value: %f", source, param, value);
alSourcef((ALuint)source, (ALenum)param, (ALfloat)value);
}
JNIEXPORT void JNICALL Java_com_jme3_audio_android_AndroidOpenALSoftAudioRenderer_alSource3f
(JNIEnv *, jclass, jint source, jint param, jfloat value1, jfloat value2, jfloat value3)
{
// __android_log_print(ANDROID_LOG_INFO, "OpenAL Soft", "alSource3f for source: %d, param: %d, value1: %f, value2: %f, value3: %f", source, param, value1, value2, value3);
alSource3f((ALuint)source, (ALenum)param, (ALfloat)value1, (ALfloat)value2, (ALfloat)value3);
}
JNIEXPORT jint JNICALL Java_com_jme3_audio_android_AndroidOpenALSoftAudioRenderer_alGetSourcei
(JNIEnv *, jclass, jint source, jint param)
{
// __android_log_print(ANDROID_LOG_INFO, "OpenAL Soft", "alGetSourcei for source: %d, param: %d", source, param);
ALint result;
alGetSourcei((ALuint)source, (ALenum)param, &result);
return (jint)result;
}
JNIEXPORT void JNICALL Java_com_jme3_audio_android_AndroidOpenALSoftAudioRenderer_alSourceUnqueueBuffers
(JNIEnv* env, jclass, jint source, jint numBuffers, jobject buffers)
{
// __android_log_print(ANDROID_LOG_INFO, "OpenAL Soft", "alSourceUnqueueBuffers for source: %d, numBuffers: %d", source, numBuffers);
ALuint* pBuffers = (ALuint*) env->GetDirectBufferAddress(buffers);
// for (ALuint i=0; i<numBuffers; i++) {
// __android_log_print(ANDROID_LOG_INFO, "OpenAL Soft", "alSourceUnqueueBuffers, checking buffer[%d]: %d", i, *(pBuffers+i));
// ALboolean isBuffer = alIsBuffer(*(pBuffers+i));
// __android_log_print(ANDROID_LOG_INFO, "OpenAL Soft", "buffer check result: %d", isBuffer);
// }
alSourceUnqueueBuffers((ALuint)source, (ALsizei)numBuffers, pBuffers);
// for (ALuint i=0; i<numBuffers; i++) {
// __android_log_print(ANDROID_LOG_INFO, "OpenAL Soft", "alSourceUnqueueBuffers[%d]: %d", i, *(pBuffers+i));
// }
}
JNIEXPORT void JNICALL Java_com_jme3_audio_android_AndroidOpenALSoftAudioRenderer_alSourceQueueBuffers
(JNIEnv* env, jclass, jint source, jint numBuffers, jobject buffers)
{
// __android_log_print(ANDROID_LOG_INFO, "OpenAL Soft", "alSourceQueueBuffers for source: %d, numBuffers: %d", source, numBuffers);
ALuint* pBuffers = (ALuint*) env->GetDirectBufferAddress(buffers);
alSourceQueueBuffers((ALuint)source, (ALsizei)numBuffers, pBuffers);
// for (ALuint i=0; i<numBuffers; i++) {
// __android_log_print(ANDROID_LOG_INFO, "OpenAL Soft", "alSourceQueueBuffers[%d]: %d", i, *(pBuffers+i));
// }
}
JNIEXPORT void JNICALL Java_com_jme3_audio_android_AndroidOpenALSoftAudioRenderer_alListener
(JNIEnv* env, jclass, jint param, jobject bufferData)
{
// __android_log_print(ANDROID_LOG_INFO, "OpenAL Soft", "alListener for param: %d", param);
ALfloat* pBufferData = (ALfloat*) env->GetDirectBufferAddress(bufferData);
alListenerfv((ALenum)param, pBufferData);
// getError();
// for (int i=0; i<4; i++) {
// __android_log_print(ANDROID_LOG_INFO, "OpenAL Soft", "alListener[%d]: %f", i, *(pBufferData+(i*sizeof(ALfloat))));
// }
}
JNIEXPORT void JNICALL Java_com_jme3_audio_android_AndroidOpenALSoftAudioRenderer_alListenerf
(JNIEnv *, jclass, jint param, jfloat value)
{
// __android_log_print(ANDROID_LOG_INFO, "OpenAL Soft", "alListenerf for param: %d, value: %f", param, value);
alListenerf((ALenum)param, (ALfloat)value);
}
JNIEXPORT void JNICALL Java_com_jme3_audio_android_AndroidOpenALSoftAudioRenderer_alListener3f
(JNIEnv *, jclass, jint param, jfloat value1, jfloat value2, jfloat value3)
{
// __android_log_print(ANDROID_LOG_INFO, "OpenAL Soft", "alListener3f for param: %d, value1: %f, value2: %f, value3: %f", param, value1, value2, value3);
alListener3f((ALenum)param, (ALfloat)value1, (ALfloat)value2, (ALfloat)value3);
}
#ifdef __cplusplus
}
#endif

@ -0,0 +1,207 @@
/* DO NOT EDIT THIS FILE - it is machine generated */
#include <jni.h>
/* Header for class com_jme3_audio_android_AndroidOpenALSoftAudioRenderer */
#ifndef _Included_com_jme3_audio_android_AndroidOpenALSoftAudioRenderer
#define _Included_com_jme3_audio_android_AndroidOpenALSoftAudioRenderer
#ifdef __cplusplus
extern "C" {
#endif
/* Inaccessible static: logger */
#undef com_jme3_audio_android_AndroidOpenALSoftAudioRenderer_BUFFER_SIZE
#define com_jme3_audio_android_AndroidOpenALSoftAudioRenderer_BUFFER_SIZE 35280L
#undef com_jme3_audio_android_AndroidOpenALSoftAudioRenderer_STREAMING_BUFFER_COUNT
#define com_jme3_audio_android_AndroidOpenALSoftAudioRenderer_STREAMING_BUFFER_COUNT 5L
#undef com_jme3_audio_android_AndroidOpenALSoftAudioRenderer_MAX_NUM_CHANNELS
#define com_jme3_audio_android_AndroidOpenALSoftAudioRenderer_MAX_NUM_CHANNELS 64L
#undef com_jme3_audio_android_AndroidOpenALSoftAudioRenderer_UPDATE_RATE
#define com_jme3_audio_android_AndroidOpenALSoftAudioRenderer_UPDATE_RATE 0.05f
/* Inaccessible static: _00024assertionsDisabled */
/*
* Class: com_jme3_audio_android_AndroidOpenALSoftAudioRenderer
* Method: alIsCreated
* Signature: ()Z
*/
JNIEXPORT jboolean JNICALL Java_com_jme3_audio_android_AndroidOpenALSoftAudioRenderer_alIsCreated
(JNIEnv *, jclass);
/*
* Class: com_jme3_audio_android_AndroidOpenALSoftAudioRenderer
* Method: alCreate
* Signature: ()Z
*/
JNIEXPORT jboolean JNICALL Java_com_jme3_audio_android_AndroidOpenALSoftAudioRenderer_alCreate
(JNIEnv *, jclass);
/*
* Class: com_jme3_audio_android_AndroidOpenALSoftAudioRenderer
* Method: alDestroy
* Signature: ()Z
*/
JNIEXPORT jboolean JNICALL Java_com_jme3_audio_android_AndroidOpenALSoftAudioRenderer_alDestroy
(JNIEnv *, jclass);
/*
* Class: com_jme3_audio_android_AndroidOpenALSoftAudioRenderer
* Method: alcGetString
* Signature: (I)Ljava/lang/String;
*/
JNIEXPORT jstring JNICALL Java_com_jme3_audio_android_AndroidOpenALSoftAudioRenderer_alcGetString
(JNIEnv *, jclass, jint);
/*
* Class: com_jme3_audio_android_AndroidOpenALSoftAudioRenderer
* Method: alGetString
* Signature: (I)Ljava/lang/String;
*/
JNIEXPORT jstring JNICALL Java_com_jme3_audio_android_AndroidOpenALSoftAudioRenderer_alGetString
(JNIEnv *, jclass, jint);
/*
* Class: com_jme3_audio_android_AndroidOpenALSoftAudioRenderer
* Method: alGenSources
* Signature: ()I
*/
JNIEXPORT jint JNICALL Java_com_jme3_audio_android_AndroidOpenALSoftAudioRenderer_alGenSources
(JNIEnv *, jclass);
/*
* Class: com_jme3_audio_android_AndroidOpenALSoftAudioRenderer
* Method: alGetError
* Signature: ()I
*/
JNIEXPORT jint JNICALL Java_com_jme3_audio_android_AndroidOpenALSoftAudioRenderer_alGetError
(JNIEnv *, jclass);
/*
* Class: com_jme3_audio_android_AndroidOpenALSoftAudioRenderer
* Method: alDeleteSources
* Signature: (ILjava/nio/IntBuffer;)V
*/
JNIEXPORT void JNICALL Java_com_jme3_audio_android_AndroidOpenALSoftAudioRenderer_alDeleteSources
(JNIEnv *, jclass, jint, jobject);
/*
* Class: com_jme3_audio_android_AndroidOpenALSoftAudioRenderer
* Method: alGenBuffers
* Signature: (ILjava/nio/IntBuffer;)V
*/
JNIEXPORT void JNICALL Java_com_jme3_audio_android_AndroidOpenALSoftAudioRenderer_alGenBuffers
(JNIEnv *, jclass, jint, jobject);
/*
* Class: com_jme3_audio_android_AndroidOpenALSoftAudioRenderer
* Method: alDeleteBuffers
* Signature: (ILjava/nio/IntBuffer;)V
*/
JNIEXPORT void JNICALL Java_com_jme3_audio_android_AndroidOpenALSoftAudioRenderer_alDeleteBuffers
(JNIEnv *, jclass, jint, jobject);
/*
* Class: com_jme3_audio_android_AndroidOpenALSoftAudioRenderer
* Method: alSourceStop
* Signature: (I)V
*/
JNIEXPORT void JNICALL Java_com_jme3_audio_android_AndroidOpenALSoftAudioRenderer_alSourceStop
(JNIEnv *, jclass, jint);
/*
* Class: com_jme3_audio_android_AndroidOpenALSoftAudioRenderer
* Method: alSourcei
* Signature: (III)V
*/
JNIEXPORT void JNICALL Java_com_jme3_audio_android_AndroidOpenALSoftAudioRenderer_alSourcei
(JNIEnv *, jclass, jint, jint, jint);
/*
* Class: com_jme3_audio_android_AndroidOpenALSoftAudioRenderer
* Method: alBufferData
* Signature: (IILjava/nio/ByteBuffer;II)V
*/
JNIEXPORT void JNICALL Java_com_jme3_audio_android_AndroidOpenALSoftAudioRenderer_alBufferData
(JNIEnv *, jclass, jint, jint, jobject, jint, jint);
/*
* Class: com_jme3_audio_android_AndroidOpenALSoftAudioRenderer
* Method: alSourcePlay
* Signature: (I)V
*/
JNIEXPORT void JNICALL Java_com_jme3_audio_android_AndroidOpenALSoftAudioRenderer_alSourcePlay
(JNIEnv *, jclass, jint);
/*
* Class: com_jme3_audio_android_AndroidOpenALSoftAudioRenderer
* Method: alSourcePause
* Signature: (I)V
*/
JNIEXPORT void JNICALL Java_com_jme3_audio_android_AndroidOpenALSoftAudioRenderer_alSourcePause
(JNIEnv *, jclass, jint);
/*
* Class: com_jme3_audio_android_AndroidOpenALSoftAudioRenderer
* Method: alSourcef
* Signature: (IIF)V
*/
JNIEXPORT void JNICALL Java_com_jme3_audio_android_AndroidOpenALSoftAudioRenderer_alSourcef
(JNIEnv *, jclass, jint, jint, jfloat);
/*
* Class: com_jme3_audio_android_AndroidOpenALSoftAudioRenderer
* Method: alSource3f
* Signature: (IIFFF)V
*/
JNIEXPORT void JNICALL Java_com_jme3_audio_android_AndroidOpenALSoftAudioRenderer_alSource3f
(JNIEnv *, jclass, jint, jint, jfloat, jfloat, jfloat);
/*
* Class: com_jme3_audio_android_AndroidOpenALSoftAudioRenderer
* Method: alGetSourcei
* Signature: (II)I
*/
JNIEXPORT jint JNICALL Java_com_jme3_audio_android_AndroidOpenALSoftAudioRenderer_alGetSourcei
(JNIEnv *, jclass, jint, jint);
/*
* Class: com_jme3_audio_android_AndroidOpenALSoftAudioRenderer
* Method: alSourceUnqueueBuffers
* Signature: (IILjava/nio/IntBuffer;)V
*/
JNIEXPORT void JNICALL Java_com_jme3_audio_android_AndroidOpenALSoftAudioRenderer_alSourceUnqueueBuffers
(JNIEnv *, jclass, jint, jint, jobject);
/*
* Class: com_jme3_audio_android_AndroidOpenALSoftAudioRenderer
* Method: alSourceQueueBuffers
* Signature: (IILjava/nio/IntBuffer;)V
*/
JNIEXPORT void JNICALL Java_com_jme3_audio_android_AndroidOpenALSoftAudioRenderer_alSourceQueueBuffers
(JNIEnv *, jclass, jint, jint, jobject);
/*
* Class: com_jme3_audio_android_AndroidOpenALSoftAudioRenderer
* Method: alListener
* Signature: (ILjava/nio/FloatBuffer;)V
*/
JNIEXPORT void JNICALL Java_com_jme3_audio_android_AndroidOpenALSoftAudioRenderer_alListener
(JNIEnv *, jclass, jint, jobject);
/*
* Class: com_jme3_audio_android_AndroidOpenALSoftAudioRenderer
* Method: alListenerf
* Signature: (IF)V
*/
JNIEXPORT void JNICALL Java_com_jme3_audio_android_AndroidOpenALSoftAudioRenderer_alListenerf
(JNIEnv *, jclass, jint, jfloat);
/*
* Class: com_jme3_audio_android_AndroidOpenALSoftAudioRenderer
* Method: alListener3f
* Signature: (IFFF)V
*/
JNIEXPORT void JNICALL Java_com_jme3_audio_android_AndroidOpenALSoftAudioRenderer_alListener3f
(JNIEnv *, jclass, jint, jfloat, jfloat, jfloat);
#ifdef __cplusplus
}
#endif
#endif

@ -0,0 +1,147 @@
#ifndef CONFIG_H
#define CONFIG_H
/* Define to the library version */
#define ALSOFT_VERSION "1.15.1"
#define ALIGN(x) __attribute__ ((aligned(x)))
/* Define if we have the Android backend */
/* #define HAVE_ANDROID 1 */
/* Define if we have the ALSA backend */
/* #define HAVE_ALSA */
/* Define if we have the OSS backend */
/* #cmakedefine HAVE_OSS */
/* Define if we have the Solaris backend */
/* #cmakedefine HAVE_SOLARIS */
/* Define if we have the SndIO backend */
/* #cmakedefine HAVE_SNDIO */
/* Define if we have the MMDevApi backend */
/* #cmakedefine HAVE_MMDEVAPI */
/* Define if we have the DSound backend */
/* #cmakedefine HAVE_DSOUND */
/* Define if we have the Windows Multimedia backend */
/* #cmakedefine HAVE_WINMM */
/* Define if we have the PortAudio backend */
/* #cmakedefine HAVE_PORTAUDIO */
/* Define if we have the PulseAudio backend */
/* #cmakedefine HAVE_PULSEAUDIO */
/* Define if we have the CoreAudio backend */
/* #cmakedefine HAVE_COREAUDIO */
/* Define if we have the OpenSL backend */
#define HAVE_OPENSL /* THIS BACKEND WORKS ON >=2.3 Android!! */
/* Define if we have the Wave Writer backend */
/* #cmakedefine HAVE_WAVE */
/* Define if we have dlfcn.h */
#define HAVE_DLFCN_H
/* Define if we have the stat function */
#define HAVE_STAT
/* Define if we have the powf function */
/* #define HAVE_POWF 1 */
/* Define if we have the sqrtf function */
/* #define HAVE_SQRTF 1 */
/* Define if we have the cosf function */
/* #define HAVE_COSF 1 */
/* Define if we have the sinf function */
/* #define HAVE_SINF 1 */
/* Define if we have the acosf function */
/* #define HAVE_ACOSF 1 */
/* Define if we have the asinf function */
/* #define HAVE_ASINF 1 */
/* Define if we have the atanf function */
/* #define HAVE_ATANF 1 */
/* Define if we have the atan2f function */
/* #define HAVE_ATAN2F 1 */
/* Define if we have the fabsf function */
/* #define HAVE_FABSF 1 */
/* Define if we have the log10f function */
/* #define HAVE_LOG10F 1 */
/* Define if we have the floorf function */
/* #define HAVE_FLOORF 1 */
/* Define if we have the strtof function */
#define HAVE_STRTOF
/* Define if we have stdint.h */
#define HAVE_STDINT_H
/* Define if we have the __int64 type */
/* #cmakedefine HAVE___INT64 */
/* Define to the size of a long int type */
#define SIZEOF_LONG 4
/* Define to the size of a long long int type */
#define SIZEOF_LONG_LONG 8
/* Define if we have GCC's destructor attribute */
#define HAVE_GCC_DESTRUCTOR
/* Define if we have GCC's format attribute */
#define HAVE_GCC_FORMAT
/* Define if we have pthread_np.h */
/* #cmakedefine HAVE_PTHREAD_NP_H */
/* Define if we have arm_neon.h */
/* #cmakedefine HAVE_ARM_NEON_H */
/* Define if we have guiddef.h */
/* #cmakedefine HAVE_GUIDDEF_H */
/* Define if we have guiddef.h */
/* #cmakedefine HAVE_INITGUID_H */
/* Define if we have ieeefp.h */
/* #cmakedefine HAVE_IEEEFP_H */
/* Define if we have float.h */
/* #cmakedefine HAVE_FLOAT_H */
/* Define if we have fpu_control.h */
/* #cmakedefine HAVE_FPU_CONTROL_H */
/* Define if we have fenv.h */
#define HAVE_FENV_H
/* Define if we have fesetround() */
/* #cmakedefine HAVE_FESETROUND */
/* Define if we have _controlfp() */
/* #cmakedefine HAVE__CONTROLFP */
/* Define if we have pthread_setschedparam() */
#define HAVE_PTHREAD_SETSCHEDPARAM
/* Define if we have the restrict keyword */
/* #cmakedefine HAVE_RESTRICT 1 */
/* Define if we have the __restrict keyword */
#define RESTRICT __restrict
#endif
Loading…
Cancel
Save