1 |
- {"ast":null,"code":"\"use strict\";\n\n// Copyright (c) Microsoft Corporation. All rights reserved.\n// Licensed under the MIT license.\nObject.defineProperty(exports, \"__esModule\", {\n value: true\n});\nexports.SpeechSynthesisAdapter = void 0;\nconst Exports_js_1 = require(\"../sdk/Exports.js\");\nconst Exports_js_2 = require(\"./Exports.js\");\nclass SpeechSynthesisAdapter extends Exports_js_2.SynthesisAdapterBase {\n constructor(authentication, connectionFactory, synthesizerConfig, speechSynthesizer, audioDestination) {\n super(authentication, connectionFactory, synthesizerConfig, audioDestination);\n this.privSpeechSynthesizer = speechSynthesizer;\n this.privSynthesizer = speechSynthesizer;\n }\n setSynthesisContextSynthesisSection() {\n this.privSynthesisContext.setSynthesisSection(this.privSpeechSynthesizer);\n }\n onSynthesisStarted(requestId) {\n const synthesisStartEventArgs = new Exports_js_1.SpeechSynthesisEventArgs(new Exports_js_1.SpeechSynthesisResult(requestId, Exports_js_1.ResultReason.SynthesizingAudioStarted));\n if (!!this.privSpeechSynthesizer.synthesisStarted) {\n this.privSpeechSynthesizer.synthesisStarted(this.privSpeechSynthesizer, synthesisStartEventArgs);\n }\n }\n onSynthesizing(audio) {\n if (!!this.privSpeechSynthesizer.synthesizing) {\n try {\n const audioWithHeader = this.privSynthesisTurn.audioOutputFormat.addHeader(audio);\n const ev = new Exports_js_1.SpeechSynthesisEventArgs(new Exports_js_1.SpeechSynthesisResult(this.privSynthesisTurn.requestId, Exports_js_1.ResultReason.SynthesizingAudio, audioWithHeader));\n this.privSpeechSynthesizer.synthesizing(this.privSpeechSynthesizer, ev);\n } catch (error) {\n // Not going to let errors in the event handler\n // trip things up.\n }\n }\n }\n onSynthesisCancelled(result) {\n if (!!this.privSpeechSynthesizer.SynthesisCanceled) {\n const cancelEvent = new Exports_js_1.SpeechSynthesisEventArgs(result);\n try {\n this.privSpeechSynthesizer.SynthesisCanceled(this.privSpeechSynthesizer, cancelEvent);\n /* eslint-disable no-empty */\n } catch {}\n }\n }\n onSynthesisCompleted(result) {\n if (this.privSpeechSynthesizer.synthesisCompleted) {\n try {\n this.privSpeechSynthesizer.synthesisCompleted(this.privSpeechSynthesizer, new Exports_js_1.SpeechSynthesisEventArgs(result));\n } catch (e) {\n // Not going to let errors in the event handler\n // trip things up.\n }\n }\n }\n onWordBoundary(wordBoundaryEventArgs) {\n if (!!this.privSpeechSynthesizer.wordBoundary) {\n try {\n this.privSpeechSynthesizer.wordBoundary(this.privSpeechSynthesizer, wordBoundaryEventArgs);\n } catch (error) {\n // Not going to let errors in the event handler\n // trip things up.\n }\n }\n }\n onVisemeReceived(visemeEventArgs) {\n if (!!this.privSpeechSynthesizer.visemeReceived) {\n try {\n this.privSpeechSynthesizer.visemeReceived(this.privSpeechSynthesizer, visemeEventArgs);\n } catch (error) {\n // Not going to let errors in the event handler\n // trip things up.\n }\n }\n }\n onBookmarkReached(bookmarkEventArgs) {\n if (!!this.privSpeechSynthesizer.bookmarkReached) {\n try {\n this.privSpeechSynthesizer.bookmarkReached(this.privSpeechSynthesizer, bookmarkEventArgs);\n } catch (error) {\n // Not going to let errors in the event handler\n // trip things up.\n }\n }\n }\n}\nexports.SpeechSynthesisAdapter = SpeechSynthesisAdapter;","map":{"version":3,"names":["Object","defineProperty","exports","value","SpeechSynthesisAdapter","Exports_js_1","require","Exports_js_2","SynthesisAdapterBase","constructor","authentication","connectionFactory","synthesizerConfig","speechSynthesizer","audioDestination","privSpeechSynthesizer","privSynthesizer","setSynthesisContextSynthesisSection","privSynthesisContext","setSynthesisSection","onSynthesisStarted","requestId","synthesisStartEventArgs","SpeechSynthesisEventArgs","SpeechSynthesisResult","ResultReason","SynthesizingAudioStarted","synthesisStarted","onSynthesizing","audio","synthesizing","audioWithHeader","privSynthesisTurn","audioOutputFormat","addHeader","ev","SynthesizingAudio","error","onSynthesisCancelled","result","SynthesisCanceled","cancelEvent","onSynthesisCompleted","synthesisCompleted","e","onWordBoundary","wordBoundaryEventArgs","wordBoundary","onVisemeReceived","visemeEventArgs","visemeReceived","onBookmarkReached","bookmarkEventArgs","bookmarkReached"],"sources":["F:/workspace/202226701027/huinongbao-app/node_modules/microsoft-cognitiveservices-speech-sdk/distrib/lib/src/common.speech/SpeechSynthesisAdapter.js"],"sourcesContent":["\"use strict\";\n// Copyright (c) Microsoft Corporation. All rights reserved.\n// Licensed under the MIT license.\nObject.defineProperty(exports, \"__esModule\", { value: true });\nexports.SpeechSynthesisAdapter = void 0;\nconst Exports_js_1 = require(\"../sdk/Exports.js\");\nconst Exports_js_2 = require(\"./Exports.js\");\nclass SpeechSynthesisAdapter extends Exports_js_2.SynthesisAdapterBase {\n constructor(authentication, connectionFactory, synthesizerConfig, speechSynthesizer, audioDestination) {\n super(authentication, connectionFactory, synthesizerConfig, audioDestination);\n this.privSpeechSynthesizer = speechSynthesizer;\n this.privSynthesizer = speechSynthesizer;\n }\n setSynthesisContextSynthesisSection() {\n this.privSynthesisContext.setSynthesisSection(this.privSpeechSynthesizer);\n }\n onSynthesisStarted(requestId) {\n const synthesisStartEventArgs = new Exports_js_1.SpeechSynthesisEventArgs(new Exports_js_1.SpeechSynthesisResult(requestId, Exports_js_1.ResultReason.SynthesizingAudioStarted));\n if (!!this.privSpeechSynthesizer.synthesisStarted) {\n this.privSpeechSynthesizer.synthesisStarted(this.privSpeechSynthesizer, synthesisStartEventArgs);\n }\n }\n onSynthesizing(audio) {\n if (!!this.privSpeechSynthesizer.synthesizing) {\n try {\n const audioWithHeader = this.privSynthesisTurn.audioOutputFormat.addHeader(audio);\n const ev = new Exports_js_1.SpeechSynthesisEventArgs(new Exports_js_1.SpeechSynthesisResult(this.privSynthesisTurn.requestId, Exports_js_1.ResultReason.SynthesizingAudio, audioWithHeader));\n this.privSpeechSynthesizer.synthesizing(this.privSpeechSynthesizer, ev);\n }\n catch (error) {\n // Not going to let errors in the event handler\n // trip things up.\n }\n }\n }\n onSynthesisCancelled(result) {\n if (!!this.privSpeechSynthesizer.SynthesisCanceled) {\n const cancelEvent = new Exports_js_1.SpeechSynthesisEventArgs(result);\n try {\n this.privSpeechSynthesizer.SynthesisCanceled(this.privSpeechSynthesizer, cancelEvent);\n /* eslint-disable no-empty */\n }\n catch { }\n }\n }\n onSynthesisCompleted(result) {\n if (this.privSpeechSynthesizer.synthesisCompleted) {\n try {\n this.privSpeechSynthesizer.synthesisCompleted(this.privSpeechSynthesizer, new Exports_js_1.SpeechSynthesisEventArgs(result));\n }\n catch (e) {\n // Not going to let errors in the event handler\n // trip things up.\n }\n }\n }\n onWordBoundary(wordBoundaryEventArgs) {\n if (!!this.privSpeechSynthesizer.wordBoundary) {\n try {\n this.privSpeechSynthesizer.wordBoundary(this.privSpeechSynthesizer, wordBoundaryEventArgs);\n }\n catch (error) {\n // Not going to let errors in the event handler\n // trip things up.\n }\n }\n }\n onVisemeReceived(visemeEventArgs) {\n if (!!this.privSpeechSynthesizer.visemeReceived) {\n try {\n this.privSpeechSynthesizer.visemeReceived(this.privSpeechSynthesizer, visemeEventArgs);\n }\n catch (error) {\n // Not going to let errors in the event handler\n // trip things up.\n }\n }\n }\n onBookmarkReached(bookmarkEventArgs) {\n if (!!this.privSpeechSynthesizer.bookmarkReached) {\n try {\n this.privSpeechSynthesizer.bookmarkReached(this.privSpeechSynthesizer, bookmarkEventArgs);\n }\n catch (error) {\n // Not going to let errors in the event handler\n // trip things up.\n }\n }\n }\n}\nexports.SpeechSynthesisAdapter = SpeechSynthesisAdapter;\n\n"],"mappings":"AAAA,YAAY;;AACZ;AACA;AACAA,MAAM,CAACC,cAAc,CAACC,OAAO,EAAE,YAAY,EAAE;EAAEC,KAAK,EAAE;AAAK,CAAC,CAAC;AAC7DD,OAAO,CAACE,sBAAsB,GAAG,KAAK,CAAC;AACvC,MAAMC,YAAY,GAAGC,OAAO,CAAC,mBAAmB,CAAC;AACjD,MAAMC,YAAY,GAAGD,OAAO,CAAC,cAAc,CAAC;AAC5C,MAAMF,sBAAsB,SAASG,YAAY,CAACC,oBAAoB,CAAC;EACnEC,WAAWA,CAACC,cAAc,EAAEC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