Skip to content

Commit

Permalink
fix: 쇼케이스용 완성
Browse files Browse the repository at this point in the history
  • Loading branch information
mosiccan committed Dec 4, 2024
1 parent cae5cb5 commit 8182a35
Show file tree
Hide file tree
Showing 4 changed files with 23 additions and 21 deletions.
4 changes: 2 additions & 2 deletions PepperoniV2/Data/AnimeQuote.swift
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,7 @@ final class AnimeQuote {
id: "quote1",
japanese: ["心臓を", "捧げよ"],
pronunciation: ["신조오오", "사사게요"],
korean: ["심장을", "받쳐라"],
korean: ["심장을", "바쳐라"],
timeMark: [0.5,1.4],
voicingTime: 3.0,
audioFile: "JINGYG_010.mov"
Expand All @@ -109,7 +109,7 @@ final class AnimeQuote {
id: "quote1",
japanese: ["左手は","添える","だけ"],
pronunciation: ["히다리테와", "소에루", "다케"],
korean: ["왼손은", "거등뿐"],
korean: ["왼손은", "거들뿐"],
timeMark: [0.2,0.8,1.1],
voicingTime: 3.0,
audioFile: "SLDUNK_010.mov"
Expand Down
2 changes: 1 addition & 1 deletion PepperoniV2/Presentation/Game/SpeakingView.swift
Original file line number Diff line number Diff line change
Expand Up @@ -366,7 +366,7 @@ struct SpeakingView: View {
if let quote = gameViewModel.selectedQuote{
gameViewModel.temporaryPronunciationScore = calculatePronunciation(original: quote.japanese, sttText: sttManager.recognizedText)

gameViewModel.temporaryIntonationScore = calculateIntonation(referenceFileName: quote.audioFile, comparisonFileURL: sttManager.getFileURL())
gameViewModel.temporaryIntonationScore = calculateIntonation(referenceFileName: quote.audioFile.components(separatedBy: ".").first ?? quote.audioFile, comparisonFileURL: sttManager.getFileURL())
print("레퍼런스 음원 주소: \(quote.audioFile)")
print("사용자 목소리 음원 주소: \(sttManager.getFileURL())")

Expand Down
37 changes: 19 additions & 18 deletions PepperoniV2/Presentation/Game/VideoPlayView.swift
Original file line number Diff line number Diff line change
Expand Up @@ -56,8 +56,9 @@ struct VideoPlayView: View {
.foregroundStyle(Color.ppMint_00)
}

//TODO: - 영상 재생 못함
if let selectedQuote = gameViewModel.selectedQuote {
if let fileURL = Bundle.main.url(forResource: selectedQuote.audioFile, withExtension: "mov") {
if let fileURL = Bundle.main.url(forResource: selectedQuote.audioFile.components(separatedBy: ".").first ?? selectedQuote.audioFile, withExtension: "mov") {
VideoPlayer(player: AVPlayer(url: fileURL))
.frame(height: 218)
.padding(.bottom, 24)
Expand All @@ -80,23 +81,23 @@ struct VideoPlayView: View {

Spacer()

Button(action: {
replayTrigger.toggle()
print("다시누름: \(gameViewModel.selectedQuote?.audioFile)")
}) {
RoundedRectangle(cornerRadius: 50)
.frame(width:109, height:41)
.foregroundStyle(Color.ppDarkGray_03)
.overlay{
HStack(spacing:4){
Image(systemName:"arrow.counterclockwise")
Text("replay")
.hakgyoansim(size: 19)
}
.foregroundStyle(Color.ppMint_00)
}
.padding(.bottom, 12)
}
// Button(action: {
// replayTrigger.toggle()
// print("다시누름: \(gameViewModel.selectedQuote?.audioFile)")
// }) {
// RoundedRectangle(cornerRadius: 50)
// .frame(width:109, height:41)
// .foregroundStyle(Color.ppDarkGray_03)
// .overlay{
// HStack(spacing:4){
// Image(systemName:"arrow.counterclockwise")
// Text("replay")
// .hakgyoansim(size: 19)
// }
// .foregroundStyle(Color.ppMint_00)
// }
// .padding(.bottom, 12)
// }

Button {
router.push(screen: Game.speaking)
Expand Down
1 change: 1 addition & 0 deletions PepperoniV2/Presentation/Helper/SpeechGrader.swift
Original file line number Diff line number Diff line change
Expand Up @@ -76,6 +76,7 @@ private func levenshteinDistance(_ source: String, _ target: String) -> Int {
return distanceMatrix[sourceCount][targetCount]
}

//TODO: - 음원 못불러옴
// calculateIntonation 함수
func calculateIntonation(referenceFileName: String, comparisonFileURL: URL) -> Double {
// referenceFileName이 .mov로 끝나면 .m4a로 변환
Expand Down

0 comments on commit 8182a35

Please sign in to comment.