Compare commits

...

6 commits

8 changed files with 35 additions and 12 deletions

View file

@ -97,6 +97,15 @@ kotlin {
implementation("com.google.zxing:javase:3.5.4")
}
}
targets.all {
compilations.all {
compileTaskProvider.configure {
compilerOptions {
freeCompilerArgs.add("-Xexpect-actual-classes")
}
}
}
}
}
android {

View file

@ -9,6 +9,8 @@ actual class SaveSettings actual constructor() {
actual fun loadLastUsedDir(): String = settings.getString("last_dir", "/")
actual fun saveLastUsedDir(lastDir: String) { settings["last_dir"] = lastDir }
actual fun saveWindowBounds(width: Int, height: Int, x: Int, y: Int) {}
actual fun loadWindowBounds(): List<Int> = listOf(0, 0, 0, 0)
actual fun saveWindowState(state: WindowState) {}
actual fun loadWindowState(): WindowState {
return WindowState(0,0,0,0)
}
}

View file

@ -4,9 +4,7 @@ import com.russhwolf.settings.Settings
import com.russhwolf.settings.set
import androidx.compose.ui.unit.DpSize
import androidx.compose.ui.unit.dp
import androidx.compose.ui.window.WindowPlacement
import androidx.compose.ui.window.WindowState
import androidx.compose.ui.window.WindowPosition
expect class SaveSettings() {
val settings: Settings

View file

@ -41,7 +41,11 @@ class POneStanzaLyrics {
this.lyrics[stanzaNumber].split("\n").toMutableList()
} else
mutableListOf()
if (result.isNotEmpty() && alternativeList.isNotEmpty()) {
result.addAll(1, alternativeList) // overridedLyrics's index from 1 not 0
} else {
result.addAll(alternativeList)
}
return result
}
}

View file

@ -44,8 +44,8 @@ import androidx.compose.material.icons.filled.SettingsVoice
import androidx.compose.material.icons.filled.Star
import androidx.compose.material.icons.filled.Tonality
import androidx.compose.material.icons.filled.Tune
import androidx.compose.material.icons.filled.VolumeOff
import androidx.compose.material.icons.filled.VolumeUp
import androidx.compose.material.icons.automirrored.filled.VolumeUp
import androidx.compose.material.icons.automirrored.filled.VolumeOff
import androidx.compose.material3.Button
import androidx.compose.material3.ButtonDefaults
import androidx.compose.material3.ExperimentalMaterial3Api
@ -402,7 +402,7 @@ fun MidiControlPanel(
Column(horizontalAlignment = Alignment.CenterHorizontally) {
Icon(
imageVector = if (volume > 0) Icons.Filled.VolumeUp else Icons.Filled.VolumeOff,
imageVector = if (volume > 0) Icons.AutoMirrored.Filled.VolumeUp else Icons.AutoMirrored.Filled.VolumeOff,
contentDescription = null,
modifier = Modifier.size(20.dp)
)

View file

@ -15,7 +15,7 @@ import androidx.compose.foundation.lazy.rememberLazyListState
import androidx.compose.material.icons.Icons
import androidx.compose.material.icons.filled.Book
import androidx.compose.material.icons.filled.Menu
import androidx.compose.material.icons.filled.MenuBook
import androidx.compose.material.icons.automirrored.filled.MenuBook
import androidx.compose.material.icons.filled.MusicNote
import androidx.compose.material3.Button
import androidx.compose.material3.DrawerState
@ -103,7 +103,7 @@ val midi = "whawyd3.mid"
},
icon = {
val isIcon = when {
isFfpm -> Icons.Filled.MenuBook
isFfpm -> Icons.AutoMirrored.Filled.MenuBook
isEws -> Icons.Filled.MusicNote
isFF -> Icons.Filled.Book
else -> Icons.Filled.Menu

View file

@ -5,6 +5,7 @@ import androidx.compose.runtime.setValue
import cafe.adriel.voyager.core.model.ScreenModel
import kotlinx.coroutines.CoroutineScope
import kotlinx.coroutines.Dispatchers
import kotlinx.coroutines.ExperimentalCoroutinesApi
import kotlinx.coroutines.flow.MutableStateFlow
import kotlinx.coroutines.flow.SharingStarted
import kotlinx.coroutines.flow.StateFlow
@ -58,7 +59,7 @@ class SharedScreenModel() : ScreenModel {
private val _searchTitle = MutableStateFlow<String>("")
val searchTitle: StateFlow<String> = _searchTitle.asStateFlow()
@OptIn
@OptIn(ExperimentalCoroutinesApi::class)
val filteredSongs: StateFlow<List<DrawerItem>> = searchTitle
.mapLatest { currentTitle ->
val searchTxt = if (currentTitle == "") "" else currentTitle.trim()

View file

@ -1,6 +1,11 @@
package mg.dot.feufaro.midi
import kotlinx.coroutines.CoroutineScope
import kotlinx.coroutines.Dispatchers
import kotlinx.coroutines.GlobalScope
import kotlinx.coroutines.Job
import kotlinx.coroutines.SupervisorJob
import kotlinx.coroutines.cancel
import kotlinx.coroutines.delay
import kotlinx.coroutines.launch
import mg.dot.feufaro.FileRepository
@ -38,6 +43,8 @@ actual class MediaPlayer actual constructor(
private var currentGlobalVolume: Float = 0.8f
private var currentTempo: Float = 1.0f
private val playerScope = CoroutineScope(Dispatchers.Default + SupervisorJob())
private var abJob: Job? = null
init {
try {
@ -90,6 +97,7 @@ actual class MediaPlayer actual constructor(
fun release() {
sequencer?.close()
synthetizer?.close()
playerScope.cancel()
}
actual fun setVolume(level: Float) {
try {
@ -139,7 +147,8 @@ actual class MediaPlayer actual constructor(
pointB = -1L
}
private fun startABMonitor() {
GlobalScope.launch {
abJob?.cancel()
abJob = playerScope.launch {
while(isLoopingAB) {
val currentTick = sequencer?.tickPosition?: 0L
if (currentTick >= pointB) {