diff --git a/frontend/app/config.json b/frontend/app/config.json index 26e8a68..3f07378 100644 --- a/frontend/app/config.json +++ b/frontend/app/config.json @@ -1,5 +1,5 @@ { - "language": "chinese", + "language": "english", "language_options": [ "chinese", "english" @@ -13,4 +13,4 @@ "fetch_mp3": "http://duyuepu.com:5099/static/", "user": "http://duyuepu.com:5000/api" } -} \ No newline at end of file +} diff --git a/frontend/app/resources/sounds/Left_en.ogg b/frontend/app/resources/sounds/Left_en.ogg new file mode 100644 index 0000000..be61bf3 Binary files /dev/null and b/frontend/app/resources/sounds/Left_en.ogg differ diff --git a/frontend/app/resources/sounds/Right_en.ogg b/frontend/app/resources/sounds/Right_en.ogg new file mode 100644 index 0000000..c353efb Binary files /dev/null and b/frontend/app/resources/sounds/Right_en.ogg differ diff --git a/frontend/app/services/utility.js b/frontend/app/services/utility.js index 8692693..4b22e51 100644 --- a/frontend/app/services/utility.js +++ b/frontend/app/services/utility.js @@ -83,6 +83,7 @@ angular.module('myApp') var deferred = $q.defer(); httpUtil.get(config.api.music_score + "/musicscores/?keyword=" + search_text) .then(function(response) { + debugger if (response !== null) { deferred.resolve(response); } diff --git a/frontend/app/views/play/play.js b/frontend/app/views/play/play.js index c9f0d88..00a5381 100644 --- a/frontend/app/views/play/play.js +++ b/frontend/app/views/play/play.js @@ -112,7 +112,12 @@ angular.module('myApp.play', ['ngRoute']) function tellCurrentOffset() { utility.stop_all_sounds(); - play([config.api.fetch_mp3 + ($scope.offset + 1) + "_zh.mp3"]); + let sound_source = + config.api.fetch_mp3 + + ($scope.offset + 1) + + (lang=="chinese"? "_zh.mp3" : "") + + (lang=="english"? "_en.ogg" : "") + play([sound_source]); } @@ -121,12 +126,21 @@ angular.module('myApp.play', ['ngRoute']) function tellCurrentBlockSize() { utility.stop_all_sounds(); if(changingBlockSize == false) { + if(lang=="chinese") { play([config.api.fetch_mp3 + 'length' + "_zh.mp3", config.api.fetch_mp3 + 'length/' + $scope.blockSize + ".mp3"]); - console.log("sentenceSize"); - changingBlockSize = true; + } + else if(lang=="english") { + play([config.api.fetch_mp3 + 'length' + "_en.ogg", config.api.fetch_mp3 + 'length/' + $scope.blockSize + "_en.ogg"]); + } + changingBlockSize = true; } else { - play([config.api.fetch_mp3 + 'length/' + $scope.blockSize + ".mp3"]); + if(lang=="chinese") { + play([config.api.fetch_mp3 + 'length/' + $scope.blockSize + ".mp3"]); + } + else if(lang == "english") { + play([config.api.fetch_mp3 + 'length/' + $scope.blockSize + "_en.ogg"]); + } } console.log($scope.blockSize); if(timeout_promise != null) { @@ -143,14 +157,14 @@ angular.module('myApp.play', ['ngRoute']) $scope.offset += $scope.blockSize; } if(readout == undefined || readout == true) tellCurrentOffset(); - $scope.display_list = []; - for (var i = 0; i < $scope.blockSize && i + $scope.offset < $scope.size; i++) { - if (lang == "chinese") { - $scope.display_list.push("第 " + (i + $scope.offset + 1) + " 小节"); - } else if (lang.indexOf("en") != -1) { - $scope.display_list.push("Measure No." + (i + $scope.offset + 1)); - } - } + // $scope.display_list = []; + // for (var i = 0; i < $scope.blockSize && i + $scope.offset < $scope.size; i++) { + // if (lang == "chinese") { + // $scope.display_list.push("第 " + (i + $scope.offset + 1) + " 小节"); + // } else if (lang.indexOf("en") != -1) { + // $scope.display_list.push("Measure No." + (i + $scope.offset + 1)); + // } + // } $scope.$apply(); } @@ -160,23 +174,26 @@ angular.module('myApp.play', ['ngRoute']) } else { $scope.offset = 0; } - $scope.display_list = []; if(readout == undefined || readout == true) tellCurrentOffset(); - - for (var i = 0; i < $scope.blockSize && i + $scope.offset < $scope.size; i++) { - if (lang == "chinese") { - $scope.display_list.push("第 " + (i + $scope.offset + 1) + " 小节"); - } else if (lang.indexOf("en") != -1) { - $scope.display_list.push("Measure No." + (i + $scope.offset + 1)); - } - } + // $scope.display_list = []; + // + // for (var i = 0; i < $scope.blockSize && i + $scope.offset < $scope.size; i++) { + // if (lang == "chinese") { + // $scope.display_list.push("第 " + (i + $scope.offset + 1) + " 小节"); + // } else if (lang.indexOf("en") != -1) { + // $scope.display_list.push("Measure No." + (i + $scope.offset + 1)); + // } + // } $scope.$apply(); } $scope.handFeekback = function() { + var sound_source = "/resources/sounds/" + $scope.hand + +(lang=="chinese"?".mp3":"") + +(lang=="english"?"_en.ogg":""); var sound = new Howl({ - src: ['/resources/sounds/'+$scope.hand+'.mp3'], + src: [sound_source], preload: true, autoplay: true, rate : 1, @@ -186,6 +203,9 @@ angular.module('myApp.play', ['ngRoute']) }, onend: function() { console.log('Finished!'); + }, + onloaderror: function(e){ + debugger } }); } @@ -228,6 +248,9 @@ angular.module('myApp.play', ['ngRoute']) setTimeout(function() { play(list); }, 0); + }, + onloaderror: function(e){ + debugger } }); utility.active_sounds.push(sound); diff --git a/frontend/app/views/search/search.html b/frontend/app/views/search/search.html index 98bdf68..b7ae669 100644 --- a/frontend/app/views/search/search.html +++ b/frontend/app/views/search/search.html @@ -7,9 +7,9 @@
{{searchList[selected].name}}
- -{{ show("Difficulty") + " : " + searchList[selected].hardness}}
+{{searchList[selected].title}}
+ +{{ show("Difficulty") + " : Easy" }}