OLD | NEW |
1 .. _devguide-coding-audio: | 1 .. _devguide-coding-audio: |
2 | 2 |
3 ##### | 3 ##### |
4 Audio | 4 Audio |
5 ##### | 5 ##### |
6 | 6 |
7 .. contents:: | 7 .. contents:: |
8 :local: | 8 :local: |
9 :backlinks: none | 9 :backlinks: none |
10 :depth: 2 | 10 :depth: 2 |
(...skipping 14 matching lines...) Expand all Loading... |
25 the SDK directory ``examples/api/audio``), which lets users specify a frequency | 25 the SDK directory ``examples/api/audio``), which lets users specify a frequency |
26 for the sine wave and click buttons to start and stop audio playback. | 26 for the sine wave and click buttons to start and stop audio playback. |
27 | 27 |
28 Reference information | 28 Reference information |
29 ===================== | 29 ===================== |
30 | 30 |
31 For reference information related to the Pepper audio API, see the following | 31 For reference information related to the Pepper audio API, see the following |
32 documentation: | 32 documentation: |
33 | 33 |
34 * `pp::AudioConfig class | 34 * `pp::AudioConfig class |
35 <https://developers.google.com/native-client/peppercpp/classpp_1_1_audio_confi
g>`_ | 35 </native-client/pepper_stable/cpp/classpp_1_1_audio_config>`_ |
36 | 36 |
37 * `pp::Audio class | 37 * `pp::Audio class </native-client/pepper_stable/cpp/classpp_1_1_audio>`_ |
38 <https://developers.google.com/native-client/peppercpp/classpp_1_1_audio>`_ | |
39 | 38 |
40 * `audio_config.h | 39 * `audio_config.h </native-client/pepper_cpp/audio__config_8h>`_ |
41 <https://developers.google.com/native-client/peppercpp/audio__config_8h>`_ | |
42 | 40 |
43 * `audio.h <https://developers.google.com/native-client/peppercpp/audio_8h>`_ | 41 * `audio.h </native-client/pepper_stable/cpp/audio_8h>`_ |
44 | 42 |
45 * `PP_AudioSampleRate | 43 * `PP_AudioSampleRate |
46 <https://developers.google.com/native-client/pepperc/group___enums.html#gaee75
0c350655f2fb0fe04c04029e0ff8>`_ | 44 </native-client/pepper_stable/c/group___enums#gaee750c350655f2fb0fe04c04029e0f
f8>`_ |
47 | 45 |
48 About the Pepper audio API | 46 About the Pepper audio API |
49 ========================== | 47 ========================== |
50 | 48 |
51 The Pepper audio API lets Native Client modules play audio streams in a | 49 The Pepper audio API lets Native Client modules play audio streams in a |
52 browser. To play an audio stream, a module generates audio samples and writes | 50 browser. To play an audio stream, a module generates audio samples and writes |
53 them into a buffer. The browser reads the audio samples from the buffer and | 51 them into a buffer. The browser reads the audio samples from the buffer and |
54 plays them using an audio device on the client computer. | 52 plays them using an audio device on the client computer. |
55 | 53 |
56 .. image:: /images/pepper-audio-buffer.png | 54 .. image:: /images/pepper-audio-buffer.png |
(...skipping 322 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
379 } | 377 } |
380 std::string message = var_message.AsString(); | 378 std::string message = var_message.AsString(); |
381 if (message == kPlaySoundId) { | 379 if (message == kPlaySoundId) { |
382 audio_.StartPlayback(); | 380 audio_.StartPlayback(); |
383 } else if (message == kStopSoundId) { | 381 } else if (message == kStopSoundId) { |
384 audio_.StopPlayback(); | 382 audio_.StopPlayback(); |
385 } else if (...) { | 383 } else if (...) { |
386 ... | 384 ... |
387 } | 385 } |
388 } | 386 } |
OLD | NEW |