OLD | NEW |
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 PPAPI_CPP_DEV_AUDIO_CONFIG_DEV_H_ | 5 #ifndef PPAPI_CPP_DEV_AUDIO_CONFIG_DEV_H_ |
6 #define PPAPI_CPP_DEV_AUDIO_CONFIG_DEV_H_ | 6 #define PPAPI_CPP_DEV_AUDIO_CONFIG_DEV_H_ |
7 | 7 |
8 #include "ppapi/c/dev/ppb_audio_config_dev.h" | 8 #include "ppapi/c/dev/ppb_audio_config_dev.h" |
9 #include "ppapi/c/pp_stdint.h" | 9 #include "ppapi/c/pp_stdint.h" |
10 #include "ppapi/cpp/resource.h" | 10 #include "ppapi/cpp/resource.h" |
(...skipping 15 matching lines...) Expand all Loading... |
26 // Audio_dev audio(..., config, ...); | 26 // Audio_dev audio(..., config, ...); |
27 // if (audio.is_null()) | 27 // if (audio.is_null()) |
28 // return false; // Couldn't create audio. | 28 // return false; // Couldn't create audio. |
29 class AudioConfig_Dev : public Resource { | 29 class AudioConfig_Dev : public Resource { |
30 public: | 30 public: |
31 AudioConfig_Dev(); | 31 AudioConfig_Dev(); |
32 | 32 |
33 // Creates an audio config based on the given sample rate and frame count. | 33 // Creates an audio config based on the given sample rate and frame count. |
34 // If the rate and frame count aren't supported, the resulting resource | 34 // If the rate and frame count aren't supported, the resulting resource |
35 // will be is_null(). Pass the result of RecommendSampleFrameCount as the | 35 // will be is_null(). Pass the result of RecommendSampleFrameCount as the |
36 // semple frame count. | 36 // sample frame count. |
37 // | 37 // |
38 // See PPB_AudioConfigDev.CreateStereo16Bit for more. | 38 // See PPB_AudioConfigDev.CreateStereo16Bit for more. |
39 AudioConfig_Dev(Instance* instance, | 39 AudioConfig_Dev(Instance* instance, |
40 PP_AudioSampleRate_Dev sample_rate, | 40 PP_AudioSampleRate_Dev sample_rate, |
41 uint32_t sample_frame_count); | 41 uint32_t sample_frame_count); |
42 | 42 |
43 // Returns a supported frame count for use in the constructor. | 43 // Returns a supported frame count for use in the constructor. |
44 // | 44 // |
45 // See PPB_AudioConfigDev.RecommendSampleFrameCount. | 45 // See PPB_AudioConfigDev.RecommendSampleFrameCount. |
46 static uint32_t RecommendSampleFrameCount( | 46 static uint32_t RecommendSampleFrameCount( |
47 uint32_t requested_sample_frame_count); | 47 uint32_t requested_sample_frame_count); |
48 | 48 |
49 PP_AudioSampleRate_Dev sample_rate() const { return sample_rate_; } | 49 PP_AudioSampleRate_Dev sample_rate() const { return sample_rate_; } |
50 uint32_t sample_frame_count() { return sample_frame_count_; } | 50 uint32_t sample_frame_count() { return sample_frame_count_; } |
51 | 51 |
52 private: | 52 private: |
53 PP_AudioSampleRate_Dev sample_rate_; | 53 PP_AudioSampleRate_Dev sample_rate_; |
54 uint32_t sample_frame_count_; | 54 uint32_t sample_frame_count_; |
55 }; | 55 }; |
56 | 56 |
57 } // namespace pp | 57 } // namespace pp |
58 | 58 |
59 #endif // PPAPI_CPP_DEV_AUDIO_CONFIG_DEV_H_ | 59 #endif // PPAPI_CPP_DEV_AUDIO_CONFIG_DEV_H_ |
60 | 60 |
OLD | NEW |