Skip to content

Commit

Permalink
🗑️ (GEK): Update old system Melody with changes
Browse files Browse the repository at this point in the history
  • Loading branch information
HPezz committed Nov 29, 2023
1 parent 0b9f985 commit c22ebd4
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -4,13 +4,14 @@

import AudioKit
import Combine
import ContentKit
import SwiftUI

public class MelodyGameplay: ObservableObject {
@Published public var progress: CGFloat = 0.0
@Published var state: ExerciseState = .idle

private let xyloPlayer = MIDIPlayer(name: "Xylophone", samples: xyloSamples)
private let xyloPlayer = MIDIPlayer(instrument: .xylophone)

private let song: MelodySongModel

Expand Down Expand Up @@ -68,6 +69,6 @@ public class MelodyGameplay: ObservableObject {
let index = kListOfTiles.firstIndex(where: {
$0.noteNumber == currentNoteNumber
})
return kListOfTiles[index!].color
return kListOfTiles[index!].color.screen
}
}
13 changes: 10 additions & 3 deletions Modules/GameEngineKit/Sources/Staging/Melody/MelodyView.swift
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,16 @@
// Copyright 2023 APF France handicap
// SPDX-License-Identifier: Apache-2.0

import DesignKit
import AudioKit
import RobotKit
import SwiftUI

public struct XylophoneTile: Identifiable {
public var id: Int
var noteNumber: MIDINoteNumber
var color: Robot.Color
}

public let kListOfTiles: [XylophoneTile] = [
XylophoneTile(id: 0, noteNumber: 24, color: .pink),
XylophoneTile(id: 1, noteNumber: 26, color: .red),
Expand Down Expand Up @@ -36,9 +43,9 @@ public struct MelodyView: View {
Button {
viewModel.onTileTapped(tile: tile)
} label: {
tile.color
tile.color.screen
}
.buttonStyle(XylophoneTileButtonStyle(index: tile.id, tilesNumber: tilesNumber))
.buttonStyle(InstrumentView.XylophoneView.TileButtonStyle(index: tile.id, tileNumber: tilesNumber))
.compositingGroup()
}
}
Expand Down

0 comments on commit c22ebd4

Please sign in to comment.