| OLD | NEW |
| 1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #ifndef MEDIA_AUDIO_SOUNDS_AUDIO_STREAM_HANDLER_H_ | 5 #ifndef MEDIA_AUDIO_SOUNDS_AUDIO_STREAM_HANDLER_H_ |
| 6 #define MEDIA_AUDIO_SOUNDS_AUDIO_STREAM_HANDLER_H_ | 6 #define MEDIA_AUDIO_SOUNDS_AUDIO_STREAM_HANDLER_H_ |
| 7 | 7 |
| 8 #include "base/basictypes.h" | 8 #include "base/basictypes.h" |
| 9 #include "base/compiler_specific.h" | 9 #include "base/compiler_specific.h" |
| 10 #include "base/strings/string_piece.h" | 10 #include "base/strings/string_piece.h" |
| (...skipping 12 matching lines...) Expand all Loading... |
| 23 public: | 23 public: |
| 24 class TestObserver { | 24 class TestObserver { |
| 25 public: | 25 public: |
| 26 virtual ~TestObserver() {} | 26 virtual ~TestObserver() {} |
| 27 | 27 |
| 28 // Following methods will be called only from the audio thread. | 28 // Following methods will be called only from the audio thread. |
| 29 | 29 |
| 30 // Called when AudioOutputStreamProxy::Start() was successfully called. | 30 // Called when AudioOutputStreamProxy::Start() was successfully called. |
| 31 virtual void OnPlay() = 0; | 31 virtual void OnPlay() = 0; |
| 32 | 32 |
| 33 // Called when current sound is replayed. |
| 34 virtual void OnReplay() = 0; |
| 35 |
| 33 // Called when AudioOutputStreamProxy::Stop() was successfully called. | 36 // Called when AudioOutputStreamProxy::Stop() was successfully called. |
| 34 virtual void OnStop(size_t cursor) = 0; | 37 virtual void OnStop(size_t cursor) = 0; |
| 35 }; | 38 }; |
| 36 | 39 |
| 37 // C-tor for AudioStreamHandler. |wav_data| should be a raw | 40 // C-tor for AudioStreamHandler. |wav_data| should be a raw |
| 38 // uncompressed WAVE data which will be sent to the audio manager. | 41 // uncompressed WAVE data which will be sent to the audio manager. |
| 39 explicit AudioStreamHandler(const base::StringPiece& wav_data); | 42 explicit AudioStreamHandler(const base::StringPiece& wav_data); |
| 40 virtual ~AudioStreamHandler(); | 43 virtual ~AudioStreamHandler(); |
| 41 | 44 |
| 42 // Returns true iff AudioStreamHandler is correctly initialized; | 45 // Returns true iff AudioStreamHandler is correctly initialized; |
| (...skipping 12 matching lines...) Expand all Loading... |
| 55 | 58 |
| 56 private: | 59 private: |
| 57 friend class AudioStreamHandlerTest; | 60 friend class AudioStreamHandlerTest; |
| 58 friend class SoundsManagerTest; | 61 friend class SoundsManagerTest; |
| 59 | 62 |
| 60 class AudioStreamContainer; | 63 class AudioStreamContainer; |
| 61 | 64 |
| 62 static void SetObserverForTesting(TestObserver* observer); | 65 static void SetObserverForTesting(TestObserver* observer); |
| 63 static void SetAudioSourceForTesting( | 66 static void SetAudioSourceForTesting( |
| 64 AudioOutputStream::AudioSourceCallback* source); | 67 AudioOutputStream::AudioSourceCallback* source); |
| 68 void AllowReplayOnceForTesting(); |
| 69 |
| 70 void StopAfterDelay(); |
| 65 | 71 |
| 66 WavAudioHandler wav_audio_; | 72 WavAudioHandler wav_audio_; |
| 67 scoped_ptr<AudioStreamContainer> stream_; | 73 scoped_ptr<AudioStreamContainer> stream_; |
| 68 | 74 |
| 69 bool initialized_; | 75 bool initialized_; |
| 70 | 76 |
| 71 DISALLOW_COPY_AND_ASSIGN(AudioStreamHandler); | 77 DISALLOW_COPY_AND_ASSIGN(AudioStreamHandler); |
| 72 }; | 78 }; |
| 73 | 79 |
| 74 } // namespace media | 80 } // namespace media |
| 75 | 81 |
| 76 #endif // MEDIA_AUDIO_SOUNDS_AUDIO_STREAM_HANDLER_H_ | 82 #endif // MEDIA_AUDIO_SOUNDS_AUDIO_STREAM_HANDLER_H_ |
| OLD | NEW |