[orx-minim] Fix audio file loading, add demo (#280)
This commit is contained in:
BIN
demo-data/sounds/26777__junggle__btn402.mp3
Normal file
BIN
demo-data/sounds/26777__junggle__btn402.mp3
Normal file
Binary file not shown.
8
demo-data/sounds/26777__junggle__btn402.txt
Normal file
8
demo-data/sounds/26777__junggle__btn402.txt
Normal file
@@ -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/
|
||||||
24
orx-jvm/orx-minim/src/demo/kotlin/DemoPlaySound01.kt
Normal file
24
orx-jvm/orx-minim/src/demo/kotlin/DemoPlaySound01.kt
Normal file
@@ -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()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -3,10 +3,11 @@ package org.openrndr.extra.minim
|
|||||||
import ddf.minim.Minim
|
import ddf.minim.Minim
|
||||||
import org.openrndr.Program
|
import org.openrndr.Program
|
||||||
import java.io.File
|
import java.io.File
|
||||||
|
import java.io.InputStream
|
||||||
|
|
||||||
class MinimObject {
|
class MinimObject {
|
||||||
fun sketchPath(fileName:String) = "./"
|
fun sketchPath(fileName:String) = "./"
|
||||||
fun createInput(fileName: String) = File(fileName).inputStream()
|
fun createInput(fileName: String) = File(fileName).inputStream() as InputStream
|
||||||
}
|
}
|
||||||
|
|
||||||
fun Program.minim(): Minim {
|
fun Program.minim(): Minim {
|
||||||
|
|||||||
Reference in New Issue
Block a user