[orx-minim] Fix audio file loading, add demo (#280)
This commit is contained in:
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 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 {
|
||||
|
||||
Reference in New Issue
Block a user