Compare commits
No commits in common. "7c1f920ae879b587474f4563230a899c3328541d" and "2f0be71dd83097a859e7e669925f943d2b816a22" have entirely different histories.
7c1f920ae8
...
2f0be71dd8
5 changed files with 113 additions and 218 deletions
|
|
@ -2,19 +2,8 @@ package mg.dot.feufaro
|
||||||
|
|
||||||
import android.content.Context
|
import android.content.Context
|
||||||
import org.koin.core.context.GlobalContext
|
import org.koin.core.context.GlobalContext
|
||||||
import java.io.File
|
|
||||||
|
|
||||||
actual fun getConfigDirectoryPath(): String {
|
actual fun getConfigDirectoryPath(): String {
|
||||||
val baseDir = GlobalContext.get().get<Context>().filesDir
|
val context = GlobalContext.get().get<Context>()
|
||||||
val feufa2Folder = File(baseDir, "Feufaro")
|
return context.filesDir.absolutePath
|
||||||
|
|
||||||
if (!feufa2Folder.exists()) {
|
|
||||||
val created = feufa2Folder.mkdirs()
|
|
||||||
if (created) {
|
|
||||||
println("CP:15: Dossier créé avec succès : ${feufa2Folder.absolutePath}")
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
val path = feufa2Folder.absolutePath
|
|
||||||
return if (path.endsWith(File.separator)) path else path + File.separator
|
|
||||||
}
|
}
|
||||||
|
|
@ -1,142 +1,129 @@
|
||||||
package mg.dot.feufaro.midi
|
package mg.dot.feufaro.midi
|
||||||
|
|
||||||
|
import java.io.File
|
||||||
import android.media.MediaPlayer
|
import android.media.MediaPlayer
|
||||||
import kotlinx.coroutines.CoroutineScope
|
import kotlinx.coroutines.GlobalScope
|
||||||
import kotlinx.coroutines.Dispatchers
|
|
||||||
import kotlinx.coroutines.Job
|
|
||||||
import kotlinx.coroutines.SupervisorJob
|
|
||||||
import kotlinx.coroutines.cancel
|
|
||||||
import kotlinx.coroutines.delay
|
import kotlinx.coroutines.delay
|
||||||
import kotlinx.coroutines.launch
|
import kotlinx.coroutines.launch
|
||||||
import java.io.File
|
|
||||||
import java.io.FileInputStream
|
|
||||||
|
|
||||||
private var androidMediaPlayer: MediaPlayer?= null
|
private var androidMediaPlayer: MediaPlayer?= null
|
||||||
|
|
||||||
actual class MediaPlayer actual constructor(filename: String, onFinished: () -> Unit) {
|
actual class MediaPlayer actual constructor(filename: String, onFinished: () -> Unit) {
|
||||||
private var mediaPlayer: MediaPlayer? = MediaPlayer()
|
private val player = androidMediaPlayer?.apply {
|
||||||
|
setDataSource(filename)
|
||||||
|
prepare()
|
||||||
|
setOnCompletionListener {
|
||||||
|
seekTo(0)
|
||||||
|
onFinished()
|
||||||
|
}
|
||||||
|
// val file = File(android.app.Instrumentation().context.filesDir, filename)
|
||||||
|
// if(file.exists()){
|
||||||
|
// androidMediaPlayer?.setDataSource(file.path)
|
||||||
|
// androidMediaPlayer?.prepare()
|
||||||
|
// androidMediaPlayer?.setOnCompletionListener {
|
||||||
|
// onFinished()
|
||||||
|
// }
|
||||||
|
// } else {
|
||||||
|
// println("Fichier midi non trouvée")
|
||||||
|
// }
|
||||||
|
}
|
||||||
private val voiceStates = mutableListOf(true, true, true, true)
|
private val voiceStates = mutableListOf(true, true, true, true)
|
||||||
// private var currentGlobalVolume: Float = 0.8f
|
private var currentGlobalVolume: Float = 0.8f
|
||||||
|
|
||||||
private var pointA: Long = -1L
|
private var pointA: Long = -1L
|
||||||
private var pointB: Long = -1L
|
private var pointB: Long = -1L
|
||||||
|
|
||||||
private val playerScope = CoroutineScope(Dispatchers.Default + SupervisorJob())
|
|
||||||
private var abJob: Job? = null
|
|
||||||
|
|
||||||
private var isLoopingAB: Boolean = false
|
private var isLoopingAB: Boolean = false
|
||||||
|
|
||||||
init {
|
|
||||||
try {
|
|
||||||
val file = File(filename)
|
|
||||||
if (file.exists()) {
|
|
||||||
val fis = FileInputStream(file)
|
|
||||||
mediaPlayer?.setDataSource(fis.fd)
|
|
||||||
mediaPlayer?.prepare()
|
|
||||||
if (android.os.Build.VERSION.SDK_INT >= android.os.Build.VERSION_CODES.M) {
|
|
||||||
val params = mediaPlayer?.playbackParams ?: android.media.PlaybackParams()
|
|
||||||
params.speed = 1.0f
|
|
||||||
mediaPlayer?.playbackParams = params
|
|
||||||
}
|
|
||||||
fis.close()
|
|
||||||
|
|
||||||
mediaPlayer?.setOnCompletionListener {
|
|
||||||
onFinished()
|
|
||||||
}
|
|
||||||
}
|
|
||||||
} catch (e: Exception) {
|
|
||||||
e.printStackTrace()
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
actual fun play() {
|
actual fun play() {
|
||||||
mediaPlayer?.start()
|
// player?.start()
|
||||||
}
|
}
|
||||||
actual fun pause() {
|
actual fun pause() {
|
||||||
mediaPlayer?.pause()
|
// player?.pause()
|
||||||
}
|
}
|
||||||
actual fun stop() {
|
actual fun stop() {
|
||||||
mediaPlayer?.stop()
|
// player?.stop()
|
||||||
mediaPlayer?.prepare()
|
|
||||||
mediaPlayer?.seekTo(0)
|
|
||||||
clearLoop()
|
|
||||||
}
|
}
|
||||||
|
|
||||||
actual fun getDuration(): Long {
|
actual fun getDuration(): Long {
|
||||||
return mediaPlayer?.duration?.toLong() ?: 0L
|
// player!!.duration.toLong() ?: 0L
|
||||||
|
return 4.toLong()
|
||||||
}
|
}
|
||||||
|
|
||||||
actual fun getCurrentPosition(): Long {
|
actual fun getCurrentPosition(): Long {
|
||||||
return mediaPlayer?.currentPosition?.toLong() ?: 0L
|
// player!!.currentPosition.toLong()
|
||||||
|
return 4.toLong()
|
||||||
}
|
}
|
||||||
|
|
||||||
actual fun seekTo(position: Long) {
|
actual fun seekTo(position: Long) {
|
||||||
mediaPlayer?.seekTo(position.toInt())
|
// player!!.seekTo(position.toInt())
|
||||||
}
|
}
|
||||||
|
|
||||||
actual fun setVolume(level: Float){
|
actual fun setVolume(level: Float){
|
||||||
mediaPlayer?.setVolume(level, level)
|
// currentGlobalVolume =level
|
||||||
|
// player?.setVolume(level, level)
|
||||||
}
|
}
|
||||||
|
|
||||||
actual fun setPointA() {
|
actual fun getLoopState() = Triple(pointA, pointB, isLoopingAB)
|
||||||
pointA = mediaPlayer?.currentPosition?.toLong() ?: 0L
|
|
||||||
|
actual fun toggleVoice(index: Int): Unit{
|
||||||
|
voiceStates[index] = !voiceStates[index]
|
||||||
}
|
}
|
||||||
|
|
||||||
actual fun setPointB() {
|
actual fun getVoiceStates(): List<Boolean> = voiceStates
|
||||||
pointB = mediaPlayer?.currentPosition?.toLong() ?: 0L
|
|
||||||
if (pointB > pointA && pointA != -1L) {
|
actual fun changeInstru(noInstru: Int): Unit{
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
actual fun setPointA(): Unit{
|
||||||
|
// pointA = getCurrentPosition()
|
||||||
|
}
|
||||||
|
|
||||||
|
actual fun setPointB(): Unit{
|
||||||
|
pointB = getCurrentPosition()
|
||||||
|
if(pointB > pointA) {
|
||||||
isLoopingAB = true
|
isLoopingAB = true
|
||||||
startABMonitor()
|
startABMonitor()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
actual fun clearLoop() {
|
actual fun clearLoop(): Unit{
|
||||||
isLoopingAB = false
|
isLoopingAB = false
|
||||||
pointA = -1L
|
|
||||||
pointB = -1L
|
|
||||||
abJob?.cancel()
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private fun startABMonitor(){
|
private fun startABMonitor(){
|
||||||
abJob?.cancel()
|
GlobalScope.launch {
|
||||||
abJob = playerScope.launch {
|
|
||||||
while(isLoopingAB){
|
while(isLoopingAB){
|
||||||
val currentPos = mediaPlayer?.currentPosition?.toLong() ?: 0L
|
// if ((player?.currentPosition ?: 0) >= pointB){
|
||||||
if (currentPos >= pointB) {
|
// player?.seekTo(pointA?.toInt())
|
||||||
mediaPlayer?.seekTo(pointA.toInt())
|
// }
|
||||||
}
|
|
||||||
delay(50)
|
delay(50)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
actual fun getLoopState() = Triple(pointA, pointB, isLoopingAB)
|
|
||||||
actual fun toggleVoice(index: Int) {
|
|
||||||
voiceStates[index] = !voiceStates[index]
|
|
||||||
println("Toggle voice $index (Limitation: Nécessite SoundFont/Fluidsynth sur Android)")
|
|
||||||
}
|
|
||||||
|
|
||||||
actual fun getVoiceStates(): List<Boolean> = voiceStates
|
|
||||||
|
|
||||||
actual fun changeInstru(noInstru: Int) {
|
|
||||||
}
|
|
||||||
|
|
||||||
actual fun setTempo(factor: Float){
|
actual fun setTempo(factor: Float){
|
||||||
if (android.os.Build.VERSION.SDK_INT >= android.os.Build.VERSION_CODES.M) {
|
|
||||||
mediaPlayer?.let {
|
|
||||||
val params = it.playbackParams
|
|
||||||
params.speed = factor
|
|
||||||
it.playbackParams = params
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
actual fun getCurrentBPM(): Float {
|
actual fun getCurrentBPM(): Float {
|
||||||
return 120f
|
return 120f
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
/*
|
||||||
|
actual fun MidiPlayer(filename: String, onFinished: () -> Unit) {
|
||||||
|
StopMidi()
|
||||||
|
val file = File(android.app.Instrumentation().context.filesDir, filename)
|
||||||
|
if(file.exists()){
|
||||||
|
androidMediaPlayer?.setDataSource(file.path)
|
||||||
|
androidMediaPlayer?.prepare()
|
||||||
|
androidMediaPlayer?.setOnCompletionListener {
|
||||||
|
onFinished()
|
||||||
|
}
|
||||||
|
androidMediaPlayer?.start()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
fun release() {
|
actual fun StopMidi() {
|
||||||
mediaPlayer?.release()
|
androidMediaPlayer?.let {
|
||||||
mediaPlayer = null
|
if (it.isPlaying) {
|
||||||
playerScope.coroutineContext.cancel()
|
it.stop()
|
||||||
|
it.release()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
androidMediaPlayer = null
|
||||||
|
}*/
|
||||||
|
|
|
||||||
|
|
@ -34,7 +34,6 @@ import androidx.compose.ui.Modifier
|
||||||
import androidx.compose.ui.geometry.Offset
|
import androidx.compose.ui.geometry.Offset
|
||||||
import androidx.compose.ui.graphics.Color
|
import androidx.compose.ui.graphics.Color
|
||||||
import androidx.compose.ui.input.pointer.pointerInput
|
import androidx.compose.ui.input.pointer.pointerInput
|
||||||
import androidx.compose.ui.layout.onGloballyPositioned
|
|
||||||
import androidx.compose.ui.text.font.FontStyle
|
import androidx.compose.ui.text.font.FontStyle
|
||||||
import androidx.compose.ui.text.font.FontWeight
|
import androidx.compose.ui.text.font.FontWeight
|
||||||
import androidx.compose.ui.unit.IntOffset
|
import androidx.compose.ui.unit.IntOffset
|
||||||
|
|
@ -65,7 +64,6 @@ object ScreenSolfa : Screen {
|
||||||
val gridTUOData = GridTUOData(measure, tuoList, stanza)
|
val gridTUOData = GridTUOData(measure, tuoList, stanza)
|
||||||
val coroutineScope = rememberCoroutineScope()
|
val coroutineScope = rememberCoroutineScope()
|
||||||
val scrollState = rememberScrollState()
|
val scrollState = rememberScrollState()
|
||||||
var viewportHeight by remember { mutableStateOf(0) }
|
|
||||||
|
|
||||||
var isScanning by remember { mutableStateOf(false) }
|
var isScanning by remember { mutableStateOf(false) }
|
||||||
var qrCodeResult by remember { mutableStateOf("Aucun code scanné") }
|
var qrCodeResult by remember { mutableStateOf("Aucun code scanné") }
|
||||||
|
|
@ -77,8 +75,7 @@ object ScreenSolfa : Screen {
|
||||||
qrCodeResult = qrCodeResult,
|
qrCodeResult = qrCodeResult,
|
||||||
onScannerButtonClick = {
|
onScannerButtonClick = {
|
||||||
isScanning = true
|
isScanning = true
|
||||||
},
|
}
|
||||||
solfaScrollState = scrollState
|
|
||||||
) { paddingValues ->
|
) { paddingValues ->
|
||||||
Box(
|
Box(
|
||||||
Modifier.fillMaxSize().padding(paddingValues)
|
Modifier.fillMaxSize().padding(paddingValues)
|
||||||
|
|
@ -94,9 +91,6 @@ object ScreenSolfa : Screen {
|
||||||
showContextualMenu = true
|
showContextualMenu = true
|
||||||
}
|
}
|
||||||
)
|
)
|
||||||
}
|
|
||||||
.onGloballyPositioned { coordinates ->
|
|
||||||
viewportHeight = coordinates.size.height
|
|
||||||
},
|
},
|
||||||
horizontalAlignment = Alignment.CenterHorizontally,
|
horizontalAlignment = Alignment.CenterHorizontally,
|
||||||
) {
|
) {
|
||||||
|
|
@ -198,7 +192,7 @@ object ScreenSolfa : Screen {
|
||||||
}
|
}
|
||||||
Row (
|
Row (
|
||||||
modifier = Modifier
|
modifier = Modifier
|
||||||
.height(75.dp)
|
.height(199.dp)
|
||||||
) {
|
) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -50,7 +50,6 @@ fun MainScreenWithDrawer(
|
||||||
sharedScreenModel: SharedScreenModel,
|
sharedScreenModel: SharedScreenModel,
|
||||||
qrCodeResult: String,
|
qrCodeResult: String,
|
||||||
onScannerButtonClick: () -> Unit,
|
onScannerButtonClick: () -> Unit,
|
||||||
solfaScrollState: ScrollState,
|
|
||||||
content: @Composable (PaddingValues) -> Unit,
|
content: @Composable (PaddingValues) -> Unit,
|
||||||
) {
|
) {
|
||||||
val drawerState = rememberDrawerState(initialValue = DrawerValue.Closed)
|
val drawerState = rememberDrawerState(initialValue = DrawerValue.Closed)
|
||||||
|
|
@ -80,7 +79,7 @@ val isPos by sharedScreenModel.isPos.collectAsState()
|
||||||
var isDragging = sharedScreenModel.isDragging
|
var isDragging = sharedScreenModel.isDragging
|
||||||
val currentPos by sharedScreenModel.currentPos.collectAsState()
|
val currentPos by sharedScreenModel.currentPos.collectAsState()
|
||||||
val duration by sharedScreenModel.duration.collectAsState()
|
val duration by sharedScreenModel.duration.collectAsState()
|
||||||
val midiFile = "whawyd3.mid" //What do we gain by all our hard work?
|
val midiFile = "whawyd3.mid"
|
||||||
var refreshTrigeer by remember { mutableStateOf(0)}
|
var refreshTrigeer by remember { mutableStateOf(0)}
|
||||||
|
|
||||||
val volumelevel by sharedScreenModel.volumeLevel.collectAsState()
|
val volumelevel by sharedScreenModel.volumeLevel.collectAsState()
|
||||||
|
|
@ -249,7 +248,6 @@ LaunchedEffect(isPlay, isPos) {
|
||||||
currentPos = currentPos,
|
currentPos = currentPos,
|
||||||
volume = volumelevel,
|
volume = volumelevel,
|
||||||
duration = duration,
|
duration = duration,
|
||||||
solfaScrollState,
|
|
||||||
onPlayPauseClick = {
|
onPlayPauseClick = {
|
||||||
sharedScreenModel.togglePlayPause()
|
sharedScreenModel.togglePlayPause()
|
||||||
},
|
},
|
||||||
|
|
|
||||||
|
|
@ -1,11 +1,6 @@
|
||||||
package mg.dot.feufaro.ui
|
package mg.dot.feufaro.ui
|
||||||
|
|
||||||
import androidx.compose.animation.*
|
import androidx.compose.animation.*
|
||||||
import androidx.compose.animation.core.AnimationSpec
|
|
||||||
import androidx.compose.animation.core.ExperimentalAnimationSpecApi
|
|
||||||
import androidx.compose.animation.core.LinearEasing
|
|
||||||
import androidx.compose.animation.core.tween
|
|
||||||
import androidx.compose.foundation.ScrollState
|
|
||||||
import androidx.compose.foundation.background
|
import androidx.compose.foundation.background
|
||||||
import androidx.compose.foundation.clickable
|
import androidx.compose.foundation.clickable
|
||||||
import androidx.compose.foundation.layout.*
|
import androidx.compose.foundation.layout.*
|
||||||
|
|
@ -39,7 +34,6 @@ fun MidiControlPanel(
|
||||||
currentPos: Float,
|
currentPos: Float,
|
||||||
volume: Float,
|
volume: Float,
|
||||||
duration: Float,
|
duration: Float,
|
||||||
solfaScrollState: ScrollState,
|
|
||||||
onPlayPauseClick: () -> Unit,
|
onPlayPauseClick: () -> Unit,
|
||||||
onSeek: (Float) -> Unit,
|
onSeek: (Float) -> Unit,
|
||||||
onVolumeChange: (Float) -> Unit,
|
onVolumeChange: (Float) -> Unit,
|
||||||
|
|
@ -67,26 +61,6 @@ fun MidiControlPanel(
|
||||||
|
|
||||||
var showSATBTools by remember { mutableStateOf(false) }
|
var showSATBTools by remember { mutableStateOf(false) }
|
||||||
var expandedCtl by remember { mutableStateOf(false) }
|
var expandedCtl by remember { mutableStateOf(false) }
|
||||||
val platform = getPlatform().name
|
|
||||||
val coroutineScope = rememberCoroutineScope()
|
|
||||||
|
|
||||||
LaunchedEffect(currentPos, duration, solfaScrollState.viewportSize, solfaScrollState.maxValue) {
|
|
||||||
if (duration > 0f && solfaScrollState.maxValue > 0) {
|
|
||||||
val progress = (currentPos / duration).coerceIn(0f, 1f)
|
|
||||||
val viewportHeight = solfaScrollState.viewportSize.toFloat()
|
|
||||||
val totalContentHeight = solfaScrollState.maxValue + viewportHeight
|
|
||||||
|
|
||||||
val targetY = (progress * (totalContentHeight-200)) - (viewportHeight / 2)
|
|
||||||
val finalTarget = targetY.coerceIn(0f, solfaScrollState.maxValue.toFloat())
|
|
||||||
solfaScrollState.animateScrollTo(
|
|
||||||
value = finalTarget.toInt(),
|
|
||||||
animationSpec = tween (
|
|
||||||
durationMillis = 300,
|
|
||||||
easing = LinearEasing
|
|
||||||
)
|
|
||||||
)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
LaunchedEffect(tempo) {
|
LaunchedEffect(tempo) {
|
||||||
currentBpm = mediaPlayer.getCurrentBPM()
|
currentBpm = mediaPlayer.getCurrentBPM()
|
||||||
}
|
}
|
||||||
|
|
@ -105,7 +79,7 @@ fun MidiControlPanel(
|
||||||
|
|
||||||
tempo = newFactor
|
tempo = newFactor
|
||||||
mediaPlayer?.setTempo(newFactor)
|
mediaPlayer?.setTempo(newFactor)
|
||||||
// println("tempo : $tempo")
|
println("tempo : $tempo")
|
||||||
}
|
}
|
||||||
Column(
|
Column(
|
||||||
modifier = Modifier.fillMaxWidth()
|
modifier = Modifier.fillMaxWidth()
|
||||||
|
|
@ -117,7 +91,8 @@ fun MidiControlPanel(
|
||||||
) {
|
) {
|
||||||
Column(
|
Column(
|
||||||
modifier = modifier
|
modifier = modifier
|
||||||
.fillMaxWidth(if (platform.startsWith("Android")) 1f else 0.6f)
|
.fillMaxWidth(if (getPlatform().name.startsWith("Android")) 0.9f else 0.6f)
|
||||||
|
.padding(16.dp)
|
||||||
.background(color = Color.Gray.copy(alpha = 0.5f), shape = RoundedCornerShape(size = 5.dp)),
|
.background(color = Color.Gray.copy(alpha = 0.5f), shape = RoundedCornerShape(size = 5.dp)),
|
||||||
horizontalAlignment = Alignment.CenterHorizontally
|
horizontalAlignment = Alignment.CenterHorizontally
|
||||||
) {
|
) {
|
||||||
|
|
@ -239,7 +214,7 @@ fun MidiControlPanel(
|
||||||
slideInHorizontally { -it } + fadeIn() togetherWith slideOutHorizontally { it } + fadeOut()
|
slideInHorizontally { -it } + fadeIn() togetherWith slideOutHorizontally { it } + fadeOut()
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
modifier = Modifier.padding(horizontal = 2.dp)
|
modifier = Modifier.padding(horizontal = 4.dp)
|
||||||
) { displayedBpm ->
|
) { displayedBpm ->
|
||||||
val isCenter = displayedBpm == currentBpmInt
|
val isCenter = displayedBpm == currentBpmInt
|
||||||
Text(
|
Text(
|
||||||
|
|
@ -250,7 +225,7 @@ fun MidiControlPanel(
|
||||||
modifier = Modifier
|
modifier = Modifier
|
||||||
.clip(CircleShape)
|
.clip(CircleShape)
|
||||||
.clickable(enabled = !isCenter) { updateTempoToBpm(displayedBpm) }
|
.clickable(enabled = !isCenter) { updateTempoToBpm(displayedBpm) }
|
||||||
.padding(horizontal = 2.dp)
|
.padding(horizontal = 4.dp)
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -358,54 +333,6 @@ fun MidiControlPanel(
|
||||||
}
|
}
|
||||||
Spacer(modifier = Modifier.weight(1f))
|
Spacer(modifier = Modifier.weight(1f))
|
||||||
|
|
||||||
if(platform.startsWith("Android")) {
|
|
||||||
Column(
|
|
||||||
modifier = Modifier.wrapContentWidth(),
|
|
||||||
horizontalAlignment = Alignment.CenterHorizontally
|
|
||||||
) {
|
|
||||||
IconButton(
|
|
||||||
onClick = onPlayPauseClick,
|
|
||||||
modifier = Modifier.size(48.dp).background(MaterialTheme.colorScheme.primary, CircleShape)
|
|
||||||
) {
|
|
||||||
Icon(
|
|
||||||
imageVector = if (isPause) Icons.Filled.PlayArrow else Icons.Filled.Pause,
|
|
||||||
contentDescription = "Pla",
|
|
||||||
tint = Color.White
|
|
||||||
)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
Spacer(modifier = Modifier.weight(1f))
|
|
||||||
|
|
||||||
Column {
|
|
||||||
IconButton(
|
|
||||||
onClick = {
|
|
||||||
isPianoSelected = !isPianoSelected
|
|
||||||
if (isPianoSelected) {
|
|
||||||
mediaPlayer?.changeInstru(1)
|
|
||||||
} else {
|
|
||||||
mediaPlayer?.changeInstru(20)
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
) {
|
|
||||||
if (isPianoSelected) {
|
|
||||||
Icon(
|
|
||||||
Icons.Default.Piano,
|
|
||||||
contentDescription = "Piano",
|
|
||||||
tint = Color.Black
|
|
||||||
)
|
|
||||||
} else {
|
|
||||||
Icon(
|
|
||||||
painter = painterResource(Res.drawable.ic_organ),
|
|
||||||
contentDescription = "Orgue",
|
|
||||||
tint = Color.Black,
|
|
||||||
modifier = Modifier.size(25.dp)
|
|
||||||
)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
Column {
|
Column {
|
||||||
IconButton(
|
IconButton(
|
||||||
onClick = {
|
onClick = {
|
||||||
|
|
@ -436,6 +363,7 @@ fun MidiControlPanel(
|
||||||
}
|
}
|
||||||
|
|
||||||
Spacer(modifier = Modifier.weight(1f))
|
Spacer(modifier = Modifier.weight(1f))
|
||||||
|
|
||||||
Column(
|
Column(
|
||||||
modifier = Modifier.wrapContentWidth(),
|
modifier = Modifier.wrapContentWidth(),
|
||||||
horizontalAlignment = Alignment.CenterHorizontally
|
horizontalAlignment = Alignment.CenterHorizontally
|
||||||
|
|
@ -451,12 +379,11 @@ fun MidiControlPanel(
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
Spacer(modifier = Modifier.weight(1f))
|
Spacer(modifier = Modifier.weight(1f))
|
||||||
|
|
||||||
if (platform.startsWith("Java")) {
|
val platform = getPlatform()
|
||||||
|
if (platform.name.startsWith("Java")) {
|
||||||
ModernVolumeSlider(
|
ModernVolumeSlider(
|
||||||
volume, onVolumeChange = onVolumeChange
|
volume, onVolumeChange = onVolumeChange
|
||||||
)
|
)
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue