Publish VCC Plus OSS source distribution for 3.6.2 build 60
This commit is contained in:
commit
c652a5276d
1192 files changed
+272368
No files matched your search
@@ -0,0 +1,139 @@
|
||||
// SPDX-License-Identifier: GPL-3.0-or-later
|
||||
import SwiftUI
|
||||
import Combine
|
||||
|
||||
struct CassetteControlsView: View {
|
||||
@ObservedObject var machine: MachineModel
|
||||
@State private var tapeSeek: Double = 0
|
||||
@State private var seeking = false
|
||||
private let refresh = Timer.publish(every: 0.1, on: .main, in: .common).autoconnect()
|
||||
|
||||
var body: some View {
|
||||
VStack(spacing: 0) {
|
||||
SecondaryHeader(title: "Cassette", badge: "cassette").padding(20)
|
||||
Divider()
|
||||
ScrollView {
|
||||
VStack(alignment: .leading, spacing: 18) {
|
||||
SecondaryCard {
|
||||
VStack(alignment: .leading, spacing: 18) {
|
||||
HStack(spacing: 12) {
|
||||
Image(systemName: "recordingtape").font(.system(size: 26)).foregroundStyle(.secondary)
|
||||
.accessibilityHidden(true)
|
||||
VStack(alignment: .leading, spacing: 4) {
|
||||
Text(machine.tapeName).font(.headline).lineLimit(1).truncationMode(.middle)
|
||||
Text(machine.tapeTransportDescription).font(.callout).foregroundStyle(.secondary)
|
||||
.accessibilityIdentifier("cassette-transport-status")
|
||||
}.frame(maxWidth: .infinity, alignment: .leading)
|
||||
SecondaryAction(title: "Insert…", systemImage: "folder", action: machine.openTape)
|
||||
.disabled(machine.tapeDirty).accessibilityIdentifier("cassette-insert")
|
||||
}
|
||||
HStack(spacing: 12) {
|
||||
Spacer(minLength: 0)
|
||||
CassetteTransportButton(title: "Rewind", symbol: "backward.end.fill") { machine.tapeAction(2) }
|
||||
.disabled(!machine.tapeMounted).accessibilityIdentifier("cassette-rewind")
|
||||
CassetteTransportButton(title: "Play", symbol: "play.fill", prominent: machine.tapeMode == 0) { machine.tapeAction(1) }
|
||||
.disabled(!machine.tapeMounted || machine.tapeMode == 2).accessibilityIdentifier("cassette-play")
|
||||
CassetteTransportButton(title: "Stop", symbol: "stop.fill", prominent: machine.tapeMode != 0) { machine.tapeAction(0) }
|
||||
.disabled(!machine.tapeMounted).accessibilityIdentifier("cassette-stop")
|
||||
CassetteTransportButton(title: "Eject", symbol: "eject.fill") { machine.tapeAction(3) }
|
||||
.disabled(!machine.tapeMounted || machine.tapeDirty).accessibilityIdentifier("cassette-eject")
|
||||
Spacer(minLength: 0)
|
||||
}
|
||||
VStack(spacing: 4) {
|
||||
Slider(value: $tapeSeek, in: 0...Double(max(1, machine.tapeLength)), onEditingChanged: { editing in
|
||||
seeking = editing
|
||||
if !editing { machine.seekTape(tapeSeek) }
|
||||
}).accessibilityLabel("Tape position").disabled(!machine.tapeMounted || machine.tapeMode == 2)
|
||||
HStack {
|
||||
Text("Tape position")
|
||||
Spacer()
|
||||
Text("\(machine.tapePosition) / \(machine.tapeLength) \(machine.tapeWAV ? "samples" : "bytes")")
|
||||
.monospacedDigit()
|
||||
}.font(.caption).foregroundStyle(.secondary)
|
||||
}
|
||||
Divider()
|
||||
HStack {
|
||||
Menu {
|
||||
Button("CAS") { machine.tapeAction(4) }
|
||||
Button("WAV") { machine.tapeAction(5) }
|
||||
} label: { Label("New Recording", systemImage: "record.circle") }
|
||||
.fixedSize().disabled(machine.tapeDirty).accessibilityIdentifier("cassette-new-recording")
|
||||
SecondaryAction(title: "Export Tape…", systemImage: "square.and.arrow.up", action: machine.exportTape)
|
||||
.disabled(!machine.tapeMounted).accessibilityIdentifier("cassette-export")
|
||||
Spacer()
|
||||
Toggle("Fast CAS", isOn: Binding(get: { machine.tapeFast }, set: machine.setFastTape))
|
||||
.disabled(machine.tapeMode != 0)
|
||||
.help("Accelerate supported CAS loads. Change this while the transport is stopped.")
|
||||
}
|
||||
recordingNotice
|
||||
}
|
||||
}.disabled(machine.busy || machine.state == .closed)
|
||||
HStack(spacing: 12) {
|
||||
Label("App sound", systemImage: "speaker.wave.2")
|
||||
Toggle("Sound", isOn: Binding(get: { machine.audioEnabled }, set: machine.setAudio))
|
||||
.labelsHidden().accessibilityLabel("Sound")
|
||||
Slider(value: $machine.volume, in: 0...1, onEditingChanged: { editing in
|
||||
if !editing { machine.setAudio(machine.audioEnabled) }
|
||||
}).frame(maxWidth: 220).accessibilityLabel("Volume")
|
||||
Text(machine.volume == 0 ? "Muted" : "\(Int((machine.volume * 100).rounded()))%")
|
||||
.monospacedDigit().frame(width: 45, alignment: .leading).foregroundStyle(.secondary)
|
||||
Spacer(minLength: 0)
|
||||
Text("All CoCo audio").font(.caption).foregroundStyle(.secondary)
|
||||
}.disabled(machine.busy)
|
||||
SecondaryHelp(title: "Recording and tape options") {
|
||||
Text("New Recording creates an in-memory CAS or WAV tape and replaces the inserted tape. Export writes a Mac file. An unsaved recording must be exported or explicitly discarded before replacement.")
|
||||
Text("Position counts bytes for CAS and samples for WAV. Rewind returns to the beginning; the position slider can seek when transport rules permit. Cue/fast-forward and independent tape pause are not available.")
|
||||
Text("Fast CAS accelerates supported ROM load routines. Volume and Sound affect all emulator audio, including cartridges, not just the tape.")
|
||||
}
|
||||
if let error = machine.fileError ?? machine.error { Text(error).foregroundStyle(.red).textSelection(.enabled) }
|
||||
}.padding(20)
|
||||
}.modifier(MediaDropTarget(machine: machine, destination: .cassette))
|
||||
Divider()
|
||||
HStack(alignment: .top, spacing: 10) {
|
||||
Image(systemName: "info.circle").foregroundStyle(.secondary)
|
||||
VStack(alignment: .leading, spacing: 4) {
|
||||
Text("Play readies the tape. The CoCo starts its motor.").font(.callout)
|
||||
Text("Closing this window preserves transport and unsaved recordings.")
|
||||
.font(.caption).foregroundStyle(.secondary)
|
||||
}
|
||||
Spacer(minLength: 0)
|
||||
}.padding(20)
|
||||
}.frame(minWidth: 680, minHeight: 460)
|
||||
.onReceive(refresh) { _ in machine.poll() }
|
||||
.onAppear { tapeSeek = Double(machine.tapePosition) }
|
||||
.onChange(of: machine.tapePosition) { _, position in if !seeking { tapeSeek = Double(position) } }
|
||||
.onChange(of: machine.tapeLength) { _, _ in if !seeking { tapeSeek = Double(machine.tapePosition) } }
|
||||
}
|
||||
|
||||
private var recordingNotice: some View {
|
||||
HStack {
|
||||
Label(machine.tapeDirty || machine.tapeMode == 2 ? "Recording needs export to keep it" : "Recordings are saved only when you export them", systemImage: machine.tapeDirty || machine.tapeMode == 2 ? "exclamationmark.circle" : "info.circle")
|
||||
.foregroundStyle(machine.tapeDirty || machine.tapeMode == 2 ? Color.orange : Color.secondary)
|
||||
.font(.caption).fixedSize(horizontal: false, vertical: true)
|
||||
Spacer(minLength: 8)
|
||||
if machine.tapeDirty || machine.tapeMode == 2 {
|
||||
SecondaryAction(title: "Discard…", systemImage: "minus.circle", action: machine.discardTape)
|
||||
.accessibilityIdentifier("cassette-discard")
|
||||
}
|
||||
}.frame(minHeight: 24).accessibilityIdentifier("cassette-recording-status")
|
||||
}
|
||||
}
|
||||
|
||||
private struct CassetteTransportButton: View {
|
||||
let title: String
|
||||
let symbol: String
|
||||
var prominent = false
|
||||
let action: () -> Void
|
||||
private var label: some View {
|
||||
VStack(spacing: 6) {
|
||||
Image(systemName: symbol).font(.system(size: 19, weight: .medium)).frame(height: 23)
|
||||
Text(title).font(.callout).fontWeight(.medium)
|
||||
}.frame(width: 72, height: 54)
|
||||
}
|
||||
var body: some View {
|
||||
Group {
|
||||
if prominent { Button(action: action) { label }.buttonStyle(.borderedProminent) }
|
||||
else { Button(action: action) { label }.buttonStyle(.bordered) }
|
||||
}.accessibilityLabel(title)
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user