Skip to content
This repository has been archived by the owner on Dec 21, 2022. It is now read-only.

Commit

Permalink
Merge pull request #6 from praxis-live/develop
Browse files Browse the repository at this point in the history
Merge develop to master for v3.3.0 release
  • Loading branch information
neilcsmith-net authored Oct 13, 2017
2 parents 2707209 + b776143 commit fbfa6b2
Show file tree
Hide file tree
Showing 60 changed files with 2,689 additions and 254 deletions.
2 changes: 1 addition & 1 deletion audio.servers.javasound/manifest.mf
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
Manifest-Version: 1.0
OpenIDE-Module: org.jaudiolibs.audioservers.javasound
OpenIDE-Module-Localizing-Bundle: org/jaudiolibs/audioservers/javasound/Bundle.properties
OpenIDE-Module-Specification-Version: 1.1.1
OpenIDE-Module-Specification-Version: 1.2.0
AutoUpdate-Essential-Module: true
AutoUpdate-Show-In-Client: false
4 changes: 2 additions & 2 deletions audio.servers.javasound/nbproject/genfiles.properties
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,6 @@ build.xml.script.CRC32=71d0f28d
build.xml.stylesheet.CRC32=[email protected]
# This file is used by a NetBeans-based IDE to track changes in generated files such as build-impl.xml.
# Do not edit this file. You may delete it but then the IDE will never regenerate such files for you.
nbproject/build-impl.xml.data.CRC32=f86e0190
nbproject/build-impl.xml.data.CRC32=7f193ec6
nbproject/build-impl.xml.script.CRC32=cd873414
nbproject/build-impl.xml.stylesheet.CRC32=238281d1@2.66.1
nbproject/build-impl.xml.stylesheet.CRC32=238281d1@2.72.1
2 changes: 1 addition & 1 deletion audio.servers.javasound/nbproject/project.properties
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
file.reference.audioservers-javasound-1.1.1.jar=release/modules/ext/audioservers-javasound-1.1.1.jar
file.reference.audioservers-javasound-1.2.0.jar=release/modules/ext/audioservers-javasound-1.2.0.jar
is.autoload=true
javac.source=1.8
javac.compilerargs=-Xlint -Xlint:-serial
4 changes: 2 additions & 2 deletions audio.servers.javasound/nbproject/project.xml
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,8 @@
<package>org.jaudiolibs.audioservers.javasound</package>
</public-packages>
<class-path-extension>
<runtime-relative-path>ext/audioservers-javasound-1.1.1.jar</runtime-relative-path>
<binary-origin>release/modules/ext/audioservers-javasound-1.1.1.jar</binary-origin>
<runtime-relative-path>ext/audioservers-javasound-1.2.0.jar</runtime-relative-path>
<binary-origin>release/modules/ext/audioservers-javasound-1.2.0.jar</binary-origin>
</class-path-extension>
</data>
</configuration>
Expand Down
Binary file not shown.
Binary file not shown.
149 changes: 149 additions & 0 deletions praxis.code/src/net/neilcsmith/praxis/code/ArrayBinding.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,149 @@
/*
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
*
* Copyright 2017 Neil C Smith.
*
* This code is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License version 3 only, as
* published by the Free Software Foundation.
*
* This code is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
* version 3 for more details.
*
* You should have received a copy of the GNU General Public License version 3
* along with this work; if not, see http://www.gnu.org/licenses/
*
*
* Please visit http://neilcsmith.net if you need additional information or
* have any questions.
*
*/
package net.neilcsmith.praxis.code;

import java.lang.reflect.Field;
//import net.neilcsmith.praxis.code.userapi.Cycle;
import net.neilcsmith.praxis.core.info.ArgumentInfo;
import net.neilcsmith.praxis.core.types.PArray;
import net.neilcsmith.praxis.core.types.PMap;
import net.neilcsmith.praxis.core.types.PNumber;
import net.neilcsmith.praxis.core.types.Value;

/**
*
* @author Neil C Smith (http://neilcsmith.net)
*/
abstract class ArrayBinding extends PropertyControl.Binding {

@Override
public void set(long time, Value value) throws Exception {
set(PArray.coerce(value));
}

@Override
public void set(long time, double value) throws Exception {
set(PArray.valueOf(PNumber.valueOf(value)));
}

abstract void set(PArray value) throws Exception;

@Override
public ArgumentInfo getArgumentInfo() {
return ArgumentInfo.create(PArray.class, PMap.EMPTY);
}

@Override
public Value getDefaultValue() {
return PArray.EMPTY;
}

static boolean isBindableFieldType(Class<?> type) {
return type == PArray.class;// || type == Cycle.class;
}

static ArrayBinding create(CodeConnector<?> connector, Field field) {
// if (field.getType() == Cycle.class) {
// return new CycleField(field);
// } else
if (field.getType() == PArray.class) {
return new PArrayField(field);
} else {
return null;
}

}

// private static class CycleField extends ArrayBinding {
//
// private final Field field;
// private CodeDelegate delegate;
// private Cycle cycle;
//
// private CycleField(Field field) {
// this.field = field;
// }
//
// @Override
// protected void attach(CodeContext<?> context, PropertyControl.Binding previous) {
// this.delegate = context.getDelegate();
// if (previous instanceof CycleField) {
// cycle = ((CycleField) previous).cycle;
// } else {
// cycle = new Cycle(){};
// }
// try {
// field.set(delegate, cycle);
// } catch (Exception ex) {
// context.getLog().log(LogLevel.ERROR, ex);
// }
// }
//
// @Override
// void set(PArray value) throws Exception {
// cycle.values(value);
// }
//
// @Override
// public Value get() {
// return cycle.values();
// }
//
// }

private static class PArrayField extends ArrayBinding {

private final Field field;
private CodeDelegate delegate;

private PArrayField(Field field) {
this.field = field;
}

@Override
protected void attach(CodeContext<?> context) {
this.delegate = context.getDelegate();
try {
set(PArray.EMPTY);
} catch (Exception ex) {
// ignore
}
}

@Override
void set(PArray value) throws Exception {
field.set(delegate, value);
}

@Override
public Value get() {
try {
return (PArray) field.get(delegate);
} catch (Exception ex) {
return PArray.EMPTY;
}
}

}

}
10 changes: 5 additions & 5 deletions praxis.code/src/net/neilcsmith/praxis/code/BooleanBinding.java
Original file line number Diff line number Diff line change
Expand Up @@ -24,9 +24,9 @@

import java.lang.reflect.Field;
import net.neilcsmith.praxis.code.userapi.Type;
import net.neilcsmith.praxis.core.Argument;
import net.neilcsmith.praxis.core.info.ArgumentInfo;
import net.neilcsmith.praxis.core.types.PBoolean;
import net.neilcsmith.praxis.core.types.Value;

/**
*
Expand All @@ -41,7 +41,7 @@ private BooleanBinding(PBoolean def) {
}

@Override
public void set(long time, Argument value) throws Exception {
public void set(long time, Value value) throws Exception {
set(PBoolean.coerce(value));
}

Expand All @@ -58,7 +58,7 @@ public ArgumentInfo getArgumentInfo() {
}

@Override
public Argument getDefaultValue() {
public Value getDefaultValue() {
return def;
}

Expand Down Expand Up @@ -94,7 +94,7 @@ void set(PBoolean value) throws Exception {
}

@Override
public Argument get() {
public Value get() {
return value;
}

Expand Down Expand Up @@ -126,7 +126,7 @@ void set(PBoolean value) throws Exception {
}

@Override
public Argument get() {
public Value get() {
try {
return PBoolean.valueOf(field.getBoolean(delegate));
} catch (Exception ex) {
Expand Down
51 changes: 43 additions & 8 deletions praxis.code/src/net/neilcsmith/praxis/code/BytesBinding.java
Original file line number Diff line number Diff line change
Expand Up @@ -31,10 +31,10 @@
import java.util.ArrayList;
import java.util.List;
import java.util.Optional;
import net.neilcsmith.praxis.core.Argument;
import net.neilcsmith.praxis.core.info.ArgumentInfo;
import net.neilcsmith.praxis.core.types.PBytes;
import net.neilcsmith.praxis.core.types.PMap;
import net.neilcsmith.praxis.core.types.Value;
import net.neilcsmith.praxis.logging.LogLevel;

/**
Expand All @@ -44,7 +44,7 @@
abstract class BytesBinding extends PropertyControl.Binding {

@Override
public void set(long time, Argument value) throws Exception {
public void set(long time, Value value) throws Exception {
Optional<PBytes> bytes = PBytes.from(value);
if (bytes.isPresent()) {
set(bytes.get());
Expand All @@ -66,17 +66,18 @@ public ArgumentInfo getArgumentInfo() {
}

@Override
public Argument getDefaultValue() {
public Value getDefaultValue() {
return PBytes.EMPTY;
}

static boolean isBindableFieldType(Class<?> type) {
return type == List.class || Serializable.class.isAssignableFrom(type);
return type == PBytes.class || type == List.class || Serializable.class.isAssignableFrom(type);
}

static BytesBinding create(CodeConnector<?> connector, Field field) {

if (isSerializableList(field.getGenericType())) {
if (field.getType() == PBytes.class) {
return new PBytesField(field);
}else if (isSerializableList(field.getGenericType())) {
return new ListField(field);
} else if (isSerializableType(field.getGenericType())) {
return new SerializableField(field);
Expand Down Expand Up @@ -117,6 +118,40 @@ private static boolean isSerializableList(java.lang.reflect.Type type) {
return false;
}

private static class PBytesField extends BytesBinding {

private final Field field;
private CodeDelegate delegate;

private PBytesField(Field field) {
this.field = field;
}

@Override
protected void attach(CodeContext<?> context) {
this.delegate = context.getDelegate();
try {
set(PBytes.EMPTY);
} catch (Exception ex) {
// ignore
}
}

@Override
void set(PBytes value) throws Exception {
field.set(delegate, value);
}

@Override
public Value get() {
try {
return (PBytes) field.get(delegate);
} catch (Exception ex) {
return PBytes.EMPTY;
}
}

}

private static class SerializableField extends BytesBinding {

Expand Down Expand Up @@ -151,7 +186,7 @@ void set(PBytes value) throws Exception {
}

@Override
public Argument get() {
public Value get() {
try {
PBytes.OutputStream bos = new PBytes.OutputStream();
ObjectOutputStream oos = new ObjectOutputStream(bos);
Expand Down Expand Up @@ -196,7 +231,7 @@ void set(PBytes value) throws Exception {
}

@Override
public Argument get() {
public Value get() {
try {
List<?> list = (List<?>) field.get(delegate);
if (list.isEmpty()) {
Expand Down
28 changes: 28 additions & 0 deletions praxis.code/src/net/neilcsmith/praxis/code/CodeConnector.java
Original file line number Diff line number Diff line change
Expand Up @@ -237,6 +237,14 @@ protected void analyseField(Field field) {
if (trig != null && analyseTriggerField(trig, field)) {
return;
}
In in = field.getAnnotation(In.class);
if (in != null && analyseInputField(in, field)) {
return;
}
AuxIn auxIn = field.getAnnotation(AuxIn.class);
if (auxIn != null && analyseAuxInputField(auxIn, field)) {
return;
}
Out out = field.getAnnotation(Out.class);
if (out != null && analyseOutputField(out, field)) {
return;
Expand Down Expand Up @@ -265,6 +273,26 @@ protected void analyseMethod(Method method) {
return;
}
}

private boolean analyseInputField(In ann, Field field) {
InputImpl.Descriptor odsc = InputImpl.createDescriptor(this, ann, field);
if (odsc != null) {
addPort(odsc);
return true;
} else {
return false;
}
}

private boolean analyseAuxInputField(AuxIn ann, Field field) {
InputImpl.Descriptor odsc = InputImpl.createDescriptor(this, ann, field);
if (odsc != null) {
addPort(odsc);
return true;
} else {
return false;
}
}

private boolean analyseOutputField(Out ann, Field field) {
OutputImpl.Descriptor odsc = OutputImpl.createDescriptor(this, ann, field);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@
*/
public abstract class ControlDescriptor {

public static enum Category {Internal, Synthetic, Property, Action}
public static enum Category {Internal, Synthetic, Action, Property}

private final String id;
private final Category category;
Expand Down
Loading

0 comments on commit fbfa6b2

Please sign in to comment.