File: TestFaust.java

package info (click to toggle)
faust 2.14.4~repack2-1
  • links: PTS, VCS
  • area: main
  • in suites: buster
  • size: 276,136 kB
  • sloc: cpp: 231,578; ansic: 15,403; sh: 10,871; java: 6,917; objc: 4,085; makefile: 3,002; cs: 1,077; ruby: 951; python: 885; xml: 550; yacc: 516; lex: 233; lisp: 201
file content (46 lines) | stat: -rw-r--r-- 1,600 bytes parent folder | download | duplicates (5)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
import java.io.*;
import com.grame.faust.Faust;
import com.grame.faust.llvm_dsp_factory;
import com.grame.faust.llvm_dsp;

class TestFaust
{
	static {
		try {
			String property = System.getProperty("java.library.path");
			System.out.println("java.library.path = " + property);
            System.loadLibrary("Faust"); 
        } catch (UnsatisfiedLinkError e) {
            System.err.println("Native code library failed to load.\n" + e);
            System.exit(1);
		}
    }

    public static void main(String args[]) throws InterruptedException {
		System.out.println("Test libfaust");
        
        // noise generator
        String prog = "random = +(12345)~*(1103515245); noise1 = random/2147483647.0; process = noise1 * vslider(\"Volume\", 0.5, 0, 1, 0.01)<:_,_;";
        
        //String argv = "-vec " + "-lv " + "1 ";
        
        String argv = "-vec " + "-lv " + "1 ";
        //String argv = "-vec " + "-lv " + "1 " + "-I " + "/Documents/faust-sf/embedded/faustjava/test_lib/";
        
        System.out.println(argv);
        
        llvm_dsp_factory factory = Faust.createCDSPFactoryFromStringAux("noise", prog, argv, "", 3);
        if (factory == null) {
            System.out.print(Faust.getCDSPLastError());
            return;
        }
         
        llvm_dsp dsp = Faust.createCDSPInstance(factory);
        
        System.out.println(Faust.getCName(factory));
        System.out.println(Faust.getCSHAKey(factory));
    
        System.out.println(Faust.getNumInputsCDSPInstance(dsp));
        System.out.println(Faust.getNumOutputsCDSPInstance(dsp));
    }
}