Plugins:PepperAudioAPI: Difference between revisions

Jump to navigation Jump to search
Line 84: Line 84:
<pre>
<pre>
NPPepperExtensions *pepper;
NPPepperExtensions *pepper;
NPDeviceContextAudio *audio = NULL;
NPDevice *audio = NULL;
/* Get PEPPER extensions */
/* Get PEPPER extensions */
NPERR ret = NPN_GetValue(instance, NPNVPepperExtensions, &pepper);
NPERR ret = NPN_GetValue(instance, NPNVPepperExtensions, &pepper);
if (NPERR_NO_ERROR == ret) {
if (NPERR_NO_ERROR == ret) {
   /* successfully obtained Pepper extensions, now acquire audio... */
   /* successfully obtained Pepper extensions, now acquire audio... */
   audio = pepper->acquireDevice(NPPepperAudioDevice);
   audio = pepper->AcquireDevice(NPPepperAudioDevice);
} else {
} else {
   /* Pepper extensions are not available */
   /* Pepper extensions are not available */
Line 99: Line 99:
</pre>
</pre>


Once an interface to the audio device is acquired, an application can query capabilities of the device, and from there, create a configuration (a set of capabilities.) In this simple example, the application picks 44.1kHz, stereo output using int16 sample types. It uses query Capability to retrieve a recommended sample frame count for the output buffer.
Once an interface to the audio device is acquired, an application can query capabilities of the device, and from there, create a configuration (a set of capabilities.) In this simple example, the application picks 44.1kHz, stereo output using int16 sample types. It uses queryCapability() to retrieve a recommended sample frame count for the output buffer.


<pre>
<pre>
45

edits

Navigation menu