I have a simple application that ideally use only the audio stuff from Juce.
I created an entry point like this:
class MyApp: public JUCEApplicationBase { public: ................. } // this generates boilerplate code to launch our app class: START_JUCE_APPLICATION (MyApp)
Within MyApp Class I instantiate an object of type:
class MyAudio : AudioSource { public: MyAudio(); ~MyAudio(); void setAudioChannels(int numInCh, int numOutCh); void shutDownAudio(); private: AudioDeviceManager audioDevice; AudioSourcePlayer audioSourcePlayer; // Inherited via AudioSource void prepareToPlay(int samplesPerBlockExpected, double sampleRate) override; void releaseResources() override; void getNextAudioBlock(const AudioSourceChannelInfo & bufferToFill) override; };
Up to here everything work as expected!
Than I tried to remove all the Java code that I don't need (I don't want to use any "Windowing" code from Juce). Ideally I'd like to have only:
public class Android2 extends Activity { static { System.loadLibrary ("Introducer1"); } @Override public void onCreate (Bundle savedInstanceState) { super.onCreate (savedInstanceState); launchApp (getApplicationInfo().publicSourceDir, getApplicationInfo().dataDir); } private native void launchApp (String appFile, String appDataDir); }
I found that the boostrap code is in "juce_android_Windowing.cpp".
I tried to comment out the Inizialize_GUI() function:
//juce_android_Windowing.cpp android.initialise (env, activity, appFile, appDataDir); DBG (SystemStats::getJUCEVersion()); JUCEApplicationBase::createInstance = &juce_CreateApplication; //initialiseJuce_GUI();
but that did not work.
When the following function
android.initialise (env, activity, appFile, appDataDir);
is called and the Jave code is not there, the program crash with an "Abort" exception.
If I try to comment out some of the class that I don't need like for example:
//#define JNI_CLASS_MEMBERS(METHOD, STATICMETHOD, FIELD, STATICFIELD) \ // METHOD (drawBitmap, "drawBitmap", "([IIIFFIIZLandroid/graphics/Paint;)V") \ // METHOD (getClipBounds, "getClipBounds", "()Landroid/graphics/Rect;") //DECLARE_JNI_CLASS (CanvasMinimal, "android/graphics/Canvas"); //#undef JNI_CLASS_MEMBERS
I'm getting compiling error because other portion of the code is using those classes.
I wonder if there is a way of accomplish what I'm looking for or if all the Java class/methid must be there and there's no way around it.
Do You have any suggestion on how to proceed?
Thank You
Alessandro