cwFlow,cwIoFlow : Update comments and formatting. No functional changes.
This commit is contained in:
parent
f8f21a9c0e
commit
071cdb26dc
@ -417,11 +417,13 @@ namespace cw
|
|||||||
if( preset_labels->is_string() && preset_labels->value(s)==kOkRC )
|
if( preset_labels->is_string() && preset_labels->value(s)==kOkRC )
|
||||||
return _class_preset_channelize_vars(inst,s);
|
return _class_preset_channelize_vars(inst,s);
|
||||||
|
|
||||||
// if the preset_labels is a list
|
// if the preset_labels is not a list
|
||||||
if( !preset_labels->is_list() )
|
if( !preset_labels->is_list() )
|
||||||
rc = cwLogError(kSyntaxErrorRC,"The preset list on instance '%s' is neither a list nor a string.",inst->label);
|
rc = cwLogError(kSyntaxErrorRC,"The preset list on instance '%s' is neither a list nor a string.",inst->label);
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
// preset_labels is a list.
|
||||||
|
|
||||||
// for each label listed in the preset label list
|
// for each label listed in the preset label list
|
||||||
for(unsigned i=0; i<preset_labels->child_count(); ++i)
|
for(unsigned i=0; i<preset_labels->child_count(); ++i)
|
||||||
{
|
{
|
||||||
|
6
cwFlow.h
6
cwFlow.h
@ -51,9 +51,13 @@ namespace cw
|
|||||||
const object_t& networkCfg,
|
const object_t& networkCfg,
|
||||||
external_device_t* deviceA = nullptr,
|
external_device_t* deviceA = nullptr,
|
||||||
unsigned deviceN = 0);
|
unsigned deviceN = 0);
|
||||||
|
|
||||||
|
// Run one cycle of the network.
|
||||||
rc_t exec_cycle( handle_t& hRef );
|
rc_t exec_cycle( handle_t& hRef );
|
||||||
|
|
||||||
|
// Run the network to completion.
|
||||||
rc_t exec( handle_t& hRef );
|
rc_t exec( handle_t& hRef );
|
||||||
|
|
||||||
rc_t destroy( handle_t& hRef );
|
rc_t destroy( handle_t& hRef );
|
||||||
|
|
||||||
void print_class_list( handle_t& hRef );
|
void print_class_list( handle_t& hRef );
|
||||||
|
@ -31,40 +31,40 @@ namespace cw
|
|||||||
typedef struct fbuf_str
|
typedef struct fbuf_str
|
||||||
{
|
{
|
||||||
struct value_str* base;
|
struct value_str* base;
|
||||||
srate_t srate; // signal sample rate
|
srate_t srate; // signal sample rate
|
||||||
unsigned flags; // See kXXXFbufFl
|
unsigned flags; // See kXXXFbufFl
|
||||||
unsigned chN; // count of channels
|
unsigned chN; // count of channels
|
||||||
unsigned binN; // count of sample frames per channel
|
unsigned binN; // count of sample frames per channel
|
||||||
unsigned hopSmpN; // hop sample count
|
unsigned hopSmpN; // hop sample count
|
||||||
sample_t** magV; // magV[ chN ][ binN ]
|
sample_t** magV; // magV[ chN ][ binN ]
|
||||||
sample_t** phsV; // phsV[ chN ][ binN ]
|
sample_t** phsV; // phsV[ chN ][ binN ]
|
||||||
sample_t** hzV; // hzV[ chN ][ binN ]
|
sample_t** hzV; // hzV[ chN ][ binN ]
|
||||||
bool* readyFlV;// readyFlV[chN] true if this channel is ready to be processed (used to sync. fbuf rate to abuf rate)
|
bool* readyFlV; // readyFlV[chN] true if this channel is ready to be processed (used to sync. fbuf rate to abuf rate)
|
||||||
sample_t* buf; // memory used by this buffer (or NULL if magV,phsV,hzV point are proxied to another buffer)
|
sample_t* buf; // memory used by this buffer (or NULL if magV,phsV,hzV point are proxied to another buffer)
|
||||||
} fbuf_t;
|
} fbuf_t;
|
||||||
|
|
||||||
enum
|
enum
|
||||||
{
|
{
|
||||||
kInvalidTFl = 0x00000000,
|
kInvalidTFl = 0x00000000,
|
||||||
kBoolTFl = 0x00000001,
|
kBoolTFl = 0x00000001,
|
||||||
kUIntTFl = 0x00000002,
|
kUIntTFl = 0x00000002,
|
||||||
kIntTFl = 0x00000004,
|
kIntTFl = 0x00000004,
|
||||||
kFloatTFl = 0x00000008,
|
kFloatTFl = 0x00000008,
|
||||||
kDoubleTFl = 0x00000010,
|
kDoubleTFl = 0x00000010,
|
||||||
|
|
||||||
kBoolMtxTFl = 0x00000020,
|
kBoolMtxTFl = 0x00000020,
|
||||||
kUIntMtxTFl = 0x00000040,
|
kUIntMtxTFl = 0x00000040,
|
||||||
kIntMtxTFl = 0x00000080,
|
kIntMtxTFl = 0x00000080,
|
||||||
kRealMtxTFl = 0x00000100,
|
kRealMtxTFl = 0x00000100,
|
||||||
kFloatMtxTFl = 0x00000200,
|
kFloatMtxTFl = 0x00000200,
|
||||||
kDoubleMtxTFl= 0x00000400,
|
kDoubleMtxTFl= 0x00000400,
|
||||||
|
|
||||||
kABufTFl = 0x00000800,
|
kABufTFl = 0x00000800,
|
||||||
kFBufTFl = 0x00001000,
|
kFBufTFl = 0x00001000,
|
||||||
kStringTFl = 0x00002000,
|
kStringTFl = 0x00002000,
|
||||||
kTimeTFl = 0x00004000,
|
kTimeTFl = 0x00004000,
|
||||||
|
|
||||||
kTypeMask = 0x00007fff,
|
kTypeMask = 0x00007fff,
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
|
70
cwIoFlow.cpp
70
cwIoFlow.cpp
@ -154,37 +154,44 @@ namespace cw
|
|||||||
void _setup_audio_device_cfg( io_flow_t* p, flow::external_device_t* d, audio_group_t* ag, audio_dev_t* ad, unsigned flags )
|
void _setup_audio_device_cfg( io_flow_t* p, flow::external_device_t* d, audio_group_t* ag, audio_dev_t* ad, unsigned flags )
|
||||||
{
|
{
|
||||||
_setup_device_cfg( d, io::audioDeviceLabel(p->ioH,ad->ioDevIdx), ad->ioDevId, flow::kAudioDevTypeId, flags );
|
_setup_device_cfg( d, io::audioDeviceLabel(p->ioH,ad->ioDevIdx), ad->ioDevId, flow::kAudioDevTypeId, flags );
|
||||||
d->u.a.abuf = &ad->abuf;
|
|
||||||
|
|
||||||
printf("%i %s\n", d->u.a.abuf->chN, d->label );
|
// Each audio device is given a flow::abuf to hold incoming or outgoing audio.
|
||||||
|
// This buffer also allows the 'audio_in' and 'audio_out' flow procs to configure themselves.
|
||||||
|
d->u.a.abuf = &ad->abuf;
|
||||||
}
|
}
|
||||||
|
|
||||||
void _fill_device_cfg_array( io_flow_t* p, flow::external_device_t* devA, unsigned devN )
|
void _setup_generic_device_array( io_flow_t* p )
|
||||||
{
|
{
|
||||||
unsigned i = 0;
|
unsigned i = 0;
|
||||||
|
|
||||||
|
// allocate the generic device control records
|
||||||
|
p->deviceN = _calc_device_count(p);
|
||||||
|
p->deviceA = mem::allocZ<flow::external_device_t>( p->deviceN );
|
||||||
|
|
||||||
|
|
||||||
// get serial devices
|
// get serial devices
|
||||||
for(unsigned di=0; i<devN && di<serialDeviceCount(p->ioH); ++di,++i)
|
for(unsigned di=0; i<p->deviceN && di<serialDeviceCount(p->ioH); ++di,++i)
|
||||||
_setup_device_cfg( devA + i, io::serialDeviceLabel(p->ioH,di), io::serialDeviceId(p->ioH,di), flow::kSerialDevTypeId, flow::kInFl | flow::kOutFl );
|
_setup_device_cfg( p->deviceA + i, io::serialDeviceLabel(p->ioH,di), io::serialDeviceId(p->ioH,di), flow::kSerialDevTypeId, flow::kInFl | flow::kOutFl );
|
||||||
|
|
||||||
// get midi devices
|
// get midi devices
|
||||||
//for(unsigned di=0; i<devN && di<midiDeviceCount(p->ioH); ++di,++i)
|
//for(unsigned di=0; i<p->deviceN && di<midiDeviceCount(p->ioH); ++di,++i)
|
||||||
// _setup_device_cfg( devA + i, io::midiDeviceLabel(p->ioH,di), di, flow::kMidiDevTypeId, flow::kInFl | flow::kOutFl );
|
// _setup_device_cfg( p->deviceA + i, io::midiDeviceLabel(p->ioH,di), di, flow::kMidiDevTypeId, flow::kInFl | flow::kOutFl );
|
||||||
|
|
||||||
// get sockets
|
// get sockets
|
||||||
for(unsigned di=0; i<devN && di<socketCount(p->ioH); ++di,++i)
|
for(unsigned di=0; i<p->deviceN && di<socketCount(p->ioH); ++di,++i)
|
||||||
_setup_device_cfg( devA + i, io::socketLabel(p->ioH,di), io::socketUserId(p->ioH,di), flow::kSocketDevTypeId, flow::kInFl | flow::kOutFl );
|
_setup_device_cfg( p->deviceA + i, io::socketLabel(p->ioH,di), io::socketUserId(p->ioH,di), flow::kSocketDevTypeId, flow::kInFl | flow::kOutFl );
|
||||||
|
|
||||||
|
|
||||||
|
// get the audio devices
|
||||||
for(unsigned gi=0; gi<p->audioGroupN; ++gi)
|
for(unsigned gi=0; gi<p->audioGroupN; ++gi)
|
||||||
{
|
{
|
||||||
audio_group_t* ag = p->audioGroupA + gi;
|
audio_group_t* ag = p->audioGroupA + gi;
|
||||||
|
|
||||||
for(unsigned di=0; i<devN && di<ag->iDeviceN; ++di,++i)
|
for(unsigned di=0; i<p->deviceN && di<ag->iDeviceN; ++di,++i)
|
||||||
_setup_audio_device_cfg( p, devA + i, ag, ag->iDeviceA + di, flow::kInFl );
|
_setup_audio_device_cfg( p, p->deviceA + i, ag, ag->iDeviceA + di, flow::kInFl );
|
||||||
|
|
||||||
for(unsigned di=0; i<devN && di<ag->oDeviceN; ++di,++i)
|
for(unsigned di=0; i<p->deviceN && di<ag->oDeviceN; ++di,++i)
|
||||||
_setup_audio_device_cfg( p, devA + i, ag, ag->oDeviceA + di, flow::kOutFl );
|
_setup_audio_device_cfg( p, p->deviceA + i, ag, ag->oDeviceA + di, flow::kOutFl );
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
@ -243,7 +250,8 @@ namespace cw
|
|||||||
|
|
||||||
rc_t rc = kOkRC;
|
rc_t rc = kOkRC;
|
||||||
flow::abuf_t* abuf;
|
flow::abuf_t* abuf;
|
||||||
|
|
||||||
|
// if there is incoming (recorded) audio
|
||||||
if( m.iBufChCnt > 0 )
|
if( m.iBufChCnt > 0 )
|
||||||
{
|
{
|
||||||
unsigned chIdx = 0;
|
unsigned chIdx = 0;
|
||||||
@ -263,6 +271,7 @@ namespace cw
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// if there are empty output (playback) buffers
|
||||||
if( m.oBufChCnt > 0 )
|
if( m.oBufChCnt > 0 )
|
||||||
{
|
{
|
||||||
|
|
||||||
@ -278,10 +287,12 @@ namespace cw
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
// update the flow network - this will generate audio into the output audio buffers
|
||||||
flow::exec_cycle(p->flowH);
|
flow::exec_cycle(p->flowH);
|
||||||
|
|
||||||
|
|
||||||
|
// if there are empty output (playback) buffers
|
||||||
if( m.oBufChCnt > 0 )
|
if( m.oBufChCnt > 0 )
|
||||||
{
|
{
|
||||||
|
|
||||||
@ -323,13 +334,11 @@ cw::rc_t cw::io_flow::create( handle_t& hRef, io::handle_t ioH, const object_t&
|
|||||||
|
|
||||||
p->ioH = ioH;
|
p->ioH = ioH;
|
||||||
|
|
||||||
|
// allocate p->audioGroupA[] and create the audio input/output buffers associated with each audio device
|
||||||
_setup_audio_groups(p);
|
_setup_audio_groups(p);
|
||||||
|
|
||||||
p->deviceN = _calc_device_count(p);
|
|
||||||
p->deviceA = mem::allocZ<flow::external_device_t>( p->deviceN );
|
|
||||||
|
|
||||||
|
// setup the control record for each external device known to the IO interface
|
||||||
_fill_device_cfg_array(p,p->deviceA,p->deviceN);
|
_setup_generic_device_array(p);
|
||||||
|
|
||||||
// create the flow object
|
// create the flow object
|
||||||
if((rc = create( p->flowH, flow_class_dict, network_cfg, p->deviceA, p->deviceN )) != kOkRC )
|
if((rc = create( p->flowH, flow_class_dict, network_cfg, p->deviceA, p->deviceN )) != kOkRC )
|
||||||
@ -367,23 +376,6 @@ cw::rc_t cw::io_flow::destroy( handle_t& hRef )
|
|||||||
return rc;
|
return rc;
|
||||||
}
|
}
|
||||||
|
|
||||||
cw::rc_t cw::io_flow::start( handle_t h )
|
|
||||||
{
|
|
||||||
rc_t rc = kOkRC;
|
|
||||||
return rc;
|
|
||||||
}
|
|
||||||
|
|
||||||
cw::rc_t cw::io_flow::stop( handle_t h )
|
|
||||||
{
|
|
||||||
rc_t rc = kOkRC;
|
|
||||||
return rc;
|
|
||||||
}
|
|
||||||
|
|
||||||
bool cw::io_flow::is_started( handle_t h )
|
|
||||||
{
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
cw::rc_t cw::io_flow::exec( handle_t h, const io::msg_t& msg )
|
cw::rc_t cw::io_flow::exec( handle_t h, const io::msg_t& msg )
|
||||||
{
|
{
|
||||||
|
@ -10,10 +10,6 @@ namespace cw
|
|||||||
rc_t create( handle_t& hRef, io::handle_t ioH, const object_t& flow_class_dict, const object_t& cfg );
|
rc_t create( handle_t& hRef, io::handle_t ioH, const object_t& flow_class_dict, const object_t& cfg );
|
||||||
rc_t destroy( handle_t& hRef );
|
rc_t destroy( handle_t& hRef );
|
||||||
|
|
||||||
rc_t start( handle_t h );
|
|
||||||
rc_t stop( handle_t h );
|
|
||||||
bool is_started( handle_t h );
|
|
||||||
|
|
||||||
rc_t exec( handle_t h, const io::msg_t& msg );
|
rc_t exec( handle_t h, const io::msg_t& msg );
|
||||||
|
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user