Compare commits
2
Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
0c09c3a0f3 | ||
|
|
bc257203e3 |
@@ -4,6 +4,22 @@ Sizzletracker for Android (`cc.tiredsysadmin.android.sizzle`). One entry per
|
|||||||
version in `versions.properties`; versions before 0.28.0 are described in the git
|
version in `versions.properties`; versions before 0.28.0 are described in the git
|
||||||
log (one commit per version).
|
log (one commit per version).
|
||||||
|
|
||||||
|
## 0.36.2 (versionCode 70)
|
||||||
|
|
||||||
|
- **Instrument editors in landscape:** the audition keyboard (or the Sampler's
|
||||||
|
pads) is now pinned on the right at the same width as on the Toolbox and
|
||||||
|
Tracker tabs, with the controls scrolling on the left, instead of being stacked
|
||||||
|
below the controls. Tab labels shrink when there are more than five, so the
|
||||||
|
Wavetable's FILTER tab isn't cut off in the narrower column.
|
||||||
|
|
||||||
|
## 0.36.1 (versionCode 69)
|
||||||
|
|
||||||
|
- **Wavetable editor fits without scrolling:** tabs are now OSC 1 · OSC 2 · VOICE
|
||||||
|
· FILTER · AMP · MOD · LFO, each oscillator's card draws its own table, and LOAD
|
||||||
|
TABLE moved into Oscillator 1's title with the frame size below the table. The
|
||||||
|
big table strip above the tabs is gone. Tabs in every device editor now share
|
||||||
|
the width instead of scrolling sideways.
|
||||||
|
|
||||||
## 0.36.0 (versionCode 68)
|
## 0.36.0 (versionCode 68)
|
||||||
|
|
||||||
- **One-tap transfer from Mikro Seq:** a song sent by Mikro Seq's "Current to
|
- **One-tap transfer from Mikro Seq:** a song sent by Mikro Seq's "Current to
|
||||||
|
|||||||
@@ -19,20 +19,27 @@ object DeviceLayouts {
|
|||||||
|
|
||||||
fun pagesFor(type: ToolboxType): List<Page> = when (type) {
|
fun pagesFor(type: ToolboxType): List<Page> = when (type) {
|
||||||
ToolboxType.WAVETABLE -> listOf(
|
ToolboxType.WAVETABLE -> listOf(
|
||||||
Page("Osc", listOf(
|
// One oscillator per tab, each drawing its own table, so every page fits
|
||||||
Panel("Oscillator 1", Tone.SOURCE, osc(1)),
|
// above the keyboard without scrolling. A loaded WAV lands on oscillator 1,
|
||||||
Panel("Oscillator 2", Tone.SOURCE, osc(2)),
|
// so LOAD TABLE and its frame size sit on that card.
|
||||||
|
Page("Osc 1", listOf(
|
||||||
|
Panel("Oscillator 1", Tone.SOURCE, listOf("o1table", "wtframe") + osc(1).drop(1), Viz.Wavetable(1),
|
||||||
|
labels = mapOf("wtframe" to "Frame"), action = { vm, slot -> LoadTableAction(vm, slot) }),
|
||||||
|
)),
|
||||||
|
Page("Osc 2", listOf(
|
||||||
|
Panel("Oscillator 2", Tone.SOURCE, osc(2), Viz.Wavetable(2)),
|
||||||
)),
|
)),
|
||||||
Page("Voice", listOf(
|
Page("Voice", listOf(
|
||||||
Panel("Voice", Tone.SOURCE, listOf("unison", "spread", "sub", "noise", "velsens")),
|
Panel("Voice", Tone.SOURCE, listOf("unison", "spread", "sub", "noise", "velsens")),
|
||||||
Panel("Table import", Tone.OUT, listOf("wtframe")),
|
|
||||||
)),
|
)),
|
||||||
Page("Filter", listOf(
|
Page("Filter", listOf(
|
||||||
Panel("Filter", Tone.FILTER, listOf("ftype", "cutoff", "reso", "keytrack", "fenv", "drive"),
|
Panel("Filter", Tone.FILTER, listOf("ftype", "cutoff", "reso", "keytrack", "fenv", "drive"),
|
||||||
Viz.Filter("ftype", "cutoff", "reso"), labels = mapOf("ftype" to "Type", "fenv" to "Env Amt")),
|
Viz.Filter("ftype", "cutoff", "reso"), labels = mapOf("ftype" to "Type", "fenv" to "Env Amt")),
|
||||||
)),
|
)),
|
||||||
Page("Env", listOf(
|
Page("Amp", listOf(
|
||||||
Panel("Amp envelope", Tone.ENV, listOf("attack", "decay", "sustain", "release"), ADSR),
|
Panel("Amp envelope", Tone.ENV, listOf("attack", "decay", "sustain", "release"), ADSR),
|
||||||
|
)),
|
||||||
|
Page("Mod", listOf(
|
||||||
Panel("Mod envelope", Tone.MOD, listOf("mattack", "mdecay", "msustain", "mrelease", "menvpos"),
|
Panel("Mod envelope", Tone.MOD, listOf("mattack", "mdecay", "msustain", "mrelease", "menvpos"),
|
||||||
Viz.Envelope("mattack", "mdecay", "msustain", "mrelease")),
|
Viz.Envelope("mattack", "mdecay", "msustain", "mrelease")),
|
||||||
)),
|
)),
|
||||||
|
|||||||
@@ -79,6 +79,8 @@ sealed interface Viz {
|
|||||||
data class Filter(val type: String?, val cutoff: String, val reso: String) : Viz
|
data class Filter(val type: String?, val cutoff: String, val reso: String) : Viz
|
||||||
/** Two cycles of the wave named by [wave]'s choice. */
|
/** Two cycles of the wave named by [wave]'s choice. */
|
||||||
data class Lfo(val wave: String) : Viz
|
data class Lfo(val wave: String) : Viz
|
||||||
|
/** The Wavetable oscillator [osc]'s table, frames stacked, the one at its position lit. */
|
||||||
|
data class Wavetable(val osc: Int) : Viz
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -95,6 +97,8 @@ class Panel(
|
|||||||
val labels: Map<String, String> = emptyMap(),
|
val labels: Map<String, String> = emptyMap(),
|
||||||
val faders: List<String>? = null,
|
val faders: List<String>? = null,
|
||||||
val faderScale: Float = 1f,
|
val faderScale: Float = 1f,
|
||||||
|
/** A small action drawn at the right of the card's title (e.g. the Wavetable's LOAD TABLE). */
|
||||||
|
val action: (@Composable (AppViewModel, ToolboxSlot) -> Unit)? = null,
|
||||||
)
|
)
|
||||||
|
|
||||||
/** A tab of cards. */
|
/** A tab of cards. */
|
||||||
@@ -131,22 +135,23 @@ fun DevicePanels(vm: AppViewModel, slot: ToolboxSlot, pages: List<Page>) {
|
|||||||
@Composable
|
@Composable
|
||||||
private fun PageTabs(pages: List<Page>, selected: Int, onSelect: (Int) -> Unit) {
|
private fun PageTabs(pages: List<Page>, selected: Int, onSelect: (Int) -> Unit) {
|
||||||
val c = LocalRetro.current
|
val c = LocalRetro.current
|
||||||
Row(
|
// Tabs share the width (up to seven fit a phone), so none hides off-screen.
|
||||||
Modifier.fillMaxWidth().horizontalScroll(rememberScrollState()),
|
Row(Modifier.fillMaxWidth(), horizontalArrangement = Arrangement.spacedBy(4.dp)) {
|
||||||
horizontalArrangement = Arrangement.spacedBy(4.dp),
|
|
||||||
) {
|
|
||||||
pages.forEachIndexed { i, p ->
|
pages.forEachIndexed { i, p ->
|
||||||
val on = i == selected
|
val on = i == selected
|
||||||
val tone = toneColor(p.panels.first().tone)
|
val tone = toneColor(p.panels.first().tone)
|
||||||
Box(
|
Box(
|
||||||
Modifier
|
Modifier
|
||||||
|
.weight(1f)
|
||||||
.border(1.dp, if (on) tone else c.grid, RectangleShape)
|
.border(1.dp, if (on) tone else c.grid, RectangleShape)
|
||||||
.background(if (on) tone.copy(alpha = 0.22f) else c.surface)
|
.background(if (on) tone.copy(alpha = 0.22f) else c.surface)
|
||||||
.clickable { onSelect(i) }
|
.clickable { onSelect(i) }
|
||||||
.padding(horizontal = 12.dp, vertical = 7.dp),
|
.padding(horizontal = 2.dp, vertical = 7.dp),
|
||||||
|
contentAlignment = Alignment.Center,
|
||||||
) {
|
) {
|
||||||
Text(p.title.uppercase(), color = if (on) tone else c.textDim,
|
Text(p.title.uppercase(), color = if (on) tone else c.textDim,
|
||||||
fontFamily = FontFamily.Monospace, fontSize = 12.sp)
|
fontFamily = FontFamily.Monospace, fontSize = if (pages.size > 5) 10.sp else 12.sp,
|
||||||
|
maxLines = 1, softWrap = false)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -174,9 +179,13 @@ fun PanelCard(vm: AppViewModel, slot: ToolboxSlot, panel: Panel, rev: Int = vm.r
|
|||||||
Box(Modifier.size(8.dp).background(tone))
|
Box(Modifier.size(8.dp).background(tone))
|
||||||
Spacer(Modifier.width(6.dp))
|
Spacer(Modifier.width(6.dp))
|
||||||
Text(panel.title.uppercase(), color = tone, fontFamily = FontFamily.Monospace, fontSize = 11.sp,
|
Text(panel.title.uppercase(), color = tone, fontFamily = FontFamily.Monospace, fontSize = 11.sp,
|
||||||
letterSpacing = 1.sp)
|
letterSpacing = 1.sp, modifier = Modifier.weight(1f))
|
||||||
|
panel.action?.invoke(vm, slot)
|
||||||
|
}
|
||||||
|
panel.viz?.let {
|
||||||
|
if (it is Viz.Wavetable) WavetablePreview(slot, it.osc, tone, rev)
|
||||||
|
else VizCanvas(slot, it, byKey, tone, rev)
|
||||||
}
|
}
|
||||||
panel.viz?.let { VizCanvas(slot, it, byKey, tone, rev) }
|
|
||||||
|
|
||||||
if (panel.faders != null) {
|
if (panel.faders != null) {
|
||||||
FaderBank(vm, slot, specs, panel, tone, rev)
|
FaderBank(vm, slot, specs, panel, tone, rev)
|
||||||
@@ -368,6 +377,7 @@ private fun VizCanvas(slot: ToolboxSlot, viz: Viz, byKey: Map<String, ParamSpec>
|
|||||||
drawLine(c.grid, Offset(0f, zeroY), Offset(w, zeroY), strokeWidth = 1f)
|
drawLine(c.grid, Offset(0f, zeroY), Offset(w, zeroY), strokeWidth = 1f)
|
||||||
drawLine(c.grid, Offset(fc * w, top), Offset(fc * w, bottom), strokeWidth = 1f)
|
drawLine(c.grid, Offset(fc * w, top), Offset(fc * w, bottom), strokeWidth = 1f)
|
||||||
}
|
}
|
||||||
|
is Viz.Wavetable -> Unit // drawn by WavetablePreview
|
||||||
is Viz.Lfo -> {
|
is Viz.Lfo -> {
|
||||||
val name = choice(viz.wave).lowercase()
|
val name = choice(viz.wave).lowercase()
|
||||||
val n = 160
|
val n = 160
|
||||||
|
|||||||
@@ -324,64 +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.
|
// Whether the MIDI-learn popup (map controls to this device's parameters) is open.
|
||||||
var showMidiLearn by remember(slot.index) { mutableStateOf(false) }
|
var showMidiLearn by remember(slot.index) { mutableStateOf(false) }
|
||||||
|
|
||||||
Box(Modifier.fillMaxSize().background(c.background.copy(alpha = 0.96f))) {
|
// The playable part pinned beside the controls: the Sampler's pads, else an
|
||||||
Column(Modifier.fillMaxSize()) {
|
// audition keyboard.
|
||||||
Column(
|
val pinned: @Composable (Modifier) -> Unit = { mod ->
|
||||||
Modifier
|
if (type == ToolboxType.SAMPLER) {
|
||||||
.weight(if (pinnedBottom) 1.7f else 1f)
|
SamplerPadBank(vm, slot, samplerPad, onSelect = { samplerPad = it }, mod)
|
||||||
.fillMaxWidth()
|
} else {
|
||||||
.padding(12.dp)
|
SlotAuditionKeyboard(vm, slot, mod)
|
||||||
.verticalScroll(rememberScrollState()),
|
}
|
||||||
verticalArrangement = Arrangement.spacedBy(8.dp),
|
}
|
||||||
) {
|
// Landscape: controls on the left, keyboard / pads pinned on the right at the
|
||||||
Row(Modifier.fillMaxWidth(), horizontalArrangement = Arrangement.SpaceBetween) {
|
// same 1 : 1.3 split as the Toolbox tab. Portrait: controls above, 1.7 : 1.
|
||||||
Text(slot.name, color = c.accent, fontFamily = FontFamily.Monospace, fontSize = 15.sp)
|
val sideBySide = pinnedBottom && isLandscape()
|
||||||
// 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() } })
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// Preset browser: load / save / import / share for this device.
|
// Header, presets and the device's own controls (scrolls on its own).
|
||||||
PresetBar(vm, slot)
|
val controls: @Composable (Modifier) -> Unit = { mod ->
|
||||||
|
Column(
|
||||||
// The Synth / Sampler / SoundFont / Delay / tape and glitch effects have
|
Modifier
|
||||||
// bespoke editors; everything else is grouped cards ([DevicePanels]), with
|
.then(mod)
|
||||||
// a source strip on top for the Wavetable and Grain Cloud and the LFO's
|
.padding(12.dp)
|
||||||
// target picker below.
|
.verticalScroll(rememberScrollState()),
|
||||||
when (type) {
|
verticalArrangement = Arrangement.spacedBy(8.dp),
|
||||||
ToolboxType.NES_SYNTH -> NesSynthEditor(vm, slot)
|
) {
|
||||||
ToolboxType.MIX_TIGHTENER -> MixTightenerEditor(vm, slot)
|
Row(Modifier.fillMaxWidth(), horizontalArrangement = Arrangement.SpaceBetween) {
|
||||||
ToolboxType.TAPE_ENGINE -> TapeEngineEditor(vm, slot)
|
Text(slot.name, color = c.accent, fontFamily = FontFamily.Monospace, fontSize = 15.sp)
|
||||||
ToolboxType.GRANULAR -> GranularEditor(vm, slot)
|
// Right-side toolbar: MIDI-learn (map controls to params) + close.
|
||||||
ToolboxType.SAMPLER -> SamplerEditor(vm, slot, samplerPad, onSelectPad = { samplerPad = it })
|
Row(horizontalArrangement = Arrangement.spacedBy(14.dp)) {
|
||||||
ToolboxType.SOUNDFONT -> SoundFontEditor(vm, slot)
|
Text("⇄ MIDI", color = c.accent, fontFamily = FontFamily.Monospace, fontSize = 13.sp,
|
||||||
ToolboxType.DELAY -> DelayEditor(vm, slot)
|
modifier = Modifier.pointerInput(Unit) { detectTapGestures { showMidiLearn = true } })
|
||||||
ToolboxType.WAVETABLE -> {
|
Text("CLOSE ✕", color = c.textDim, fontFamily = FontFamily.Monospace, fontSize = 13.sp,
|
||||||
WavetableEditor(vm, slot)
|
modifier = Modifier.pointerInput(Unit) { detectTapGestures { onClose() } })
|
||||||
DevicePanels(vm, slot, DeviceLayouts.pagesFor(type))
|
|
||||||
}
|
|
||||||
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))
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (pinnedBottom) {
|
// Preset browser: load / save / import / share for this device.
|
||||||
Box(Modifier.fillMaxWidth().height(2.dp).background(c.accent)) // fixed divider
|
PresetBar(vm, slot)
|
||||||
if (type == ToolboxType.SAMPLER) {
|
|
||||||
SamplerPadBank(vm, slot, samplerPad, onSelect = { samplerPad = it }, Modifier.weight(1f))
|
// The Synth / Sampler / SoundFont / Delay / tape and glitch effects have
|
||||||
} else {
|
// bespoke editors; everything else is grouped cards ([DevicePanels]), with
|
||||||
SlotAuditionKeyboard(vm, slot, Modifier.weight(1f))
|
// 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))
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -7,10 +7,12 @@ import androidx.activity.compose.rememberLauncherForActivityResult
|
|||||||
import androidx.activity.result.contract.ActivityResultContracts
|
import androidx.activity.result.contract.ActivityResultContracts
|
||||||
import androidx.compose.foundation.Canvas
|
import androidx.compose.foundation.Canvas
|
||||||
import androidx.compose.foundation.background
|
import androidx.compose.foundation.background
|
||||||
import androidx.compose.foundation.layout.Arrangement
|
import androidx.compose.foundation.border
|
||||||
import androidx.compose.foundation.layout.Column
|
import androidx.compose.foundation.clickable
|
||||||
|
import androidx.compose.foundation.layout.Box
|
||||||
import androidx.compose.foundation.layout.fillMaxWidth
|
import androidx.compose.foundation.layout.fillMaxWidth
|
||||||
import androidx.compose.foundation.layout.height
|
import androidx.compose.foundation.layout.height
|
||||||
|
import androidx.compose.foundation.layout.padding
|
||||||
import androidx.compose.material3.AlertDialog
|
import androidx.compose.material3.AlertDialog
|
||||||
import androidx.compose.material3.Text
|
import androidx.compose.material3.Text
|
||||||
import androidx.compose.material3.TextButton
|
import androidx.compose.material3.TextButton
|
||||||
@@ -21,28 +23,76 @@ import androidx.compose.runtime.remember
|
|||||||
import androidx.compose.runtime.setValue
|
import androidx.compose.runtime.setValue
|
||||||
import androidx.compose.ui.Modifier
|
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.RectangleShape
|
||||||
import androidx.compose.ui.platform.LocalContext
|
import androidx.compose.ui.platform.LocalContext
|
||||||
import androidx.compose.ui.text.font.FontFamily
|
import androidx.compose.ui.text.font.FontFamily
|
||||||
import androidx.compose.ui.unit.dp
|
import androidx.compose.ui.unit.dp
|
||||||
import androidx.compose.ui.unit.sp
|
import androidx.compose.ui.unit.sp
|
||||||
import cc.tiredsysadmin.android.sizzle.model.ToolboxSlot
|
import cc.tiredsysadmin.android.sizzle.model.ToolboxSlot
|
||||||
import cc.tiredsysadmin.android.sizzle.ui.AppViewModel
|
import cc.tiredsysadmin.android.sizzle.ui.AppViewModel
|
||||||
import cc.tiredsysadmin.android.sizzle.ui.components.RetroButton
|
|
||||||
import cc.tiredsysadmin.android.sizzle.ui.theme.LocalRetro
|
import cc.tiredsysadmin.android.sizzle.ui.theme.LocalRetro
|
||||||
import cc.tiredsysadmin.android.sizzle.wavetable.WaveDefs
|
import cc.tiredsysadmin.android.sizzle.wavetable.WaveDefs
|
||||||
import cc.tiredsysadmin.android.sizzle.wavetable.WaveTables
|
import cc.tiredsysadmin.android.sizzle.wavetable.WaveTables
|
||||||
|
|
||||||
/**
|
/*
|
||||||
* The Wavetable's table strip: LOAD TABLE (a Serum / WaveEdit / power-of-two-frame
|
* The Wavetable's own pieces inside its generic cards (see DeviceLayouts): each
|
||||||
* WAV becomes the "Custom" table) and a view of oscillator 1's table, every frame
|
* oscillator card draws that oscillator's table ([WavetablePreview], via
|
||||||
* stacked back to front with the one at its POSITION lit.
|
* [Viz.Wavetable]), and Oscillator 1's card carries LOAD TABLE ([LoadTableAction]),
|
||||||
|
* because a loaded WAV becomes the "Custom" table and is selected on oscillator 1.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
/** Every frame of oscillator [osc]'s table stacked back to front, the one at its POSITION lit. */
|
||||||
@Composable
|
@Composable
|
||||||
fun WavetableEditor(vm: AppViewModel, slot: ToolboxSlot) {
|
fun WavetablePreview(slot: ToolboxSlot, osc: Int, tone: Color, rev: Int) {
|
||||||
|
val c = LocalRetro.current
|
||||||
|
val name = slot.string("o${osc}table", WaveDefs.TABLES[0])
|
||||||
|
val frame = slot.string("wtframe", WaveDefs.FRAME_SIZES[0]).toIntOrNull() ?: 0
|
||||||
|
val table = if (name == WaveTables.CUSTOM) WaveTables.forSample(slot.string(WaveDefs.SAMPLE_KEY), frame) else WaveTables.factory(name)
|
||||||
|
val pos = slot.float("o${osc}pos", 0f)
|
||||||
|
val caption = if (table == null) "$name (preparing…)"
|
||||||
|
else "${if (name == WaveTables.CUSTOM) "your table" else name} · ${table.frames} frames"
|
||||||
|
|
||||||
|
Box(Modifier.fillMaxWidth().height(72.dp).background(c.background).border(1.dp, c.grid, RectangleShape)) {
|
||||||
|
if (table != null) {
|
||||||
|
// 128 points of each frame's richest level, stacked; recomputed per table only
|
||||||
|
val curves = remember(table) {
|
||||||
|
val n = table.size(0); val step = maxOf(1, table.frames / 16)
|
||||||
|
(0 until table.frames step step).map { f -> FloatArray(128) { i -> table.data[0][f * n + i * n / 128] } to f }
|
||||||
|
}
|
||||||
|
val lit = (pos * (table.frames - 1) + 0.5f).toInt()
|
||||||
|
Canvas(Modifier.fillMaxWidth().height(72.dp)) {
|
||||||
|
if (rev < 0) return@Canvas // capture the revision so the drawing follows edits
|
||||||
|
val k = curves.size
|
||||||
|
val rowH = size.height * 0.45f
|
||||||
|
for ((idx, cf) in curves.withIndex().reversed()) {
|
||||||
|
val (pts, f) = cf
|
||||||
|
val depth = if (k > 1) idx.toFloat() / (k - 1) else 0f
|
||||||
|
val x0 = size.width * 0.04f + depth * size.width * 0.18f
|
||||||
|
val w = size.width * 0.76f
|
||||||
|
val yMid = size.height * 0.72f - depth * size.height * 0.45f
|
||||||
|
val near = kotlin.math.abs(f - lit) * 2 <= maxOf(1, table.frames / curves.size)
|
||||||
|
val col = if (near) tone else c.text.copy(alpha = 0.25f)
|
||||||
|
for (i in 1 until pts.size) {
|
||||||
|
drawLine(col,
|
||||||
|
Offset(x0 + w * (i - 1) / pts.size, yMid - pts[i - 1] * rowH * 0.5f),
|
||||||
|
Offset(x0 + w * i / pts.size, yMid - pts[i] * rowH * 0.5f),
|
||||||
|
strokeWidth = if (near) 2f else 1f)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
Text(caption, color = c.textDim, fontFamily = FontFamily.Monospace, fontSize = 9.sp,
|
||||||
|
modifier = Modifier.padding(horizontal = 4.dp, vertical = 2.dp))
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/** LOAD TABLE in Oscillator 1's title: a Serum / WaveEdit / power-of-two-frame WAV
|
||||||
|
* becomes the "Custom" table and is selected on oscillator 1. */
|
||||||
|
@Composable
|
||||||
|
fun LoadTableAction(vm: AppViewModel, slot: ToolboxSlot) {
|
||||||
val c = LocalRetro.current
|
val c = LocalRetro.current
|
||||||
val context = LocalContext.current
|
val context = LocalContext.current
|
||||||
@Suppress("UNUSED_VARIABLE") val rev = vm.revision
|
|
||||||
|
|
||||||
var importError by remember(slot.index) { mutableStateOf<String?>(null) }
|
var importError by remember(slot.index) { mutableStateOf<String?>(null) }
|
||||||
val picker = rememberLauncherForActivityResult(ActivityResultContracts.OpenDocument()) { uri ->
|
val picker = rememberLauncherForActivityResult(ActivityResultContracts.OpenDocument()) { uri ->
|
||||||
if (uri == null) return@rememberLauncherForActivityResult
|
if (uri == null) return@rememberLauncherForActivityResult
|
||||||
@@ -54,47 +104,13 @@ fun WavetableEditor(vm: AppViewModel, slot: ToolboxSlot) {
|
|||||||
"Couldn't load this wavetable. Use an uncompressed .wav (Serum, WaveEdit, or frames of 256–2048 samples)."
|
"Couldn't load this wavetable. Use an uncompressed .wav (Serum, WaveEdit, or frames of 256–2048 samples)."
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Text(
|
||||||
val name = slot.string("o1table", WaveDefs.TABLES[0])
|
"+ LOAD TABLE", color = c.accent, fontFamily = FontFamily.Monospace, fontSize = 11.sp,
|
||||||
val frame = slot.string("wtframe", WaveDefs.FRAME_SIZES[0]).toIntOrNull() ?: 0
|
modifier = Modifier
|
||||||
val table = if (name == WaveTables.CUSTOM) WaveTables.forSample(slot.string(WaveDefs.SAMPLE_KEY), frame) else WaveTables.factory(name)
|
.border(1.dp, c.accent.copy(alpha = 0.6f), RectangleShape)
|
||||||
val pos = slot.float("o1pos", 0f)
|
.clickable { picker.launch(arrayOf("*/*")) }
|
||||||
|
.padding(horizontal = 8.dp, vertical = 3.dp),
|
||||||
Column(Modifier.fillMaxWidth(), verticalArrangement = Arrangement.spacedBy(8.dp)) {
|
)
|
||||||
RetroButton("LOAD TABLE") { picker.launch(arrayOf("*/*")) }
|
|
||||||
Text(
|
|
||||||
if (table == null) "Osc 1: $name (preparing…)" else "Osc 1: ${if (name == WaveTables.CUSTOM) "your table" else name} · ${table.frames} frames",
|
|
||||||
color = c.textDim, fontFamily = FontFamily.Monospace, fontSize = 10.sp,
|
|
||||||
)
|
|
||||||
if (table != null) {
|
|
||||||
// 128 points of each frame's richest level, stacked; recomputed per table only
|
|
||||||
val curves = remember(table) {
|
|
||||||
val n = table.size(0); val step = maxOf(1, table.frames / 16)
|
|
||||||
(0 until table.frames step step).map { f -> FloatArray(128) { i -> table.data[0][f * n + i * n / 128] } to f }
|
|
||||||
}
|
|
||||||
val lit = (pos * (table.frames - 1) + 0.5f).toInt()
|
|
||||||
Canvas(Modifier.fillMaxWidth().height(110.dp).background(c.surface)) {
|
|
||||||
val k = curves.size
|
|
||||||
val rowH = size.height * 0.45f
|
|
||||||
for ((idx, cf) in curves.withIndex().reversed()) {
|
|
||||||
val (pts, f) = cf
|
|
||||||
val depth = if (k > 1) idx.toFloat() / (k - 1) else 0f
|
|
||||||
val x0 = size.width * 0.04f + depth * size.width * 0.18f
|
|
||||||
val w = size.width * 0.76f
|
|
||||||
val yMid = size.height * 0.72f - depth * size.height * 0.45f
|
|
||||||
val near = kotlin.math.abs(f - lit) * 2 <= maxOf(1, table.frames / curves.size)
|
|
||||||
val col = if (near) c.accent else c.text.copy(alpha = 0.25f)
|
|
||||||
for (i in 1 until pts.size) {
|
|
||||||
drawLine(col,
|
|
||||||
Offset(x0 + w * (i - 1) / pts.size, yMid - pts[i - 1] * rowH * 0.5f),
|
|
||||||
Offset(x0 + w * i / pts.size, yMid - pts[i] * rowH * 0.5f),
|
|
||||||
strokeWidth = if (near) 2f else 1f)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
importError?.let { msg ->
|
importError?.let { msg ->
|
||||||
AlertDialog(
|
AlertDialog(
|
||||||
onDismissRequest = { importError = null },
|
onDismissRequest = { importError = null },
|
||||||
|
|||||||
@@ -349,6 +349,17 @@ table). `DeviceLayoutsTest` checks that every parameter of every laid-out device
|
|||||||
is on exactly one card and that knob labels stay short. A device missing from
|
is on exactly one card and that knob labels stay short. A device missing from
|
||||||
`DeviceLayouts` falls back to one card with all its parameters.
|
`DeviceLayouts` falls back to one card with all its parameters.
|
||||||
|
|
||||||
|
**Fit above the keyboard (0.36.1).** Instruments pin an audition keyboard, which
|
||||||
|
leaves the editor about 460 dp on a 20:9 phone, of which the title, preset bar and
|
||||||
|
tab strip take about 170. A page should therefore stay under ~290 dp (one card
|
||||||
|
with a drawing, a choice row and a knob row is ~230; two such cards don't fit).
|
||||||
|
That is why the Wavetable has one oscillator per tab and separate AMP and MOD
|
||||||
|
tabs (with more than five tabs the labels drop to 10 sp, so they fit the narrower
|
||||||
|
landscape column). Its table drawing is a `Viz.Wavetable(osc)` inside each oscillator card
|
||||||
|
(`WavetablePreview`), and LOAD TABLE is a `Panel.action` in Oscillator 1's title
|
||||||
|
(`LoadTableAction`, WavetableEditor.kt). Tabs share the strip's width (up to
|
||||||
|
seven fit) instead of scrolling sideways.
|
||||||
|
|
||||||
**Recomposition pitfall (fixed in 0.35.1).** Slot params live in a plain map that
|
**Recomposition pitfall (fixed in 0.35.1).** Slot params live in a plain map that
|
||||||
Compose can't observe; edits bump `vm.revision` instead. Because the compiler's
|
Compose can't observe; edits bump `vm.revision` instead. Because the compiler's
|
||||||
strong skipping compares `vm`/`slot` by identity, a child composable that receives
|
strong skipping compares `vm`/`slot` by identity, a child composable that receives
|
||||||
@@ -810,6 +821,9 @@ polish and interchange niceties, not functional gaps.
|
|||||||
the same sum).
|
the same sum).
|
||||||
- **Responsive landscape layout** ✓ (`ui/Responsive.kt`): nav rail, side-by-side
|
- **Responsive landscape layout** ✓ (`ui/Responsive.kt`): nav rail, side-by-side
|
||||||
screens, two-column mixer/editors, wider on-screen keyboards for tablets/handhelds.
|
screens, two-column mixer/editors, wider on-screen keyboards for tablets/handhelds.
|
||||||
|
Instrument editors (`ParamEditor` in ToolboxScreen.kt) pin their audition
|
||||||
|
keyboard, or the Sampler's pads, on the right in landscape at the Toolbox tab's
|
||||||
|
1 : 1.3 split, and below the controls in portrait (1.7 : 1) (0.36.2).
|
||||||
- **Arrangement niceties** ✓: 256-bar canvas with viewport-culled drawing,
|
- **Arrangement niceties** ✓: 256-bar canvas with viewport-culled drawing,
|
||||||
per-lane mutes, and centre-follow scrolling.
|
per-lane mutes, and centre-follow scrolling.
|
||||||
- **Per-bus soft-clip limiter** ✓, sampler QoL (fire-on-tap, clear, normalize),
|
- **Per-bus soft-clip limiter** ✓, sampler QoL (fire-on-tap, clear, normalize),
|
||||||
|
|||||||
+3
-2
@@ -227,7 +227,7 @@ The keyboard pinned at the bottom of the Toolbox auditions the current device.
|
|||||||
**Device editors.** Controls are grouped into cards by what they do, each with its
|
**Device editors.** Controls are grouped into cards by what they do, each with its
|
||||||
own colour: amber for the sound source, green for the filter, pink for envelopes,
|
own colour: amber for the sound source, green for the filter, pink for envelopes,
|
||||||
violet for modulation, white for output and mix. Bigger devices split their cards
|
violet for modulation, white for output and mix. Bigger devices split their cards
|
||||||
into tabs along the top (Wavetable: OSC · VOICE · FILTER · ENV · LFO). Drag a knob
|
into tabs along the top (Wavetable: OSC 1 · OSC 2 · VOICE · FILTER · AMP · MOD · LFO). Drag a knob
|
||||||
up or down to turn it, double‑tap it to reset; short choices are switches you tap.
|
up or down to turn it, double‑tap it to reset; short choices are switches you tap.
|
||||||
Envelope, filter and LFO cards draw their shape and follow the knobs as you turn
|
Envelope, filter and LFO cards draw their shape and follow the knobs as you turn
|
||||||
them. The 10‑Band EQ is a row of vertical faders (double‑tap one to flatten it).
|
them. The 10‑Band EQ is a row of vertical faders (double‑tap one to flatten it).
|
||||||
@@ -313,7 +313,8 @@ WAV made of frames of 256 to 2048 samples (set **Frame Size** if it guesses wron
|
|||||||
oscillator 1 then plays it as **Custom**. **Bend** sharpens a wave without changing
|
oscillator 1 then plays it as **Custom**. **Bend** sharpens a wave without changing
|
||||||
its pitch, **Unison** stacks up to four detuned copies (**Spread**), and there is a
|
its pitch, **Unison** stacks up to four detuned copies (**Spread**), and there is a
|
||||||
**Sub** sine, **Noise**, a **Filter** with its own envelope amount and **Drive**.
|
**Sub** sine, **Noise**, a **Filter** with its own envelope amount and **Drive**.
|
||||||
The table view shows oscillator 1's frames, the one at its position lit.
|
Each oscillator's tab draws its table's frames, the one at its position lit;
|
||||||
|
**LOAD TABLE** is in oscillator 1's title, with **Frame** below its table.
|
||||||
|
|
||||||
### Effects
|
### Effects
|
||||||
|
|
||||||
|
|||||||
+2
-2
@@ -8,8 +8,8 @@
|
|||||||
# or polish. android.versionCode is monotonic and bumps by 1 on every release,
|
# or polish. android.versionCode is monotonic and bumps by 1 on every release,
|
||||||
# because F-Droid and the Android package manager order installs by it alone.
|
# because F-Droid and the Android package manager order installs by it alone.
|
||||||
|
|
||||||
android.versionName = 0.36.0
|
android.versionName = 0.36.2
|
||||||
android.versionCode = 68
|
android.versionCode = 70
|
||||||
|
|
||||||
# No desktop builds exist yet. These lines are the agreed slots so a port starts
|
# No desktop builds exist yet. These lines are the agreed slots so a port starts
|
||||||
# with a version instead of inventing one; `-` means "not built on this
|
# with a version instead of inventing one; `-` means "not built on this
|
||||||
|
|||||||
Reference in New Issue
Block a user