/* Copyright 2017 The Chromium Authors * Use of this source code is governed by a BSD-style license that can be * found in the LICENSE file. */ /* From dev/ppb_audio_output_dev.idl modified Fri Apr 7 07:07:59 2017. */ #ifndef PPAPI_C_DEV_PPB_AUDIO_OUTPUT_DEV_H_ #define PPAPI_C_DEV_PPB_AUDIO_OUTPUT_DEV_H_ #include "ppapi/c/dev/ppb_device_ref_dev.h" #include "ppapi/c/pp_array_output.h" #include "ppapi/c/pp_bool.h" #include "ppapi/c/pp_completion_callback.h" #include "ppapi/c/pp_instance.h" #include "ppapi/c/pp_macros.h" #include "ppapi/c/pp_resource.h" #include "ppapi/c/pp_stdint.h" #include "ppapi/c/pp_time.h" #define PPB_AUDIO_OUTPUT_DEV_INTERFACE_0_1 … #define PPB_AUDIO_OUTPUT_DEV_INTERFACE … /** * @file * This file defines the <code>PPB_AudioOutput_dev</code> interface, which * provides realtime stereo audio streaming capabilities. */ /** * @addtogroup Typedefs * @{ */ /** * <code>PPB_AudioOutput_Callback</code> defines the type of an audio callback * function used to fill the audio buffer with data. Please see the * Create() function in the <code>PPB_AudioOutput</code> interface for * more details on this callback. * * @param[out] sample_buffer A buffer to fill with audio data. * @param[in] buffer_size_in_bytes The size of the buffer in bytes. * @param[in] latency How long before the audio data is to be presented. * @param[inout] user_data An opaque pointer that was passed into * <code>PPB_AudioOutput.Create()</code>. */ PPB_AudioOutput_Callback; /** * @} */ /** * @addtogroup Interfaces * @{ */ /** * The <code>PPB_AudioOutput</code> interface contains pointers to several * functions for handling audio resources. * Please see descriptions for each <code>PPB_AudioOutput</code> and * <code>PPB_AudioConfig</code> function for more details. A C example using * <code>PPB_AudioOutput</code> and <code>PPB_AudioConfig</code> follows. * * <strong>Example: </strong> * * @code * void audio_output_callback(void* sample_buffer, * uint32_t buffer_size_in_bytes, * PP_TimeDelta latency, * void* user_data) { * ... quickly fill in the buffer with samples and return to caller ... * } * * ...Assume the application has cached the audio configuration interface in * audio_config_interface and the audio interface in * audio_output_interface... * * uint32_t count = audio_config_interface->RecommendSampleFrameCount( * PP_AUDIOSAMPLERATE_44100, 4096); * PP_Resource pp_audio_config = audio_config_interface->CreateStereo16Bit( * pp_instance, PP_AUDIOSAMPLERATE_44100, count); * PP_Resource pp_audio_output = audio_interface->Create(pp_instance, * pp_audio_config, audio_callback, NULL); * audio_interface->EnumerateDevices(pp_audio_output, output_device_list, * callback); * audio_interface->Open(pp_audio_output, device_ref, pp_audio_config, * audio_output_callback, user_data, callback); * audio_output_interface->StartPlayback(pp_audio_output); * * ...audio_output_callback() will now be periodically invoked on a separate * thread... * @endcode */ struct PPB_AudioOutput_Dev_0_1 { … }; PPB_AudioOutput_Dev; /** * @} */ #endif /* PPAPI_C_DEV_PPB_AUDIO_OUTPUT_DEV_H_ */