Skip to content

Commit ea49026

Browse files
committed
fix: #11 & add bottom bar
1 parent a82ca3c commit ea49026

File tree

2 files changed

+9
-8
lines changed

2 files changed

+9
-8
lines changed

MVTouchbar/MVTouchbar/barsScene.swift

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -159,8 +159,9 @@ class barsScene: SKScene {
159159

160160
func levelFor(group: Int, level: Int) {
161161
guard allNodes.count == 100 else { return }
162-
163-
for i in 0...level { // Reveal all needed nodes
162+
guard level > 0 else { return }
163+
164+
for i in 1...level { // Reveal all needed nodes
164165
if i > 10 {
165166
continue
166167
}

MVTouchbar/MVTouchbar/volume.swift

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -116,25 +116,25 @@ public class volume {
116116
case 2:
117117
let s = powf(peaks.max()!, 0.1)
118118
for i in 0...99 { // Number of frequencies in each loudness level varies logarithmically
119-
if peaks[i] == 0.0 {
119+
if peaks[i] <= 1 {
120120
finalPeaks.append(1)
121121
continue
122122
}
123123
var peak = logA(x: peaks[i], ofBase: s)
124124
if(peak.isNaN){
125125
peak = 1.0
126126
}
127-
if peak < 0.0 {
128-
peak = 1.0
129-
}
130127

131128
if peak > 10.0 {
132129
peak = peak/10
133130
}
134-
131+
if peak <= 0.5 {
132+
peak = 1.0
133+
}
134+
135135
finalPeaks.append(Int(peak))
136136
}
137-
print(finalPeaks)
137+
// print(peaks.max() ?? -1)
138138
default:
139139
fatalError() //should never default
140140
break

0 commit comments

Comments
 (0)