effects can be passed to analyzers. started on making inputs modulatable

This commit is contained in:
wirsing
2014-07-16 11:49:07 -07:00
parent 00ee473b14
commit cde6050277
14 changed files with 227 additions and 77 deletions

View File

@@ -47,6 +47,14 @@ JNIEXPORT void JNICALL Java_processing_sound_MethClaInterface_synthStop
JNIEXPORT void JNICALL Java_processing_sound_MethClaInterface_oscSet
(JNIEnv *, jobject, jfloat, jfloat, jfloat, jfloat, jintArray);
/*
* Class: processing_sound_MethClaInterface
* Method: oscAudioSet
* Signature: ([I[I[I[I[I)V
*/
JNIEXPORT void JNICALL Java_processing_sound_MethClaInterface_oscAudioSet
(JNIEnv *, jobject, jintArray, jintArray, jintArray, jintArray, jintArray);
/*
* Class: processing_sound_MethClaInterface
* Method: sinePlay
@@ -210,9 +218,9 @@ JNIEXPORT void JNICALL Java_processing_sound_MethClaInterface_brownNoiseSet
/*
* Class: processing_sound_MethClaInterface
* Method: envelopePlay
* Signature: ([IFFFF)I
* Signature: ([IFFFF)[I
*/
JNIEXPORT jint JNICALL Java_processing_sound_MethClaInterface_envelopePlay
JNIEXPORT jintArray JNICALL Java_processing_sound_MethClaInterface_envelopePlay
(JNIEnv *, jobject, jintArray, jfloat, jfloat, jfloat, jfloat);
/*
@@ -226,25 +234,25 @@ JNIEXPORT jint JNICALL Java_processing_sound_MethClaInterface_doneAfter
/*
* Class: processing_sound_MethClaInterface
* Method: highPassPlay
* Signature: ([IFF)I
* Signature: ([IFF)[I
*/
JNIEXPORT jint JNICALL Java_processing_sound_MethClaInterface_highPassPlay
JNIEXPORT jintArray JNICALL Java_processing_sound_MethClaInterface_highPassPlay
(JNIEnv *, jobject, jintArray, jfloat, jfloat);
/*
* Class: processing_sound_MethClaInterface
* Method: lowPassPlay
* Signature: ([IFF)I
* Signature: ([IFF)[I
*/
JNIEXPORT jint JNICALL Java_processing_sound_MethClaInterface_lowPassPlay
JNIEXPORT jintArray JNICALL Java_processing_sound_MethClaInterface_lowPassPlay
(JNIEnv *, jobject, jintArray, jfloat, jfloat);
/*
* Class: processing_sound_MethClaInterface
* Method: bandPassPlay
* Signature: ([IFF)I
* Signature: ([IFF)[I
*/
JNIEXPORT jint JNICALL Java_processing_sound_MethClaInterface_bandPassPlay
JNIEXPORT jintArray JNICALL Java_processing_sound_MethClaInterface_bandPassPlay
(JNIEnv *, jobject, jintArray, jfloat, jfloat);
/*
@@ -258,9 +266,9 @@ JNIEXPORT void JNICALL Java_processing_sound_MethClaInterface_filterSet
/*
* Class: processing_sound_MethClaInterface
* Method: delayPlay
* Signature: ([IFFF)I
* Signature: ([IFFF)[I
*/
JNIEXPORT jint JNICALL Java_processing_sound_MethClaInterface_delayPlay
JNIEXPORT jintArray JNICALL Java_processing_sound_MethClaInterface_delayPlay
(JNIEnv *, jobject, jintArray, jfloat, jfloat, jfloat);
/*
@@ -274,9 +282,9 @@ JNIEXPORT void JNICALL Java_processing_sound_MethClaInterface_delaySet
/*
* Class: processing_sound_MethClaInterface
* Method: reverbPlay
* Signature: ([IFFF)I
* Signature: ([IFFF)[I
*/
JNIEXPORT jint JNICALL Java_processing_sound_MethClaInterface_reverbPlay
JNIEXPORT jintArray JNICALL Java_processing_sound_MethClaInterface_reverbPlay
(JNIEnv *, jobject, jintArray, jfloat, jfloat, jfloat);
/*

View File

@@ -140,6 +140,75 @@ JNIEXPORT void JNICALL Java_processing_sound_MethClaInterface_oscSet (JNIEnv *en
env->ReleaseIntArrayElements(nodeId, m_nodeId, 0);
};
JNIEXPORT void JNICALL Java_processing_sound_MethClaInterface_oscAudioSet(JNIEnv *env, jobject object, jintArray freq, jintArray amp, jintArray add, jintArray pos, jintArray nodeId){
jint* m_freq = env->GetIntArrayElements(freq, 0);
jint* m_amp = env->GetIntArrayElements(amp, 0);
jint* m_add = env->GetIntArrayElements(add, 0);
jint* m_pos = env->GetIntArrayElements(pos, 0);
jint* m_nodeId = env->GetIntArrayElements(nodeId, 0);
Methcla::Request request(engine());
request.openBundle(Methcla::immediately);
if (m_freq[0] != -1)
{
Methcla::AudioBusId freq_bus = m_engine->audioBusId().alloc();
request.set(m_nodeId[0], 0 , 0);
request.free(m_freq[1]);
request.mapOutput(m_freq[0], 0, freq_bus);
request.mapInput(m_nodeId[0], 0, freq_bus);
std::cout << "freq" << std::endl;
}
if (m_amp[0] != -1)
{
Methcla::AudioBusId amp_bus = m_engine->audioBusId().alloc();
//request.set(m_nodeId[0], 1 , 0);
//request.free(m_amp[1]);
request.mapOutput(m_amp[0], 0, amp_bus);
std::cout << m_amp[0] << std::endl;
request.set(m_amp[0], 0, 200);
request.mapInput(m_nodeId[0], 1, amp_bus);
std::cout << "amp" << std::endl;
}
if (m_add[0] != -1)
{
Methcla::AudioBusId add_bus = m_engine->audioBusId().alloc();
request.set(m_nodeId[0], 2 , 0);
request.free(m_add[1]);
request.mapOutput(m_add[0], 0, add_bus);
request.mapInput(m_nodeId[0], 2, add_bus);
std::cout << "add" << std::endl;
}
if (m_pos[0] != -1)
{
Methcla::AudioBusId pos_bus = m_engine->audioBusId().alloc();
request.set(m_nodeId[1], 0 , 0);
request.free(m_pos[1]);
request.mapOutput(m_pos[0], 0, pos_bus);
request.mapInput(m_nodeId[1], 0, pos_bus);
std::cout << "pos" << std::endl;
}
request.closeBundle();
request.send();
env->ReleaseIntArrayElements(freq, m_freq, 0);
env->ReleaseIntArrayElements(amp, m_amp, 0);
env->ReleaseIntArrayElements(add, m_add, 0);
env->ReleaseIntArrayElements(pos, m_pos, 0);
env->ReleaseIntArrayElements(nodeId, m_nodeId, 0);
};
// SineOsc
JNIEXPORT jintArray JNICALL Java_processing_sound_MethClaInterface_sinePlay(JNIEnv *env, jobject object, jfloat freq, jfloat amp, jfloat add, jfloat pos){
@@ -316,6 +385,7 @@ JNIEXPORT void JNICALL Java_processing_sound_MethClaInterface_sqrSet(JNIEnv *env
Methcla::Request request(engine());
request.openBundle(Methcla::immediately);
request.set(m_nodeId[0], 0 , freq);
request.set(m_nodeId[0], 0 , 0.5f);
request.set(m_nodeId[0], 2 , amp);
request.set(m_nodeId[1], 0 , pos);
request.closeBundle();
@@ -780,9 +850,11 @@ JNIEXPORT void JNICALL Java_processing_sound_MethClaInterface_brownNoiseSet(JNIE
};
JNIEXPORT jint JNICALL Java_processing_sound_MethClaInterface_envelopePlay(JNIEnv *env, jobject object, jintArray nodeId, jfloat attackTime, jfloat sustainTime, jfloat sustainLevel, jfloat releaseTime){
JNIEXPORT jintArray JNICALL Java_processing_sound_MethClaInterface_envelopePlay(JNIEnv *env, jobject object, jintArray nodeId, jfloat attackTime, jfloat sustainTime, jfloat sustainLevel, jfloat releaseTime){
jint* m_nodeId = env->GetIntArrayElements(nodeId, 0);
jintArray returnId = env->NewIntArray(2);
jint *m_returnId = env->GetIntArrayElements(returnId, NULL);
Methcla::AudioBusId in_bus = m_engine->audioBusId().alloc();
Methcla::AudioBusId out_bus = m_engine->audioBusId().alloc();
@@ -813,15 +885,21 @@ JNIEXPORT jint JNICALL Java_processing_sound_MethClaInterface_envelopePlay(JNIEn
request.closeBundle();
request.send();
m_returnId[0]=synth.id();
m_returnId[1]=m_nodeId[1];
env->ReleaseIntArrayElements(returnId, m_returnId, 0);
env->ReleaseIntArrayElements(nodeId, m_nodeId, 0);
return synth.id();
return returnId;
};
JNIEXPORT jint JNICALL Java_processing_sound_MethClaInterface_highPassPlay(JNIEnv *env, jobject object, jintArray nodeId, jfloat freq, jfloat res){
JNIEXPORT jintArray JNICALL Java_processing_sound_MethClaInterface_highPassPlay(JNIEnv *env, jobject object, jintArray nodeId, jfloat freq, jfloat res){
jint* m_nodeId = env->GetIntArrayElements(nodeId, 0);
jintArray returnId = env->NewIntArray(2);
jint *m_returnId = env->GetIntArrayElements(returnId, NULL);
Methcla::AudioBusId in_bus = m_engine->audioBusId().alloc();
Methcla::AudioBusId out_bus = m_engine->audioBusId().alloc();
@@ -845,14 +923,20 @@ JNIEXPORT jint JNICALL Java_processing_sound_MethClaInterface_highPassPlay(JNIEn
request.closeBundle();
request.send();
env->ReleaseIntArrayElements(nodeId, m_nodeId, 0);
m_returnId[0]=synth.id();
m_returnId[1]=m_nodeId[1];
return synth.id();
env->ReleaseIntArrayElements(returnId, m_returnId, 0);
env->ReleaseIntArrayElements(nodeId, m_nodeId, 0);
return returnId;
};
JNIEXPORT jint JNICALL Java_processing_sound_MethClaInterface_lowPassPlay(JNIEnv *env, jobject object, jintArray nodeId, jfloat freq, jfloat res){
JNIEXPORT jintArray JNICALL Java_processing_sound_MethClaInterface_lowPassPlay(JNIEnv *env, jobject object, jintArray nodeId, jfloat freq, jfloat res){
jint* m_nodeId = env->GetIntArrayElements(nodeId, 0);
jintArray returnId = env->NewIntArray(2);
jint *m_returnId = env->GetIntArrayElements(returnId, NULL);
Methcla::AudioBusId in_bus = m_engine->audioBusId().alloc();
Methcla::AudioBusId out_bus = m_engine->audioBusId().alloc();
@@ -876,14 +960,20 @@ JNIEXPORT jint JNICALL Java_processing_sound_MethClaInterface_lowPassPlay(JNIEnv
request.closeBundle();
request.send();
env->ReleaseIntArrayElements(nodeId, m_nodeId, 0);
m_returnId[0]=synth.id();
m_returnId[1]=m_nodeId[1];
return synth.id();
env->ReleaseIntArrayElements(returnId, m_returnId, 0);
env->ReleaseIntArrayElements(nodeId, m_nodeId, 0);
return returnId;
};
JNIEXPORT jint JNICALL Java_processing_sound_MethClaInterface_bandPassPlay(JNIEnv *env, jobject object, jintArray nodeId, jfloat freq, jfloat res){
JNIEXPORT jintArray JNICALL Java_processing_sound_MethClaInterface_bandPassPlay(JNIEnv *env, jobject object, jintArray nodeId, jfloat freq, jfloat res){
jint* m_nodeId = env->GetIntArrayElements(nodeId, 0);
jintArray returnId = env->NewIntArray(2);
jint *m_returnId = env->GetIntArrayElements(returnId, NULL);
Methcla::AudioBusId in_bus = m_engine->audioBusId().alloc();
Methcla::AudioBusId out_bus = m_engine->audioBusId().alloc();
@@ -907,9 +997,13 @@ JNIEXPORT jint JNICALL Java_processing_sound_MethClaInterface_bandPassPlay(JNIEn
request.closeBundle();
request.send();
m_returnId[0]=synth.id();
m_returnId[1]=m_nodeId[1];
env->ReleaseIntArrayElements(returnId, m_returnId, 0);
env->ReleaseIntArrayElements(nodeId, m_nodeId, 0);
return synth.id();
return returnId;
};
JNIEXPORT void JNICALL Java_processing_sound_MethClaInterface_filterSet(JNIEnv *env, jobject object, jfloat freq, jfloat res, jint nodeId){
@@ -922,9 +1016,11 @@ JNIEXPORT void JNICALL Java_processing_sound_MethClaInterface_filterSet(JNIEnv *
request.send();
};
JNIEXPORT jint JNICALL Java_processing_sound_MethClaInterface_delayPlay(JNIEnv *env, jobject object, jintArray nodeId, jfloat maxDelayTime, jfloat delayTime, jfloat feedBack){
JNIEXPORT jintArray JNICALL Java_processing_sound_MethClaInterface_delayPlay(JNIEnv *env, jobject object, jintArray nodeId, jfloat maxDelayTime, jfloat delayTime, jfloat feedBack){
jint* m_nodeId = env->GetIntArrayElements(nodeId, 0);
jint* m_nodeId = env->GetIntArrayElements(nodeId, 0);
jintArray returnId = env->NewIntArray(2);
jint *m_returnId = env->GetIntArrayElements(returnId, NULL);
Methcla::AudioBusId in_bus = m_engine->audioBusId().alloc();
Methcla::AudioBusId out_bus = m_engine->audioBusId().alloc();
@@ -947,10 +1043,14 @@ JNIEXPORT jint JNICALL Java_processing_sound_MethClaInterface_delayPlay(JNIEnv *
request.closeBundle();
request.send();
m_returnId[0]=synth.id();
m_returnId[1]=m_nodeId[1];
env->ReleaseIntArrayElements(returnId, m_returnId, 0);
env->ReleaseIntArrayElements(nodeId, m_nodeId, 0);
return synth.id();
return returnId;
};
@@ -963,9 +1063,11 @@ JNIEXPORT void JNICALL Java_processing_sound_MethClaInterface_delaySet(JNIEnv *e
request.send();
};
JNIEXPORT jint JNICALL Java_processing_sound_MethClaInterface_reverbPlay(JNIEnv *env, jobject object, jintArray nodeId, jfloat room, jfloat damp, jfloat wet){
JNIEXPORT jintArray JNICALL Java_processing_sound_MethClaInterface_reverbPlay(JNIEnv *env, jobject object, jintArray nodeId, jfloat room, jfloat damp, jfloat wet){
jint* m_nodeId = env->GetIntArrayElements(nodeId, 0);
jintArray returnId = env->NewIntArray(2);
jint *m_returnId = env->GetIntArrayElements(returnId, NULL);
Methcla::AudioBusId in_bus = m_engine->audioBusId().alloc();
Methcla::AudioBusId out_bus = m_engine->audioBusId().alloc();
@@ -991,9 +1093,13 @@ JNIEXPORT jint JNICALL Java_processing_sound_MethClaInterface_reverbPlay(JNIEnv
request.closeBundle();
request.send();
m_returnId[0]=synth.id();
m_returnId[1]=m_nodeId[1];
env->ReleaseIntArrayElements(returnId, m_returnId, 0);
env->ReleaseIntArrayElements(nodeId, m_nodeId, 0);
return synth.id();
return returnId;
};
JNIEXPORT void JNICALL Java_processing_sound_MethClaInterface_reverbSet(JNIEnv *env, jobject object, jfloat room, jfloat damp, jfloat wet, jint nodeId){

View File

@@ -6,8 +6,7 @@ public class BandPass implements SoundObject{
PApplet parent;
private Engine m_engine;
private int m_nodeId;
private int[] m_m = {0,0};
private int[] m_nodeId = {-1,-1};
private float m_freq = 100;
private float m_res = 1;
@@ -29,7 +28,7 @@ public class BandPass implements SoundObject{
}
private void set(){
m_engine.filterSet(m_freq, m_res, m_nodeId);
m_engine.filterSet(m_freq, m_res, m_nodeId[0]);
}
public void set(float freq, float res){
@@ -48,14 +47,14 @@ public class BandPass implements SoundObject{
}
public int[] returnId(){
return m_m;
return m_nodeId;
}
public void stop(){
//m_engine.synthStop(m_nodeId);
m_engine.synthStop(m_nodeId);
}
public void dispose() {
//m_engine.synthStop(m_nodeId);
m_engine.synthStop(m_nodeId);
}
}

View File

@@ -6,8 +6,7 @@ public class Delay implements SoundObject{
PApplet parent;
private Engine m_engine;
private int m_nodeId;
private int[] m_m = {0,0};
private int m_nodeId[] = {-1,-1};
private float m_maxDelayTime = 2;
private float m_delayTime = 0;
private float m_feedBack = 0;
@@ -35,7 +34,7 @@ public class Delay implements SoundObject{
}
private void set(){
m_engine.delaySet(m_delayTime, m_feedBack, m_nodeId);
m_engine.delaySet(m_delayTime, m_feedBack, m_nodeId[0]);
}
public void set(float delayTime, float feedBack){
@@ -54,14 +53,14 @@ public class Delay implements SoundObject{
}
public int[] returnId(){
return m_m;
return m_nodeId;
}
public void stop(){
//m_engine.synthStop(m_nodeId);
m_engine.synthStop(m_nodeId);
}
public void dispose() {
//m_engine.synthStop(m_nodeId);
m_engine.synthStop(m_nodeId);
}
}

View File

@@ -62,6 +62,10 @@ public class Engine {
public static void oscSet(float freq, float amp, float add, float pos, int[] nodeId){
methCla.oscSet(freq, amp, add, pos, nodeId);
};
public static void oscAudioSet(int[] freqId, int[] ampId, int[] addId, int[] posId, int[] nodeId){
methCla.oscAudioSet(freqId, ampId, addId, posId, nodeId);
};
// Sine Wave Oscillator
@@ -163,7 +167,7 @@ public class Engine {
// Envelope
public static int envelopePlay(int[] input, float attackTime, float sustainTime, float sustainLevel, float releaseTime){
public static int[] envelopePlay(int[] input, float attackTime, float sustainTime, float sustainLevel, float releaseTime){
return methCla.envelopePlay(input, attackTime, sustainTime, sustainLevel, releaseTime);
};
@@ -173,15 +177,15 @@ public class Engine {
// Filters
public static int highPassPlay(int[] input, float freq, float res){
public static int[] highPassPlay(int[] input, float freq, float res){
return methCla.highPassPlay(input, freq, res);
};
public static int lowPassPlay(int[] input, float freq, float res){
public static int[] lowPassPlay(int[] input, float freq, float res){
return methCla.lowPassPlay(input, freq, res);
};
public static int bandPassPlay(int[] input, float freq, float res){
public static int[] bandPassPlay(int[] input, float freq, float res){
return methCla.bandPassPlay(input, freq, res);
};
@@ -191,7 +195,7 @@ public class Engine {
// Delay
public static int delayPlay(int[] input, float maxDelayTime, float delayTime, float feedBack){
public static int[] delayPlay(int[] input, float maxDelayTime, float delayTime, float feedBack){
return methCla.delayPlay(input, maxDelayTime, delayTime, feedBack);
};
@@ -201,7 +205,7 @@ public class Engine {
// Reverb
public static int reverbPlay(int[] input, float room, float damp, float wet){
public static int[] reverbPlay(int[] input, float room, float damp, float wet){
return methCla.reverbPlay(input, room, damp, wet);
};

View File

@@ -5,7 +5,7 @@ public class Env {
PApplet parent;
private Engine m_engine;
int m_nodeId;
int[] m_nodeId = {-1, -1};
public Env (PApplet theParent) {
this.parent = theParent;
@@ -18,11 +18,11 @@ public class Env {
m_nodeId = m_engine.envelopePlay(input.returnId(), attackTime, sustainTime, sustainLevel, releaseTime);
}
public int returnId(){
public int[] returnId(){
return m_nodeId;
}
public void dispose(){
//m_engine.synthStop(m_nodeId);
m_engine.synthStop(m_nodeId);
}
};

View File

@@ -6,8 +6,7 @@ public class HighPass implements SoundObject{
PApplet parent;
private Engine m_engine;
private int m_nodeId;
private int[] m_m = {0,0};
private int[] m_nodeId = {-1,-1};
private float m_freq = 100;
private float m_res = 1;
@@ -29,7 +28,7 @@ public class HighPass implements SoundObject{
}
private void set(){
m_engine.filterSet(m_freq, m_res, m_nodeId);
m_engine.filterSet(m_freq, m_res, m_nodeId[0]);
}
public void set(float freq, float res){
@@ -48,14 +47,14 @@ public class HighPass implements SoundObject{
}
public int[] returnId(){
return m_m;
return m_nodeId;
}
public void stop(){
//m_engine.synthStop(m_nodeId);
m_engine.synthStop(m_nodeId);
}
public void dispose() {
//m_engine.synthStop(m_nodeId);
m_engine.synthStop(m_nodeId);
}
}

View File

@@ -6,8 +6,7 @@ public class LowPass implements SoundObject{
PApplet parent;
private Engine m_engine;
private int m_nodeId;
private int[] m_m = {0,0};
private int[] m_nodeId = {-1, -1};
private float m_freq = 100;
private float m_res = 1;
@@ -29,7 +28,7 @@ public class LowPass implements SoundObject{
}
private void set(){
m_engine.filterSet(m_freq, m_res, m_nodeId);
m_engine.filterSet(m_freq, m_res, m_nodeId[0]);
}
public void set(float freq, float res){
@@ -48,14 +47,14 @@ public class LowPass implements SoundObject{
}
public int[] returnId(){
return m_m;
return m_nodeId;
}
public void stop(){
//m_engine.synthStop(m_nodeId);
m_engine.synthStop(m_nodeId);
}
public void dispose() {
//m_engine.synthStop(m_nodeId);
m_engine.synthStop(m_nodeId);
}
}

View File

@@ -23,6 +23,8 @@ public class MethClaInterface
// general Oscillator methods
public native void oscSet(float freq, float amp, float add, float pos, int[] nodeId);
public native void oscAudioSet(int[] freqId, int[] ampId, int[] addId, int[] posId, int[] nodeId);
// Sine Wave Oscillator
@@ -86,29 +88,29 @@ public class MethClaInterface
// Envelope
public native int envelopePlay(int[] input, float attackTime, float sustainTime, float sustainLevel, float releaseTime);
public native int[] envelopePlay(int[] input, float attackTime, float sustainTime, float sustainLevel, float releaseTime);
public native int doneAfter(float seconds);
// Filters
public native int highPassPlay(int[] input, float freq, float res);
public native int[] highPassPlay(int[] input, float freq, float res);
public native int lowPassPlay(int[] input, float freq, float res);
public native int[] lowPassPlay(int[] input, float freq, float res);
public native int bandPassPlay(int[] input, float freq, float res);
public native int[] bandPassPlay(int[] input, float freq, float res);
public native void filterSet(float freq, float res, int nodeId);
// Delay
public native int delayPlay(int[] input, float maxDelayTime, float delayTime, float feedBack);
public native int[] delayPlay(int[] input, float maxDelayTime, float delayTime, float feedBack);
public native void delaySet(float delayTime, float feedBack, int nodeId);
// Reverb
public native int reverbPlay(int[] input, float room, float damp, float wet);
public native int[] reverbPlay(int[] input, float room, float damp, float wet);
public native void reverbSet(float room, float damp, float wet, int nodeId);

View File

@@ -6,8 +6,7 @@ public class Reverb implements SoundObject{
PApplet parent;
private Engine m_engine;
private int m_nodeId;
private int[] m_m = {0,0};
private int[] m_nodeId = {-1, -1};
private float m_room = 1;
private float m_damp = 0;
private float m_wet = 0.5f;
@@ -39,7 +38,7 @@ public class Reverb implements SoundObject{
}
private void set(){
m_engine.reverbSet(m_room, m_damp, m_wet, m_nodeId);
m_engine.reverbSet(m_room, m_damp, m_wet, m_nodeId[0]);
}
public void set(float room, float damp, float wet){
@@ -63,14 +62,14 @@ public class Reverb implements SoundObject{
}
public int[] returnId(){
return m_m;
return m_nodeId;
}
public void stop(){
//m_engine.synthStop(m_nodeId);
m_engine.synthStop(m_nodeId);
}
public void dispose() {
//m_engine.synthStop(m_nodeId);
m_engine.synthStop(m_nodeId);
}
}

View File

@@ -6,6 +6,12 @@ public class SawOsc implements Oscillator{
PApplet parent;
private Engine m_engine;
private int[] m_nodeId = {-1,-1};
private int[] m_freqId = {-1,-1};
private int[] m_ampId = {-1,-1};
private int[] m_addId = {-1,-1};
private int[] m_posId = {-1,-1};
private float m_freq = 440;
private float m_amp = 0.5f;
private float m_add = 0;
@@ -42,6 +48,12 @@ public class SawOsc implements Oscillator{
m_engine.oscSet(m_freq, m_amp, m_add, m_pos, m_nodeId);
}
}
private void audioSet(){
if(m_nodeId[0] != -1 ) {
m_engine.oscAudioSet(m_freqId, m_ampId, m_addId, m_posId, m_nodeId);
}
}
public void set(float freq, float amp, float add, float pos){
m_freq=freq; m_amp=amp; m_add=add; m_pos=pos;
@@ -53,21 +65,41 @@ public class SawOsc implements Oscillator{
this.set();
}
public void freq(SoundObject freq){
m_freqId=freq.returnId();
this.audioSet();
}
public void amp(float amp){
m_amp=amp;
this.set();
}
public void amp(SoundObject amp){
m_ampId=amp.returnId();
this.audioSet();
}
public void add(float add){
m_add=add;
this.set();
}
public void add(SoundObject add){
m_addId=add.returnId();
this.audioSet();
}
public void pan(float pos){
m_pos=pos;
this.set();
}
public void pan(SoundObject pos){
m_posId=pos.returnId();
this.audioSet();
}
public void stop(){
m_engine.synthStop(m_nodeId);
}

View File

@@ -20,7 +20,8 @@ public class SqrOsc implements SoundObject {
}
public void play(){
m_nodeId = m_engine.sqrPlay(m_freq, m_amp, m_add-1, m_pos);
//m_nodeId = m_engine.pulsePlay(m_freq, 0.5f, m_amp*2, m_add-1, m_pos);
m_nodeId = m_engine.sqrPlay(m_freq, m_amp, m_add-1, m_pos);
};
public void play(float freq, float amp, float add, float pos){

View File

@@ -3,11 +3,13 @@
2.0 SOUND
FOR RELEASE
- Improve/make examples
Bugs:
- Fix FFT Crash
- Fix Low Pass Distortion
- Fix problem of passing effects to Analyzers
+ Fix problem of passing effects to Analyzers
Features:
- Make oscillators modulatable