diff --git a/demo-data/sounds/26777__junggle__btn402.mp3 b/demo-data/sounds/26777__junggle__btn402.mp3 new file mode 100644 index 00000000..f18599a7 Binary files /dev/null and b/demo-data/sounds/26777__junggle__btn402.mp3 differ diff --git a/demo-data/sounds/26777__junggle__btn402.txt b/demo-data/sounds/26777__junggle__btn402.txt new file mode 100644 index 00000000..8f0505fc --- /dev/null +++ b/demo-data/sounds/26777__junggle__btn402.txt @@ -0,0 +1,8 @@ +Sound author +http://jazzy.junggle.net/ + +License +https://creativecommons.org/licenses/by/4.0/ + +Downloaded from +https://freesound.org/s/26777/ diff --git a/orx-jvm/orx-minim/src/demo/kotlin/DemoPlaySound01.kt b/orx-jvm/orx-minim/src/demo/kotlin/DemoPlaySound01.kt new file mode 100644 index 00000000..bb215d7a --- /dev/null +++ b/orx-jvm/orx-minim/src/demo/kotlin/DemoPlaySound01.kt @@ -0,0 +1,24 @@ +import org.openrndr.application +import org.openrndr.extra.minim.minim + +fun main() { + application { + program { + val minim = minim() + val player = minim.loadFile( + "demo-data/sounds/26777__junggle__btn402.mp3" + ) + + // fade gain to -40dB in 15 seconds + player.shiftGain(player.gain, -40f, 15000) + + extend { + if(frameCount % 30 == 0) { + player.rewind() + //player.gain = Random.nextDouble(-20.0, 0.0).toFloat() + player.play() + } + } + } + } +} \ No newline at end of file diff --git a/orx-jvm/orx-minim/src/main/kotlin/Minim.kt b/orx-jvm/orx-minim/src/main/kotlin/Minim.kt index 02f4354e..50dbc5a8 100644 --- a/orx-jvm/orx-minim/src/main/kotlin/Minim.kt +++ b/orx-jvm/orx-minim/src/main/kotlin/Minim.kt @@ -3,10 +3,11 @@ package org.openrndr.extra.minim import ddf.minim.Minim import org.openrndr.Program import java.io.File +import java.io.InputStream class MinimObject { fun sketchPath(fileName:String) = "./" - fun createInput(fileName: String) = File(fileName).inputStream() + fun createInput(fileName: String) = File(fileName).inputStream() as InputStream } fun Program.minim(): Minim {