Lines Matching full:core
175 coreaudio_voice_isPlaying (coreaudioVoice *core)
179 UInt32 propertySize = sizeof(core->deviceID);
181 core->deviceID, 0, core->isInput,
195 static int coreaudio_voice_lock (coreaudioVoice *core, const char *fn_name)
199 err = pthread_mutex_lock (&core->mutex);
209 coreaudio_voice_unlock (coreaudioVoice *core, const char *fn_name)
213 err = pthread_mutex_unlock (&core->mutex);
223 coreaudio_voice_ctl (coreaudioVoice* core, int cmd)
230 D("%s: %s started\n", __FUNCTION__, core->isInput ? "input" : "output");
231 if (!coreaudio_voice_isPlaying(core)) {
232 status = AudioDeviceStart(core->deviceID, core->ioproc);
241 D("%s: %s stopped\n", __FUNCTION__, core->isInput ? "input" : "output");
243 if (coreaudio_voice_isPlaying(core)) {
244 status = AudioDeviceStop(core->deviceID, core->ioproc);
256 coreaudio_voice_fini (coreaudioVoice* core)
263 coreaudio_voice_ctl(core, VOICE_DISABLE);
266 status = AudioDeviceRemoveIOProc(core->deviceID, core->ioproc);
271 core->deviceID = kAudioDeviceUnknown;
274 err = pthread_mutex_destroy(&core->mutex);
282 coreaudio_voice_init (coreaudioVoice* core,
296 core->isInput = input ? true : false;
299 err = pthread_mutex_init(&core->mutex, NULL);
315 propertySize = sizeof(core->deviceID);
320 &core->deviceID);
326 if (core->deviceID == kAudioDeviceUnknown) {
334 core->deviceID,
336 core->isInput,
347 core->bufferFrameSize = (UInt32) frameRange.mMinimum;
351 core->bufferFrameSize = (UInt32) frameRange.mMaximum;
355 core->bufferFrameSize = frameSize;
359 propertySize = sizeof(core->bufferFrameSize);
361 core->deviceID,
364 core->isInput,
367 &core->bufferFrameSize);
371 core->bufferFrameSize);
376 propertySize = sizeof(core->bufferFrameSize);
378 core->deviceID,
380 core->isInput,
383 &core->bufferFrameSize);
389 // TODO: hw->samples = *pNBuffers * core->bufferFrameSize;
392 propertySize = sizeof(core->streamBasicDescription);
394 core->deviceID,
396 core->isInput,
399 &core->streamBasicDescription);
403 core->deviceID = kAudioDeviceUnknown;
408 core->streamBasicDescription.mSampleRate = (Float64) as->freq;
409 propertySize = sizeof(core->streamBasicDescription);
411 core->deviceID,
414 core->isInput,
417 &core->streamBasicDescription);
421 core->deviceID = kAudioDeviceUnknown;
426 core->ioproc = ioproc;
427 status = AudioDeviceAddIOProc(core->deviceID, ioproc, hw);
430 core->deviceID = kAudioDeviceUnknown;
435 if (!input && !coreaudio_voice_isPlaying(core)) {
436 status = AudioDeviceStart(core->deviceID, core->ioproc);
439 AudioDeviceRemoveIOProc(core->deviceID, core->ioproc);
440 core->deviceID = kAudioDeviceUnknown;
459 coreaudioVoice core[1];
462 #define CORE_OUT(hw) ((coreaudioVoiceOut*)(hw))->core
468 coreaudioVoice *core = CORE_OUT(hw);
470 if (coreaudio_voice_lock (core, "coreaudio_run_out")) {
474 if (core->decr > live) {
475 ldebug ("core->decr %d live %d core->live %d\n",
476 core->decr,
478 core->live);
481 decr = audio_MIN (core->decr, live);
482 core->decr -= decr;
484 core->live = live - decr;
485 hw->rpos = core->pos;
487 coreaudio_voice_unlock (core, "coreaudio_run_out");
504 coreaudioVoice *core = CORE_OUT(hw);
515 if (coreaudio_voice_lock (core, "audioDeviceIOProc")) {
520 frameCount = core->bufferFrameSize;
521 live = core->live;
526 coreaudio_voice_unlock (core, "audioDeviceIOProc(empty)");
530 rpos = core->pos;
550 core->decr += frameCount;
551 core->pos = rpos;
553 coreaudio_voice_unlock (core, "audioDeviceIOProc");
564 coreaudioVoice* core = CORE_OUT(hw);
569 err = coreaudio_voice_init (core, as, conf.out_buffer_frames, audioOutDeviceIOProc, hw, 0);
573 hw->samples = core->bufferFrameSize * conf.out_nbuffers;
579 coreaudioVoice *core = CORE_OUT(hw);
581 coreaudio_voice_fini (core);
587 coreaudioVoice *core = CORE_OUT(hw);
589 return coreaudio_voice_ctl (core, cmd);
604 coreaudioVoice core[1];
607 #define CORE_IN(hw) ((coreaudioVoiceIn *) (hw))->core
614 coreaudioVoice *core = CORE_IN(hw);
616 if (coreaudio_voice_lock (core, "coreaudio_run_in")) {
619 D("%s: core.decr=%d core.pos=%d\n", __FUNCTION__, core->decr, core->pos);
620 decr = core->decr;
621 core->decr -= decr;
622 hw->wpos = core->pos;
624 coreaudio_voice_unlock (core, "coreaudio_run_in");
642 coreaudioVoice *core = CORE_IN(hw);
653 if (coreaudio_voice_lock (core, "audioDeviceIOProc")) {
658 frameCount = core->bufferFrameSize;
659 avail = hw->samples - hw->total_samples_captured - core->decr;
661 D("%s: enter avail=%d core.decr=%d core.pos=%d hw.samples=%d hw.total_samples_captured=%d frameCount=%d\n",
662 __FUNCTION__, avail, core->decr, core->pos, hw->samples, hw->total_samples_captured, (int)frameCount);
667 coreaudio_voice_unlock (core, "audioDeviceIOProc(empty)");
671 wpos = core->pos;
691 core->decr += frameCount;
692 core->pos = wpos;
694 D("exit: core.decr=%d core.pos=%d\n", core->decr, core->pos);
695 coreaudio_voice_unlock (core, "audioDeviceIOProc");
710 coreaudioVoice* core = CORE_IN(hw);
715 err = coreaudio_voice_init (core, as, conf.in_buffer_frames, audioInDeviceIOProc, hw, 1);
720 hw->samples = core->bufferFrameSize * conf.in_nbuffers;
728 coreaudioVoice* core = CORE_IN(hw);
730 coreaudio_voice_fini(core);
736 coreaudioVoice* core = CORE_IN(hw);
738 return coreaudio_voice_ctl(core, cmd);