Chris@37
|
1 /*
|
Chris@37
|
2 jVamp
|
Chris@37
|
3
|
Chris@37
|
4 A Java host interface for Vamp audio analysis plugins
|
Chris@37
|
5
|
Chris@37
|
6 Centre for Digital Music, Queen Mary, University of London.
|
Chris@37
|
7 Copyright 2012 Chris Cannam and QMUL.
|
Chris@37
|
8
|
Chris@37
|
9 Permission is hereby granted, free of charge, to any person
|
Chris@37
|
10 obtaining a copy of this software and associated documentation
|
Chris@37
|
11 files (the "Software"), to deal in the Software without
|
Chris@37
|
12 restriction, including without limitation the rights to use, copy,
|
Chris@37
|
13 modify, merge, publish, distribute, sublicense, and/or sell copies
|
Chris@37
|
14 of the Software, and to permit persons to whom the Software is
|
Chris@37
|
15 furnished to do so, subject to the following conditions:
|
Chris@37
|
16
|
Chris@37
|
17 The above copyright notice and this permission notice shall be
|
Chris@37
|
18 included in all copies or substantial portions of the Software.
|
Chris@37
|
19
|
Chris@37
|
20 THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
Chris@37
|
21 EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
Chris@37
|
22 MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
Chris@37
|
23 NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR
|
Chris@37
|
24 ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF
|
Chris@37
|
25 CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
Chris@37
|
26 WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
Chris@37
|
27
|
Chris@37
|
28 Except as contained in this notice, the names of the Centre for
|
Chris@37
|
29 Digital Music; Queen Mary, University of London; and Chris Cannam
|
Chris@37
|
30 shall not be used in advertising or otherwise to promote the sale,
|
Chris@37
|
31 use or other dealings in this Software without prior written
|
Chris@37
|
32 authorization.
|
Chris@37
|
33 */
|
Chris@2
|
34
|
Chris@2
|
35 package org.vamp_plugins;
|
Chris@2
|
36
|
Chris@49
|
37 /**
|
Chris@49
|
38 * RealTime class, corresponding to the C++ Vamp::RealTime.
|
Chris@49
|
39 *
|
Chris@49
|
40 * Although the implementation is in native code, this class does not
|
Chris@49
|
41 * store a native object handle and has no dispose() method -- it can
|
Chris@49
|
42 * be garbage collected without prior disposal like any plain Java
|
Chris@49
|
43 * object.
|
Chris@49
|
44 */
|
Chris@20
|
45 public class RealTime
|
Chris@20
|
46 {
|
Chris@20
|
47 public RealTime(int s, int n) { initialise(s, n); }
|
Chris@2
|
48
|
Chris@20
|
49 public native int sec();
|
Chris@20
|
50 public native int nsec();
|
Chris@19
|
51
|
Chris@20
|
52 public native int usec();
|
Chris@20
|
53 public native int msec();
|
Chris@20
|
54
|
Chris@20
|
55 /// Return a debug-type string to full precision
|
Chris@20
|
56 public native String toString();
|
Chris@20
|
57
|
Chris@20
|
58 /// Return a user-readable formatted string to the nearest millisecond
|
Chris@20
|
59 public native String toText();
|
Chris@20
|
60
|
Chris@20
|
61 public native static RealTime fromSeconds(double sec);
|
Chris@20
|
62 public native static RealTime fromMilliseconds(int msec);
|
Chris@20
|
63
|
Chris@20
|
64 public native static RealTime frame2RealTime(long frame, int sampleRate);
|
Chris@20
|
65 public native static long realTime2Frame(RealTime r, int sampleRate);
|
Chris@20
|
66
|
Chris@20
|
67 private native void initialise(int s, int n);
|
Chris@49
|
68 private int m_s;
|
Chris@49
|
69 private int m_n;
|
Chris@2
|
70 }
|
Chris@2
|
71
|
Chris@17
|
72
|