| OLD | NEW |
| (Empty) | |
| 1 // Copyright 2016 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. |
| 4 |
| 5 #ifndef IOS_CHROME_BROWSER_UI_VOICE_TEXT_TO_SPEECH_PLAYER_H_ |
| 6 #define IOS_CHROME_BROWSER_UI_VOICE_TEXT_TO_SPEECH_PLAYER_H_ |
| 7 |
| 8 #import <Foundation/Foundation.h> |
| 9 |
| 10 // Class responsible for playing TextToSpeech audio data and emitting audio |
| 11 // levels. |
| 12 @interface TextToSpeechPlayer : NSObject |
| 13 |
| 14 // Whether there is audio data prepared to be played. |
| 15 @property(nonatomic, readonly, getter=isReadyForPlayback) BOOL readyForPlayback; |
| 16 |
| 17 // Whether the TextToSpeechPlayer is currently playing audio. |
| 18 @property(nonatomic, readonly, getter=isPlayingAudio) BOOL playingAudio; |
| 19 |
| 20 // Stores a reference to |audioData| and clears up prior TTS state. Calling |
| 21 // this function while |playingAudio| is YES will cancel prior playback. This |
| 22 // function will post a kTTSAudioReadyForPlaybackNotification notification with |
| 23 // the TexToSpeechPlayer used as the sending object. |
| 24 - (void)prepareToPlayAudioData:(NSData*)audioData; |
| 25 |
| 26 // Creates an AVAudioPlayer and begins playing audio data passed to |
| 27 // |-prepareToPlayAudioData:|. No-op if called when |readyForPlayback| is NO |
| 28 // or |playingAudio| is YES. This function will post a |
| 29 // kTTSWillStartPlayingNotification with the TextToSpeechPlayer used as the |
| 30 // sending object. |
| 31 - (void)beginPlayback; |
| 32 |
| 33 // Stops any active playback and notifies observers that TTS has stopped. This |
| 34 // function will post a kTTSDidStopPlayingNotification notification with the |
| 35 // TextToSpeechPlayer used as the sending object. |
| 36 - (void)cancelPlayback; |
| 37 |
| 38 @end |
| 39 |
| 40 #endif // IOS_CHROME_BROWSER_UI_VOICE_TEXT_TO_SPEECH_PLAYER_H_ |
| OLD | NEW |