Skip to content

Commit bc3ca0f

Browse files
author
Danilo Campana Fuchs
committed
Scala™
1 parent a88e147 commit bc3ca0f

File tree

4 files changed

+50
-2
lines changed

4 files changed

+50
-2
lines changed

ForceTouchPlayer.xcodeproj/project.pbxproj

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@
1212
311A7A9E252D08660072A16B /* Assets.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = 311A7A9D252D08660072A16B /* Assets.xcassets */; };
1313
311A7AA1252D08660072A16B /* Preview Assets.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = 311A7AA0252D08660072A16B /* Preview Assets.xcassets */; };
1414
311A7AA4252D08660072A16B /* Main.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 311A7AA2252D08660072A16B /* Main.storyboard */; };
15+
317A217C2541277B00A96DF2 /* CMajorScale.swift in Sources */ = {isa = PBXBuildFile; fileRef = 317A217B2541277B00A96DF2 /* CMajorScale.swift */; };
1516
31A156D32530030800777E42 /* HappyBirthday.swift in Sources */ = {isa = PBXBuildFile; fileRef = 31A156D22530030800777E42 /* HappyBirthday.swift */; };
1617
31A156D525300B6B00777E42 /* Extensions.swift in Sources */ = {isa = PBXBuildFile; fileRef = 31A156D425300B6B00777E42 /* Extensions.swift */; };
1718
31ED484D252FE058002B9BAD /* Song.swift in Sources */ = {isa = PBXBuildFile; fileRef = 31ED484C252FE058002B9BAD /* Song.swift */; };
@@ -31,6 +32,7 @@
3132
311A7AA3252D08660072A16B /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; name = Base; path = Base.lproj/Main.storyboard; sourceTree = "<group>"; };
3233
311A7AA5252D08660072A16B /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = "<group>"; };
3334
311A7AA6252D08660072A16B /* ForceTouchPlayer.entitlements */ = {isa = PBXFileReference; lastKnownFileType = text.plist.entitlements; path = ForceTouchPlayer.entitlements; sourceTree = "<group>"; };
35+
317A217B2541277B00A96DF2 /* CMajorScale.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = CMajorScale.swift; sourceTree = "<group>"; };
3436
31A156D22530030800777E42 /* HappyBirthday.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = HappyBirthday.swift; sourceTree = "<group>"; };
3537
31A156D425300B6B00777E42 /* Extensions.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = Extensions.swift; sourceTree = "<group>"; };
3638
31ED484C252FE058002B9BAD /* Song.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = Song.swift; sourceTree = "<group>"; };
@@ -102,6 +104,7 @@
102104
31A156D22530030800777E42 /* HappyBirthday.swift */,
103105
7DDC3567253DC8D000F48DCD /* ImperialMarch.swift */,
104106
7D830401253FB48E002466B0 /* HedwigsTheme.swift */,
107+
317A217B2541277B00A96DF2 /* CMajorScale.swift */,
105108
);
106109
path = Songs;
107110
sourceTree = "<group>";
@@ -184,6 +187,7 @@
184187
7DDC3568253DC8D000F48DCD /* ImperialMarch.swift in Sources */,
185188
31A156D525300B6B00777E42 /* Extensions.swift in Sources */,
186189
31ED484F252FE0DA002B9BAD /* SongsRepository.swift in Sources */,
190+
317A217C2541277B00A96DF2 /* CMajorScale.swift in Sources */,
187191
31ED4852252FE128002B9BAD /* TwinkleTwinkleLittleStar.swift in Sources */,
188192
31A156D32530030800777E42 /* HappyBirthday.swift in Sources */,
189193
311A7A9A252D08620072A16B /* AppDelegate.swift in Sources */,

ForceTouchPlayer/Song.swift

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,11 +3,13 @@ import Foundation
33
struct Song {
44
let name: String
55

6+
/// Tempo when user first selects the song
67
var defaultTempo: Double = 144.0
78

89
/// Padding note added between each note in a song
9-
var padding: Note? = Note(frequency: 0, value: 1.0/4.0)
10+
var padding: Note? = Note(frequency: 0, value: 0.25)
1011

12+
/// Raw notes in array-of-tuples form
1113
let rawNotes: [RawNote]
1214

1315
var notes: [Note] {
Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
1+
//
2+
// Scale.swift
3+
// ForceTouchPlayer
4+
//
5+
// Created by Danilo Campana Fuchs on 21/10/20.
6+
// Copyright © 2020 Danilo Campana Fuchs. All rights reserved.
7+
//
8+
9+
import Foundation
10+
11+
let cMajorScale = Song(
12+
name: "C Major Scale",
13+
defaultTempo: 144.0,
14+
rawNotes: [
15+
(NOTE_C1, 1),
16+
(NOTE_D1, 1),
17+
(NOTE_E1, 1),
18+
(NOTE_F1, 1),
19+
(NOTE_G1, 1),
20+
(NOTE_A1, 1),
21+
(NOTE_B1, 1),
22+
(NOTE_C2, 1),
23+
(NOTE_D2, 1),
24+
(NOTE_E2, 1),
25+
(NOTE_F2, 1),
26+
27+
(NOTE_G2, 1),
28+
29+
(NOTE_F2, 1),
30+
(NOTE_E2, 1),
31+
(NOTE_D2, 1),
32+
(NOTE_C2, 1),
33+
(NOTE_B1, 1),
34+
(NOTE_A1, 1),
35+
(NOTE_G1, 1),
36+
(NOTE_F1, 1),
37+
(NOTE_E1, 1),
38+
(NOTE_D1, 1),
39+
(NOTE_C1, 1),
40+
]
41+
)

ForceTouchPlayer/SongsRepository.swift

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,8 @@ struct SongsRepository {
66
tetrisThemeA,
77
happyBirthday,
88
imperialMarch,
9-
hedwigsTheme
9+
hedwigsTheme,
10+
cMajorScale,
1011
]
1112

1213
func listSongs() -> [Song] {

0 commit comments

Comments
 (0)