Delete unused downloads page asset.
[chromium-blink-merge.git] / ppapi / cpp / audio_buffer.h
blobecaa439d1cba6c75d1c45150d583e748533acac6
1 // Copyright 2014 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.
5 #ifndef PPAPI_CPP_AUDIO_BUFFER_H_
6 #define PPAPI_CPP_AUDIO_BUFFER_H_
8 #include "ppapi/c/ppb_audio_buffer.h"
9 #include "ppapi/cpp/resource.h"
11 namespace pp {
13 class AudioBuffer : public Resource {
14 public:
15 /// Default constructor for creating an is_null()
16 /// <code>AudioBuffer</code> object.
17 AudioBuffer();
19 /// The copy constructor for <code>AudioBuffer</code>.
20 ///
21 /// @param[in] other A reference to an <code>AudioBuffer</code>.
22 AudioBuffer(const AudioBuffer& other);
24 /// Constructs an <code>AudioBuffer</code> from a <code>Resource</code>.
25 ///
26 /// @param[in] resource A <code>PPB_AudioBuffer</code> resource.
27 explicit AudioBuffer(const Resource& resource);
29 /// A constructor used when you have received a <code>PP_Resource</code> as a
30 /// return value that has had 1 ref added for you.
31 ///
32 /// @param[in] resource A <code>PPB_AudioBuffer</code> resource.
33 AudioBuffer(PassRef, PP_Resource resource);
35 virtual ~AudioBuffer();
37 /// Gets the timestamp of the audio buffer.
38 ///
39 /// @return A <code>PP_TimeDelta</code> containing the timestamp of the audio
40 /// buffer. Given in seconds since the start of the containing audio stream.
41 PP_TimeDelta GetTimestamp() const;
43 /// Sets the timestamp of the audio buffer.
44 ///
45 /// @param[in] timestamp A <code>PP_TimeDelta</code> containing the timestamp
46 /// of the audio buffer. Given in seconds since the start of the containing
47 /// audio stream.
48 void SetTimestamp(PP_TimeDelta timestamp);
50 /// Gets the sample rate of the audio buffer.
51 ///
52 /// @return The sample rate of the audio buffer.
53 PP_AudioBuffer_SampleRate GetSampleRate() const;
55 /// Gets the sample size of the audio buffer in bytes.
56 ///
57 /// @return The sample size of the audio buffer in bytes.
58 PP_AudioBuffer_SampleSize GetSampleSize() const;
60 /// Gets the number of channels in the audio buffer.
61 ///
62 /// @return The number of channels in the audio buffer.
63 uint32_t GetNumberOfChannels() const;
65 /// Gets the number of samples in the audio buffer.
66 ///
67 /// @return The number of samples in the audio buffer.
68 /// For example, at a sampling rate of 44,100 Hz in stereo audio, a buffer
69 /// containing 4,410 * 2 samples would have a duration of 100 milliseconds.
70 uint32_t GetNumberOfSamples() const;
72 /// Gets the data buffer containing the audio buffer samples.
73 ///
74 /// @return A pointer to the beginning of the data buffer.
75 void* GetDataBuffer();
77 /// Gets the size of data buffer in bytes.
78 ///
79 /// @return The size of the data buffer in bytes.
80 uint32_t GetDataBufferSize() const;
83 } // namespace pp
85 #endif // PPAPI_CPP_AUDIO_BUFFER_H_