Refactor/unify modules files structure
This commit is contained in:
@@ -1,7 +1,8 @@
|
||||
package io.smnp.ext
|
||||
package io.smnp.ext.mic
|
||||
|
||||
import io.smnp.ext.function.MicLevelFunction
|
||||
import io.smnp.ext.function.WaitFunction
|
||||
import io.smnp.ext.provider.NativeModuleProvider
|
||||
import io.smnp.ext.mic.function.MicLevelFunction
|
||||
import io.smnp.ext.mic.function.WaitFunction
|
||||
import org.pf4j.Extension
|
||||
|
||||
@Extension
|
||||
@@ -1,9 +1,9 @@
|
||||
package io.smnp.ext.function
|
||||
package io.smnp.ext.mic.function
|
||||
|
||||
import io.smnp.callable.function.Function
|
||||
import io.smnp.callable.function.FunctionDefinitionTool
|
||||
import io.smnp.callable.signature.Signature.Companion.simple
|
||||
import io.smnp.ext.mic.TestMicrophoneLevelLoop
|
||||
import io.smnp.ext.mic.lib.loop.TestMicrophoneLevelLoop
|
||||
import io.smnp.type.model.Value
|
||||
|
||||
class MicLevelFunction : Function("micLevel") {
|
||||
@@ -1,9 +1,9 @@
|
||||
package io.smnp.ext.function
|
||||
package io.smnp.ext.mic.function
|
||||
|
||||
import io.smnp.callable.function.Function
|
||||
import io.smnp.callable.function.FunctionDefinitionTool
|
||||
import io.smnp.callable.signature.Signature.Companion.simple
|
||||
import io.smnp.ext.mic.SoundListenerLoop
|
||||
import io.smnp.ext.mic.lib.loop.SoundListenerLoop
|
||||
import io.smnp.type.enumeration.DataType.INT
|
||||
import io.smnp.type.matcher.Matcher.Companion.ofType
|
||||
import io.smnp.type.model.Value
|
||||
@@ -11,7 +11,10 @@ import io.smnp.type.model.Value
|
||||
class WaitFunction : Function("wait") {
|
||||
override fun define(new: FunctionDefinitionTool) {
|
||||
new function simple(ofType(INT), ofType(INT)) body { _, (inThreshold, outThreshold) ->
|
||||
val loop = SoundListenerLoop(inThreshold.value as Int, outThreshold.value as Int)
|
||||
val loop = SoundListenerLoop(
|
||||
inThreshold.value as Int,
|
||||
outThreshold.value as Int
|
||||
)
|
||||
loop.run()
|
||||
Value.void()
|
||||
}
|
||||
@@ -1,4 +1,4 @@
|
||||
package io.smnp.ext.mic
|
||||
package io.smnp.ext.mic.lib.loop
|
||||
|
||||
import io.smnp.error.CustomException
|
||||
import javax.sound.sampled.AudioFormat
|
||||
@@ -1,4 +1,4 @@
|
||||
package io.smnp.ext.mic
|
||||
package io.smnp.ext.mic.lib.loop
|
||||
|
||||
class SoundListenerLoop(private val inThreshold: Int, private val outThreshold: Int) : MicrophoneLevelLoop() {
|
||||
private var noiseReached = false
|
||||
@@ -1,4 +1,4 @@
|
||||
package io.smnp.ext.mic
|
||||
package io.smnp.ext.mic.lib.loop
|
||||
|
||||
import kotlin.math.min
|
||||
|
||||
Reference in New Issue
Block a user