| OLD | NEW |
| 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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_AUDIO_CONFIG_H_ | 5 #ifndef PPAPI_CPP_AUDIO_CONFIG_H_ |
| 6 #define PPAPI_CPP_AUDIO_CONFIG_H_ | 6 #define PPAPI_CPP_AUDIO_CONFIG_H_ |
| 7 | 7 |
| 8 #include "ppapi/c/ppb_audio_config.h" | 8 #include "ppapi/c/ppb_audio_config.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 22 matching lines...) Expand all Loading... |
| 33 /// <code>buffer16[2]</code> is the second left channel sample. | 33 /// <code>buffer16[2]</code> is the second left channel sample. |
| 34 /// <code>buffer16[3]</code> is the second right channel sample. | 34 /// <code>buffer16[3]</code> is the second right channel sample. |
| 35 /// <code>...</code> | 35 /// <code>...</code> |
| 36 /// <code>buffer16[2 * (sample_frame_count - 1)]</code> is the last left | 36 /// <code>buffer16[2 * (sample_frame_count - 1)]</code> is the last left |
| 37 /// channel sample. | 37 /// channel sample. |
| 38 /// <code>buffer16[2 * (sample_frame_count - 1) + 1]</code> is the last right | 38 /// <code>buffer16[2 * (sample_frame_count - 1) + 1]</code> is the last right |
| 39 /// channel sample. | 39 /// channel sample. |
| 40 /// Data will always be in the native endian format of the platform. | 40 /// Data will always be in the native endian format of the platform. |
| 41 /// | 41 /// |
| 42 /// <strong>Example:</strong> | 42 /// <strong>Example:</strong> |
| 43 /// @code | 43 /// <code> |
| 44 /// |
| 44 /// // Create an audio config with a supported frame count. | 45 /// // Create an audio config with a supported frame count. |
| 45 /// uint32_t sample_frame_count = AudioConfig::RecommendSampleFrameCount( | 46 /// uint32_t sample_frame_count = AudioConfig::RecommendSampleFrameCount( |
| 46 /// PP_AUDIOSAMPLERATE_44100, 4096); | 47 /// PP_AUDIOSAMPLERATE_44100, 4096); |
| 47 /// AudioConfig config(PP_AUDIOSAMPLERATE_44100, sample_frame_count); | 48 /// AudioConfig config(PP_AUDIOSAMPLERATE_44100, sample_frame_count); |
| 48 /// if (config.is_null()) | 49 /// if (config.is_null()) |
| 49 /// return false; // Couldn't configure audio. | 50 /// return false; // Couldn't configure audio. |
| 50 /// | 51 /// |
| 51 /// // Then use the config to create your audio resource. | 52 /// // Then use the config to create your audio resource. |
| 52 /// Audio audio(instance, config, callback, user_data); | 53 /// Audio audio(instance, config, callback, user_data); |
| 53 /// if (audio.is_null()) | 54 /// if (audio.is_null()) |
| 54 /// return false; // Couldn't create audio. | 55 /// return false; // Couldn't create audio. |
| 55 /// @endcode | 56 /// </code> |
| 56 class AudioConfig : public Resource { | 57 class AudioConfig : public Resource { |
| 57 public: | 58 public: |
| 58 /// An empty constructor for an <code>AudioConfig</code> resource. | 59 /// An empty constructor for an <code>AudioConfig</code> resource. |
| 59 AudioConfig(); | 60 AudioConfig(); |
| 60 | 61 |
| 61 /// A constructor that creates an audio config based on the given sample rate | 62 /// A constructor that creates an audio config based on the given sample rate |
| 62 /// and frame count. If the rate and frame count aren't supported, the | 63 /// and frame count. If the rate and frame count aren't supported, the |
| 63 /// resulting resource will be is_null(). You can pass the result of | 64 /// resulting resource will be is_null(). You can pass the result of |
| 64 /// RecommendSampleFrameCount() as the sample frame count. | 65 /// RecommendSampleFrameCount() as the sample frame count. |
| 65 /// | 66 /// |
| (...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 111 | 112 |
| 112 private: | 113 private: |
| 113 PP_AudioSampleRate sample_rate_; | 114 PP_AudioSampleRate sample_rate_; |
| 114 uint32_t sample_frame_count_; | 115 uint32_t sample_frame_count_; |
| 115 }; | 116 }; |
| 116 | 117 |
| 117 } // namespace pp | 118 } // namespace pp |
| 118 | 119 |
| 119 #endif // PPAPI_CPP_AUDIO_CONFIG_H_ | 120 #endif // PPAPI_CPP_AUDIO_CONFIG_H_ |
| 120 | 121 |
| OLD | NEW |