| @@ -1037,15 +1037,29 @@ public class AnalyticsCollection extends Activity | |||||
| //============================================================================== | //============================================================================== | ||||
| public static class NativeInvocationHandler implements InvocationHandler | public static class NativeInvocationHandler implements InvocationHandler | ||||
| { | { | ||||
| public NativeInvocationHandler (long nativeContextRef) | |||||
| public NativeInvocationHandler (Activity activityToUse, long nativeContextRef) | |||||
| { | { | ||||
| activity = activityToUse; | |||||
| nativeContext = nativeContextRef; | nativeContext = nativeContextRef; | ||||
| } | } | ||||
| public void nativeContextDeleted() | |||||
| { | |||||
| nativeContext = 0; | |||||
| } | |||||
| @Override | @Override | ||||
| public void finalize() | public void finalize() | ||||
| { | { | ||||
| dispatchFinalize (nativeContext); | |||||
| activity.runOnUiThread (new Runnable() | |||||
| { | |||||
| @Override | |||||
| public void run() | |||||
| { | |||||
| if (nativeContext != 0) | |||||
| dispatchFinalize (nativeContext); | |||||
| } | |||||
| }); | |||||
| } | } | ||||
| @Override | @Override | ||||
| @@ -1055,15 +1069,21 @@ public class AnalyticsCollection extends Activity | |||||
| } | } | ||||
| //============================================================================== | //============================================================================== | ||||
| Activity activity; | |||||
| private long nativeContext = 0; | private long nativeContext = 0; | ||||
| private native void dispatchFinalize (long nativeContextRef); | private native void dispatchFinalize (long nativeContextRef); | ||||
| private native Object dispatchInvoke (long nativeContextRef, Object proxy, Method method, Object[] args); | private native Object dispatchInvoke (long nativeContextRef, Object proxy, Method method, Object[] args); | ||||
| } | } | ||||
| public static InvocationHandler createInvocationHandler (long nativeContextRef) | |||||
| public InvocationHandler createInvocationHandler (long nativeContextRef) | |||||
| { | |||||
| return new NativeInvocationHandler (this, nativeContextRef); | |||||
| } | |||||
| public void invocationHandlerContextDeleted (InvocationHandler handler) | |||||
| { | { | ||||
| return new NativeInvocationHandler (nativeContextRef); | |||||
| ((NativeInvocationHandler) handler).nativeContextDeleted(); | |||||
| } | } | ||||
| //============================================================================== | //============================================================================== | ||||
| @@ -1560,7 +1560,7 @@ static const unsigned char temp_binary_data_3[] = | |||||
| " {\r\n" | " {\r\n" | ||||
| " bypass = false;\r\n" | " bypass = false;\r\n" | ||||
| "\r\n" | "\r\n" | ||||
| " auto maxSize = static_cast<size_t> (roundDoubleToInt (8192.0 * sampleRate / 44100.0));\r\n" | |||||
| " auto maxSize = static_cast<size_t> (roundToInt (sampleRate * (8192.0 / 44100.0)));\r\n" | |||||
| "\r\n" | "\r\n" | ||||
| " if (cabinetTypeParameter->getCurrentSelectedID() == 2)\r\n" | " if (cabinetTypeParameter->getCurrentSelectedID() == 2)\r\n" | ||||
| " convolution.loadImpulseResponse (BinaryData::guitar_amp_wav,\r\n" | " convolution.loadImpulseResponse (BinaryData::guitar_amp_wav,\r\n" | ||||
| @@ -2235,7 +2235,7 @@ static const unsigned char temp_binary_data_10[] = | |||||
| "\r\n" | "\r\n" | ||||
| " ChoiceParameter typeParam {{ \"Low-pass\", \"Band-pass\", \"High-pass\"}, 1, \"Type\" };\r\n" | " ChoiceParameter typeParam {{ \"Low-pass\", \"Band-pass\", \"High-pass\"}, 1, \"Type\" };\r\n" | ||||
| " SliderParameter cutoffParam {{ 20.0, 20000.0 }, 0.5, 440.0f, \"Cutoff\", \"Hz\" };\r\n" | " SliderParameter cutoffParam {{ 20.0, 20000.0 }, 0.5, 440.0f, \"Cutoff\", \"Hz\" };\r\n" | ||||
| " SliderParameter qParam {{ 0.3, 20.0 }, 0.5, 1.0 / std::sqrt (2.0), \"Resonance\" };\r\n" | |||||
| " SliderParameter qParam {{ 0.3, 20.0 }, 0.5, 1.0 / MathConstants<double>::sqrt2, \"Resonance\" };\r\n" | |||||
| "\r\n" | "\r\n" | ||||
| " std::vector<DSPDemoParameterBase*> parameters { &typeParam, &cutoffParam, &qParam };\r\n" | " std::vector<DSPDemoParameterBase*> parameters { &typeParam, &cutoffParam, &qParam };\r\n" | ||||
| " double sampleRate = 0;\r\n" | " double sampleRate = 0;\r\n" | ||||
| @@ -2325,14 +2325,14 @@ const char* getNamedResource (const char* resourceNameUTF8, int& numBytes) throw | |||||
| case 0x409ff6ec: numBytes = 37902; return cassette_recorder_wav; | case 0x409ff6ec: numBytes = 37902; return cassette_recorder_wav; | ||||
| case 0x69523d16: numBytes = 628; return EditorColourScheme_xml; | case 0x69523d16: numBytes = 628; return EditorColourScheme_xml; | ||||
| case 0x700ccf3c: numBytes = 90246; return guitar_amp_wav; | case 0x700ccf3c: numBytes = 90246; return guitar_amp_wav; | ||||
| case 0x5922ccdf: numBytes = 3011; return ConvolutionDemo_cpp; | |||||
| case 0x5922ccdf: numBytes = 3007; return ConvolutionDemo_cpp; | |||||
| case 0x14aa0aae: numBytes = 2674; return FIRFilterDemo_cpp; | case 0x14aa0aae: numBytes = 2674; return FIRFilterDemo_cpp; | ||||
| case 0xab621a06: numBytes = 1809; return GainDemo_cpp; | case 0xab621a06: numBytes = 1809; return GainDemo_cpp; | ||||
| case 0x06a7a4b1: numBytes = 2819; return IIRFilterDemo_cpp; | case 0x06a7a4b1: numBytes = 2819; return IIRFilterDemo_cpp; | ||||
| case 0x6fc33e27: numBytes = 3986; return OscillatorDemo_cpp; | case 0x6fc33e27: numBytes = 3986; return OscillatorDemo_cpp; | ||||
| case 0xdfdc547d: numBytes = 3039; return OverdriveDemo_cpp; | case 0xdfdc547d: numBytes = 3039; return OverdriveDemo_cpp; | ||||
| case 0x3f21e597: numBytes = 4849; return SIMDRegisterDemo_cpp; | case 0x3f21e597: numBytes = 4849; return SIMDRegisterDemo_cpp; | ||||
| case 0x54e9f84c: numBytes = 2718; return StateVariableFilterDemo_cpp; | |||||
| case 0x54e9f84c: numBytes = 2731; return StateVariableFilterDemo_cpp; | |||||
| case 0x5ce06dd8: numBytes = 2037; return WaveShaperTanhDemo_cpp; | case 0x5ce06dd8: numBytes = 2037; return WaveShaperTanhDemo_cpp; | ||||
| default: break; | default: break; | ||||
| } | } | ||||
| @@ -18,7 +18,7 @@ namespace BinaryData | |||||
| const int guitar_amp_wavSize = 90246; | const int guitar_amp_wavSize = 90246; | ||||
| extern const char* ConvolutionDemo_cpp; | extern const char* ConvolutionDemo_cpp; | ||||
| const int ConvolutionDemo_cppSize = 3011; | |||||
| const int ConvolutionDemo_cppSize = 3007; | |||||
| extern const char* FIRFilterDemo_cpp; | extern const char* FIRFilterDemo_cpp; | ||||
| const int FIRFilterDemo_cppSize = 2674; | const int FIRFilterDemo_cppSize = 2674; | ||||
| @@ -39,7 +39,7 @@ namespace BinaryData | |||||
| const int SIMDRegisterDemo_cppSize = 4849; | const int SIMDRegisterDemo_cppSize = 4849; | ||||
| extern const char* StateVariableFilterDemo_cpp; | extern const char* StateVariableFilterDemo_cpp; | ||||
| const int StateVariableFilterDemo_cppSize = 2718; | |||||
| const int StateVariableFilterDemo_cppSize = 2731; | |||||
| extern const char* WaveShaperTanhDemo_cpp; | extern const char* WaveShaperTanhDemo_cpp; | ||||
| const int WaveShaperTanhDemo_cppSize = 2037; | const int WaveShaperTanhDemo_cppSize = 2037; | ||||
| @@ -1037,15 +1037,29 @@ public class JuceDemo extends Activity | |||||
| //============================================================================== | //============================================================================== | ||||
| public static class NativeInvocationHandler implements InvocationHandler | public static class NativeInvocationHandler implements InvocationHandler | ||||
| { | { | ||||
| public NativeInvocationHandler (long nativeContextRef) | |||||
| public NativeInvocationHandler (Activity activityToUse, long nativeContextRef) | |||||
| { | { | ||||
| activity = activityToUse; | |||||
| nativeContext = nativeContextRef; | nativeContext = nativeContextRef; | ||||
| } | } | ||||
| public void nativeContextDeleted() | |||||
| { | |||||
| nativeContext = 0; | |||||
| } | |||||
| @Override | @Override | ||||
| public void finalize() | public void finalize() | ||||
| { | { | ||||
| dispatchFinalize (nativeContext); | |||||
| activity.runOnUiThread (new Runnable() | |||||
| { | |||||
| @Override | |||||
| public void run() | |||||
| { | |||||
| if (nativeContext != 0) | |||||
| dispatchFinalize (nativeContext); | |||||
| } | |||||
| }); | |||||
| } | } | ||||
| @Override | @Override | ||||
| @@ -1055,15 +1069,21 @@ public class JuceDemo extends Activity | |||||
| } | } | ||||
| //============================================================================== | //============================================================================== | ||||
| Activity activity; | |||||
| private long nativeContext = 0; | private long nativeContext = 0; | ||||
| private native void dispatchFinalize (long nativeContextRef); | private native void dispatchFinalize (long nativeContextRef); | ||||
| private native Object dispatchInvoke (long nativeContextRef, Object proxy, Method method, Object[] args); | private native Object dispatchInvoke (long nativeContextRef, Object proxy, Method method, Object[] args); | ||||
| } | } | ||||
| public static InvocationHandler createInvocationHandler (long nativeContextRef) | |||||
| public InvocationHandler createInvocationHandler (long nativeContextRef) | |||||
| { | |||||
| return new NativeInvocationHandler (this, nativeContextRef); | |||||
| } | |||||
| public void invocationHandlerContextDeleted (InvocationHandler handler) | |||||
| { | { | ||||
| return new NativeInvocationHandler (nativeContextRef); | |||||
| ((NativeInvocationHandler) handler).nativeContextDeleted(); | |||||
| } | } | ||||
| //============================================================================== | //============================================================================== | ||||
| @@ -1037,15 +1037,29 @@ public class InAppPurchase extends Activity | |||||
| //============================================================================== | //============================================================================== | ||||
| public static class NativeInvocationHandler implements InvocationHandler | public static class NativeInvocationHandler implements InvocationHandler | ||||
| { | { | ||||
| public NativeInvocationHandler (long nativeContextRef) | |||||
| public NativeInvocationHandler (Activity activityToUse, long nativeContextRef) | |||||
| { | { | ||||
| activity = activityToUse; | |||||
| nativeContext = nativeContextRef; | nativeContext = nativeContextRef; | ||||
| } | } | ||||
| public void nativeContextDeleted() | |||||
| { | |||||
| nativeContext = 0; | |||||
| } | |||||
| @Override | @Override | ||||
| public void finalize() | public void finalize() | ||||
| { | { | ||||
| dispatchFinalize (nativeContext); | |||||
| activity.runOnUiThread (new Runnable() | |||||
| { | |||||
| @Override | |||||
| public void run() | |||||
| { | |||||
| if (nativeContext != 0) | |||||
| dispatchFinalize (nativeContext); | |||||
| } | |||||
| }); | |||||
| } | } | ||||
| @Override | @Override | ||||
| @@ -1055,15 +1069,21 @@ public class InAppPurchase extends Activity | |||||
| } | } | ||||
| //============================================================================== | //============================================================================== | ||||
| Activity activity; | |||||
| private long nativeContext = 0; | private long nativeContext = 0; | ||||
| private native void dispatchFinalize (long nativeContextRef); | private native void dispatchFinalize (long nativeContextRef); | ||||
| private native Object dispatchInvoke (long nativeContextRef, Object proxy, Method method, Object[] args); | private native Object dispatchInvoke (long nativeContextRef, Object proxy, Method method, Object[] args); | ||||
| } | } | ||||
| public static InvocationHandler createInvocationHandler (long nativeContextRef) | |||||
| public InvocationHandler createInvocationHandler (long nativeContextRef) | |||||
| { | |||||
| return new NativeInvocationHandler (this, nativeContextRef); | |||||
| } | |||||
| public void invocationHandlerContextDeleted (InvocationHandler handler) | |||||
| { | { | ||||
| return new NativeInvocationHandler (nativeContextRef); | |||||
| ((NativeInvocationHandler) handler).nativeContextDeleted(); | |||||
| } | } | ||||
| //============================================================================== | //============================================================================== | ||||
| @@ -1969,15 +1969,29 @@ public class MidiTest extends Activity | |||||
| //============================================================================== | //============================================================================== | ||||
| public static class NativeInvocationHandler implements InvocationHandler | public static class NativeInvocationHandler implements InvocationHandler | ||||
| { | { | ||||
| public NativeInvocationHandler (long nativeContextRef) | |||||
| public NativeInvocationHandler (Activity activityToUse, long nativeContextRef) | |||||
| { | { | ||||
| activity = activityToUse; | |||||
| nativeContext = nativeContextRef; | nativeContext = nativeContextRef; | ||||
| } | } | ||||
| public void nativeContextDeleted() | |||||
| { | |||||
| nativeContext = 0; | |||||
| } | |||||
| @Override | @Override | ||||
| public void finalize() | public void finalize() | ||||
| { | { | ||||
| dispatchFinalize (nativeContext); | |||||
| activity.runOnUiThread (new Runnable() | |||||
| { | |||||
| @Override | |||||
| public void run() | |||||
| { | |||||
| if (nativeContext != 0) | |||||
| dispatchFinalize (nativeContext); | |||||
| } | |||||
| }); | |||||
| } | } | ||||
| @Override | @Override | ||||
| @@ -1987,15 +2001,21 @@ public class MidiTest extends Activity | |||||
| } | } | ||||
| //============================================================================== | //============================================================================== | ||||
| Activity activity; | |||||
| private long nativeContext = 0; | private long nativeContext = 0; | ||||
| private native void dispatchFinalize (long nativeContextRef); | private native void dispatchFinalize (long nativeContextRef); | ||||
| private native Object dispatchInvoke (long nativeContextRef, Object proxy, Method method, Object[] args); | private native Object dispatchInvoke (long nativeContextRef, Object proxy, Method method, Object[] args); | ||||
| } | } | ||||
| public static InvocationHandler createInvocationHandler (long nativeContextRef) | |||||
| public InvocationHandler createInvocationHandler (long nativeContextRef) | |||||
| { | |||||
| return new NativeInvocationHandler (this, nativeContextRef); | |||||
| } | |||||
| public void invocationHandlerContextDeleted (InvocationHandler handler) | |||||
| { | { | ||||
| return new NativeInvocationHandler (nativeContextRef); | |||||
| ((NativeInvocationHandler) handler).nativeContextDeleted(); | |||||
| } | } | ||||
| //============================================================================== | //============================================================================== | ||||
| @@ -1037,15 +1037,29 @@ public class JUCENetworkGraphicsDemo extends Activity | |||||
| //============================================================================== | //============================================================================== | ||||
| public static class NativeInvocationHandler implements InvocationHandler | public static class NativeInvocationHandler implements InvocationHandler | ||||
| { | { | ||||
| public NativeInvocationHandler (long nativeContextRef) | |||||
| public NativeInvocationHandler (Activity activityToUse, long nativeContextRef) | |||||
| { | { | ||||
| activity = activityToUse; | |||||
| nativeContext = nativeContextRef; | nativeContext = nativeContextRef; | ||||
| } | } | ||||
| public void nativeContextDeleted() | |||||
| { | |||||
| nativeContext = 0; | |||||
| } | |||||
| @Override | @Override | ||||
| public void finalize() | public void finalize() | ||||
| { | { | ||||
| dispatchFinalize (nativeContext); | |||||
| activity.runOnUiThread (new Runnable() | |||||
| { | |||||
| @Override | |||||
| public void run() | |||||
| { | |||||
| if (nativeContext != 0) | |||||
| dispatchFinalize (nativeContext); | |||||
| } | |||||
| }); | |||||
| } | } | ||||
| @Override | @Override | ||||
| @@ -1055,15 +1069,21 @@ public class JUCENetworkGraphicsDemo extends Activity | |||||
| } | } | ||||
| //============================================================================== | //============================================================================== | ||||
| Activity activity; | |||||
| private long nativeContext = 0; | private long nativeContext = 0; | ||||
| private native void dispatchFinalize (long nativeContextRef); | private native void dispatchFinalize (long nativeContextRef); | ||||
| private native Object dispatchInvoke (long nativeContextRef, Object proxy, Method method, Object[] args); | private native Object dispatchInvoke (long nativeContextRef, Object proxy, Method method, Object[] args); | ||||
| } | } | ||||
| public static InvocationHandler createInvocationHandler (long nativeContextRef) | |||||
| public InvocationHandler createInvocationHandler (long nativeContextRef) | |||||
| { | |||||
| return new NativeInvocationHandler (this, nativeContextRef); | |||||
| } | |||||
| public void invocationHandlerContextDeleted (InvocationHandler handler) | |||||
| { | { | ||||
| return new NativeInvocationHandler (nativeContextRef); | |||||
| ((NativeInvocationHandler) handler).nativeContextDeleted(); | |||||
| } | } | ||||
| //============================================================================== | //============================================================================== | ||||
| @@ -1037,15 +1037,29 @@ public class OSCReceiver extends Activity | |||||
| //============================================================================== | //============================================================================== | ||||
| public static class NativeInvocationHandler implements InvocationHandler | public static class NativeInvocationHandler implements InvocationHandler | ||||
| { | { | ||||
| public NativeInvocationHandler (long nativeContextRef) | |||||
| public NativeInvocationHandler (Activity activityToUse, long nativeContextRef) | |||||
| { | { | ||||
| activity = activityToUse; | |||||
| nativeContext = nativeContextRef; | nativeContext = nativeContextRef; | ||||
| } | } | ||||
| public void nativeContextDeleted() | |||||
| { | |||||
| nativeContext = 0; | |||||
| } | |||||
| @Override | @Override | ||||
| public void finalize() | public void finalize() | ||||
| { | { | ||||
| dispatchFinalize (nativeContext); | |||||
| activity.runOnUiThread (new Runnable() | |||||
| { | |||||
| @Override | |||||
| public void run() | |||||
| { | |||||
| if (nativeContext != 0) | |||||
| dispatchFinalize (nativeContext); | |||||
| } | |||||
| }); | |||||
| } | } | ||||
| @Override | @Override | ||||
| @@ -1055,15 +1069,21 @@ public class OSCReceiver extends Activity | |||||
| } | } | ||||
| //============================================================================== | //============================================================================== | ||||
| Activity activity; | |||||
| private long nativeContext = 0; | private long nativeContext = 0; | ||||
| private native void dispatchFinalize (long nativeContextRef); | private native void dispatchFinalize (long nativeContextRef); | ||||
| private native Object dispatchInvoke (long nativeContextRef, Object proxy, Method method, Object[] args); | private native Object dispatchInvoke (long nativeContextRef, Object proxy, Method method, Object[] args); | ||||
| } | } | ||||
| public static InvocationHandler createInvocationHandler (long nativeContextRef) | |||||
| public InvocationHandler createInvocationHandler (long nativeContextRef) | |||||
| { | |||||
| return new NativeInvocationHandler (this, nativeContextRef); | |||||
| } | |||||
| public void invocationHandlerContextDeleted (InvocationHandler handler) | |||||
| { | { | ||||
| return new NativeInvocationHandler (nativeContextRef); | |||||
| ((NativeInvocationHandler) handler).nativeContextDeleted(); | |||||
| } | } | ||||
| //============================================================================== | //============================================================================== | ||||
| @@ -1037,15 +1037,29 @@ public class OSCSender extends Activity | |||||
| //============================================================================== | //============================================================================== | ||||
| public static class NativeInvocationHandler implements InvocationHandler | public static class NativeInvocationHandler implements InvocationHandler | ||||
| { | { | ||||
| public NativeInvocationHandler (long nativeContextRef) | |||||
| public NativeInvocationHandler (Activity activityToUse, long nativeContextRef) | |||||
| { | { | ||||
| activity = activityToUse; | |||||
| nativeContext = nativeContextRef; | nativeContext = nativeContextRef; | ||||
| } | } | ||||
| public void nativeContextDeleted() | |||||
| { | |||||
| nativeContext = 0; | |||||
| } | |||||
| @Override | @Override | ||||
| public void finalize() | public void finalize() | ||||
| { | { | ||||
| dispatchFinalize (nativeContext); | |||||
| activity.runOnUiThread (new Runnable() | |||||
| { | |||||
| @Override | |||||
| public void run() | |||||
| { | |||||
| if (nativeContext != 0) | |||||
| dispatchFinalize (nativeContext); | |||||
| } | |||||
| }); | |||||
| } | } | ||||
| @Override | @Override | ||||
| @@ -1055,15 +1069,21 @@ public class OSCSender extends Activity | |||||
| } | } | ||||
| //============================================================================== | //============================================================================== | ||||
| Activity activity; | |||||
| private long nativeContext = 0; | private long nativeContext = 0; | ||||
| private native void dispatchFinalize (long nativeContextRef); | private native void dispatchFinalize (long nativeContextRef); | ||||
| private native Object dispatchInvoke (long nativeContextRef, Object proxy, Method method, Object[] args); | private native Object dispatchInvoke (long nativeContextRef, Object proxy, Method method, Object[] args); | ||||
| } | } | ||||
| public static InvocationHandler createInvocationHandler (long nativeContextRef) | |||||
| public InvocationHandler createInvocationHandler (long nativeContextRef) | |||||
| { | |||||
| return new NativeInvocationHandler (this, nativeContextRef); | |||||
| } | |||||
| public void invocationHandlerContextDeleted (InvocationHandler handler) | |||||
| { | { | ||||
| return new NativeInvocationHandler (nativeContextRef); | |||||
| ((NativeInvocationHandler) handler).nativeContextDeleted(); | |||||
| } | } | ||||
| //============================================================================== | //============================================================================== | ||||
| @@ -1969,15 +1969,29 @@ public class PushNotificationsDemo extends Activity | |||||
| //============================================================================== | //============================================================================== | ||||
| public static class NativeInvocationHandler implements InvocationHandler | public static class NativeInvocationHandler implements InvocationHandler | ||||
| { | { | ||||
| public NativeInvocationHandler (long nativeContextRef) | |||||
| public NativeInvocationHandler (Activity activityToUse, long nativeContextRef) | |||||
| { | { | ||||
| activity = activityToUse; | |||||
| nativeContext = nativeContextRef; | nativeContext = nativeContextRef; | ||||
| } | } | ||||
| public void nativeContextDeleted() | |||||
| { | |||||
| nativeContext = 0; | |||||
| } | |||||
| @Override | @Override | ||||
| public void finalize() | public void finalize() | ||||
| { | { | ||||
| dispatchFinalize (nativeContext); | |||||
| activity.runOnUiThread (new Runnable() | |||||
| { | |||||
| @Override | |||||
| public void run() | |||||
| { | |||||
| if (nativeContext != 0) | |||||
| dispatchFinalize (nativeContext); | |||||
| } | |||||
| }); | |||||
| } | } | ||||
| @Override | @Override | ||||
| @@ -1987,15 +2001,21 @@ public class PushNotificationsDemo extends Activity | |||||
| } | } | ||||
| //============================================================================== | //============================================================================== | ||||
| Activity activity; | |||||
| private long nativeContext = 0; | private long nativeContext = 0; | ||||
| private native void dispatchFinalize (long nativeContextRef); | private native void dispatchFinalize (long nativeContextRef); | ||||
| private native Object dispatchInvoke (long nativeContextRef, Object proxy, Method method, Object[] args); | private native Object dispatchInvoke (long nativeContextRef, Object proxy, Method method, Object[] args); | ||||
| } | } | ||||
| public static InvocationHandler createInvocationHandler (long nativeContextRef) | |||||
| public InvocationHandler createInvocationHandler (long nativeContextRef) | |||||
| { | |||||
| return new NativeInvocationHandler (this, nativeContextRef); | |||||
| } | |||||
| public void invocationHandlerContextDeleted (InvocationHandler handler) | |||||
| { | { | ||||
| return new NativeInvocationHandler (nativeContextRef); | |||||
| ((NativeInvocationHandler) handler).nativeContextDeleted(); | |||||
| } | } | ||||
| //============================================================================== | //============================================================================== | ||||
| @@ -1969,15 +1969,29 @@ public class JuceDemoPlugin extends Activity | |||||
| //============================================================================== | //============================================================================== | ||||
| public static class NativeInvocationHandler implements InvocationHandler | public static class NativeInvocationHandler implements InvocationHandler | ||||
| { | { | ||||
| public NativeInvocationHandler (long nativeContextRef) | |||||
| public NativeInvocationHandler (Activity activityToUse, long nativeContextRef) | |||||
| { | { | ||||
| activity = activityToUse; | |||||
| nativeContext = nativeContextRef; | nativeContext = nativeContextRef; | ||||
| } | } | ||||
| public void nativeContextDeleted() | |||||
| { | |||||
| nativeContext = 0; | |||||
| } | |||||
| @Override | @Override | ||||
| public void finalize() | public void finalize() | ||||
| { | { | ||||
| dispatchFinalize (nativeContext); | |||||
| activity.runOnUiThread (new Runnable() | |||||
| { | |||||
| @Override | |||||
| public void run() | |||||
| { | |||||
| if (nativeContext != 0) | |||||
| dispatchFinalize (nativeContext); | |||||
| } | |||||
| }); | |||||
| } | } | ||||
| @Override | @Override | ||||
| @@ -1987,15 +2001,21 @@ public class JuceDemoPlugin extends Activity | |||||
| } | } | ||||
| //============================================================================== | //============================================================================== | ||||
| Activity activity; | |||||
| private long nativeContext = 0; | private long nativeContext = 0; | ||||
| private native void dispatchFinalize (long nativeContextRef); | private native void dispatchFinalize (long nativeContextRef); | ||||
| private native Object dispatchInvoke (long nativeContextRef, Object proxy, Method method, Object[] args); | private native Object dispatchInvoke (long nativeContextRef, Object proxy, Method method, Object[] args); | ||||
| } | } | ||||
| public static InvocationHandler createInvocationHandler (long nativeContextRef) | |||||
| public InvocationHandler createInvocationHandler (long nativeContextRef) | |||||
| { | |||||
| return new NativeInvocationHandler (this, nativeContextRef); | |||||
| } | |||||
| public void invocationHandlerContextDeleted (InvocationHandler handler) | |||||
| { | { | ||||
| return new NativeInvocationHandler (nativeContextRef); | |||||
| ((NativeInvocationHandler) handler).nativeContextDeleted(); | |||||
| } | } | ||||
| //============================================================================== | //============================================================================== | ||||
| @@ -1969,15 +1969,29 @@ public class AudioPerformanceTest extends Activity | |||||
| //============================================================================== | //============================================================================== | ||||
| public static class NativeInvocationHandler implements InvocationHandler | public static class NativeInvocationHandler implements InvocationHandler | ||||
| { | { | ||||
| public NativeInvocationHandler (long nativeContextRef) | |||||
| public NativeInvocationHandler (Activity activityToUse, long nativeContextRef) | |||||
| { | { | ||||
| activity = activityToUse; | |||||
| nativeContext = nativeContextRef; | nativeContext = nativeContextRef; | ||||
| } | } | ||||
| public void nativeContextDeleted() | |||||
| { | |||||
| nativeContext = 0; | |||||
| } | |||||
| @Override | @Override | ||||
| public void finalize() | public void finalize() | ||||
| { | { | ||||
| dispatchFinalize (nativeContext); | |||||
| activity.runOnUiThread (new Runnable() | |||||
| { | |||||
| @Override | |||||
| public void run() | |||||
| { | |||||
| if (nativeContext != 0) | |||||
| dispatchFinalize (nativeContext); | |||||
| } | |||||
| }); | |||||
| } | } | ||||
| @Override | @Override | ||||
| @@ -1987,15 +2001,21 @@ public class AudioPerformanceTest extends Activity | |||||
| } | } | ||||
| //============================================================================== | //============================================================================== | ||||
| Activity activity; | |||||
| private long nativeContext = 0; | private long nativeContext = 0; | ||||
| private native void dispatchFinalize (long nativeContextRef); | private native void dispatchFinalize (long nativeContextRef); | ||||
| private native Object dispatchInvoke (long nativeContextRef, Object proxy, Method method, Object[] args); | private native Object dispatchInvoke (long nativeContextRef, Object proxy, Method method, Object[] args); | ||||
| } | } | ||||
| public static InvocationHandler createInvocationHandler (long nativeContextRef) | |||||
| public InvocationHandler createInvocationHandler (long nativeContextRef) | |||||
| { | |||||
| return new NativeInvocationHandler (this, nativeContextRef); | |||||
| } | |||||
| public void invocationHandlerContextDeleted (InvocationHandler handler) | |||||
| { | { | ||||
| return new NativeInvocationHandler (nativeContextRef); | |||||
| ((NativeInvocationHandler) handler).nativeContextDeleted(); | |||||
| } | } | ||||
| //============================================================================== | //============================================================================== | ||||
| @@ -956,7 +956,7 @@ public class JuceAppActivity extends Activity | |||||
| public static class NativeInvocationHandler implements InvocationHandler | public static class NativeInvocationHandler implements InvocationHandler | ||||
| { | { | ||||
| public NativeInvocationHandler (Activity activityToUse, long nativeContextRef) | public NativeInvocationHandler (Activity activityToUse, long nativeContextRef) | ||||
| { | |||||
| { | |||||
| activity = activityToUse; | activity = activityToUse; | ||||
| nativeContext = nativeContextRef; | nativeContext = nativeContextRef; | ||||
| } | } | ||||
| @@ -986,7 +986,7 @@ public class JuceAppActivity extends Activity | |||||
| return dispatchInvoke (nativeContext, proxy, method, args); | return dispatchInvoke (nativeContext, proxy, method, args); | ||||
| } | } | ||||
| //============================================================================== | |||||
| //============================================================================== | |||||
| Activity activity; | Activity activity; | ||||
| private long nativeContext = 0; | private long nativeContext = 0; | ||||
| @@ -997,11 +997,11 @@ public class JuceAppActivity extends Activity | |||||
| public InvocationHandler createInvocationHandler (long nativeContextRef) | public InvocationHandler createInvocationHandler (long nativeContextRef) | ||||
| { | { | ||||
| return new NativeInvocationHandler (this, nativeContextRef); | return new NativeInvocationHandler (this, nativeContextRef); | ||||
| } | |||||
| public void invocationHandlerContextDeleted (InvocationHandler handler) | |||||
| { | |||||
| ((NativeInvocationHandler) handler).nativeContextDeleted(); | |||||
| } | |||||
| public void invocationHandlerContextDeleted (InvocationHandler handler) | |||||
| { | |||||
| ((NativeInvocationHandler) handler).nativeContextDeleted(); | |||||
| } | } | ||||
| //============================================================================== | //============================================================================== | ||||