Upgrade project to Java 17 and Gradle 8
This commit is contained in:
@@ -11,21 +11,21 @@ subprojects {
|
||||
group 'com.bartlomiejpluta'
|
||||
version '1.0-SNAPSHOT'
|
||||
|
||||
sourceCompatibility = 1.8
|
||||
sourceCompatibility = 17
|
||||
|
||||
compileKotlin {
|
||||
kotlinOptions.jvmTarget = "1.8"
|
||||
kotlinOptions.jvmTarget = "17"
|
||||
}
|
||||
compileTestKotlin {
|
||||
kotlinOptions.jvmTarget = "1.8"
|
||||
kotlinOptions.jvmTarget = "17"
|
||||
}
|
||||
|
||||
dependencies {
|
||||
// compileOnly important!!! We do not want to put the api into the zip file since the main program has it already!
|
||||
compileOnly project(':api')
|
||||
compile "org.jetbrains.kotlin:kotlin-stdlib-jdk8"
|
||||
implementation project(':api')
|
||||
implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk8"
|
||||
kapt(group: 'org.pf4j', name: 'pf4j', version: "3.2.0")
|
||||
compileOnly(group: 'org.pf4j', name: 'pf4j', version: "3.2.0") {
|
||||
implementation(group: 'org.pf4j', name: 'pf4j', version: "3.2.0") {
|
||||
exclude group: "org.slf4j"
|
||||
}
|
||||
}
|
||||
@@ -46,7 +46,7 @@ subprojects {
|
||||
with jar
|
||||
}
|
||||
into('lib') {
|
||||
from configurations.compile
|
||||
from configurations.implementation
|
||||
}
|
||||
archiveExtension = 'zip'
|
||||
}
|
||||
|
||||
@@ -3,7 +3,7 @@ configurations {
|
||||
}
|
||||
|
||||
dependencies {
|
||||
fatjar group: 'org.knowm.xchart', name: 'xchart', version: '3.6.2'
|
||||
implementation group: 'org.knowm.xchart', name: 'xchart', version: '3.6.2'
|
||||
}
|
||||
|
||||
jar {
|
||||
|
||||
@@ -10,7 +10,7 @@ abstract class Envelope {
|
||||
(byte * eval(
|
||||
index.toDouble(),
|
||||
wave.bytes.size
|
||||
)).toByte()
|
||||
)).toInt().toByte()
|
||||
}.toByteArray())
|
||||
}
|
||||
|
||||
|
||||
@@ -14,7 +14,7 @@ class Wave(val bytes: ByteArray) {
|
||||
}
|
||||
|
||||
operator fun times(value: Double): Wave {
|
||||
return Wave(bytes.map { (it * value).toByte() }.toByteArray())
|
||||
return Wave(bytes.map { (it * value).toInt().toByte() }.toByteArray())
|
||||
}
|
||||
|
||||
fun extend(bytes: ByteArray): Wave {
|
||||
@@ -35,7 +35,7 @@ class Wave(val bytes: ByteArray) {
|
||||
|
||||
val maxValue = Byte.MAX_VALUE.toDouble() / (signal.max() ?: 1.0)
|
||||
|
||||
return Wave(signal.map { (it * maxValue).toByte() }.toByteArray())
|
||||
return Wave(signal.map { (it * maxValue).toInt().toByte() }.toByteArray())
|
||||
}
|
||||
|
||||
fun sine(frequency: Double, duration: Double, samplingRate: Double): Wave {
|
||||
@@ -43,7 +43,7 @@ class Wave(val bytes: ByteArray) {
|
||||
val buffer = ByteArray(length)
|
||||
|
||||
buffer.forEachIndexed { i, _ ->
|
||||
buffer[i] = (Byte.MAX_VALUE * sin(i / samplingRate * 2.0 * Math.PI * frequency)).toByte()
|
||||
buffer[i] = (Byte.MAX_VALUE * sin(i / samplingRate * 2.0 * Math.PI * frequency)).toInt().toByte()
|
||||
}
|
||||
|
||||
return Wave(buffer)
|
||||
|
||||
Reference in New Issue
Block a user