OLD | NEW |
(Empty) | |
| 1 // Copyright (c) 2010 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 MEDIA_AUDIO_AUDIO_OUTPUT_STREAM_PROXY_H |
| 6 #define MEDIA_AUDIO_AUDIO_OUTPUT_STREAM_PROXY_H |
| 7 |
| 8 #include "base/basictypes.h" |
| 9 #include "base/task.h" |
| 10 #include "media/audio/audio_io.h" |
| 11 #include "media/audio/audio_parameters.h" |
| 12 |
| 13 class AudioOutputDispatcher; |
| 14 |
| 15 class AudioOutputProxy : public AudioOutputStream { |
| 16 public: |
| 17 AudioOutputProxy(AudioOutputDispatcher* dispatcher); |
| 18 |
| 19 // AudioOutputStream interface. |
| 20 virtual bool Open(); |
| 21 virtual void Start(AudioSourceCallback* callback); |
| 22 virtual void Stop(); |
| 23 virtual void SetVolume(double volume); |
| 24 virtual void GetVolume(double* volume); |
| 25 virtual void Close(); |
| 26 |
| 27 private: |
| 28 // Needs to access destructor. |
| 29 friend class DeleteTask<AudioOutputProxy>; |
| 30 |
| 31 enum State { |
| 32 kCreated, |
| 33 kOpened, |
| 34 kPlaying, |
| 35 kClosed, |
| 36 kError, |
| 37 }; |
| 38 |
| 39 virtual ~AudioOutputProxy(); |
| 40 |
| 41 scoped_refptr<AudioOutputDispatcher> dispatcher_; |
| 42 State state_; |
| 43 |
| 44 // The actual audio stream. Must be set to NULL in any state other |
| 45 // than kPlaying. |
| 46 AudioOutputStream* physical_stream_; |
| 47 |
| 48 // Need to save volume here, so that we can restore it in case the stream |
| 49 // is stopped, and then started again. |
| 50 double volume_; |
| 51 |
| 52 DISALLOW_COPY_AND_ASSIGN(AudioOutputProxy); |
| 53 }; |
| 54 |
| 55 #endif // MEDIA_AUDIO_AUDIO_OUTPUT_STREAM_PROXY_H |
OLD | NEW |