cwIo : added audioGroupDeviceCount(),audioGroupDeviceIndex(),audioDeviceLabel(),audioDeviceUserId()
This commit is contained in:
parent
f27c773bae
commit
869d367ed9
66
cwIo.cpp
66
cwIo.cpp
@ -1081,7 +1081,7 @@ namespace cw
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// This function is called by the audio device drivers to when incoming audio arrives
|
// This function is called by the audio device drivers when incoming audio arrives
|
||||||
// or when there is available space to write outgoing audio.
|
// or when there is available space to write outgoing audio.
|
||||||
// If all in/out devices in a group are ready to be source/sink audio data then this function
|
// If all in/out devices in a group are ready to be source/sink audio data then this function
|
||||||
// triggers the group thread condition var thereby causing an application callback
|
// triggers the group thread condition var thereby causing an application callback
|
||||||
@ -2078,6 +2078,17 @@ unsigned cw::io::audioDeviceLabelToIndex( handle_t h, const char* label )
|
|||||||
return kInvalidIdx;
|
return kInvalidIdx;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
const char* cw::io::audioDeviceLabel( handle_t h, unsigned devIdx )
|
||||||
|
{
|
||||||
|
io_t* p = _handleToPtr(h);
|
||||||
|
audioDev_t* ad;
|
||||||
|
|
||||||
|
if((ad = _audioDeviceIndexToRecd(p,devIdx)) != nullptr )
|
||||||
|
return ad->label;
|
||||||
|
|
||||||
|
return nullptr;
|
||||||
|
}
|
||||||
|
|
||||||
cw::rc_t cw::io::audioDeviceSetUserId( handle_t h, unsigned devIdx, unsigned userId )
|
cw::rc_t cw::io::audioDeviceSetUserId( handle_t h, unsigned devIdx, unsigned userId )
|
||||||
{
|
{
|
||||||
io_t* p = _handleToPtr(h);
|
io_t* p = _handleToPtr(h);
|
||||||
@ -2119,6 +2130,18 @@ const char* cw::io::audioDeviceName( handle_t h, unsigned devIdx )
|
|||||||
return ad->devName;
|
return ad->devName;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
unsigned cw::io::audioDeviceUserId( handle_t h, unsigned devIdx )
|
||||||
|
{
|
||||||
|
io_t* p = _handleToPtr(h);
|
||||||
|
audioDev_t* ad;
|
||||||
|
|
||||||
|
if((ad = _audioDeviceIndexToRecd(p, devIdx )) == nullptr )
|
||||||
|
return kInvalidId;
|
||||||
|
|
||||||
|
return ad->userId;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
double cw::io::audioDeviceSampleRate( handle_t h, unsigned devIdx )
|
double cw::io::audioDeviceSampleRate( handle_t h, unsigned devIdx )
|
||||||
{
|
{
|
||||||
io_t* p = _handleToPtr(h);
|
io_t* p = _handleToPtr(h);
|
||||||
@ -2397,6 +2420,47 @@ unsigned cw::io::audioGroupDspFrameCount( handle_t h, unsigned groupIdx )
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
unsigned cw::io::audioGroupDeviceCount( handle_t h, unsigned groupIdx, unsigned inOrOutFl )
|
||||||
|
{
|
||||||
|
audioGroup_t* ag;
|
||||||
|
io_t* p = _handleToPtr(h);
|
||||||
|
unsigned n = 0;
|
||||||
|
|
||||||
|
if((ag = _audioGroupFromIndex( p, groupIdx )) != nullptr )
|
||||||
|
{
|
||||||
|
audio_group_dev_t* agd = cwIsFlag(inOrOutFl,kInFl) ? ag->msg.iDevL : ag->msg.oDevL;
|
||||||
|
for(; agd!=nullptr; agd=agd->link)
|
||||||
|
++n;
|
||||||
|
}
|
||||||
|
|
||||||
|
return n;
|
||||||
|
}
|
||||||
|
|
||||||
|
unsigned cw::io::audioGroupDeviceIndex( handle_t h, unsigned groupIdx, unsigned inOrOutFl, unsigned groupDevIdx )
|
||||||
|
{
|
||||||
|
audioGroup_t* ag;
|
||||||
|
io_t* p = _handleToPtr(h);
|
||||||
|
unsigned n = 0;
|
||||||
|
|
||||||
|
if((ag = _audioGroupFromIndex( p, groupIdx )) != nullptr )
|
||||||
|
{
|
||||||
|
audio_group_dev_t* agd = cwIsFlag(inOrOutFl,kInFl) ? ag->msg.iDevL : ag->msg.oDevL;
|
||||||
|
|
||||||
|
for(; agd!=nullptr; agd=agd->link)
|
||||||
|
{
|
||||||
|
if( n == groupDevIdx )
|
||||||
|
return agd->devIdx;
|
||||||
|
++n;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
cwLogError(kInvalidIdRC,"The audio group device index '%i' could found on group index: '%i' .",groupDevIdx,groupIdx);
|
||||||
|
|
||||||
|
|
||||||
|
return kInvalidIdx;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
//----------------------------------------------------------------------------------------------------------
|
//----------------------------------------------------------------------------------------------------------
|
||||||
//
|
//
|
||||||
// Socket
|
// Socket
|
||||||
|
14
cwIo.h
14
cwIo.h
@ -82,12 +82,12 @@ namespace cw
|
|||||||
double srate; // Group sample rate.
|
double srate; // Group sample rate.
|
||||||
unsigned dspFrameCnt; // Count of samples in each buffer pointed to by iBufArray[] and oBufArray[]
|
unsigned dspFrameCnt; // Count of samples in each buffer pointed to by iBufArray[] and oBufArray[]
|
||||||
|
|
||||||
sample_t** iBufArray; // Array of iBufChCnt ptrs to buffers of size bufSmpCnt
|
sample_t** iBufArray; // iBufArray[iBufChCnt] Array ptrs to buffers of size dspFrameCnt
|
||||||
unsigned iBufChCnt; // Count of elements in iBufArray[]
|
unsigned iBufChCnt; // Count of elements in iBufArray[]
|
||||||
time::spec_t* iTimeStampPtr; //
|
time::spec_t* iTimeStampPtr; //
|
||||||
audio_group_dev_t* iDevL; // Linked list of input devices which map directly to channels in iBufArray[]
|
audio_group_dev_t* iDevL; // Linked list of input devices which map directly to channels in iBufArray[]
|
||||||
|
|
||||||
sample_t** oBufArray; //
|
sample_t** oBufArray; // oBufArray[oBufChCnt] Array of ptrs to buffers of size dspFrameCnt
|
||||||
unsigned oBufChCnt; //
|
unsigned oBufChCnt; //
|
||||||
time::spec_t* oTimeStampPtr; //
|
time::spec_t* oTimeStampPtr; //
|
||||||
audio_group_dev_t* oDevL; // Linked list of output devices which map directly to channels in oBufArray[]
|
audio_group_dev_t* oDevL; // Linked list of output devices which map directly to channels in oBufArray[]
|
||||||
@ -178,7 +178,7 @@ namespace cw
|
|||||||
unsigned serialDeviceCount( handle_t h );
|
unsigned serialDeviceCount( handle_t h );
|
||||||
unsigned serialDeviceIndex( handle_t h, const char* label );
|
unsigned serialDeviceIndex( handle_t h, const char* label );
|
||||||
const char* serialDeviceLabel( handle_t h, unsigned devIdx );
|
const char* serialDeviceLabel( handle_t h, unsigned devIdx );
|
||||||
unsigned serialDeviceId( handle_t h, unsigned devIdx );
|
unsigned serialDeviceId( handle_t h, unsigned devIdx ); // defaults to device index
|
||||||
void serialDeviceSetId( handle_t h, unsigned devIdx, unsigned id );
|
void serialDeviceSetId( handle_t h, unsigned devIdx, unsigned id );
|
||||||
|
|
||||||
rc_t serialDeviceSend( handle_t h, unsigned devIdx, const void* byteA, unsigned byteN );
|
rc_t serialDeviceSend( handle_t h, unsigned devIdx, const void* byteA, unsigned byteN );
|
||||||
@ -204,9 +204,11 @@ namespace cw
|
|||||||
|
|
||||||
unsigned audioDeviceCount( handle_t h );
|
unsigned audioDeviceCount( handle_t h );
|
||||||
unsigned audioDeviceLabelToIndex( handle_t h, const char* label );
|
unsigned audioDeviceLabelToIndex( handle_t h, const char* label );
|
||||||
|
const char* audioDeviceLabel( handle_t h, unsigned devIdx );
|
||||||
rc_t audioDeviceSetUserId( handle_t h, unsigned devIdx, unsigned userId );
|
rc_t audioDeviceSetUserId( handle_t h, unsigned devIdx, unsigned userId );
|
||||||
bool audioDeviceIsEnabled( handle_t h, unsigned devIdx );
|
bool audioDeviceIsEnabled( handle_t h, unsigned devIdx );
|
||||||
const char* audioDeviceName( handle_t h, unsigned devIdx );
|
const char* audioDeviceName( handle_t h, unsigned devIdx );
|
||||||
|
unsigned audioDeviceUserId( handle_t h, unsigned devIdx );
|
||||||
double audioDeviceSampleRate( handle_t h, unsigned devIdx );
|
double audioDeviceSampleRate( handle_t h, unsigned devIdx );
|
||||||
unsigned audioDeviceFramesPerCycle( handle_t h, unsigned devIdx );
|
unsigned audioDeviceFramesPerCycle( handle_t h, unsigned devIdx );
|
||||||
unsigned audioDeviceChannelCount( handle_t h, unsigned devIdx, unsigned inOrOutFlag );
|
unsigned audioDeviceChannelCount( handle_t h, unsigned devIdx, unsigned inOrOutFlag );
|
||||||
@ -228,6 +230,12 @@ namespace cw
|
|||||||
double audioGroupSampleRate( handle_t h, unsigned groupIdx );
|
double audioGroupSampleRate( handle_t h, unsigned groupIdx );
|
||||||
unsigned audioGroupDspFrameCount( handle_t h, unsigned groupIdx );
|
unsigned audioGroupDspFrameCount( handle_t h, unsigned groupIdx );
|
||||||
|
|
||||||
|
// Get the count of in or out devices assigned to this group.
|
||||||
|
unsigned audioGroupDeviceCount( handle_t h, unsigned groupIdx, unsigned inOrOutFl );
|
||||||
|
|
||||||
|
// Get the device index of each of the devices assigned to this group
|
||||||
|
unsigned audioGroupDeviceIndex( handle_t h, unsigned groupIdx, unsigned inOrOutFl, unsigned groupDeviceIdx );
|
||||||
|
|
||||||
//----------------------------------------------------------------------------------------------------------
|
//----------------------------------------------------------------------------------------------------------
|
||||||
//
|
//
|
||||||
// Socket
|
// Socket
|
||||||
|
Loading…
Reference in New Issue
Block a user