Cover cropper with zoom and output size for both playlist types, lyrics Vocals/Softness turn karaoke on (build 65)
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
1 parent
b10528d69c
commit
ac363ea0f7
6 files changed
+182
-12
No files matched your search
@@ -581,14 +581,16 @@ final class PlaybackManager: StemEngineListener, @unchecked Sendable {
|
||||
|
||||
var karaokeVocals: KaraokeVocals { KaraokeVocals(rawValue: settings.karaokeVocals) ?? .Off }
|
||||
|
||||
func setKaraokeVocals(_ v: KaraokeVocals) {
|
||||
/// [engage] (from the lyrics panel) turns karaoke on, so the choice is heard even if lyrics were opened without it.
|
||||
func setKaraokeVocals(_ v: KaraokeVocals, engage: Bool = false) {
|
||||
settings.karaokeVocals = v.rawValue
|
||||
if karaoke { applyMix(karaokeMix) }
|
||||
if karaoke { applyMix(karaokeMix) } else if engage { setKaraoke(true) }
|
||||
}
|
||||
|
||||
func setKaraokeSoftDb(_ db: Int) {
|
||||
func setKaraokeSoftDb(_ db: Int, engage: Bool = false) {
|
||||
settings.karaokeSoftDb = db
|
||||
if karaoke && karaokeVocals == .Soft { applyMix(karaokeMix) }
|
||||
guard karaokeVocals == .Soft else { return }
|
||||
if karaoke { applyMix(karaokeMix) } else if engage { setKaraoke(true) }
|
||||
}
|
||||
|
||||
/// Turning it off puts back the song's saved mix, or the one from before, unless the mix was changed meanwhile.
|
||||
|
||||
@@ -88,10 +88,11 @@ final class StemPlaylists {
|
||||
/// Saves [data] (any image format Photos hands over) as the list's cover, scaled to 1200 px.
|
||||
/// Each pick gets a new file name so cached art doesn't show the old one.
|
||||
@discardableResult
|
||||
/// A picked photo as a JPEG no bigger than 1200 px a side.
|
||||
/// A picked photo as a JPEG no bigger than 2000 px a side. The cropper's JPEGs pass through as they are.
|
||||
static func coverJpeg(_ data: Data) -> Data? {
|
||||
guard let img = UIImage(data: data) else { return nil }
|
||||
let side: CGFloat = 1200
|
||||
let side: CGFloat = 2000
|
||||
if data.starts(with: [0xFF, 0xD8]), max(img.size.width, img.size.height) <= side { return data }
|
||||
let scale = min(1, side / max(img.size.width, img.size.height, 1))
|
||||
let size = CGSize(width: (img.size.width * scale).rounded(), height: (img.size.height * scale).rounded())
|
||||
let fmt = UIGraphicsImageRendererFormat.default(); fmt.scale = 1
|
||||
|
||||
Reference in new issue
Block a user