Lines Matching full:core
182 coreaudio_voice_isPlaying (coreaudioVoice* core)
186 UInt32 propertySize = sizeof(core->deviceID);
188 core->deviceID, 0, core->isInput,
198 coreaudio_voice_lock (coreaudioVoice* core, const char *fn_name)
202 err = pthread_mutex_lock (&core->mutex);
212 coreaudio_voice_unlock (coreaudioVoice* core, const char *fn_name)
216 err = pthread_mutex_unlock (&core->mutex);
226 coreaudio_voice_ctl (coreaudioVoice* core, int cmd)
233 D("%s: %s started\n", __FUNCTION__, core->isInput ? "input" : "output");
234 if (!coreaudio_voice_isPlaying(core)) {
235 status = AudioDeviceStart(core->deviceID, core->ioproc);
244 D("%s: %s stopped\n", __FUNCTION__, core->isInput ? "input" : "output");
246 if (coreaudio_voice_isPlaying(core)) {
247 status = AudioDeviceStop(core->deviceID, core->ioproc);
259 coreaudio_voice_fini (coreaudioVoice* core)
266 coreaudio_voice_ctl(core, VOICE_DISABLE);
269 status = AudioDeviceRemoveIOProc(core->deviceID, core->ioproc);
274 core->deviceID = kAudioDeviceUnknown;
277 err = pthread_mutex_destroy(&core->mutex);
285 coreaudio_voice_init (coreaudioVoice* core,
299 core->isInput = input ? true : false;
302 err = pthread_mutex_init(&core->mutex, NULL);
318 propertySize = sizeof(core->deviceID);
323 &core->deviceID);
329 if (core->deviceID == kAudioDeviceUnknown) {
337 core->deviceID,
339 core->isInput,
350 core->bufferFrameSize = (UInt32) frameRange.mMinimum;
354 core->bufferFrameSize = (UInt32) frameRange.mMaximum;
358 core->bufferFrameSize = frameSize;
362 propertySize = sizeof(core->bufferFrameSize);
364 core->deviceID,
367 core->isInput,
370 &core->bufferFrameSize);
374 core->bufferFrameSize);
379 propertySize = sizeof(core->bufferFrameSize);
381 core->deviceID,
383 core->isInput,
386 &core->bufferFrameSize);
392 // TODO: hw->samples = *pNBuffers * core->bufferFrameSize;
395 propertySize = sizeof(core->streamBasicDescription);
397 core->deviceID,
399 core->isInput,
402 &core->streamBasicDescription);
406 core->deviceID = kAudioDeviceUnknown;
411 core->streamBasicDescription.mSampleRate = (Float64) as->freq;
412 propertySize = sizeof(core->streamBasicDescription);
414 core->deviceID,
417 core->isInput,
420 &core->streamBasicDescription);
424 core->deviceID = kAudioDeviceUnknown;
429 core->ioproc = ioproc;
430 status = AudioDeviceAddIOProc(core->deviceID, ioproc, hw);
433 core->deviceID = kAudioDeviceUnknown;
438 if (!input && !coreaudio_voice_isPlaying(core)) {
439 status = AudioDeviceStart(core->deviceID, core->ioproc);
442 AudioDeviceRemoveIOProc(core->deviceID, core->ioproc);
443 core->deviceID = kAudioDeviceUnknown;
462 coreaudioVoice core[1];
465 #define CORE_OUT(hw) ((coreaudioVoiceOut*)(hw))->core
472 coreaudioVoice *core = CORE_OUT(hw);
474 if (coreaudio_voice_lock (core, "coreaudio_run_out")) {
480 if (core->decr > live) {
481 ldebug ("core->decr %d live %d core->live %d\n",
482 core->decr,
484 core->live);
487 decr = audio_MIN (core->decr, live);
488 core->decr -= decr;
489 core->live = live - decr;
490 hw->rpos = core->pos;
492 coreaudio_voice_unlock (core, "coreaudio_run_out");
511 coreaudioVoice *core = CORE_OUT(hw);
522 if (coreaudio_voice_lock (core, "audioDeviceIOProc")) {
527 frameCount = core->bufferFrameSize;
528 live = core->live;
533 coreaudio_voice_unlock (core, "audioDeviceIOProc(empty)");
537 rpos = core->pos;
557 core->decr += frameCount;
558 core->pos = rpos;
560 coreaudio_voice_unlock (core, "audioDeviceIOProc");
573 coreaudioVoice* core = CORE_OUT(hw);
578 err = coreaudio_voice_init( core, as, conf.out_buffer_frames, audioOutDeviceIOProc, hw, 0 );
582 hw->samples = core->bufferFrameSize * conf.out_nbuffers;
590 coreaudioVoice* core = CORE_OUT(hw);
592 coreaudio_voice_fini(core);
598 coreaudioVoice* core = CORE_OUT(hw);
600 return coreaudio_voice_ctl(core, cmd);
615 coreaudioVoice core[1];
618 #define CORE_IN(hw) ((coreaudioVoiceIn*)(hw))->core
626 coreaudioVoice *core = CORE_IN(hw);
628 if (coreaudio_voice_lock (core, "coreaudio_run_in")) {
631 D("%s: core.decr=%d core.pos=%d\n", __FUNCTION__, core->decr, core->pos);
632 decr = core->decr;
633 core->decr -= decr;
634 hw->wpos = core->pos;
636 coreaudio_voice_unlock (core, "coreaudio_run_in");
655 coreaudioVoice *core = CORE_IN(hw);
666 if (coreaudio_voice_lock (core, "audioDeviceIOProc")) {
671 frameCount = core->bufferFrameSize;
672 avail = hw->samples - hw->total_samples_captured - core->decr;
674 D("%s: enter avail=%d core.decr=%d core.pos=%d hw.samples=%d hw.total_samples_captured=%d frameCount=%d\n",
675 __FUNCTION__, avail, core->decr, core->pos, hw->samples, hw->total_samples_captured, (int)frameCount);
680 coreaudio_voice_unlock (core, "audioDeviceIOProc(empty)");
684 wpos = core->pos;
704 core->decr += frameCount;
705 core->pos = wpos;
707 D("exit: core.decr=%d core.pos=%d\n", core->decr, core->pos);
708 coreaudio_voice_unlock (core, "audioDeviceIOProc");
723 coreaudioVoice* core = CORE_IN(hw);
728 err = coreaudio_voice_init( core, as, conf.in_buffer_frames, audioInDeviceIOProc, hw, 1 );
733 hw->samples = core->bufferFrameSize * conf.in_nbuffers;
741 coreaudioVoice* core = CORE_IN(hw);
743 coreaudio_voice_fini(core);
749 coreaudioVoice* core = CORE_IN(hw);
751 return coreaudio_voice_ctl(core, cmd);