From 0218a9aaa1dc0ed815103d940b019eb3bd754fe5 Mon Sep 17 00:00:00 2001 From: Hugo Pezziardi Date: Fri, 6 Dec 2024 11:15:51 +0100 Subject: [PATCH 1/6] =?UTF-8?q?=F0=9F=8D=B1=20(ContentKit):=20Add=20ColorM?= =?UTF-8?q?usicPad=20activity=20icon?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../standalones/icons/color_music_pad.activity.icon.png | 3 +++ 1 file changed, 3 insertions(+) create mode 100644 Modules/ContentKit/Resources/Content/activities/standalones/icons/color_music_pad.activity.icon.png diff --git a/Modules/ContentKit/Resources/Content/activities/standalones/icons/color_music_pad.activity.icon.png b/Modules/ContentKit/Resources/Content/activities/standalones/icons/color_music_pad.activity.icon.png new file mode 100644 index 0000000000..cbfa06ca83 --- /dev/null +++ b/Modules/ContentKit/Resources/Content/activities/standalones/icons/color_music_pad.activity.icon.png @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:66ccd3b8c52512eb6c00680a7eee4092c8d0e2680ce6dee70fe20e73b6b6fd50 +size 10567 From 2ed6ccc4463741a85be70679198114f18e00c086 Mon Sep 17 00:00:00 2001 From: Hugo Pezziardi Date: Fri, 6 Dec 2024 11:16:25 +0100 Subject: [PATCH 2/6] =?UTF-8?q?=E2=9C=A8=20(GEK):=20Add=20new=20scale=20fo?= =?UTF-8?q?r=20ColorMusicPad?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../GameEngineKit/Sources/OldSystem/Utils/MIDI/MIDIScale.swift | 3 +++ 1 file changed, 3 insertions(+) diff --git a/Modules/GameEngineKit/Sources/OldSystem/Utils/MIDI/MIDIScale.swift b/Modules/GameEngineKit/Sources/OldSystem/Utils/MIDI/MIDIScale.swift index d0e22c0e56..1aa6d755cd 100644 --- a/Modules/GameEngineKit/Sources/OldSystem/Utils/MIDI/MIDIScale.swift +++ b/Modules/GameEngineKit/Sources/OldSystem/Utils/MIDI/MIDIScale.swift @@ -7,6 +7,7 @@ import AudioKit enum MIDIScale: String { case majorPentatonic case majorHeptatonic + case majorPentatonicDoubleOctave // MARK: Internal @@ -16,6 +17,8 @@ enum MIDIScale: String { [24, 26, 28, 31, 33] case .majorHeptatonic: [24, 26, 28, 29, 31, 33, 35, 36] + case .majorPentatonicDoubleOctave: + [24, 26, 28, 31, 33, 36, 38, 40, 43, 45] } } } From 98a413584575cfb0953e2db1dd59719b51c64e44 Mon Sep 17 00:00:00 2001 From: Hugo Pezziardi Date: Fri, 6 Dec 2024 11:16:50 +0100 Subject: [PATCH 3/6] =?UTF-8?q?=E2=9C=A8=20(RobotKit):=20Add=202=20new=20R?= =?UTF-8?q?obot.Color?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Modules/RobotKit/Sources/Robot+Colors.swift | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/Modules/RobotKit/Sources/Robot+Colors.swift b/Modules/RobotKit/Sources/Robot+Colors.swift index 407f16817b..e6911a9449 100644 --- a/Modules/RobotKit/Sources/Robot+Colors.swift +++ b/Modules/RobotKit/Sources/Robot+Colors.swift @@ -71,6 +71,8 @@ public extension Robot { case purple case pink case yellow + case mint + case lightPink // MARK: Public @@ -96,6 +98,10 @@ public extension Robot { .pink case .yellow: .yellow + case .mint: + .mint + case .lightPink: + .lightPink } } } @@ -118,6 +124,9 @@ public extension Robot.Color { static let purple: Robot.Color = .init(robot: 20, 0, 80, screen: 173, 73, 247) static let pink: Robot.Color = .init(robot: 255, 0, 127, screen: 252, 103, 178) static let yellow: Robot.Color = .init(robot: 255, 255, 0, screen: 251, 232, 0) + + static let mint: Robot.Color = .init(robot: 0, 255, 150, screen: 173, 235, 179) + static let lightPink: Robot.Color = .init(robot: 255, 0, 255, screen: 218, 177, 218) } // swiftlint:enable nesting identifier_name line_length From 83052fdf29c3b1c358c5f43eb7dea12cef871ce1 Mon Sep 17 00:00:00 2001 From: Hugo Pezziardi Date: Fri, 6 Dec 2024 11:18:29 +0100 Subject: [PATCH 4/6] =?UTF-8?q?=E2=9C=A8=20(ContentKit):=20Add=20ColorMusi?= =?UTF-8?q?cPad=20yaml?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- ...9D1EE7DD846ACB048145089F34C33.activity.yml | 79 +++++++++++++++++++ .../categories/educational_games.category.yml | 1 + Specs/jtd/activity.jtd.json | 6 +- 3 files changed, 85 insertions(+), 1 deletion(-) create mode 100644 Modules/ContentKit/Resources/Content/activities/standalones/color_music_pad-8439D1EE7DD846ACB048145089F34C33.activity.yml diff --git a/Modules/ContentKit/Resources/Content/activities/standalones/color_music_pad-8439D1EE7DD846ACB048145089F34C33.activity.yml b/Modules/ContentKit/Resources/Content/activities/standalones/color_music_pad-8439D1EE7DD846ACB048145089F34C33.activity.yml new file mode 100644 index 0000000000..f95361fbcc --- /dev/null +++ b/Modules/ContentKit/Resources/Content/activities/standalones/color_music_pad-8439D1EE7DD846ACB048145089F34C33.activity.yml @@ -0,0 +1,79 @@ +# Leka - iOS Monorepo +# Copyright APF France handicap +# SPDX-License-Identifier: Apache-2.0 + +version: 1.0.0 +uuid: 8439D1EE7DD846ACB048145089F34C33 +name: color_music_pad + +created_at: "2024-12-06T11:17:39.636246" +last_edited_at: "2024-12-06T11:17:39.636246" +status: published + +authors: + - leka + +skills: + - relationship_tablet_robot + - sensory_integration/vision + - sensory_integration/hearing + - sensory_integration + +tags: + - colors + - music + - standalone_activity + - robot_colors + - sensory_stimulation + +hmi: + - tablet_robot + +types: + - one_on_one + +locales: + - en_US + - fr_FR + +l10n: + - locale: fr_FR + details: + icon: color_music_pad + + title: Pavé musical coloré + subtitle: null + + short_description: | + Jouer de la musique avec Leka sur des larges touches colorées. + + description: | + Lorem Ipsum + + instructions: | + Lorem Ipsum + + - locale: en_US + details: + icon: color_music_pad + + title: Color Music Pad + subtitle: null + + short_description: | + Play music with Leka on large colored keys. + + description: | + Lorem Ipsum + + instructions: | + Lorem Ipsum + +exercises_payload: + options: + shuffle_exercises: false + shuffle_groups: false + + exercise_groups: + - group: + - interface: colorMusicPad diff --git a/Modules/ContentKit/Resources/Content/categories/educational_games.category.yml b/Modules/ContentKit/Resources/Content/categories/educational_games.category.yml index 30d8928f64..7c5c453155 100644 --- a/Modules/ContentKit/Resources/Content/categories/educational_games.category.yml +++ b/Modules/ContentKit/Resources/Content/categories/educational_games.category.yml @@ -28,3 +28,4 @@ content: - melody-CB995F829411449AB32E6B8A688E3DDB - xylophone_pentatonic-7C1DDED6C6D44913B9A7D4EB4AEE8F6B - xylophone_heptatonic-65193102AE2947439ABB82D5891EDDBA + - color_music_pad-8439D1EE7DD846ACB048145089F34C33 diff --git a/Specs/jtd/activity.jtd.json b/Specs/jtd/activity.jtd.json index ebc2b6ccd2..00d1a16f1c 100644 --- a/Specs/jtd/activity.jtd.json +++ b/Specs/jtd/activity.jtd.json @@ -425,6 +425,9 @@ "ref": "$exercise/payload/memory" } } + }, + "colorMusicPad": { + "properties": {} } } }, @@ -464,7 +467,8 @@ "musicalInstruments", "melody", "pairing", - "memory" + "memory", + "colorMusicPad" ] }, "$exercise/gameplay": { From e575381d88ceb826a12cd0142230af36bace03bf Mon Sep 17 00:00:00 2001 From: Hugo Pezziardi Date: Fri, 6 Dec 2024 11:19:03 +0100 Subject: [PATCH 5/6] =?UTF-8?q?=E2=9C=A8=20(ContentKit):=20Add=20ColorMusi?= =?UTF-8?q?cPad=20exercise?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Modules/ContentKit/Sources/Exercise/Exercise+Interface.swift | 1 + Modules/ContentKit/Sources/Exercise/Exercise.swift | 1 + 2 files changed, 2 insertions(+) diff --git a/Modules/ContentKit/Sources/Exercise/Exercise+Interface.swift b/Modules/ContentKit/Sources/Exercise/Exercise+Interface.swift index 5791ed7287..564452cd65 100644 --- a/Modules/ContentKit/Sources/Exercise/Exercise+Interface.swift +++ b/Modules/ContentKit/Sources/Exercise/Exercise+Interface.swift @@ -30,5 +30,6 @@ public extension Exercise { case melody case pairing case memory + case colorMusicPad } } diff --git a/Modules/ContentKit/Sources/Exercise/Exercise.swift b/Modules/ContentKit/Sources/Exercise/Exercise.swift index c46e880960..3eb4817523 100644 --- a/Modules/ContentKit/Sources/Exercise/Exercise.swift +++ b/Modules/ContentKit/Sources/Exercise/Exercise.swift @@ -72,6 +72,7 @@ public struct Exercise: Decodable { (.gamepadColorPad, .none), (.gamepadArrowPad, .none), (.hideAndSeek, .none), + (.colorMusicPad, .none), (.pairing, .none): self.payload = nil From 313b551f949cd3b2b683a47b554fc0762c855aef Mon Sep 17 00:00:00 2001 From: Hugo Pezziardi Date: Fri, 6 Dec 2024 11:19:35 +0100 Subject: [PATCH 6/6] =?UTF-8?q?=E2=9C=A8=20(GEK):=20Add=20ColorMusicPad=20?= =?UTF-8?q?activity?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../ColorMusicPad/ColorMusicPad.swift | 41 +++++++++++++++++++ .../Views/Activity/ActivityView.swift | 3 ++ 2 files changed, 44 insertions(+) create mode 100644 Modules/GameEngineKit/Sources/OldSystem/Exercises/Specialized/ColorMusicPad/ColorMusicPad.swift diff --git a/Modules/GameEngineKit/Sources/OldSystem/Exercises/Specialized/ColorMusicPad/ColorMusicPad.swift b/Modules/GameEngineKit/Sources/OldSystem/Exercises/Specialized/ColorMusicPad/ColorMusicPad.swift new file mode 100644 index 0000000000..cf393b42ee --- /dev/null +++ b/Modules/GameEngineKit/Sources/OldSystem/Exercises/Specialized/ColorMusicPad/ColorMusicPad.swift @@ -0,0 +1,41 @@ +// Leka - iOS Monorepo +// Copyright APF France handicap +// SPDX-License-Identifier: Apache-2.0 + +import AudioKit +import DesignKit +import RobotKit +import SwiftUI + +struct ColorMusicPad: View { + // MARK: Internal + + @StateObject var midiPlayer: MIDIPlayer = .init(instrument: MIDIInstrument.xylophone) + + var body: some View { + LazyVGrid(columns: self.columns, spacing: self.kHorizontalSpacing) { + ForEach(0..<10) { index in + Rectangle() + .fill(self.colors[index].screen) + .onTapGesture { + Robot.shared.shine(.all(in: self.colors[index])) + self.midiPlayer.noteOn(number: self.scale.notes[index]) + } + .frame(width: self.kTileWidth, height: self.kTileHeight) + } + } + } + + // MARK: Private + + private let scale: MIDIScale = .majorPentatonicDoubleOctave + private let colors: [Robot.Color] = [.lightPink, .red, .orange, .yellow, .green, .mint, .lightBlue, .blue, .purple, .pink] + private let columns = Array(repeating: GridItem(), count: 5) + private let kHorizontalSpacing: CGFloat = 0 + private let kTileWidth: CGFloat = 220 + private let kTileHeight: CGFloat = 600 +} + +#Preview { + ColorMusicPad() +} diff --git a/Modules/GameEngineKit/Sources/OldSystem/Views/Activity/ActivityView.swift b/Modules/GameEngineKit/Sources/OldSystem/Views/Activity/ActivityView.swift index df7d19fd73..1b8034cadc 100644 --- a/Modules/GameEngineKit/Sources/OldSystem/Views/Activity/ActivityView.swift +++ b/Modules/GameEngineKit/Sources/OldSystem/Views/Activity/ActivityView.swift @@ -387,6 +387,9 @@ public struct ActivityView: View { exercise: self.viewModel.currentExercise, data: self.viewModel.currentExerciseSharedData ) + + case .colorMusicPad: + ColorMusicPad() } }