37 0x52, 0x49, 0x46, 0x46,
38 0x00, 0x00, 0x00, 0x00,
39 0x57, 0x41, 0x56, 0x45,
40 0x66, 0x6d, 0x74, 0x20,
41 0x10, 0x00, 0x00, 0x00,
42 0x01, 0x00, 0x01, 0x00,
43 0x80, 0x3e, 0x00, 0x00,
44 0x00, 0xfa, 0x00, 0x00,
45 0x04, 0x00, 0x20, 0x00,
46 0x64, 0x61, 0x74, 0x61,
47 0x00, 0x00, 0x00, 0x00,
58 int16_t* cancelled,
void *unknown) {
65 printf(
"Sample received. Total samples recorded: %d\n", c->
samples);
69 printf(
"Caught SIGINT, cleaning up\n");
73 int main(
int argc,
char** argv) {
75 printf(
"freenect_init() failed\n");
82 printf (
"Number of devices found: %d\n", nr_devices);
88 int user_device_number = 0;
90 printf(
"Could not open device\n");
97 state.
logfiles[0] = fopen(
"channel1.wav",
"wb");
98 state.
logfiles[1] = fopen(
"channel2.wav",
"wb");
99 state.
logfiles[2] = fopen(
"channel3.wav",
"wb");
100 state.
logfiles[3] = fopen(
"channel4.wav",
"wb");
120 for(i = 0; i < 4 ; i++) {
122 fseek(state.
logfiles[i], 4, SEEK_SET);
124 int chunksize = state.
samples * 4 + 36;
125 buf[0] = (chunksize & 0x000000ff);
126 buf[1] = (chunksize & 0x0000ff00) >> 8;
127 buf[2] = (chunksize & 0x00ff0000) >> 16;
128 buf[3] = (chunksize & 0xff000000) >> 24;
129 fwrite(buf, 1, 4,state.
logfiles[i]);
131 fseek(state.
logfiles[i], 40, SEEK_SET);
133 int subchunk2size = state.
samples * 4;
134 buf[0] = (subchunk2size & 0x000000ff);
135 buf[1] = (subchunk2size & 0x0000ff00) >> 8;
136 buf[2] = (subchunk2size & 0x00ff0000) >> 16;
137 buf[3] = (subchunk2size & 0xff000000) >> 24;
138 fwrite(buf, 1, 4,state.
logfiles[i]);
int main(int argc, char **argv)
void freenect_select_subdevices(freenect_context *ctx, freenect_device_flags subdevs)
static freenect_device * f_dev
void in_callback(freenect_device *dev, int num_samples, int32_t *mic1, int32_t *mic2, int32_t *mic3, int32_t *mic4, int16_t *cancelled, void *unknown)
int freenect_num_devices(freenect_context *ctx)
int freenect_shutdown(freenect_context *ctx)
void freenect_set_log_level(freenect_context *ctx, freenect_loglevel level)
FREENECTAPI void freenect_set_audio_in_callback(freenect_device *dev, freenect_audio_in_cb callback)
void * freenect_get_user(freenect_device *dev)
FREENECTAPI int freenect_start_audio(freenect_device *dev)
int freenect_open_device(freenect_context *ctx, freenect_device **dev, int index)
static freenect_context * f_ctx
int freenect_process_events(freenect_context *ctx)
void freenect_set_user(freenect_device *dev, void *user)
int freenect_init(freenect_context **ctx, freenect_usb_context *usb_ctx)