This commit is contained in:
2011-09-18 11:12:10 +00:00
parent b3d6e71569
commit 51833179bc
4 changed files with 13 additions and 22 deletions

Binary file not shown.

View File

@@ -376,8 +376,9 @@ typedef struct ir_t {
*/
typedef struct speaker_t {
byte format;
byte vol;
byte rate;
byte freq;
byte vol;
} speaker_t;
@@ -663,7 +664,7 @@ WIIUSE_EXPORT extern void wiiuse_speaker_activate(struct wiimote_t* wm);
WIIUSE_EXPORT extern void wiiuse_speaker_deactivate(struct wiimote_t* wm);
WIIUSE_EXPORT extern void wiiuse_speaker_format(struct wiimote_t* wm, byte format);
WIIUSE_EXPORT extern void wiiuse_speaker_volume(struct wiimote_t* wm, double vol);
WIIUSE_EXPORT extern void wiiuse_speaker_rate(struct wiimote_t* wm, double freq);
WIIUSE_EXPORT extern void wiiuse_speaker_rate(struct wiimote_t* wm, byte rate, byte freq);
WIIUSE_EXPORT extern void wiiuse_speaker_config(struct wiimote_t* wm);
WIIUSE_EXPORT extern void wiiuse_speaker_data(struct wiimote_t* wm, byte* data, int len);

View File

@@ -710,38 +710,28 @@ JNIEXPORT void JNICALL Java_wiiusej_WiiUseApi_deactivateSpeaker(JNIEnv *env, job
}
JNIEXPORT void JNICALL Java_wiiusej_WiiUseApi_setSpeakerFormat(JNIEnv *env, jobject obj, jint id, jbyte format) {
struct wiimote_t* wm = wiiuse_get_by_id(wiimotes, nbMaxWiimotes, id);
wiiuse_speaker_config(wm);
wiiuse_speaker_format(wm, format);
wiiuse_speaker_format(wiiuse_get_by_id(wiimotes, nbMaxWiimotes, id), format);
}
JNIEXPORT void JNICALL Java_wiiusej_WiiUseApi_setSpeakerRate(JNIEnv *env, jobject obj, jint id, jint rate) {
struct wiimote_t* wm = wiiuse_get_by_id(wiimotes, nbMaxWiimotes, id);
wiiuse_speaker_rate(wm, rate);
wiiuse_speaker_config(wm);
JNIEXPORT void JNICALL Java_wiiusej_WiiUseApi_setSpeakerRate(JNIEnv *env, jobject obj, jint id, jbyte rate, jbyte freq) {
wiiuse_speaker_rate(wiiuse_get_by_id(wiimotes, nbMaxWiimotes, id), rate, freq);
}
JNIEXPORT void JNICALL Java_wiiusej_WiiUseApi_setSpeakerVolume(JNIEnv *env, jobject obj, jint id, jdouble vol) {
struct wiimote_t* wm = wiiuse_get_by_id(wiimotes, nbMaxWiimotes, id);
wiiuse_speaker_volume(wm, vol);
wiiuse_speaker_config(wm);
wiiuse_speaker_volume(wiiuse_get_by_id(wiimotes, nbMaxWiimotes, id), vol);
}
JNIEXPORT void JNICALL Java_wiiusej_WiiUseApi_setSpeakerConfig(JNIEnv *env, jobject obj, jint id, jbyte format, jint rate, jdouble vol) {
struct wiimote_t* wm = wiiuse_get_by_id(wiimotes, nbMaxWiimotes, id);
wiiuse_speaker_format(wm, format);
wiiuse_speaker_rate(wm, rate);
wiiuse_speaker_volume(wm, vol);
wiiuse_speaker_config(wm);
JNIEXPORT void JNICALL Java_wiiusej_WiiUseApi_setSpeakerConfig(JNIEnv *env, jobject obj, jint id) {
wiiuse_speaker_config(wiiuse_get_by_id(wiimotes, nbMaxWiimotes, id));
}
JNIEXPORT void JNICALL Java_wiiusej_WiiUseApi_streamSpeakerData(JNIEnv *env, jobject obj, jint id, jbyteArray jbArray) {
jbyte *jbData = (*env)->GetByteArrayElements(env, jbArray, JNI_FALSE);
/* Todo: Check for data loss by using signed vs unsigned bytes */
int len = (int) (*env)->GetArrayLength(env, jbArray);
/*byte data[length];
/*byte data[len];
int i = 0;
for (i = 0; i < length; ++i) {
for (i = 0; i < len; ++i) {
data[i] = (byte) jbData[i];
}*/
wiiuse_speaker_data(wiiuse_get_by_id(wiimotes, nbMaxWiimotes, id), (byte*) jbData, len);

View File

@@ -333,7 +333,7 @@ JNIEXPORT void JNICALL Java_wiiusej_WiiUseApi_setSpeakerFormat
* Signature: (II)V
*/
JNIEXPORT void JNICALL Java_wiiusej_WiiUseApi_setSpeakerRate
(JNIEnv *, jobject, jint, jint);
(JNIEnv *, jobject, jint, jbyte, jbyte);
/*
* Class: wiiusej_WiiUseApi
@@ -349,7 +349,7 @@ JNIEXPORT void JNICALL Java_wiiusej_WiiUseApi_setSpeakerVolume
* Signature: (IBID)V
*/
JNIEXPORT void JNICALL Java_wiiusej_WiiUseApi_setSpeakerConfig
(JNIEnv *, jobject, jint, jbyte, jint, jdouble);
(JNIEnv *, jobject, jint);
/*
* Class: wiiusej_WiiUseApi