Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fixed error on compilation of SpectrogramFlatView/UIColor+intermediate.swift for macOS #85

Merged
merged 2 commits into from
Mar 20, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,19 @@ Steps involved:
this implementation caches the resulting image.


Suggested next steps on development:
* Layout and draw the slices directly on a Canvas (instead of HStack) and independently move the Canvas left.
* Make class compatible with macOS
- Drawing with Canvas instead of UIGraphicsImageRenderer
(caching of UIImage no longer needed if callback can draw directly on one Canvas)
- CrossPlatformColor from Waveform.swift or Color.Resolved instead of UIColor for gradient lookup
* Add some parameters that can be changed while the spectrogram is running
- Pause so user can have a close look at the analyzed past
- Gain or sensitivity
- Speed of the rolling plot / detail frequency by adjusting fftSize
- Min and max frequency shown


Cause of inefficiency of this implementation
* Each time a new slice arrives from FFTTap, the view gets a complete layout update.
* Rendering of new slices is done on a background thread and involves too many steps
Expand Down Expand Up @@ -66,6 +79,8 @@ Steps involved:
import AudioKit
import SwiftUI

#if !os(macOS) || targetEnvironment(macCatalyst)

/// Displays a rolling plot of the frequency spectrum.
///
/// Each slice represents a point in time with the frequencies shown from bottom to top
Expand Down Expand Up @@ -145,3 +160,5 @@ struct SpectrogramFlatView_Previews: PreviewProvider {
return SpectrogramFlatView(node: Mixer())
}
}

#endif
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
// Copyright AudioKit. All Rights Reserved. Revision History at http://github.com/AudioKit/AudioKitUI/
//

#if !os(macOS) || targetEnvironment(macCatalyst)

import AudioKit
import SwiftUI

Expand Down Expand Up @@ -168,3 +170,5 @@ class SpectrogramFlatModel: ObservableObject {
}

}

#endif
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
// Copyright AudioKit. All Rights Reserved. Revision History at http://github.com/AudioKit/AudioKitUI/

#if !os(macOS) || targetEnvironment(macCatalyst)

import SwiftUI

/// One slice with frequencies from low frequencies at the bottom up to high frequences.
Expand Down Expand Up @@ -286,3 +288,5 @@ struct SpectrogramSlice_Previews: PreviewProvider {
).scaleEffect(x: 1, y: -1)
}
}

#endif
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
// Copyright AudioKit. All Rights Reserved. Revision History at http://github.com/AudioKit/AudioKitUI/

#if !os(macOS) || targetEnvironment(macCatalyst)

import Foundation
import UIKit

Expand Down Expand Up @@ -38,3 +40,5 @@ extension Array where Element: UIColor {
}
}
}

#endif
Loading