Instrument editors pin the keyboard / sampler pads on the right in landscape (0.36.2)
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
co-authored by
Claude Opus 5.5
parent
bc257203e3
commit
0c09c3a0f3
@@ -150,7 +150,8 @@ private fun PageTabs(pages: List<Page>, selected: Int, onSelect: (Int) -> Unit)
|
||||
contentAlignment = Alignment.Center,
|
||||
) {
|
||||
Text(p.title.uppercase(), color = if (on) tone else c.textDim,
|
||||
fontFamily = FontFamily.Monospace, fontSize = 12.sp, maxLines = 1, softWrap = false)
|
||||
fontFamily = FontFamily.Monospace, fontSize = if (pages.size > 5) 10.sp else 12.sp,
|
||||
maxLines = 1, softWrap = false)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -324,60 +324,80 @@ private fun ParamEditor(vm: AppViewModel, slot: ToolboxSlot, onClose: () -> Unit
|
||||
// Whether the MIDI-learn popup (map controls to this device's parameters) is open.
|
||||
var showMidiLearn by remember(slot.index) { mutableStateOf(false) }
|
||||
|
||||
Box(Modifier.fillMaxSize().background(c.background.copy(alpha = 0.96f))) {
|
||||
Column(Modifier.fillMaxSize()) {
|
||||
Column(
|
||||
Modifier
|
||||
.weight(if (pinnedBottom) 1.7f else 1f)
|
||||
.fillMaxWidth()
|
||||
.padding(12.dp)
|
||||
.verticalScroll(rememberScrollState()),
|
||||
verticalArrangement = Arrangement.spacedBy(8.dp),
|
||||
) {
|
||||
Row(Modifier.fillMaxWidth(), horizontalArrangement = Arrangement.SpaceBetween) {
|
||||
Text(slot.name, color = c.accent, fontFamily = FontFamily.Monospace, fontSize = 15.sp)
|
||||
// Right-side toolbar: MIDI-learn (map controls to params) + close.
|
||||
Row(horizontalArrangement = Arrangement.spacedBy(14.dp)) {
|
||||
Text("⇄ MIDI", color = c.accent, fontFamily = FontFamily.Monospace, fontSize = 13.sp,
|
||||
modifier = Modifier.pointerInput(Unit) { detectTapGestures { showMidiLearn = true } })
|
||||
Text("CLOSE ✕", color = c.textDim, fontFamily = FontFamily.Monospace, fontSize = 13.sp,
|
||||
modifier = Modifier.pointerInput(Unit) { detectTapGestures { onClose() } })
|
||||
}
|
||||
}
|
||||
// The playable part pinned beside the controls: the Sampler's pads, else an
|
||||
// audition keyboard.
|
||||
val pinned: @Composable (Modifier) -> Unit = { mod ->
|
||||
if (type == ToolboxType.SAMPLER) {
|
||||
SamplerPadBank(vm, slot, samplerPad, onSelect = { samplerPad = it }, mod)
|
||||
} else {
|
||||
SlotAuditionKeyboard(vm, slot, mod)
|
||||
}
|
||||
}
|
||||
// Landscape: controls on the left, keyboard / pads pinned on the right at the
|
||||
// same 1 : 1.3 split as the Toolbox tab. Portrait: controls above, 1.7 : 1.
|
||||
val sideBySide = pinnedBottom && isLandscape()
|
||||
|
||||
// Preset browser: load / save / import / share for this device.
|
||||
PresetBar(vm, slot)
|
||||
|
||||
// The Synth / Sampler / SoundFont / Delay / tape and glitch effects have
|
||||
// bespoke editors; everything else is grouped cards ([DevicePanels]), with
|
||||
// a source strip on top for the Grain Cloud and the LFO's
|
||||
// target picker below.
|
||||
when (type) {
|
||||
ToolboxType.NES_SYNTH -> NesSynthEditor(vm, slot)
|
||||
ToolboxType.MIX_TIGHTENER -> MixTightenerEditor(vm, slot)
|
||||
ToolboxType.TAPE_ENGINE -> TapeEngineEditor(vm, slot)
|
||||
ToolboxType.GRANULAR -> GranularEditor(vm, slot)
|
||||
ToolboxType.SAMPLER -> SamplerEditor(vm, slot, samplerPad, onSelectPad = { samplerPad = it })
|
||||
ToolboxType.SOUNDFONT -> SoundFontEditor(vm, slot)
|
||||
ToolboxType.DELAY -> DelayEditor(vm, slot)
|
||||
ToolboxType.GRAIN_CLOUD -> {
|
||||
GrainCloudEditor(vm, slot)
|
||||
DevicePanels(vm, slot, DeviceLayouts.pagesFor(type))
|
||||
}
|
||||
ToolboxType.LFO -> {
|
||||
DevicePanels(vm, slot, DeviceLayouts.pagesFor(type))
|
||||
LfoTargetPicker(vm, slot)
|
||||
}
|
||||
else -> DevicePanels(vm, slot, DeviceLayouts.pagesFor(type))
|
||||
// Header, presets and the device's own controls (scrolls on its own).
|
||||
val controls: @Composable (Modifier) -> Unit = { mod ->
|
||||
Column(
|
||||
Modifier
|
||||
.then(mod)
|
||||
.padding(12.dp)
|
||||
.verticalScroll(rememberScrollState()),
|
||||
verticalArrangement = Arrangement.spacedBy(8.dp),
|
||||
) {
|
||||
Row(Modifier.fillMaxWidth(), horizontalArrangement = Arrangement.SpaceBetween) {
|
||||
Text(slot.name, color = c.accent, fontFamily = FontFamily.Monospace, fontSize = 15.sp)
|
||||
// Right-side toolbar: MIDI-learn (map controls to params) + close.
|
||||
Row(horizontalArrangement = Arrangement.spacedBy(14.dp)) {
|
||||
Text("⇄ MIDI", color = c.accent, fontFamily = FontFamily.Monospace, fontSize = 13.sp,
|
||||
modifier = Modifier.pointerInput(Unit) { detectTapGestures { showMidiLearn = true } })
|
||||
Text("CLOSE ✕", color = c.textDim, fontFamily = FontFamily.Monospace, fontSize = 13.sp,
|
||||
modifier = Modifier.pointerInput(Unit) { detectTapGestures { onClose() } })
|
||||
}
|
||||
}
|
||||
|
||||
if (pinnedBottom) {
|
||||
Box(Modifier.fillMaxWidth().height(2.dp).background(c.accent)) // fixed divider
|
||||
if (type == ToolboxType.SAMPLER) {
|
||||
SamplerPadBank(vm, slot, samplerPad, onSelect = { samplerPad = it }, Modifier.weight(1f))
|
||||
} else {
|
||||
SlotAuditionKeyboard(vm, slot, Modifier.weight(1f))
|
||||
// Preset browser: load / save / import / share for this device.
|
||||
PresetBar(vm, slot)
|
||||
|
||||
// The Synth / Sampler / SoundFont / Delay / tape and glitch effects have
|
||||
// bespoke editors; everything else is grouped cards ([DevicePanels]), with
|
||||
// a source strip on top for the Grain Cloud and the LFO's
|
||||
// target picker below.
|
||||
when (type) {
|
||||
ToolboxType.NES_SYNTH -> NesSynthEditor(vm, slot)
|
||||
ToolboxType.MIX_TIGHTENER -> MixTightenerEditor(vm, slot)
|
||||
ToolboxType.TAPE_ENGINE -> TapeEngineEditor(vm, slot)
|
||||
ToolboxType.GRANULAR -> GranularEditor(vm, slot)
|
||||
ToolboxType.SAMPLER -> SamplerEditor(vm, slot, samplerPad, onSelectPad = { samplerPad = it })
|
||||
ToolboxType.SOUNDFONT -> SoundFontEditor(vm, slot)
|
||||
ToolboxType.DELAY -> DelayEditor(vm, slot)
|
||||
ToolboxType.GRAIN_CLOUD -> {
|
||||
GrainCloudEditor(vm, slot)
|
||||
DevicePanels(vm, slot, DeviceLayouts.pagesFor(type))
|
||||
}
|
||||
ToolboxType.LFO -> {
|
||||
DevicePanels(vm, slot, DeviceLayouts.pagesFor(type))
|
||||
LfoTargetPicker(vm, slot)
|
||||
}
|
||||
else -> DevicePanels(vm, slot, DeviceLayouts.pagesFor(type))
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Box(Modifier.fillMaxSize().background(c.background.copy(alpha = 0.96f))) {
|
||||
if (sideBySide) {
|
||||
Row(Modifier.fillMaxSize()) {
|
||||
controls(Modifier.weight(1f).fillMaxHeight())
|
||||
Box(Modifier.width(2.dp).fillMaxHeight().background(c.accent)) // fixed divider
|
||||
pinned(Modifier.weight(1.3f).fillMaxHeight())
|
||||
}
|
||||
} else {
|
||||
Column(Modifier.fillMaxSize()) {
|
||||
controls(Modifier.weight(if (pinnedBottom) 1.7f else 1f).fillMaxWidth())
|
||||
if (pinnedBottom) {
|
||||
Box(Modifier.fillMaxWidth().height(2.dp).background(c.accent)) // fixed divider
|
||||
pinned(Modifier.weight(1f))
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user