mirror of
https://gitlab.linphone.org/BC/public/linphone-iphone.git
synced 2026-01-22 13:48:09 +00:00
wrap linphone_core_set_tone() to java
This commit is contained in:
parent
d032c1d3c9
commit
8be3fd04d1
4 changed files with 47 additions and 0 deletions
|
|
@ -1348,6 +1348,16 @@ extern "C" jstring Java_org_linphone_core_LinphoneCoreImpl_getRing(JNIEnv* env
|
|||
return NULL;
|
||||
}
|
||||
}
|
||||
extern "C" void Java_org_linphone_core_LinphoneCoreImpl_setTone(JNIEnv* env
|
||||
,jobject thiz
|
||||
,jlong lc
|
||||
,jint toneid
|
||||
,jstring jpath) {
|
||||
const char* path = jpath ? env->GetStringUTFChars(jpath, NULL) : NULL;
|
||||
linphone_core_set_tone((LinphoneCore *)lc, (LinphoneToneID)toneid, path);
|
||||
if (path) env->ReleaseStringUTFChars(jpath, path);
|
||||
}
|
||||
|
||||
extern "C" void Java_org_linphone_core_LinphoneCoreImpl_setCallErrorTone(JNIEnv* env
|
||||
,jobject thiz
|
||||
,jlong lc
|
||||
|
|
|
|||
|
|
@ -1533,6 +1533,14 @@ public interface LinphoneCore {
|
|||
*/
|
||||
public void setCallErrorTone(Reason reason, String path);
|
||||
|
||||
/**
|
||||
* Assign an audio file to be played locally in replacement of common telephony tone.
|
||||
* This is typically used to internationalize tones.
|
||||
* @param id a tone id
|
||||
* @param wav a path to a 16 bit PCM linear wav file.
|
||||
*/
|
||||
public void setTone(ToneID id, String wavfile);
|
||||
|
||||
/**
|
||||
* Inform the core about the maximum transmission unit of the network.
|
||||
* This is used for fragmenting video RTP packets to a size compatible with the network.
|
||||
|
|
|
|||
24
java/common/org/linphone/core/ToneID.java
Normal file
24
java/common/org/linphone/core/ToneID.java
Normal file
|
|
@ -0,0 +1,24 @@
|
|||
package org.linphone.core;
|
||||
|
||||
public enum ToneID {
|
||||
Undefined(0),
|
||||
Busy(1),
|
||||
CallWaiting(2),
|
||||
CallOnHold(3),
|
||||
CallLost(4);
|
||||
protected final int mValue;
|
||||
private ToneID(int value){
|
||||
mValue=value;
|
||||
}
|
||||
static protected ToneID fromInt(int value) throws LinphoneCoreException{
|
||||
switch(value){
|
||||
case 0: return Undefined;
|
||||
case 1: return Busy;
|
||||
case 2: return CallWaiting;
|
||||
case 3: return CallOnHold;
|
||||
case 4: return CallLost;
|
||||
default:
|
||||
throw new LinphoneCoreException("Unhandled enum value "+value+" for LinphoneToneID");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -1160,5 +1160,10 @@ class LinphoneCoreImpl implements LinphoneCore {
|
|||
public boolean isSdp200AckEnabled() {
|
||||
return isSdp200AckEnabled(nativePtr);
|
||||
}
|
||||
private native void setTone(long nativePtr, int id, String wavfile);
|
||||
@Override
|
||||
public void setTone(ToneID id, String wavfile) {
|
||||
setTone(nativePtr, id.mValue, wavfile);
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue