i am trying to create a B4A Library for a well known audio codec, the Speex Codec its also called Jspeex, this library already available in JAVA on the net and its also been used in some android software successfully such as Ipox5 and many others on google play market and its available its class folder and as JAR , So i tried for almost two weeks to create create one some api just to initialize the encoder for speex which initialize the codec , i created the class and attached reference libraries as suggested for B4A but I KEEP GETTING COMPILER errors ALL the time , my syntax as i believe all correct , once i try to export to Jar i get errors , once i try to create JAVADOC i get WARNINGS , BUT even though Both the JAR AND XML file get created , so i added them into B4A New Library folder (folder i created for B4A) THEN I added the library to B4A project in the process global to create an instance of it only without even using the api, but i keep getting an error every time i run project , i connected my galaxy s2 through USB , and once the app starts running for 5 seconds it just CRASHES WITH "The application sptest(process.com.sp.test has stopped unexpectedly.Please try again".
this is the source for the java class :
import org.xiph.speex.SpeexEncoder;
import anywheresoftware.b4a.BA.Permissions;
import anywheresoftware.b4a.BA.ShortName;
import anywheresoftware.b4a.BA.Version;
@Permissions(values = {"android.permission.WRITE_EXTERNAL_STORAGE", "android.permission.RECORD_AUDIO"})
@ShortName("speexen")
@Version(1.03f)
public class speextest1 {
int mode; // wide band
int sampleRate;
int channels1;
int quality; // high quality
byte packet;
int packetlength;
boolean initstatus;
public Boolean IsInitialized = false;
public final SpeexEncoder enc = new SpeexEncoder();
public void encinit(int mode, int quality, int sampleRate,
int channels) {
try
{
enc.getSampleRate();
//* enc.init(mode, quality, sampleRate,channels);
if (enc.init(mode, quality, sampleRate,channels))
{
IsInitialized = true;
}
}
catch (Exception e)
{
e.printStackTrace();
}
}
----------------------------------------------------
and this is the source of my B4A PROJECT , nothing but decalaration forthe library
'Activity module
Sub Process_Globals
'These global variables will be declared once when the application starts.
'These variables can be accessed from all modules.
Dim sp As speexen
End Sub
Sub Globals
'These global variables will be redeclared each time the activity is created.
'These variables can only be accessed from this module.
End Sub
Sub Activity_Create(FirstTime As Boolean)
End Sub
Sub Activity_Resume
End Sub
Sub Activity_Pause (UserClosed As Boolean)
End Sub
Sub one
'sp.encinit(0, 8000, 1, 0)
End Sub
}
-------------------------------------------
This is the Logcat i get when i run the project in B4A
LogCat connected to: 304D09173118252F
--------- beginning of /dev/log/main
--------- beginning of /dev/log/system
main_process_globals (java line: 254)
java.lang.NoClassDefFoundError: org.xiph.speex.SpeexEncoder
at com.speextest1.speextest1.<init>(speextest1.java:24)
at com.sp.test.main._process_globals(main.java:254)
at com.sp.test.main.initializeProcessGlobals(main.java:229)
at com.sp.test.main.afterFirstLayout(main.java:80)
at com.sp.test.main.access$100(main.java:16)
at com.sp.test.main$WaitForLayout.run(main.java:72)
at android.os.Handler.handleCallback(Handler.java:587)
at android.os.Handler.dispatchMessage(Handler.java:92)
at android.os.Looper.loop(Looper.java:130)
at android.app.ActivityThread.main(ActivityThread.java:3691)
at java.lang.reflect.Method.invokeNative(Native Method)
at java.lang.reflect.Method.invoke(Method.java:507)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:907)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:665)
at dalvik.system.NativeStart.main(Native Method)
-------------------------------------------------
I WOULD LIKE TO MAKE I NOTE THAT LINE 24 Mentioned in LOGCAT of the java class is this:
public final SpeexEncoder enc = new SpeexEncoder();
------------------------
I also have fixed all Envormental variables in windows 7 to POINT JAVA 1.6
CLASSPATH C:\Program Files\Java\jdk1.6.0_33\lib.;
path C:\Program Files\Java\jdk1.6.0_33\bin
JAVA_HOME C:\Program Files\Java\jdk1.6.0_33\bin
----------------------------------------------------------
I am not good in java or Eclipse but i have been searching all over the B4A forum for solution as well as through Google
After almost two weeks hard trying with no luck even though this library already working for Android devices as i mentioned for many software on Google play.
Speex or is it also Called JSPEEX is well known Audio Codec library it Used to reduce PCM bandWidth used with AudioRecord FROM 128 KB/SEC INTO of only less than 10 kb/sec through the network bandwidth if audio is tranmitted through network , these two links would give you the JAR archive as well as the source for the library
Speex: a free codec for free speech
Talkative
-------------------------------
I well appreciate any help.
Thanks in advance
this is the source for the java class :
import org.xiph.speex.SpeexEncoder;
import anywheresoftware.b4a.BA.Permissions;
import anywheresoftware.b4a.BA.ShortName;
import anywheresoftware.b4a.BA.Version;
@Permissions(values = {"android.permission.WRITE_EXTERNAL_STORAGE", "android.permission.RECORD_AUDIO"})
@ShortName("speexen")
@Version(1.03f)
public class speextest1 {
int mode; // wide band
int sampleRate;
int channels1;
int quality; // high quality
byte packet;
int packetlength;
boolean initstatus;
public Boolean IsInitialized = false;
public final SpeexEncoder enc = new SpeexEncoder();
public void encinit(int mode, int quality, int sampleRate,
int channels) {
try
{
enc.getSampleRate();
//* enc.init(mode, quality, sampleRate,channels);
if (enc.init(mode, quality, sampleRate,channels))
{
IsInitialized = true;
}
}
catch (Exception e)
{
e.printStackTrace();
}
}
----------------------------------------------------
and this is the source of my B4A PROJECT , nothing but decalaration forthe library
'Activity module
Sub Process_Globals
'These global variables will be declared once when the application starts.
'These variables can be accessed from all modules.
Dim sp As speexen
End Sub
Sub Globals
'These global variables will be redeclared each time the activity is created.
'These variables can only be accessed from this module.
End Sub
Sub Activity_Create(FirstTime As Boolean)
End Sub
Sub Activity_Resume
End Sub
Sub Activity_Pause (UserClosed As Boolean)
End Sub
Sub one
'sp.encinit(0, 8000, 1, 0)
End Sub
}
-------------------------------------------
This is the Logcat i get when i run the project in B4A
LogCat connected to: 304D09173118252F
--------- beginning of /dev/log/main
--------- beginning of /dev/log/system
main_process_globals (java line: 254)
java.lang.NoClassDefFoundError: org.xiph.speex.SpeexEncoder
at com.speextest1.speextest1.<init>(speextest1.java:24)
at com.sp.test.main._process_globals(main.java:254)
at com.sp.test.main.initializeProcessGlobals(main.java:229)
at com.sp.test.main.afterFirstLayout(main.java:80)
at com.sp.test.main.access$100(main.java:16)
at com.sp.test.main$WaitForLayout.run(main.java:72)
at android.os.Handler.handleCallback(Handler.java:587)
at android.os.Handler.dispatchMessage(Handler.java:92)
at android.os.Looper.loop(Looper.java:130)
at android.app.ActivityThread.main(ActivityThread.java:3691)
at java.lang.reflect.Method.invokeNative(Native Method)
at java.lang.reflect.Method.invoke(Method.java:507)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:907)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:665)
at dalvik.system.NativeStart.main(Native Method)
-------------------------------------------------
I WOULD LIKE TO MAKE I NOTE THAT LINE 24 Mentioned in LOGCAT of the java class is this:
public final SpeexEncoder enc = new SpeexEncoder();
------------------------
I also have fixed all Envormental variables in windows 7 to POINT JAVA 1.6
CLASSPATH C:\Program Files\Java\jdk1.6.0_33\lib.;
path C:\Program Files\Java\jdk1.6.0_33\bin
JAVA_HOME C:\Program Files\Java\jdk1.6.0_33\bin
----------------------------------------------------------
I am not good in java or Eclipse but i have been searching all over the B4A forum for solution as well as through Google
After almost two weeks hard trying with no luck even though this library already working for Android devices as i mentioned for many software on Google play.
Speex or is it also Called JSPEEX is well known Audio Codec library it Used to reduce PCM bandWidth used with AudioRecord FROM 128 KB/SEC INTO of only less than 10 kb/sec through the network bandwidth if audio is tranmitted through network , these two links would give you the JAR archive as well as the source for the library
Speex: a free codec for free speech
Talkative
-------------------------------
I well appreciate any help.
Thanks in advance