Skip to content

Commit 3f2bd02

Browse files
Merge pull request #53 from matejsemancik/feature/processing4
Processing 4
2 parents 7ff766a + 64d498a commit 3f2bd02

File tree

22 files changed

+174
-99
lines changed

22 files changed

+174
-99
lines changed

.run/PlaygroundApp.run.xml

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
<component name="ProjectRunConfigurationManager">
2+
<configuration default="false" name="PlaygroundApp" type="JetRunConfigurationType" nameIsGenerated="true">
3+
<option name="ALTERNATIVE_JRE_PATH" value="azul-11" />
4+
<option name="ALTERNATIVE_JRE_PATH_ENABLED" value="true" />
5+
<option name="MAIN_CLASS_NAME" value="dev.matsem.astral.playground.PlaygroundApp" />
6+
<module name="astral-visuals.playground.main" />
7+
<option name="PROGRAM_PARAMETERS" value="--sketch-path=$PROJECT_DIR$" />
8+
<shortenClasspath name="NONE" />
9+
<option name="VM_PARAMETERS" value="-Djava.library.path=/Applications/Processing.app/Contents/Java/core/library/macos-x86_64" />
10+
<method v="2">
11+
<option name="Make" enabled="true" />
12+
</method>
13+
</configuration>
14+
</component>

.run/VisualsApp.run.xml

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
<component name="ProjectRunConfigurationManager">
2+
<configuration default="false" name="VisualsApp" type="JetRunConfigurationType" nameIsGenerated="true">
3+
<option name="ALTERNATIVE_JRE_PATH" value="azul-11" />
4+
<option name="ALTERNATIVE_JRE_PATH_ENABLED" value="true" />
5+
<option name="MAIN_CLASS_NAME" value="dev.matsem.astral.visuals.VisualsApp" />
6+
<module name="astral-visuals.visuals.main" />
7+
<option name="PROGRAM_PARAMETERS" value="--sketch-path=$PROJECT_DIR$" />
8+
<shortenClasspath name="NONE" />
9+
<option name="VM_PARAMETERS" value="-Djava.library.path=/Applications/Processing.app/Contents/Java/core/library/macos-x86_64" />
10+
<method v="2">
11+
<option name="Make" enabled="true" />
12+
</method>
13+
</configuration>
14+
</component>

.sdkmanrc

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
# Enable auto-env through the sdkman_auto_env config
2+
# Add key=value pairs of SDKs to use below
3+
java=11.0.11-zulu

README.md

Lines changed: 33 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -13,56 +13,62 @@ The `:visuals` module is meant to be used in live environment at the parties. Th
1313

1414
## How to build
1515

16-
This project depends on local [Processing](https://processing.org) installation, so go ahead and install it if you haven't already. Then create a `local.properties` file in project's root directory and configure the core library and contributed libraries' paths:
16+
This project depends on local [Processing 4](https://processing.org) installation, so go ahead and install it if you haven't already. Then create a `local.properties` file in project's root directory and configure the core library and contributed libraries' paths:
1717

1818
```
19-
processingLibsDir=/path/to/your/processing/libraries/dir
20-
processingCoreDir=/path/to/core/processing/libraries
19+
processing.core.jars=/path/to/your/processing/libraries/dir
20+
processing.core.natives=/path/to/your/processing/libraries/dir/<os-architecture>
21+
processing.libs.jars=/path/to/core/processing/libraries
2122
```
2223

2324
On macOS it might look like this:
2425

2526
```
26-
processingLibsDir=/Users/username/Documents/Processing/libraries
27-
processingCoreDir=/Applications/Processing.app/Contents/Java/core/library
27+
processing.core.jars=/Applications/Processing.app/Contents/Java/core/library
28+
processing.core.natives=/Applications/Processing.app/Contents/Java/core/library/macos-x86_64
29+
processing.libs.jars=/Users/matsem/Documents/Processing/libraries
2830
```
2931

30-
The Gradle buildscript will look for Processing dependencies at these two paths. Dependencies are defined in CommonDependencies gradle plugin. Open it up, and you can notice that this project depends on some 3rd party libraries, which need to be installed at `processingLibsDir` path. Open your Processing library manager (Sketch > Import Library > Add library) and install whatever libraries are specified in the `build.gradle` file.
32+
The Gradle buildscript will look for Processing dependencies at these two paths. Dependencies are defined in CommonDependencies gradle plugin. Open it up, and you can notice that this project depends on some 3rd party libraries, which need to be installed at `processing.libs.jars` path. Open your Processing library manager (Sketch > Import Library > Add library) and install whatever libraries are specified in the `build.gradle` file.
3133

3234
Current list of library dependencies is
3335

34-
```
35-
Minim // audio processing
36-
The MidiBus // for remote control
37-
Video Export // I use this to export video teasers synced with external audio file
38-
Box2D for Processing // for physics (look for BoxesSketch)
39-
Video // video playback
40-
extruder // 2d shape -> 3d shape extrusion
41-
geomerative // for generating shapes from text
42-
PostFX for Processing // can apply post-processing shaders
43-
```
44-
45-
If you've set up everything correctly, you should be able to build the project using Gradle `build` task.
46-
47-
```
48-
./gradlew build
36+
```kotlin
37+
val processingLibs = listOf(
38+
"minim", // audio input everything (input source, fft analysis, etc.)
39+
"themidibus", // MIDI control protocol implementation
40+
"VideoExport", // I use this to export video teasers synced with external audio file
41+
"box2d_processing", // for physics (look for Gravity sketch in playground module)
42+
"video", // video playback
43+
"extruder", // 2d shape -> 3d shape extrusion
44+
"geomerative", // text -> shape, svg -> shape conversion
45+
"peasycam", // adds camera handling to the sketches, nice to have when prototyping
46+
"PostFX", // can apply post-processing shaders to video output
47+
"oscP5", // OSC control protocol implementation
48+
"blobDetection" // library to find "blobs" on image
49+
)
4950
```
5051

5152
## How to run
5253

53-
You can run the project with Gradle `run` task. Be sure to include the `--sketch-path` argument so sketches can properly resolve the data folder with resources.
54+
You can run the project with Gradle `run` task. Be sure to include the `--sketch-path` argument so sketches can properly resolve the data folder containing resources needed by some Sketches.
5455

5556
```
5657
./gradlew playground:run --args='--sketch-path=/path/to/project/'
5758
./gradlew visuals:run --args='--sketch-path=/path/to/project/'
5859
```
5960

61+
There are also IntelliJ Run configurations in `.run` folder which you can use to run the app from IDE. Just be sure to edit their configuration to match your setup.
62+
63+
Note: Due to the fragileness of Processing dependencies (namely JogAmp), the project currently works only with some JDK versions, specifically `11.0.11-zulu`. You can find `.sdkmanrc` file in project folder
64+
that sets up the current SDK for you if you use [SDKMAN!](https://sdkman.io/). (`11.0.12` does not work yet, causing [this](https://github.com/processing/processing4/issues/249) issue).
65+
6066
## Remote control
6167
Currently, the project supports 3 remote control options:
6268

6369
- If you own Traktor Kontrol F1, the `KontrolF1` class is for you - I use it for quick prototyping. It handles most of KontrolF1's hardware features, like pad buttons (with colors feature), encoder, knobs and faders.
6470
- If you'd like to try the `:visuals` module, go ahead and get yourself the [TouchOSC](https://hexler.net/products/touchosc) app and load it with `Astral.touchosc` layout that can be found in the `touchosc` folder. This layout uses MIDI and OSC protocol and there is a `Galaxy` class that handles most of TouchOSC MIDI controls. For future, I plan on to get rid of `Galaxy` and migrate everyhing to OSC protocol, which leads us to the last option
65-
- OSC - The most convinient way, though, is to use the [OSC](http://opensoundcontrol.org/introduction-osc) (Open Sound Control) with Delegated Properties
71+
- OSC - The most convenient way, though, is to use the [OSC](http://opensoundcontrol.org/introduction-osc) (Open Sound Control) with Delegated Properties
6672

6773
### Osc Delegated Properties
6874
First, make your sketch/class implement the `OscHandler` interface, which makes you provide the `OscManager` class.
@@ -87,4 +93,7 @@ Then, you can create all sorts of properties tied to various OSC controls, like
8793
private var fader1: Float by oscFaderDelegate("/1/fader1", defaultValue = 0.5f)
8894
```
8995

90-
Most of the delegated properties support writing, so, if for example you create the fader variable and at some point in time you assing the value into it, the corresponding control in TouchOSC app will reflect that change.
96+
Most of the delegated properties support value assign, so, if for example you create the fader variable and at some point in time you assign the value into it, the corresponding control in TouchOSC app will reflect that change.
97+
98+
## Known bugs after Processing4 migration
99+
- movie library does not work (issues with linking native libs)

build.gradle.kts

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
import org.jetbrains.kotlin.gradle.tasks.KotlinCompile
22

33
plugins {
4-
kotlin("jvm") version "1.4.31"
5-
kotlin("plugin.serialization") version "1.4.31"
4+
kotlin("jvm") version Versions.kotlin
5+
kotlin("plugin.serialization") version Versions.kotlin
66
}
77

88
group = ProjectSettings.group
@@ -19,15 +19,14 @@ dependencies {
1919

2020
tasks {
2121
compileKotlin {
22-
kotlinOptions.jvmTarget = "1.8"
22+
kotlinOptions.jvmTarget = "11"
2323
}
2424
compileTestKotlin {
25-
kotlinOptions.jvmTarget = "1.8"
25+
kotlinOptions.jvmTarget = "11"
2626
}
2727
}
2828

2929
val compileKotlin: KotlinCompile by tasks
3030
compileKotlin.kotlinOptions {
3131
freeCompilerArgs = listOf("-Xinline-classes")
32-
useIR = true
3332
}
Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,8 @@
11
object Dependencies {
2-
const val koin = "org.koin:koin-core:2.1.5"
3-
const val serializationCore = "org.jetbrains.kotlinx:kotlinx-serialization-core:1.0.0-RC"
4-
const val coroutines = "org.jetbrains.kotlinx:kotlinx-coroutines-core:1.3.4"
2+
const val koin = "org.koin:koin-core:${Versions.koin}"
3+
const val serializationJson = "org.jetbrains.kotlinx:kotlinx-serialization-json:${Versions.serializationJson}"
4+
const val coroutines = "org.jetbrains.kotlinx:kotlinx-coroutines-core:${Versions.coroutines}"
5+
56
val processingLibs = listOf(
67
"minim",
78
"themidibus",
@@ -13,7 +14,6 @@ object Dependencies {
1314
"peasycam",
1415
"PostFX",
1516
"oscP5",
16-
"ControlP5",
1717
"blobDetection"
1818
)
1919
}
Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
11
object ProjectSettings {
2-
val version = "2.0.0"
3-
val group = "dev.matsem"
2+
const val version = "2.1.0"
3+
const val group = "dev.matsem"
44
}
Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
object Versions {
2+
const val kotlin = "1.6.10"
3+
const val serializationJson = "1.3.2"
4+
const val coroutines = "1.6.0"
5+
const val koin = "2.1.5"
6+
}

buildSrc/src/main/kotlin/dev/matsem/astral/CommonDependencies.kt

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,10 +17,11 @@ internal fun Project.configureCommonDependencies() {
1717
val props = Properties().apply {
1818
load(file("${rootDir}/local.properties").inputStream())
1919
}
20-
val processingCoreDir = props["processingCoreDir"]
21-
val processingLibsDir = props["processingLibsDir"]
20+
val processingCoreDir = props["processing.core.jars"]
21+
val processingLibsDir = props["processing.libs.jars"]
2222

2323
dependencies {
24+
add("implementation", kotlin("bom"))
2425
add("implementation", kotlin("stdlib-jdk8"))
2526
add("implementation", Dependencies.koin)
2627
add("implementation", Dependencies.coroutines)

core/build.gradle.kts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -11,17 +11,17 @@ repositories {
1111
}
1212

1313
dependencies {
14-
implementation(Dependencies.serializationCore)
14+
implementation(Dependencies.serializationJson)
1515
}
1616

1717
group = ProjectSettings.group
1818
version = ProjectSettings.version
1919

2020
tasks {
2121
compileKotlin {
22-
kotlinOptions.jvmTarget = "1.8"
22+
kotlinOptions.jvmTarget = "11"
2323
}
2424
compileTestKotlin {
25-
kotlinOptions.jvmTarget = "1.8"
25+
kotlinOptions.jvmTarget = "11"
2626
}
2727
}

0 commit comments

Comments
 (0)