/usr/include/libfreenect_audio.h is in libfreenect-dev 1:0.5.3-1+b2.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 | /*
* This file is part of the OpenKinect Project. http://www.openkinect.org
*
* Copyright (c) 2011 individual OpenKinect contributors. See the CONTRIB file
* for details.
*
* This code is licensed to you under the terms of the Apache License, version
* 2.0, or, at your option, the terms of the GNU General Public License,
* version 2.0. See the APACHE20 and GPL2 files for the text of the licenses,
* or the following URLs:
* http://www.apache.org/licenses/LICENSE-2.0
* http://www.gnu.org/licenses/gpl-2.0.txt
*
* If you redistribute this file in source form, modified or unmodified, you
* may:
* 1) Leave this header intact and distribute it under the same terms,
* accompanying it with the APACHE20 and GPL20 files, or
* 2) Delete the Apache 2.0 clause and accompany it with the GPL2 file, or
* 3) Delete the GPL v2 clause and accompany it with the APACHE20 file
* In all cases you must keep the copyright notice intact and include a copy
* of the CONTRIB file.
*
* Binary distributions must follow the binary distribution requirements of
* either License.
*/
#pragma once
#include "libfreenect.h"
#include <stdint.h>
#ifdef __cplusplus
extern "C" {
#endif
/// Structure to represent a single 16-bit signed little-endian PCM sample.
typedef struct {
int16_t left;
int16_t right;
int16_t center;
int16_t lfe;
int16_t surround_left;
int16_t surround_right;
} freenect_sample_51;
/**
* Typedef for "you wanted this microphone data, here it is" event callbacks.
* TODO: Timestamp details
* The format of the unknown stream is as of yet undetermined.
*
* @param dev Device which triggered this callback
* @param num_samples Number of samples provided in each of the audio data arrays (mic[1-4] and cancelled)
* @param mic1 Microphone data for the leftmost microphone: 32-bit PCM little-endian samples at 16kHz.
* @param mic2 Microphone data for the left-middle microphone: 32-bit PCM little-endian samples at 16kHz.
* @param mic3 Microphone data for the right-middle microphone: 32-bit PCM little-endian samples at 16kHz.
* @param mic4 Microphone data for the rightmost microphone: 32-bit PCM little-endian samples at 16kHz.
* @param cancelled Noise-cancelled audio data: 16-bit PCM little-endian samples at 16kHz.
*/
typedef void (*freenect_audio_in_cb)(freenect_device *dev, int num_samples,
int32_t* mic1, int32_t* mic2,
int32_t* mic3, int32_t* mic4,
int16_t* cancelled, void *unknown/*, timestamp_t timestamp*/);
/**
* Typedef for "you're playing audio, the library needs you to fill up the outgoing audio buffer" event callbacks
* The library will request samples at a rate of 48000Hz.
*
* @param dev Device this callback was triggered for
* @param samples Pointer to the memory where the library expects you to copy the next sample_count freenect_sample_51's to.
* @param sample_count Bidirectional. in: maximum number of samples the driver wants (don't copy in more than this, you'll clobber memory). out: actual number of samples provided to the driver.
*/
typedef void (*freenect_audio_out_cb)(freenect_device *dev, freenect_sample_51* samples, int* sample_count);
/**
* Set the audio in callback. This is the function called when the library
* has new microphone samples. It will be called approximately 62.5 times per
* second (16kHz sample rate, expect 512 samples/callback)
*
* @param dev Device for which to set the callback
* @param callback Callback function to set
*/
FREENECTAPI void freenect_set_audio_in_callback(freenect_device *dev, freenect_audio_in_cb callback);
/**
* Set the audio out callback. This is the "tell me what audio you're about
* to play through the speakers so the Kinect can subtract it out" callback for
* a given device. If you choose not set an audio_out_callback, the library
* will send silence to the Kinect for you - it requires data either way.
*
* @param dev Device for which to set the callback
* @param callback Callback function to set
*/
FREENECTAPI void freenect_set_audio_out_callback(freenect_device *dev, freenect_audio_out_cb callback);
/**
* Start streaming audio for the specified device.
*
* @param dev Device for which to start audio streaming
*
* @return 0 on success, < 0 if error
*/
FREENECTAPI int freenect_start_audio(freenect_device* dev);
/**
* Stop streaming audio for the specified device.
*
* @param dev Device for which to stop audio streaming
*
* @return 0 on success, < 0 if error
*/
FREENECTAPI int freenect_stop_audio(freenect_device* dev);
#ifdef __cplusplus
}
#endif
|