OLD | NEW |
1 {{+bindTo:partials.standard_nacl_article}} | 1 {{+bindTo:partials.standard_nacl_article}} |
2 | 2 |
3 <section id="audio"> | 3 <section id="audio"> |
4 <span id="devguide-coding-audio"></span><h1 id="audio"><span id="devguide-coding
-audio"></span>Audio</h1> | 4 <span id="devguide-coding-audio"></span><h1 id="audio"><span id="devguide-coding
-audio"></span>Audio</h1> |
5 <div class="contents local" id="contents" style="display: none"> | 5 <div class="contents local" id="contents" style="display: none"> |
6 <ul class="small-gap"> | 6 <ul class="small-gap"> |
7 <li><a class="reference internal" href="#reference-information" id="id1">Referen
ce information</a></li> | 7 <li><a class="reference internal" href="#reference-information" id="id1">Referen
ce information</a></li> |
8 <li><a class="reference internal" href="#about-the-pepper-audio-api" id="id2">Ab
out the Pepper audio API</a></li> | 8 <li><a class="reference internal" href="#about-the-pepper-audio-api" id="id2">Ab
out the Pepper audio API</a></li> |
9 <li><a class="reference internal" href="#digital-audio-concepts" id="id3">Digita
l audio concepts</a></li> | 9 <li><a class="reference internal" href="#digital-audio-concepts" id="id3">Digita
l audio concepts</a></li> |
10 <li><a class="reference internal" href="#setting-up-the-module" id="id4">Setting
up the module</a></li> | 10 <li><a class="reference internal" href="#setting-up-the-module" id="id4">Setting
up the module</a></li> |
(...skipping 25 matching lines...) Expand all Loading... |
36 generates audio samples using a sine wave with a frequency of 440 Hz. The module | 36 generates audio samples using a sine wave with a frequency of 440 Hz. The module |
37 starts playing the audio samples as soon as it is loaded into the browser. For a | 37 starts playing the audio samples as soon as it is loaded into the browser. For a |
38 slightly more sophisticated example, see the <code>audio</code> example (source
code in | 38 slightly more sophisticated example, see the <code>audio</code> example (source
code in |
39 the SDK directory <code>examples/api/audio</code>), which lets users specify a f
requency | 39 the SDK directory <code>examples/api/audio</code>), which lets users specify a f
requency |
40 for the sine wave and click buttons to start and stop audio playback.</p> | 40 for the sine wave and click buttons to start and stop audio playback.</p> |
41 <section id="reference-information"> | 41 <section id="reference-information"> |
42 <h2 id="reference-information">Reference information</h2> | 42 <h2 id="reference-information">Reference information</h2> |
43 <p>For reference information related to the Pepper audio API, see the following | 43 <p>For reference information related to the Pepper audio API, see the following |
44 documentation:</p> | 44 documentation:</p> |
45 <ul class="small-gap"> | 45 <ul class="small-gap"> |
46 <li><a class="reference external" href="https://developers.google.com/native-cli
ent/peppercpp/classpp_1_1_audio_config">pp::AudioConfig class</a></li> | 46 <li><a class="reference external" href="/native-client/pepper_stable/cpp/classpp
_1_1_audio_config">pp::AudioConfig class</a></li> |
47 <li><a class="reference external" href="https://developers.google.com/native-cli
ent/peppercpp/classpp_1_1_audio">pp::Audio class</a></li> | 47 <li><a class="reference external" href="/native-client/pepper_stable/cpp/classpp
_1_1_audio">pp::Audio class</a></li> |
48 <li><a class="reference external" href="https://developers.google.com/native-cli
ent/peppercpp/audio__config_8h">audio_config.h</a></li> | 48 <li><a class="reference external" href="/native-client/pepper_cpp/audio__config_
8h">audio_config.h</a></li> |
49 <li><a class="reference external" href="https://developers.google.com/native-cli
ent/peppercpp/audio_8h">audio.h</a></li> | 49 <li><a class="reference external" href="/native-client/pepper_stable/cpp/audio_8
h">audio.h</a></li> |
50 <li><a class="reference external" href="https://developers.google.com/native-cli
ent/pepperc/group___enums.html#gaee750c350655f2fb0fe04c04029e0ff8">PP_AudioSampl
eRate</a></li> | 50 <li><a class="reference external" href="/native-client/pepper_stable/c/group___e
nums#gaee750c350655f2fb0fe04c04029e0ff8">PP_AudioSampleRate</a></li> |
51 </ul> | 51 </ul> |
52 </section><section id="about-the-pepper-audio-api"> | 52 </section><section id="about-the-pepper-audio-api"> |
53 <h2 id="about-the-pepper-audio-api">About the Pepper audio API</h2> | 53 <h2 id="about-the-pepper-audio-api">About the Pepper audio API</h2> |
54 <p>The Pepper audio API lets Native Client modules play audio streams in a | 54 <p>The Pepper audio API lets Native Client modules play audio streams in a |
55 browser. To play an audio stream, a module generates audio samples and writes | 55 browser. To play an audio stream, a module generates audio samples and writes |
56 them into a buffer. The browser reads the audio samples from the buffer and | 56 them into a buffer. The browser reads the audio samples from the buffer and |
57 plays them using an audio device on the client computer.</p> | 57 plays them using an audio device on the client computer.</p> |
58 <img alt="/native-client/images/pepper-audio-buffer.png" src="/native-client/ima
ges/pepper-audio-buffer.png" /> | 58 <img alt="/native-client/images/pepper-audio-buffer.png" src="/native-client/ima
ges/pepper-audio-buffer.png" /> |
59 <p>This mechanism is simple but low-level. If you want to play plain sound files
in | 59 <p>This mechanism is simple but low-level. If you want to play plain sound files
in |
60 a web application, you may want to consider higher-level alternatives such as | 60 a web application, you may want to consider higher-level alternatives such as |
(...skipping 282 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
343 } else if (message == kStopSoundId) { | 343 } else if (message == kStopSoundId) { |
344 audio_.StopPlayback(); | 344 audio_.StopPlayback(); |
345 } else if (...) { | 345 } else if (...) { |
346 ... | 346 ... |
347 } | 347 } |
348 } | 348 } |
349 </pre> | 349 </pre> |
350 </section></section> | 350 </section></section> |
351 | 351 |
352 {{/partials.standard_nacl_article}} | 352 {{/partials.standard_nacl_article}} |
OLD | NEW |