mirror of
https://github.com/processing/processing4.git
synced 2026-06-16 04:26:26 +02:00
added PinkNoise + changed filter Classes to long names
This commit is contained in:
@@ -18,6 +18,7 @@
|
||||
#include "methcla/plugins/soundfile_api_libsndfile.h"
|
||||
#include "methcla/plugins/sampler.h"
|
||||
#include "methcla/plugins/whitenoise.h"
|
||||
#include "methcla/plugins/pinknoise.h"
|
||||
#include "methcla/plugins/node-control.h"
|
||||
#include "methcla/plugins/pan2.h"
|
||||
#include "methcla/plugins/soundfile_api_mpg123.h"
|
||||
@@ -26,6 +27,7 @@
|
||||
#include "methcla/plugins/hpf.h"
|
||||
#include "methcla/plugins/lpf.h"
|
||||
#include "methcla/plugins/delay.h"
|
||||
#include "methcla/plugins/audio_in.h"
|
||||
|
||||
#define OUTPUT_BUFFER_SIZE 1024
|
||||
#define SNDF_BUFFER_LEN 1024
|
||||
@@ -66,13 +68,15 @@ JNIEXPORT jint JNICALL Java_processing_sound_MethClaInterface_engineNew (JNIEnv
|
||||
.addLibrary(methcla_plugins_patch_cable)
|
||||
.addLibrary(methcla_plugins_sampler)
|
||||
.addLibrary(methcla_plugins_white_noise)
|
||||
.addLibrary(methcla_plugins_pink_noise)
|
||||
.addLibrary(methcla_plugins_node_control)
|
||||
.addLibrary(methcla_plugins_pan2)
|
||||
.addLibrary(methcla_plugins_amplitude_follower)
|
||||
.addLibrary(methcla_plugins_hpf)
|
||||
.addLibrary(methcla_plugins_lpf)
|
||||
.addLibrary(methcla_plugins_delay)
|
||||
.addLibrary(methcla_plugins_fft);
|
||||
.addLibrary(methcla_plugins_fft)
|
||||
.addLibrary(methcla_plugins_audioin);
|
||||
|
||||
m_engine = new Methcla::Engine(options);
|
||||
|
||||
@@ -371,6 +375,68 @@ JNIEXPORT void JNICALL Java_processing_sound_MethClaInterface_pulseSet(JNIEnv *e
|
||||
env->ReleaseIntArrayElements(nodeId, m_nodeId, 0);
|
||||
};
|
||||
|
||||
JNIEXPORT jintArray JNICALL Java_processing_sound_MethClaInterface_audioInPlay(JNIEnv *env, jobject object, jfloat amp, jfloat add, jfloat pos, jboolean out){
|
||||
|
||||
jintArray nodeId = env->NewIntArray(2);
|
||||
jint *m_nodeId = env->GetIntArrayElements(nodeId, NULL);
|
||||
|
||||
Methcla::AudioBusId bus = m_engine->audioBusId().alloc();
|
||||
Methcla::AudioBusId in = m_engine->audioBusId().alloc();
|
||||
|
||||
Methcla::Request request(engine());
|
||||
request.openBundle(Methcla::immediately);
|
||||
|
||||
auto synth = request.synth(
|
||||
METHCLA_PLUGINS_AUDIOIN_URI,
|
||||
engine().root(),
|
||||
{amp, add, pos}
|
||||
);
|
||||
|
||||
auto pan = request.synth(
|
||||
METHCLA_PLUGINS_PAN2_URI,
|
||||
engine().root(),
|
||||
{pos, 0},
|
||||
{Methcla::Value(1.f)}
|
||||
);
|
||||
|
||||
request.mapInput(synth.id(), 0, in, Methcla::kBusMappingExternal);
|
||||
request.mapOutput(synth.id(), 0, bus);
|
||||
request.mapInput(pan.id(), 0, bus);
|
||||
|
||||
request.mapOutput(pan.id(), 0, Methcla::AudioBusId(0), Methcla::kBusMappingExternal);
|
||||
request.mapOutput(pan.id(), 1, Methcla::AudioBusId(1), Methcla::kBusMappingExternal);
|
||||
|
||||
|
||||
request.activate(synth.id());
|
||||
request.activate(pan.id());
|
||||
|
||||
request.closeBundle();
|
||||
request.send();
|
||||
|
||||
m_nodeId[0]=synth.id();
|
||||
m_nodeId[1]=pan.id();
|
||||
|
||||
env->ReleaseIntArrayElements(nodeId, m_nodeId, 0);
|
||||
|
||||
return nodeId;
|
||||
};
|
||||
|
||||
JNIEXPORT void JNICALL Java_processing_sound_MethClaInterface_audioInSet(JNIEnv *env, jobject object, jfloat amp, jfloat add, jfloat pos, jintArray nodeId){
|
||||
jint* m_nodeId = env->GetIntArrayElements(nodeId, 0);
|
||||
|
||||
Methcla::Request request(engine());
|
||||
request.openBundle(Methcla::immediately);
|
||||
request.set(m_nodeId[0], 0 , amp);
|
||||
request.set(m_nodeId[0], 1 , add);
|
||||
request.set(m_nodeId[1], 0 , pos);
|
||||
request.closeBundle();
|
||||
request.send();
|
||||
|
||||
env->ReleaseIntArrayElements(nodeId, m_nodeId, 0);
|
||||
};
|
||||
|
||||
|
||||
|
||||
JNIEXPORT jintArray JNICALL Java_processing_sound_MethClaInterface_soundFileInfo(JNIEnv *env, jobject object, jstring path){
|
||||
const char *str = env->GetStringUTFChars(path, 0);
|
||||
|
||||
@@ -595,6 +661,64 @@ JNIEXPORT void JNICALL Java_processing_sound_MethClaInterface_whiteNoiseSet(JNIE
|
||||
env->ReleaseIntArrayElements(nodeId, m_nodeId, 0);
|
||||
};
|
||||
|
||||
JNIEXPORT jintArray JNICALL Java_processing_sound_MethClaInterface_pinkNoisePlay(JNIEnv *env, jobject object, jfloat amp, jfloat add, jfloat pos){
|
||||
jintArray nodeId = env->NewIntArray(2);
|
||||
jint *m_nodeId = env->GetIntArrayElements(nodeId, NULL);
|
||||
|
||||
Methcla::AudioBusId bus = m_engine->audioBusId().alloc();
|
||||
Methcla::Request request(engine());
|
||||
|
||||
request.openBundle(Methcla::immediately);
|
||||
|
||||
auto synth = request.synth(
|
||||
METHCLA_PLUGINS_PINK_NOISE_URI,
|
||||
engine().root(),
|
||||
{ amp, add },
|
||||
{}
|
||||
);
|
||||
|
||||
auto pan = request.synth(
|
||||
METHCLA_PLUGINS_PAN2_URI,
|
||||
engine().root(),
|
||||
{pos, 1.f},
|
||||
{Methcla::Value(1.f)}
|
||||
);
|
||||
|
||||
request.mapOutput(synth.id(), 0, bus);
|
||||
request.mapInput(pan.id(), 0, bus);
|
||||
request.mapOutput(pan.id(), 0, Methcla::AudioBusId(0), Methcla::kBusMappingExternal);
|
||||
request.mapOutput(pan.id(), 1, Methcla::AudioBusId(1), Methcla::kBusMappingExternal);
|
||||
|
||||
request.activate(synth.id());
|
||||
request.activate(pan.id());
|
||||
|
||||
request.closeBundle();
|
||||
request.send();
|
||||
|
||||
m_nodeId[0]=synth.id();
|
||||
m_nodeId[1]=pan.id();
|
||||
|
||||
env->ReleaseIntArrayElements(nodeId, m_nodeId, 0);
|
||||
|
||||
return nodeId;
|
||||
};
|
||||
|
||||
JNIEXPORT void JNICALL Java_processing_sound_MethClaInterface_pinkNoiseSet(JNIEnv *env, jobject object, jfloat amp, jfloat add, jfloat pos, jintArray nodeId){
|
||||
|
||||
jint* m_nodeId = env->GetIntArrayElements(nodeId, 0);
|
||||
|
||||
Methcla::Request request(engine());
|
||||
request.openBundle(Methcla::immediately);
|
||||
request.set(m_nodeId[0], 0, amp);
|
||||
request.set(m_nodeId[1], 0, pos);
|
||||
request.closeBundle();
|
||||
request.send();
|
||||
|
||||
env->ReleaseIntArrayElements(nodeId, m_nodeId, 0);
|
||||
};
|
||||
|
||||
|
||||
|
||||
JNIEXPORT jint 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);
|
||||
@@ -932,7 +1056,6 @@ JNIEXPORT void JNICALL Java_processing_sound_MethClaInterface_destroy_1fft(JNIEn
|
||||
free(fft_ptr);
|
||||
};
|
||||
|
||||
|
||||
/* OLD VARIABLE IN OUT FUNCTION
|
||||
JNIEXPORT jint JNICALL Java_processing_sound_MethClaInterface_out(JNIEnv *env, jobject object, jint in, jint out, jfloatArray pos){
|
||||
|
||||
|
||||
Reference in New Issue
Block a user