Make Y-axis dynamic: show carrier or binaural range based on selected audio curve
This commit is contained in:
@@ -266,33 +266,28 @@ internal fun TimelineGraph(
|
||||
(context as? android.app.Activity)?.window?.decorView?.performHapticFeedback(HapticFeedbackConstants.KEYBOARD_TAP)
|
||||
}
|
||||
|
||||
// Left axis labels (carrier for audio, flash interval for visual)
|
||||
val leftYLabels = if (isVisual) {
|
||||
// Y-axis labels - dynamic based on which curve is selected. For audio: carrier (left) or binaural (right). For visual: flash interval.
|
||||
val yAxisLabels = if (isVisual) {
|
||||
listOf(
|
||||
formatMsLabel(ParameterMapping.logMap01(1f, ParameterRanges.FLASH_INTERVAL_MS_MIN, ParameterRanges.FLASH_INTERVAL_MS_MAX)),
|
||||
formatMsLabel(ParameterMapping.logMap01(0.5f, ParameterRanges.FLASH_INTERVAL_MS_MIN, ParameterRanges.FLASH_INTERVAL_MS_MAX)),
|
||||
formatMsLabel(ParameterMapping.logMap01(0f, ParameterRanges.FLASH_INTERVAL_MS_MIN, ParameterRanges.FLASH_INTERVAL_MS_MAX)),
|
||||
)
|
||||
} else {
|
||||
listOf(
|
||||
formatHzLabel(ParameterMapping.logMap01(1f, ParameterRanges.CARRIER_HZ_MIN, ParameterRanges.CARRIER_HZ_MAX)),
|
||||
formatHzLabel(ParameterMapping.logMap01(0.5f, ParameterRanges.CARRIER_HZ_MIN, ParameterRanges.CARRIER_HZ_MAX)),
|
||||
formatHzLabel(ParameterMapping.logMap01(0f, ParameterRanges.CARRIER_HZ_MIN, ParameterRanges.CARRIER_HZ_MAX)),
|
||||
)
|
||||
}
|
||||
// Right axis labels (blank interval for visual, binaural for audio)
|
||||
val rightYLabels = if (isVisual) {
|
||||
listOf(
|
||||
formatMsLabel(ParameterMapping.logMap01(1f, ParameterRanges.BLANK_INTERVAL_MS_MIN, ParameterRanges.BLANK_INTERVAL_MS_MAX)),
|
||||
formatMsLabel(ParameterMapping.logMap01(0.5f, ParameterRanges.BLANK_INTERVAL_MS_MIN, ParameterRanges.BLANK_INTERVAL_MS_MAX)),
|
||||
formatMsLabel(ParameterMapping.logMap01(0f, ParameterRanges.BLANK_INTERVAL_MS_MIN, ParameterRanges.BLANK_INTERVAL_MS_MAX)),
|
||||
)
|
||||
} else {
|
||||
listOf(
|
||||
formatHzLabel(ParameterMapping.logMap01(1f, ParameterRanges.BINAURAL_HZ_MIN, ParameterRanges.BINAURAL_HZ_MAX)),
|
||||
formatHzLabel(ParameterMapping.logMap01(0.5f, ParameterRanges.BINAURAL_HZ_MIN, ParameterRanges.BINAURAL_HZ_MAX)),
|
||||
formatHzLabel(ParameterMapping.logMap01(0f, ParameterRanges.BINAURAL_HZ_MIN, ParameterRanges.BINAURAL_HZ_MAX)),
|
||||
)
|
||||
// Audio: switch labels based on selected side
|
||||
if (selectedLeft) {
|
||||
listOf(
|
||||
formatHzLabel(ParameterMapping.logMap01(1f, ParameterRanges.CARRIER_HZ_MIN, ParameterRanges.CARRIER_HZ_MAX)),
|
||||
formatHzLabel(ParameterMapping.logMap01(0.5f, ParameterRanges.CARRIER_HZ_MIN, ParameterRanges.CARRIER_HZ_MAX)),
|
||||
formatHzLabel(ParameterMapping.logMap01(0f, ParameterRanges.CARRIER_HZ_MIN, ParameterRanges.CARRIER_HZ_MAX)),
|
||||
)
|
||||
} else {
|
||||
listOf(
|
||||
formatHzLabel(ParameterMapping.logMap01(1f, ParameterRanges.BINAURAL_HZ_MIN, ParameterRanges.BINAURAL_HZ_MAX)),
|
||||
formatHzLabel(ParameterMapping.logMap01(0.5f, ParameterRanges.BINAURAL_HZ_MIN, ParameterRanges.BINAURAL_HZ_MAX)),
|
||||
formatHzLabel(ParameterMapping.logMap01(0f, ParameterRanges.BINAURAL_HZ_MIN, ParameterRanges.BINAURAL_HZ_MAX)),
|
||||
)
|
||||
}
|
||||
}
|
||||
val xStart = formatTimeLabel(viewport.startSec)
|
||||
val xMid = formatTimeLabel(viewport.startSec + viewport.secondsPerScreen / 2f)
|
||||
@@ -309,7 +304,7 @@ internal fun TimelineGraph(
|
||||
verticalArrangement = Arrangement.SpaceBetween,
|
||||
horizontalAlignment = Alignment.End,
|
||||
) {
|
||||
leftYLabels.forEach { label ->
|
||||
yAxisLabels.forEach { label ->
|
||||
Text(
|
||||
text = label,
|
||||
color = MaterialTheme.colorScheme.onSurface.copy(alpha = 0.75f),
|
||||
@@ -505,29 +500,12 @@ internal fun TimelineGraph(
|
||||
}
|
||||
}
|
||||
|
||||
// Right Y-axis labels column
|
||||
Column(
|
||||
modifier = Modifier.height(190.dp).width(48.dp),
|
||||
verticalArrangement = Arrangement.SpaceBetween,
|
||||
horizontalAlignment = Alignment.Start,
|
||||
) {
|
||||
rightYLabels.forEach { label ->
|
||||
Text(
|
||||
text = label,
|
||||
color = MaterialTheme.colorScheme.onSurface.copy(alpha = 0.75f),
|
||||
style = MaterialTheme.typography.labelSmall,
|
||||
textAlign = TextAlign.Start,
|
||||
modifier = Modifier.fillMaxWidth(),
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
Row(
|
||||
modifier = Modifier.fillMaxWidth().padding(top = 4.dp),
|
||||
horizontalArrangement = Arrangement.spacedBy(8.dp),
|
||||
verticalAlignment = Alignment.CenterVertically,
|
||||
) {
|
||||
Spacer(modifier = Modifier.width(96.dp))
|
||||
Spacer(modifier = Modifier.width(48.dp))
|
||||
Row(
|
||||
modifier = Modifier.weight(1f),
|
||||
horizontalArrangement = Arrangement.SpaceBetween,
|
||||
|
||||
Reference in New Issue
Block a user