Skip to content

Commit

Permalink
Merge pull request #55 from DeveloperAcademy-POSTECH/bug/#54-NoSoundA…
Browse files Browse the repository at this point in the history
…tLeft

Bug: 왼쪽손 손목 회전시 소리가 나지 않는 현상 해결
  • Loading branch information
MartyTheGout authored Nov 9, 2024
2 parents 375e5c1 + f8ae07a commit fefaa89
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -104,14 +104,14 @@ struct HandRollingStretchingView: View {
let colorValueChangedTo = min (newValue * 2, 6)
viewModel.getDifferentRingColor(viewModel.rightGuideRing, intChangeTo: Int32(colorValueChangedTo))
Task {
await viewModel.playRotationChangeRingSound(newValue)
await viewModel.playRotationChangeRingSound(newValue, chirality: .right)
}
}
.onChange(of: viewModel.leftRotationCount, initial: false ) { _, newValue in
let colorValueChangedTo = min (newValue * 2 + 1, 7)
viewModel.getDifferentRingColor(viewModel.leftGuideRing, intChangeTo: Int32(colorValueChangedTo))
Task {
await viewModel.playRotationChangeRingSound(newValue)
await viewModel.playRotationChangeRingSound(newValue, chirality: .left)
}
}
.onChange(of: viewModel.rightHitCount, initial: false ) { oldNumber, newNumber in
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -123,13 +123,15 @@ extension HandRollingStretchingViewModel {
return previous + (current - previous) * factor
}

func playRotationChangeRingSound(_ newValue: Int) async {
func playRotationChangeRingSound(_ newValue: Int, chirality : Chirality) async {

let guideRing = chirality == .left ? leftGuideRing : rightGuideRing
if newValue >= 3 {
try? await playSpatialAudio(rightGuideRing, audioInfo: AudioFindHelper.handRotationThreeTimes)
try? await playSpatialAudio(guideRing, audioInfo: AudioFindHelper.handRotationThreeTimes)
} else if newValue == 2 {
try? await playSpatialAudio(rightGuideRing, audioInfo: AudioFindHelper.handRotationTwice)
try? await playSpatialAudio(guideRing, audioInfo: AudioFindHelper.handRotationTwice)
} else if newValue == 1 {
try? await playSpatialAudio(rightGuideRing, audioInfo: AudioFindHelper.handRotationOnce)
try? await playSpatialAudio(guideRing, audioInfo: AudioFindHelper.handRotationOnce)
}
}
}

0 comments on commit fefaa89

Please sign in to comment.