comparison Alc/backends/send.c @ 15:19ff95c69cf5

moved send.c to org file
author Robert McIntyre <rlm@mit.edu>
date Thu, 03 Nov 2011 12:08:39 -0700
parents 63312ec4a2bf
children
comparison
equal deleted inserted replaced
14:63312ec4a2bf 15:19ff95c69cf5
1
1 #include "config.h" 2 #include "config.h"
2 #include <stdlib.h> 3 #include <stdlib.h>
3 #include "alMain.h" 4 #include "alMain.h"
4 #include "AL/al.h" 5 #include "AL/al.h"
5 #include "AL/alc.h" 6 #include "AL/alc.h"
302 ALvoid *buffer_address = 303 ALvoid *buffer_address =
303 ((ALbyte *)(((char*)(*env)->GetDirectBufferAddress(env, buffer)) + position)); 304 ((ALbyte *)(((char*)(*env)->GetDirectBufferAddress(env, buffer)) + position));
304 ALCdevice *recorder = (ALCdevice*) ((intptr_t)device); 305 ALCdevice *recorder = (ALCdevice*) ((intptr_t)device);
305 send_data *data = (send_data*)recorder->ExtraData; 306 send_data *data = (send_data*)recorder->ExtraData;
306 if ((ALuint)n > data->numContexts){return;} 307 if ((ALuint)n > data->numContexts){return;}
307 //if ((uint) samples > data->size){ 308
308 // samples = (int) data->size; 309 //printf("Want %d samples for listener %d\n", samples, n);
309 //} 310 //printf("Device's format type is %d bytes per sample,\n",
310 printf("Want %d samples for listener %d\n", samples, n); 311 // BytesFromDevFmt(recorder->FmtType));
311 printf("Device's format type is %d bytes per sample,\n", 312 //printf("and it has %d channels, making for %d requested bytes\n",
312 BytesFromDevFmt(recorder->FmtType)); 313 // recorder->NumChan,
313 printf("and it has %d channels, making for %d requested bytes\n", 314 // BytesFromDevFmt(recorder->FmtType) * recorder->NumChan * samples);
314 recorder->NumChan,
315 BytesFromDevFmt(recorder->FmtType) * recorder->NumChan * samples);
316 315
317 memcpy(buffer_address, data->contexts[n]->renderBuffer, 316 memcpy(buffer_address, data->contexts[n]->renderBuffer,
318 BytesFromDevFmt(recorder->FmtType) * recorder->NumChan * samples); 317 BytesFromDevFmt(recorder->FmtType) * recorder->NumChan * samples);
319 //samples*sizeof(ALfloat)); 318 //samples*sizeof(ALfloat));
320 } 319 }
325 * Signature: (J)V 324 * Signature: (J)V
326 */ 325 */
327 JNIEXPORT void JNICALL Java_com_aurellem_send_AudioSend_naddListener 326 JNIEXPORT void JNICALL Java_com_aurellem_send_AudioSend_naddListener
328 (JNIEnv *env, jclass clazz, jlong device){ 327 (JNIEnv *env, jclass clazz, jlong device){
329 UNUSED(env); UNUSED(clazz); 328 UNUSED(env); UNUSED(clazz);
330 printf("creating new context via naddListener\n"); 329 //printf("creating new context via naddListener\n");
331 ALCdevice *Device = (ALCdevice*) ((intptr_t)device); 330 ALCdevice *Device = (ALCdevice*) ((intptr_t)device);
332 ALCcontext *new = alcCreateContext(Device, NULL); 331 ALCcontext *new = alcCreateContext(Device, NULL);
333 addContext(Device, new); 332 addContext(Device, new);
334 } 333 }
335 334
416 float frequency = Device->Frequency; 415 float frequency = Device->Frequency;
417 int bitsPerFrame = (8 * BytesFromDevFmt(Device->FmtType)); 416 int bitsPerFrame = (8 * BytesFromDevFmt(Device->FmtType));
418 int channels = Device->NumChan; 417 int channels = Device->NumChan;
419 418
420 419
421 printf("freq = %f, bpf = %d, channels = %d, signed? = %d\n", 420 //printf("freq = %f, bpf = %d, channels = %d, signed? = %d\n",
422 frequency, bitsPerFrame, channels, isSigned); 421 // frequency, bitsPerFrame, channels, isSigned);
423 422
424 jobject format = (*env)-> 423 jobject format = (*env)->
425 NewObject( 424 NewObject(
426 env,AudioFormatClass,AudioFormatConstructor, 425 env,AudioFormatClass,AudioFormatConstructor,
427 frequency, 426 frequency,
515 break; 514 break;
516 case CAPTURE_DEVICE_PROBE: 515 case CAPTURE_DEVICE_PROBE:
517 break; 516 break;
518 } 517 }
519 } 518 }
520
521
522