Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(422)

Side by Side Diff: media/audio/simple_sources.h

Issue 4661001: Simplified AudioOutputStream interface. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: - Created 10 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « media/audio/openbsd/audio_manager_openbsd.cc ('k') | media/audio/simple_sources.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. 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 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_SIMPLE_SOURCES_H_ 5 #ifndef MEDIA_AUDIO_SIMPLE_SOURCES_H_
6 #define MEDIA_AUDIO_SIMPLE_SOURCES_H_ 6 #define MEDIA_AUDIO_SIMPLE_SOURCES_H_
7 7
8 #include <list> 8 #include <list>
9 9
10 #include "base/lock.h" 10 #include "base/lock.h"
(...skipping 11 matching lines...) Expand all
22 // hertz and it has to be less than half of the sampling frequency 22 // hertz and it has to be less than half of the sampling frequency
23 // |sample_freq| or else you will get aliasing. 23 // |sample_freq| or else you will get aliasing.
24 SineWaveAudioSource(Format format, int channels, 24 SineWaveAudioSource(Format format, int channels,
25 double freq, double sample_freq); 25 double freq, double sample_freq);
26 virtual ~SineWaveAudioSource() {} 26 virtual ~SineWaveAudioSource() {}
27 27
28 // Implementation of AudioSourceCallback. 28 // Implementation of AudioSourceCallback.
29 virtual uint32 OnMoreData( 29 virtual uint32 OnMoreData(
30 AudioOutputStream* stream, uint8* dest, uint32 max_size, 30 AudioOutputStream* stream, uint8* dest, uint32 max_size,
31 AudioBuffersState audio_buffers); 31 AudioBuffersState audio_buffers);
32 virtual void OnClose(AudioOutputStream* stream);
33 virtual void OnError(AudioOutputStream* stream, int code); 32 virtual void OnError(AudioOutputStream* stream, int code);
34 33
35 protected: 34 protected:
36 Format format_; 35 Format format_;
37 int channels_; 36 int channels_;
38 double freq_; 37 double freq_;
39 double sample_freq_; 38 double sample_freq_;
40 }; 39 };
41 40
42 // Defines an interface for pushing audio output. In contrast, the interfaces 41 // Defines an interface for pushing audio output. In contrast, the interfaces
(...skipping 23 matching lines...) Expand all
66 65
67 // Write one buffer. 66 // Write one buffer.
68 virtual bool Write(const void* data, uint32 len); 67 virtual bool Write(const void* data, uint32 len);
69 68
70 // Return the total number of bytes not given to the audio device yet. 69 // Return the total number of bytes not given to the audio device yet.
71 virtual uint32 UnProcessedBytes(); 70 virtual uint32 UnProcessedBytes();
72 71
73 // Implementation of AudioSourceCallback. 72 // Implementation of AudioSourceCallback.
74 virtual uint32 OnMoreData(AudioOutputStream* stream, uint8* dest, 73 virtual uint32 OnMoreData(AudioOutputStream* stream, uint8* dest,
75 uint32 max_size, AudioBuffersState buffers_state); 74 uint32 max_size, AudioBuffersState buffers_state);
76 virtual void OnClose(AudioOutputStream* stream);
77 virtual void OnError(AudioOutputStream* stream, int code); 75 virtual void OnError(AudioOutputStream* stream, int code);
78 76
79 // Discard all buffered data and reset to initial state. 77 // Discard all buffered data and reset to initial state.
80 void ClearAll(); 78 void ClearAll();
81 79
82 private: 80 private:
83 // Free acquired resources. 81 // Free acquired resources.
84 void CleanUp(); 82 void CleanUp();
85 83
86 media::SeekableBuffer buffer_; 84 media::SeekableBuffer buffer_;
87 }; 85 };
88 86
89 #endif // MEDIA_AUDIO_SIMPLE_SOURCES_H_ 87 #endif // MEDIA_AUDIO_SIMPLE_SOURCES_H_
OLDNEW
« no previous file with comments | « media/audio/openbsd/audio_manager_openbsd.cc ('k') | media/audio/simple_sources.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698