Skip to content

Commit

Permalink
Merge branch 'main' into develop
Browse files Browse the repository at this point in the history
# Conflicts:
#	Sources/AudioKitUI/Helpers/AudioKitUIHelpers.swift
  • Loading branch information
aure committed Mar 16, 2022
2 parents e16fc19 + 6e68c1f commit b9d8f93
Show file tree
Hide file tree
Showing 7 changed files with 16 additions and 17 deletions.
4 changes: 2 additions & 2 deletions Package.resolved
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,8 @@
"repositoryURL": "https://github.com/AudioKit/AudioKit.git",
"state": {
"branch": null,
"revision": "94ed6b8934db8fed4b1cf387a507e36168b05bf1",
"version": "5.3.2"
"revision": "86c9285d673baa7f7955e8f2c1550e5e9740bada",
"version": "5.3.3"
}
}
]
Expand Down
3 changes: 2 additions & 1 deletion Sources/AudioKitUI/Helpers/AudioKitUIHelpers.swift
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,8 @@ import AVFoundation
import AudioKit
import SwiftUI


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

struct DeviceRotationViewModifier: ViewModifier {
Expand All @@ -24,7 +26,6 @@ extension View {
self.modifier(DeviceRotationViewModifier(action: action))
}
}

#endif

extension Shape {
Expand Down
4 changes: 2 additions & 2 deletions Sources/AudioKitUI/Visualizations/AmplitudeView.swift
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ class AmplitudeModel: ObservableObject {
}
}

struct AmplitudeView: View {
public struct AmplitudeView: View {
@StateObject var amplitudeModel = AmplitudeModel()
var node: Node
@State var stereoMode: StereoMode = .center
Expand Down Expand Up @@ -58,7 +58,7 @@ struct AmplitudeView: View {
self._numberOfSegments = State(initialValue: numberOfSegments)
}

var body: some View {
public var body: some View {
let isClipping = amplitudeModel.amplitude >= 1.0 ? true : false
let numberOfBlackSegments = numberOfSegments - 1

Expand Down
2 changes: 1 addition & 1 deletion Sources/AudioKitUI/Visualizations/FFTView.swift
Original file line number Diff line number Diff line change
Expand Up @@ -116,7 +116,7 @@ public struct FFTView: View {

public var body: some View {
HStack(spacing: 0.0) {
ForEach(0 ..< barCount) {
ForEach(0 ..< barCount, id: \.self) {
if $0 < fft.amplitudes.count {
if let amplitude = fft.amplitudes[$0] {
AmplitudeBar(amplitude: amplitude,
Expand Down
8 changes: 3 additions & 5 deletions Sources/AudioKitUI/Visualizations/NodeFFTView.swift
Original file line number Diff line number Diff line change
Expand Up @@ -19,18 +19,16 @@ public struct NodeFFTView: ViewRepresentable {
internal var plot: FloatPlot {
nodeTap.start()

let isFFT = false
let isCentered = false
let metalFragmentOrig = """
float sample = waveform.sample(s, \(isFFT ? "(pow(10, in.t.x) - 1.0) / 9.0" : "in.t.x")).x;
float sample = waveform.sample(s, (pow(10, in.t.x) - 1.0) / 9.0).x;
half4 backgroundColor = half4(colorParameters[1]);
half4 foregroundColor = half4(colorParameters[0]);
float y = (in.t.y - \(isCentered ? 0.5 : 1));
float y = (in.t.y - 1);
bool isFilled = parameters[0] != 0;
float d = isFilled ? fmax(fabs(y) - fabs(sample), 0) : fabs(y - sample);
float alpha = \(isFFT ? "fabs(1/(50 * d))" : "smoothstep(0.01, 0.04, d)");
float alpha = fabs(1/(50 * d));
return { mix(foregroundColor, backgroundColor, alpha) };
"""

Expand Down
4 changes: 2 additions & 2 deletions Sources/AudioKitUI/Visualizations/SpectrogramView.swift
Original file line number Diff line number Diff line change
Expand Up @@ -164,7 +164,7 @@ class SpectrogramModel: ObservableObject {

// MARK: SpectrogramView

struct SpectrogramView: View {
public struct SpectrogramView: View {
@StateObject var spectrogram = SpectrogramModel()
var node: Node

Expand All @@ -175,7 +175,7 @@ struct SpectrogramView: View {
@State var sideColor = Color.white.opacity(0.2)
@State var backgroundColor = Color.black

var body: some View {
public var body: some View {
let xOffset = CGFloat(0.22) / CGFloat(spectrogram.fftDataReadings.maxItems)
let yOffset = CGFloat(-0.8) / CGFloat(spectrogram.fftDataReadings.maxItems)

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -167,7 +167,7 @@ class SpectrumModel: ObservableObject {

// MARK: SpectrumView

struct SpectrumView: View {
public struct SpectrumView: View {
@StateObject var spectrum = SpectrumModel()
var node: Node
@State var frequencyDisplayed: CGFloat = 100.0
Expand Down Expand Up @@ -316,7 +316,7 @@ struct SpectrumView: View {
}

return ZStack {
ForEach(1..<mappedPoints.count) {
ForEach(1..<mappedPoints.count, id: \.self) {
if mappedPoints[$0].x > 0.00001 {
Circle()
.fill(plotPointColor)
Expand Down Expand Up @@ -391,7 +391,7 @@ struct HorizontalAxis: View {

return ZStack {
GeometryReader { geo in
ForEach(0..<verticalLineXLocationsMapped.count) { i in
ForEach(0..<verticalLineXLocationsMapped.count, id: \.self) { i in
Path { path in
path.move(to: CGPoint(x: verticalLineXLocationsMapped[i] * geo.size.width, y: 0.0))
path.addLine(to: CGPoint(x: verticalLineXLocationsMapped[i] * geo.size.width, y: geo.size.height))
Expand Down Expand Up @@ -436,7 +436,7 @@ struct VerticalAxis: View {

return ZStack {
GeometryReader { geo in
ForEach(0..<horizontalLineYLocationsMapped.count) { i in
ForEach(0..<horizontalLineYLocationsMapped.count, id: \.self) { i in
if horizontalLineYLocationsMapped[i] > 0.0 && horizontalLineYLocationsMapped[i] < 1.0 {
MorphableShape(controlPoints: AnimatableVector(with: locationData[i].locationData))
.stroke(Color(red: 1.0, green: 1.0, blue: 1.0, opacity: 0.4))
Expand Down

0 comments on commit b9d8f93

Please sign in to comment.