cwAudioDeviceAlsa.h/cpp: Added deviceIsAsync(),deviceExecute(), and cbDevIdx arg

to deviceSetup().
This commit is contained in:
kevin 2023-02-14 20:49:12 -05:00
parent d3b2dec511
commit 0b5458ca7b
2 changed files with 20 additions and 3 deletions

View File

@ -73,6 +73,7 @@ namespace cw
device::cbFunc_t cbFunc; // user callback device::cbFunc_t cbFunc; // user callback
void* cbArg; void* cbArg;
unsigned cbDevIdx;
} devRecd_t; } devRecd_t;
@ -831,7 +832,7 @@ namespace cw
inputFl ? drp->iCbCnt++ : drp->oCbCnt++; inputFl ? drp->iCbCnt++ : drp->oCbCnt++;
pkt.devIdx = drp->devIdx; pkt.devIdx = drp->cbDevIdx;
pkt.begChIdx = 0; pkt.begChIdx = 0;
pkt.chCnt = chCnt; pkt.chCnt = chCnt;
pkt.audioFramesCnt = frmCnt; 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.deviceStart = deviceStart;
p->driver.deviceStop = deviceStop; p->driver.deviceStop = deviceStop;
p->driver.deviceIsStarted = deviceIsStarted; p->driver.deviceIsStarted = deviceIsStarted;
p->driver.deviceIsAsync = deviceIsAsync;
p->driver.deviceExecute = deviceExecute;
p->driver.deviceRealTimeReport = deviceRealTimeReport; p->driver.deviceRealTimeReport = deviceRealTimeReport;
hRef.set(p); hRef.set(p);
@ -1434,7 +1438,7 @@ unsigned cw::audio::device::alsa::deviceFramesPerCycle( struct driver_str* drv,
return p->devArray[devIdx].framesPerCycle; 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<alsa_t*>(drv->drvArg); alsa_t* p = static_cast<alsa_t*>(drv->drvArg);
cwAssert( devIdx < deviceCount(drv)); 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->periodsPerBuf = periodsPerBuf;
drp->cbFunc = cbFunc; drp->cbFunc = cbFunc;
drp->cbArg = cbArg; drp->cbArg = cbArg;
drp->cbDevIdx = cbDevIdx;
} }
return rc; 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 ) void cw::audio::device::alsa::deviceRealTimeReport(struct driver_str* drv, unsigned devIdx )
{ {
alsa_t* p = static_cast<alsa_t*>(drv->drvArg); alsa_t* p = static_cast<alsa_t*>(drv->drvArg);

View File

@ -20,10 +20,12 @@ namespace cw
unsigned deviceChannelCount( struct driver_str* drv, unsigned devIdx, bool inputFl ); unsigned deviceChannelCount( struct driver_str* drv, unsigned devIdx, bool inputFl );
double deviceSampleRate( struct driver_str* drv, unsigned devIdx ); double deviceSampleRate( struct driver_str* drv, unsigned devIdx );
unsigned deviceFramesPerCycle( struct driver_str* drv, unsigned devIdx, bool inputFl ); 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 deviceStart( struct driver_str* drv, unsigned devIdx );
rc_t deviceStop( struct driver_str* drv, unsigned devIdx ); rc_t deviceStop( struct driver_str* drv, unsigned devIdx );
bool deviceIsStarted( 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 ); void deviceRealTimeReport( struct driver_str* drv, unsigned devIdx );
rc_t report(handle_t h ); rc_t report(handle_t h );