AWS SDK for C++

AWS SDK for C++ Version 1.11.773

Loading...
Searching...
No Matches
StartSpeechSynthesisStreamHandler.h
1
6#pragma once
7#include <aws/core/client/AWSError.h>
8#include <aws/core/utils/HashingUtils.h>
9#include <aws/core/utils/event/EventStreamHandler.h>
10#include <aws/polly/PollyErrors.h>
11#include <aws/polly/Polly_EXPORTS.h>
12#include <aws/polly/model/AudioEvent.h>
13#include <aws/polly/model/StartSpeechSynthesisStreamInitialResponse.h>
14#include <aws/polly/model/StreamClosedEvent.h>
15
16namespace Aws {
17namespace Polly {
18namespace Model {
20
22 typedef std::function<void(const StartSpeechSynthesisStreamInitialResponse&)> StartSpeechSynthesisStreamInitialResponseCallback;
24 StartSpeechSynthesisStreamInitialResponseCallbackEx;
25 typedef std::function<void(const AudioEvent&)> AudioEventCallback;
26 typedef std::function<void(const StreamClosedEvent&)> StreamClosedEventCallback;
27 typedef std::function<void(const Aws::Client::AWSError<PollyErrors>& error)> ErrorCallback;
28
29 public:
33
34 AWS_POLLY_API virtual void OnEvent() override;
35
37
43 inline void SetInitialResponseCallbackEx(const StartSpeechSynthesisStreamInitialResponseCallbackEx& callback) {
44 m_onInitialResponse = callback;
45 }
49 inline void SetInitialResponseCallback(const StartSpeechSynthesisStreamInitialResponseCallback& noArgCallback) {
50 m_onInitialResponse = [noArgCallback](const StartSpeechSynthesisStreamInitialResponse& rs, const Utils::Event::InitialResponseType) {
51 return noArgCallback(rs);
52 };
53 }
55 inline void SetAudioEventCallback(const AudioEventCallback& callback) { m_onAudioEvent = callback; }
56 inline void SetStreamClosedEventCallback(const StreamClosedEventCallback& callback) { m_onStreamClosedEvent = callback; }
57 inline void SetOnErrorCallback(const ErrorCallback& callback) { m_onError = callback; }
58
59 inline StartSpeechSynthesisStreamInitialResponseCallbackEx& GetInitialResponseCallbackEx() { return m_onInitialResponse; }
60
61 private:
62 AWS_POLLY_API void HandleEventInMessage();
63 AWS_POLLY_API void HandleErrorInMessage();
64 AWS_POLLY_API void MarshallError(const Aws::String& errorCode, const Aws::String& errorMessage);
65
66 StartSpeechSynthesisStreamInitialResponseCallbackEx m_onInitialResponse;
67 AudioEventCallback m_onAudioEvent;
68 StreamClosedEventCallback m_onStreamClosedEvent;
69 ErrorCallback m_onError;
70};
71
72namespace StartSpeechSynthesisStreamEventMapper {
74
76} // namespace StartSpeechSynthesisStreamEventMapper
77} // namespace Model
78} // namespace Polly
79} // namespace Aws
AWS_POLLY_API StartSpeechSynthesisStreamHandler(const StartSpeechSynthesisStreamHandler &)=default
void SetInitialResponseCallbackEx(const StartSpeechSynthesisStreamInitialResponseCallbackEx &callback)
void SetStreamClosedEventCallback(const StreamClosedEventCallback &callback)
StartSpeechSynthesisStreamInitialResponseCallbackEx & GetInitialResponseCallbackEx()
AWS_POLLY_API StartSpeechSynthesisStreamHandler & operator=(const StartSpeechSynthesisStreamHandler &)=default
void SetInitialResponseCallback(const StartSpeechSynthesisStreamInitialResponseCallback &noArgCallback)
virtual AWS_POLLY_API void OnEvent() override
AWS_POLLY_API StartSpeechSynthesisStreamEventType GetStartSpeechSynthesisStreamEventTypeForName(const Aws::String &name)
AWS_POLLY_API Aws::String GetNameForStartSpeechSynthesisStreamEventType(StartSpeechSynthesisStreamEventType value)
std::basic_string< char, std::char_traits< char >, Aws::Allocator< char > > String