Commit b88eacad authored by Tt's avatar Tt

变声

parent c2c5a222
...@@ -220,7 +220,15 @@ export default class SceneComponent extends MyCocosSceneComponent { ...@@ -220,7 +220,15 @@ export default class SceneComponent extends MyCocosSceneComponent {
this.microphoneAreaRecover(); this.microphoneAreaRecover();
cc.audioEngine.stopAllEffects(); cc.audioEngine.stopAllEffects();
courseware && courseware.startTest(this.letter); //开始录音 courseware && courseware.startTestConvert(this.letter); //开始录音
// (<any>window).courseware.startTestConvert('My name is Lucy');
// (<any>window).courseware.stopTestConvert(res => {
// // 录音评测返回结果, 与stopTest方法返回结果一致
// }, covert => {
// // 变声返回结果,结构为 {convertUrl: ‘http://jliasldfjsdfi.mp3'}
// });
} }
async onTouchRecordEnd() { async onTouchRecordEnd() {
if (!this.recording) return; if (!this.recording) return;
...@@ -251,14 +259,16 @@ export default class SceneComponent extends MyCocosSceneComponent { ...@@ -251,14 +259,16 @@ export default class SceneComponent extends MyCocosSceneComponent {
if (!courseware) { if (!courseware) {
return this.recrodEnd(testData) return this.recrodEnd(testData)
} }
courseware && courseware.stopTest((res) => { courseware && courseware.stopTestConvert((res) => {
res = JSON.parse(res); res = JSON.parse(res);
this.recrodEnd(res); this.recrodEnd(res);
}); //结束录音 }, covert => {
this.recordAudio = covert.convertUrl;
// 变声返回结果,结构为 {convertUrl: ‘http://jliasldfjsdfi.mp3'}
});//结束录音
} }
async recrodEnd(data) { async recrodEnd(data) {
this.hideVoiceFlash(); this.hideVoiceFlash();
this.recordAudio = data.audioUrl;
let score = data.result.overall; let score = data.result.overall;
pg.event.emit('layer_record_score', score); pg.event.emit('layer_record_score', score);
this.recording = false; this.recording = false;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment