diff org/vamp_plugins/RealTime.java @ 49:2db3640905ef

Rewrite RealTime so as not to use a native object handle, removing onerous and unsatisfactory requirement to call dispose() on all RealTime objects or leak native heap
author Chris Cannam
date Wed, 02 Sep 2015 15:17:40 +0100
parents c9515589be7d
children
line wrap: on
line diff
--- a/org/vamp_plugins/RealTime.java	Wed Mar 06 15:08:40 2013 +0000
+++ b/org/vamp_plugins/RealTime.java	Wed Sep 02 15:17:40 2015 +0100
@@ -34,12 +34,18 @@
 
 package org.vamp_plugins;
 
+/**
+ * RealTime class, corresponding to the C++ Vamp::RealTime.
+ *
+ * Although the implementation is in native code, this class does not
+ * store a native object handle and has no dispose() method -- it can
+ * be garbage collected without prior disposal like any plain Java
+ * object.
+ */
 public class RealTime
 {
     public RealTime(int s, int n) { initialise(s, n); }
 
-    public native void dispose();
-
     public native int sec();
     public native int nsec();
 
@@ -59,7 +65,8 @@
     public native static long realTime2Frame(RealTime r, int sampleRate);
 
     private native void initialise(int s, int n);
-    private long nativeHandle;
+    private int m_s;
+    private int m_n;
 }