Chromium Code Reviews| Index: ios/chrome/browser/ui/voice/text_to_speech_player.h |
| diff --git a/ios/chrome/browser/ui/voice/text_to_speech_player.h b/ios/chrome/browser/ui/voice/text_to_speech_player.h |
| new file mode 100644 |
| index 0000000000000000000000000000000000000000..933e491ae973f4795b77764a8c192897fdda55eb |
| --- /dev/null |
| +++ b/ios/chrome/browser/ui/voice/text_to_speech_player.h |
| @@ -0,0 +1,40 @@ |
| +// Copyright 2016 The Chromium Authors. All rights reserved. |
| +// Use of this source code is governed by a BSD-style license that can be |
| +// found in the LICENSE file. |
| + |
| +#ifndef IOS_CHROME_BROWSER_UI_VOICE_TEXT_TO_SPEECH_PLAYER_H_ |
| +#define IOS_CHROME_BROWSER_UI_VOICE_TEXT_TO_SPEECH_PLAYER_H_ |
| + |
| +#import <Foundation/Foundation.h> |
| + |
| +// Class responsible for playing TextToSpeech audio data and emitting audio |
| +// levels. |
| +@interface TextToSpeechPlayer : NSObject |
| + |
| +// Whether there is audio data prepared to be played. |
| +@property(nonatomic, readonly, getter=isReadyForPlayback) BOOL readyForPlayback; |
| + |
| +// Whether the TextToSpeechPlayer is currently playing audio. |
| +@property(nonatomic, readonly, getter=isPlayingAudio) BOOL playingAudio; |
| + |
| +// Stores a reference to |audioData| and clears up prior TTS state. Calling |
| +// this function while |playingAudio| is YES will cancel prior playback. This |
| +// function will post a kTTSAudioReadyForPlaybackNotification notification with |
| +// the TexToSpeechPlayer used as the sending object. |
| +- (void)prepareToPlayAudioData:(NSData*)audioData; |
| + |
| +// Creates an AVAudioPlayer and begins playing audio data passed to |
| +// |-prepareToPlayAudioData:|. no-op if called when |readyForPlayback| is NO |
|
sdefresne
2016/10/25 13:20:30
Should this be spelled "No-op" as it is starting a
rohitrao (ping after 24h)
2016/10/25 15:23:12
Done.
|
| +// or |playingAudio| is YES. This function will post a |
| +// kTTSWillStartPlayingNotification with the TextToSpeechPlayer used as the |
| +// sending object. |
| +- (void)beginPlayback; |
| + |
| +// Stops any active playback and notifies observers that TTS has stopped. This |
| +// function will post a kTTSDidStopPlayingNotification notification with the |
| +// TextToSpeechPlayer used as the sending object. |
| +- (void)cancelPlayback; |
| + |
| +@end |
| + |
| +#endif // IOS_CHROME_BROWSER_UI_VOICE_TEXT_TO_SPEECH_PLAYER_H_ |