From 0b5458ca7b408a99ddee54bc555b57b1b226db69 Mon Sep 17 00:00:00 2001 From: kevin Date: Tue, 14 Feb 2023 20:49:12 -0500 Subject: [PATCH] cwAudioDeviceAlsa.h/cpp: Added deviceIsAsync(),deviceExecute(), and cbDevIdx arg to deviceSetup(). --- cwAudioDeviceAlsa.cpp | 19 +++++++++++++++++-- cwAudioDeviceAlsa.h | 4 +++- 2 files changed, 20 insertions(+), 3 deletions(-) diff --git a/cwAudioDeviceAlsa.cpp b/cwAudioDeviceAlsa.cpp index f369fc8..0043fed 100644 --- a/cwAudioDeviceAlsa.cpp +++ b/cwAudioDeviceAlsa.cpp @@ -73,6 +73,7 @@ namespace cw device::cbFunc_t cbFunc; // user callback void* cbArg; + unsigned cbDevIdx; } devRecd_t; @@ -831,7 +832,7 @@ namespace cw inputFl ? drp->iCbCnt++ : drp->oCbCnt++; - pkt.devIdx = drp->devIdx; + pkt.devIdx = drp->cbDevIdx; pkt.begChIdx = 0; pkt.chCnt = chCnt; pkt.audioFramesCnt = frmCnt; @@ -1374,6 +1375,9 @@ cw::rc_t cw::audio::device::alsa::create( handle_t& hRef, struct driver_str*& dr p->driver.deviceStart = deviceStart; p->driver.deviceStop = deviceStop; p->driver.deviceIsStarted = deviceIsStarted; + p->driver.deviceIsAsync = deviceIsAsync; + p->driver.deviceExecute = deviceExecute; + p->driver.deviceRealTimeReport = deviceRealTimeReport; hRef.set(p); @@ -1434,7 +1438,7 @@ unsigned cw::audio::device::alsa::deviceFramesPerCycle( struct driver_str* drv, return p->devArray[devIdx].framesPerCycle; } -cw::rc_t cw::audio::device::alsa::deviceSetup( struct driver_str* drv, unsigned devIdx, double srate, unsigned framesPerCycle, cbFunc_t cbFunc, void* cbArg ) +cw::rc_t cw::audio::device::alsa::deviceSetup( struct driver_str* drv, unsigned devIdx, double srate, unsigned framesPerCycle, cbFunc_t cbFunc, void* cbArg, unsigned cbDevIdx ) { alsa_t* p = static_cast(drv->drvArg); cwAssert( devIdx < deviceCount(drv)); @@ -1454,6 +1458,7 @@ cw::rc_t cw::audio::device::alsa::deviceSetup( struct driver_str* drv, unsigned drp->periodsPerBuf = periodsPerBuf; drp->cbFunc = cbFunc; drp->cbArg = cbArg; + drp->cbDevIdx = cbDevIdx; } return rc; @@ -1579,6 +1584,16 @@ bool cw::audio::device::alsa::deviceIsStarted(struct driver_str* drv, unsigned } +bool cw::audio::device::alsa::deviceIsAsync(struct driver_str* drv, unsigned devIdx ) +{ + return true; +} + +cw::rc_t cw::audio::device::alsa::deviceExecute(struct driver_str* drv, unsigned devIdx ) +{ + return kOkRC; +} + void cw::audio::device::alsa::deviceRealTimeReport(struct driver_str* drv, unsigned devIdx ) { alsa_t* p = static_cast(drv->drvArg); diff --git a/cwAudioDeviceAlsa.h b/cwAudioDeviceAlsa.h index 69b5271..d40d0fe 100644 --- a/cwAudioDeviceAlsa.h +++ b/cwAudioDeviceAlsa.h @@ -20,10 +20,12 @@ namespace cw unsigned deviceChannelCount( struct driver_str* drv, unsigned devIdx, bool inputFl ); double deviceSampleRate( struct driver_str* drv, unsigned devIdx ); unsigned deviceFramesPerCycle( struct driver_str* drv, unsigned devIdx, bool inputFl ); - rc_t deviceSetup( struct driver_str* drv, unsigned devIdx, double sr, unsigned frmPerCycle, cbFunc_t cbFunc, void* cbArg ); + rc_t deviceSetup( struct driver_str* drv, unsigned devIdx, double sr, unsigned frmPerCycle, cbFunc_t cbFunc, void* cbArg, unsigned cbDevIdx ); rc_t deviceStart( struct driver_str* drv, unsigned devIdx ); rc_t deviceStop( struct driver_str* drv, unsigned devIdx ); bool deviceIsStarted( struct driver_str* drv, unsigned devIdx ); + bool deviceIsAsync( struct driver_str* drv, unsigned devIdx ); + rc_t deviceExecute( struct driver_str* drv, unsigned devIdx ); void deviceRealTimeReport( struct driver_str* drv, unsigned devIdx ); rc_t report(handle_t h );