Skip to content

Commit

Permalink
Bug: 왼쪽손 손목 회전시 소리가 나지 않는 현상 해결
Browse files Browse the repository at this point in the history
  • Loading branch information
MartyTheGout committed Nov 9, 2024
1 parent 4fe7143 commit f8ae07a
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 f8ae07a

Please sign in to comment.