put midi file to the app folder
This commit is contained in:
parent
5611222ffc
commit
dbaf7bdda6
2 changed files with 10 additions and 4 deletions
|
|
@ -36,6 +36,7 @@ import androidx.compose.ui.platform.*
|
|||
import kotlinx.coroutines.*
|
||||
import mg.dot.feufaro.data.DrawerItem
|
||||
import mg.dot.feufaro.data.getDrawerItems
|
||||
import mg.dot.feufaro.getConfigDirectoryPath
|
||||
import mg.dot.feufaro.getPlatform
|
||||
import mg.dot.feufaro.midi.MediaPlayer
|
||||
import mg.dot.feufaro.solfa.Solfa
|
||||
|
|
@ -78,7 +79,7 @@ val isPos by sharedScreenModel.isPos.collectAsState()
|
|||
var isDragging = sharedScreenModel.isDragging
|
||||
val currentPos by sharedScreenModel.currentPos.collectAsState()
|
||||
val duration by sharedScreenModel.duration.collectAsState()
|
||||
var midiFile = "whawyd3.mid"
|
||||
val midiFile = "whawyd3.mid"
|
||||
var refreshTrigeer by remember { mutableStateOf(0)}
|
||||
|
||||
val volumelevel by sharedScreenModel.volumeLevel.collectAsState()
|
||||
|
|
@ -99,7 +100,7 @@ LaunchedEffect(isPlay, isPos) {
|
|||
}
|
||||
}
|
||||
LaunchedEffect(Unit) {
|
||||
sharedScreenModel.loadNewSong("whawyd3.mid")
|
||||
sharedScreenModel.loadNewSong("${getConfigDirectoryPath()}$midiFile")
|
||||
}
|
||||
ModalNavigationDrawer(drawerState = drawerState, drawerContent = {
|
||||
SimpleDrawerContent(
|
||||
|
|
@ -114,7 +115,7 @@ LaunchedEffect(isPlay, isPos) {
|
|||
onScannerButtonClick()
|
||||
},
|
||||
onSongSelected = { newSong ->
|
||||
sharedScreenModel.loadNewSong("whawyd3.mid")
|
||||
sharedScreenModel.loadNewSong("${getConfigDirectoryPath()}$midiFile")
|
||||
}
|
||||
)
|
||||
}, content = {
|
||||
|
|
@ -223,7 +224,7 @@ LaunchedEffect(isPlay, isPos) {
|
|||
onClick = {
|
||||
isExpanded = !isExpanded
|
||||
refreshTrigeer++
|
||||
sharedScreenModel.loadNewSong("whawyd3.mid")
|
||||
sharedScreenModel.loadNewSong("${getConfigDirectoryPath()}$midiFile")
|
||||
}, modifier = Modifier.alpha(0.45f)
|
||||
) {
|
||||
Icon(
|
||||
|
|
|
|||
|
|
@ -9,6 +9,7 @@ import kotlinx.coroutines.cancel
|
|||
import kotlinx.coroutines.delay
|
||||
import kotlinx.coroutines.launch
|
||||
import mg.dot.feufaro.FileRepository
|
||||
import mg.dot.feufaro.getConfigDirectoryPath
|
||||
import java.io.ByteArrayInputStream
|
||||
import java.io.File
|
||||
import java.util.prefs.Preferences
|
||||
|
|
@ -67,6 +68,10 @@ actual class MediaPlayer actual constructor(
|
|||
onFinished()
|
||||
}
|
||||
}
|
||||
} else {
|
||||
// Créeons une fichier vide au 1er lancement de l'application, après MidiWriterKotlin l'écrasera
|
||||
val f0file = File("${getConfigDirectoryPath()}whawyd3.mid")
|
||||
f0file.createNewFile()
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue