OLD | NEW |
1 // Copyright (c) 2009 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2009 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_MAC_AUDIO_OUTPUT_MAC_H_ | 5 #ifndef MEDIA_AUDIO_MAC_AUDIO_OUTPUT_MAC_H_ |
6 #define MEDIA_AUDIO_MAC_AUDIO_OUTPUT_MAC_H_ | 6 #define MEDIA_AUDIO_MAC_AUDIO_OUTPUT_MAC_H_ |
7 | 7 |
8 #include <AudioToolbox/AudioQueue.h> | 8 #include <AudioToolbox/AudioQueue.h> |
9 #include <AudioToolbox/AudioFormat.h> | 9 #include <AudioToolbox/AudioFormat.h> |
10 | 10 |
(...skipping 15 matching lines...) Expand all Loading... |
26 char bits_per_sample); | 26 char bits_per_sample); |
27 // The dtor is typically called by the AudioManager only and it is usually | 27 // The dtor is typically called by the AudioManager only and it is usually |
28 // triggered by calling AudioOutputStream::Close(). | 28 // triggered by calling AudioOutputStream::Close(). |
29 virtual ~PCMQueueOutAudioOutputStream(); | 29 virtual ~PCMQueueOutAudioOutputStream(); |
30 | 30 |
31 // Implementation of AudioOutputStream. | 31 // Implementation of AudioOutputStream. |
32 virtual bool Open(size_t packet_size); | 32 virtual bool Open(size_t packet_size); |
33 virtual void Close(); | 33 virtual void Close(); |
34 virtual void Start(AudioSourceCallback* callback); | 34 virtual void Start(AudioSourceCallback* callback); |
35 virtual void Stop(); | 35 virtual void Stop(); |
36 virtual void SetVolume(double left_level, double right_level); | 36 virtual void SetVolume(double volume); |
37 virtual void GetVolume(double* left_level, double* right_level); | 37 virtual void GetVolume(double* volume); |
38 | 38 |
39 private: | 39 private: |
40 // The audio is double buffered. | 40 // The audio is double buffered. |
41 static const size_t kNumBuffers = 2; | 41 static const size_t kNumBuffers = 2; |
42 | 42 |
43 // The OS calls back here when an audio buffer has been processed. | 43 // The OS calls back here when an audio buffer has been processed. |
44 static void RenderCallback(void* p_this, AudioQueueRef queue, | 44 static void RenderCallback(void* p_this, AudioQueueRef queue, |
45 AudioQueueBufferRef buffer); | 45 AudioQueueBufferRef buffer); |
46 // Called when an error occurs. | 46 // Called when an error occurs. |
47 void HandleError(OSStatus err); | 47 void HandleError(OSStatus err); |
(...skipping 12 matching lines...) Expand all Loading... |
60 int silence_bytes_; | 60 int silence_bytes_; |
61 // Volume level from 0 to 1. | 61 // Volume level from 0 to 1. |
62 float volume_; | 62 float volume_; |
63 // Number of bytes yet to be played in audio buffer. | 63 // Number of bytes yet to be played in audio buffer. |
64 int pending_bytes_; | 64 int pending_bytes_; |
65 | 65 |
66 DISALLOW_COPY_AND_ASSIGN(PCMQueueOutAudioOutputStream); | 66 DISALLOW_COPY_AND_ASSIGN(PCMQueueOutAudioOutputStream); |
67 }; | 67 }; |
68 | 68 |
69 #endif // MEDIA_AUDIO_MAC_AUDIO_OUTPUT_MAC_H_ | 69 #endif // MEDIA_AUDIO_MAC_AUDIO_OUTPUT_MAC_H_ |
OLD | NEW |