Merge branch 'master' into dev
This commit is contained in:
commit
5f3f986db6
@ -1102,14 +1102,14 @@ cw::rc_t cw::audio::device::file::test( const object_t* cfg)
|
|||||||
rc_t rc2 = kOkRC;
|
rc_t rc2 = kOkRC;
|
||||||
const char* ifname = nullptr;
|
const char* ifname = nullptr;
|
||||||
const char* ofname = nullptr;
|
const char* ofname = nullptr;
|
||||||
struct driver_str driver = {0};
|
struct driver_str driver = {};
|
||||||
struct driver_str* driver_ptr = &driver;
|
struct driver_str* driver_ptr = &driver;
|
||||||
unsigned bitsPerSample = 0; // zero indicates floating point sample format for output audio file
|
unsigned bitsPerSample = 0; // zero indicates floating point sample format for output audio file
|
||||||
unsigned sleepMicrosec = 0;
|
unsigned sleepMicrosec = 0;
|
||||||
const char* devLabel = "dev_file";
|
const char* devLabel = "dev_file";
|
||||||
unsigned devIdx = 0;
|
unsigned devIdx = 0;
|
||||||
unsigned framesPerCycle = 0;
|
unsigned framesPerCycle = 0;
|
||||||
cb_object_t obj = { 0 };
|
cb_object_t obj = {};
|
||||||
void* cbArg = &obj;
|
void* cbArg = &obj;
|
||||||
audiofile::info_t info;
|
audiofile::info_t info;
|
||||||
handle_t h;
|
handle_t h;
|
||||||
|
@ -302,7 +302,7 @@ cw::rc_t cw::afop::file_processor( const char* srcFn, const char* dstFn, proc_fu
|
|||||||
audiofile::handle_t srcAfH;
|
audiofile::handle_t srcAfH;
|
||||||
audiofile::handle_t dstAfH;
|
audiofile::handle_t dstAfH;
|
||||||
audiofile::info_t info;
|
audiofile::info_t info;
|
||||||
proc_ctx_t proc_ctx = {0};
|
proc_ctx_t proc_ctx = {};
|
||||||
|
|
||||||
if( hopSmpN > wndSmpN )
|
if( hopSmpN > wndSmpN )
|
||||||
return cwLogError(kInvalidArgRC,"The hop sample count (%i) cannot exceed the window sample count (%i).", hopSmpN, wndSmpN );
|
return cwLogError(kInvalidArgRC,"The hop sample count (%i) cannot exceed the window sample count (%i).", hopSmpN, wndSmpN );
|
||||||
|
@ -138,7 +138,7 @@ namespace cw
|
|||||||
{
|
{
|
||||||
|
|
||||||
|
|
||||||
#define cwAssert(cond) while(1){ if(!(cond)){ cwLogFatal(kAssertFailRC,"Assert failed on condition:%s",#cond ); } break; }
|
#define cwAssert(C) while(1){ if(!(C)){ cwLogFatal(kAssertFailRC,"Assert failed on condition:%s",#C ); } break; }
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
@ -113,6 +113,7 @@ namespace cw
|
|||||||
continue;
|
continue;
|
||||||
|
|
||||||
state = c==dquote ? kInQuotedField : kInField;
|
state = c==dquote ? kInQuotedField : kInField;
|
||||||
|
[[fallthrough]];
|
||||||
|
|
||||||
case kInField:
|
case kInField:
|
||||||
if(c == field_seperator_char )
|
if(c == field_seperator_char )
|
||||||
|
@ -2647,7 +2647,7 @@ cw::rc_t cw::dataset::test( const object_t* cfg )
|
|||||||
printf("%3i : ",j);
|
printf("%3i : ",j);
|
||||||
|
|
||||||
// print the first 5 images from each batch to an SVG file
|
// print the first 5 images from each batch to an SVG file
|
||||||
for(unsigned i=0; i<0; ++i,++imageN)
|
for(unsigned i=0; i<5; ++i,++imageN)
|
||||||
{
|
{
|
||||||
printf("%i ", numbV[i] );
|
printf("%i ", numbV[i] );
|
||||||
|
|
||||||
|
10
cwFlow.cpp
10
cwFlow.cpp
@ -23,7 +23,7 @@ namespace cw
|
|||||||
class_members_t* members;
|
class_members_t* members;
|
||||||
} library_t;
|
} library_t;
|
||||||
|
|
||||||
library_t library[] = {
|
library_t g_library[] = {
|
||||||
{ "audio_in", &audio_in::members },
|
{ "audio_in", &audio_in::members },
|
||||||
{ "audio_out", &audio_out::members },
|
{ "audio_out", &audio_out::members },
|
||||||
{ "audioFileIn", &audioFileIn::members },
|
{ "audioFileIn", &audioFileIn::members },
|
||||||
@ -49,7 +49,7 @@ namespace cw
|
|||||||
|
|
||||||
class_members_t* _find_library_record( const char* label )
|
class_members_t* _find_library_record( const char* label )
|
||||||
{
|
{
|
||||||
for(library_t* l = library; l->label != nullptr; ++l)
|
for(library_t* l = g_library; l->label != nullptr; ++l)
|
||||||
if( textCompare(l->label,label) == 0)
|
if( textCompare(l->label,label) == 0)
|
||||||
return l->members;
|
return l->members;
|
||||||
|
|
||||||
@ -86,7 +86,7 @@ namespace cw
|
|||||||
return rc;
|
return rc;
|
||||||
}
|
}
|
||||||
|
|
||||||
rc_t _parse_class_cfg(flow_t* p, const library_t* library, const object_t* classCfg)
|
rc_t _parse_class_cfg(flow_t* p, const object_t* classCfg)
|
||||||
{
|
{
|
||||||
rc_t rc = kOkRC;
|
rc_t rc = kOkRC;
|
||||||
|
|
||||||
@ -1012,7 +1012,7 @@ namespace cw
|
|||||||
rc_t _create_instance( flow_t* p, const object_t* inst_cfg )
|
rc_t _create_instance( flow_t* p, const object_t* inst_cfg )
|
||||||
{
|
{
|
||||||
rc_t rc = kOkRC;
|
rc_t rc = kOkRC;
|
||||||
inst_parse_vars_t pvars = {0};
|
inst_parse_vars_t pvars = {};
|
||||||
instance_t* inst = nullptr;
|
instance_t* inst = nullptr;
|
||||||
class_desc_t* class_desc = nullptr;
|
class_desc_t* class_desc = nullptr;
|
||||||
|
|
||||||
@ -1576,7 +1576,7 @@ cw::rc_t cw::flow::create( handle_t& hRef,
|
|||||||
p->deviceN = deviceN;
|
p->deviceN = deviceN;
|
||||||
|
|
||||||
// parse the class description array
|
// parse the class description array
|
||||||
if((rc = _parse_class_cfg(p,library,&classCfg)) != kOkRC )
|
if((rc = _parse_class_cfg(p,&classCfg)) != kOkRC )
|
||||||
{
|
{
|
||||||
rc = cwLogError(kSyntaxErrorRC,"Error parsing the class description list.");
|
rc = cwLogError(kSyntaxErrorRC,"Error parsing the class description list.");
|
||||||
goto errLabel;
|
goto errLabel;
|
||||||
|
8
cwIo.cpp
8
cwIo.cpp
@ -3882,10 +3882,10 @@ void cw::io::latency_measure_setup(handle_t h)
|
|||||||
p->latency_meas_enable_fl = true;
|
p->latency_meas_enable_fl = true;
|
||||||
p->latency_meas_thresh_db = -50;
|
p->latency_meas_thresh_db = -50;
|
||||||
p->latency_meas_thresh_lin = pow(10.0,p->latency_meas_thresh_db/20.0);
|
p->latency_meas_thresh_lin = pow(10.0,p->latency_meas_thresh_db/20.0);
|
||||||
p->latency_meas_result.note_on_input_ts = {0};
|
p->latency_meas_result.note_on_input_ts = {};
|
||||||
p->latency_meas_result.note_on_output_ts = {0};
|
p->latency_meas_result.note_on_output_ts = {};
|
||||||
p->latency_meas_result.audio_in_ts = {0};
|
p->latency_meas_result.audio_in_ts = {};
|
||||||
p->latency_meas_result.audio_out_ts = {0};
|
p->latency_meas_result.audio_out_ts = {};
|
||||||
p->latency_meas_result.audio_in_rms_max = 0;
|
p->latency_meas_result.audio_in_rms_max = 0;
|
||||||
p->latency_meas_result.audio_out_rms_max = 0;
|
p->latency_meas_result.audio_out_rms_max = 0;
|
||||||
|
|
||||||
|
@ -648,14 +648,14 @@ namespace cw
|
|||||||
|
|
||||||
rc_t _transmit_note( midi_record_play_t* p, unsigned ch, unsigned pitch, unsigned vel, unsigned microsecs )
|
rc_t _transmit_note( midi_record_play_t* p, unsigned ch, unsigned pitch, unsigned vel, unsigned microsecs )
|
||||||
{
|
{
|
||||||
time::spec_t ts = {0};
|
time::spec_t ts = {};
|
||||||
time::microsecondsToSpec( ts, microsecs );
|
time::microsecondsToSpec( ts, microsecs );
|
||||||
return _event_callback( p, kInvalidId, ts, kInvalidId, nullptr, ch, midi::kNoteOnMdId, pitch, vel, 0 );
|
return _event_callback( p, kInvalidId, ts, kInvalidId, nullptr, ch, midi::kNoteOnMdId, pitch, vel, 0 );
|
||||||
}
|
}
|
||||||
|
|
||||||
rc_t _transmit_ctl( midi_record_play_t* p, unsigned ch, unsigned ctlId, unsigned ctlVal, unsigned microsecs )
|
rc_t _transmit_ctl( midi_record_play_t* p, unsigned ch, unsigned ctlId, unsigned ctlVal, unsigned microsecs )
|
||||||
{
|
{
|
||||||
time::spec_t ts = {0};
|
time::spec_t ts = {};
|
||||||
time::microsecondsToSpec( ts, microsecs );
|
time::microsecondsToSpec( ts, microsecs );
|
||||||
return _event_callback( p, kInvalidId, ts, kInvalidId, nullptr, ch, midi::kCtlMdId, ctlId, ctlVal, 0 );
|
return _event_callback( p, kInvalidId, ts, kInvalidId, nullptr, ch, midi::kCtlMdId, ctlId, ctlVal, 0 );
|
||||||
}
|
}
|
||||||
@ -1826,7 +1826,7 @@ unsigned cw::midi_record_play::label_to_device_index( handle_t h, const char* de
|
|||||||
const char* cw::midi_record_play::device_index_to_label( handle_t h, unsigned devIdx )
|
const char* cw::midi_record_play::device_index_to_label( handle_t h, unsigned devIdx )
|
||||||
{
|
{
|
||||||
midi_record_play_t* p = _handleToPtr(h);
|
midi_record_play_t* p = _handleToPtr(h);
|
||||||
return 0 <= devIdx && devIdx < p->midiDevN ? p->midiDevA[devIdx].label : nullptr;
|
return devIdx < p->midiDevN ? p->midiDevA[devIdx].label : nullptr;
|
||||||
}
|
}
|
||||||
|
|
||||||
cw::rc_t cw::midi_record_play::seek( handle_t h, time::spec_t seek_timestamp )
|
cw::rc_t cw::midi_record_play::seek( handle_t h, time::spec_t seek_timestamp )
|
||||||
@ -1897,7 +1897,7 @@ unsigned cw::midi_record_play::event_loc( handle_t h )
|
|||||||
{
|
{
|
||||||
midi_record_play_t* p = _handleToPtr(h);
|
midi_record_play_t* p = _handleToPtr(h);
|
||||||
|
|
||||||
if( !p->recordFl && 0 <= p->msgArrayOutIdx && p->msgArrayOutIdx < p->msgArrayN )
|
if( !p->recordFl && p->msgArrayOutIdx < p->msgArrayN )
|
||||||
return p->msgArray[ p->msgArrayOutIdx ].loc;
|
return p->msgArray[ p->msgArrayOutIdx ].loc;
|
||||||
|
|
||||||
return kInvalidId;
|
return kInvalidId;
|
||||||
|
@ -445,7 +445,7 @@ namespace cw
|
|||||||
"crossFadeCount", app->crossFadeCnt,
|
"crossFadeCount", app->crossFadeCnt,
|
||||||
"beg_play_loc", app->beg_play_loc,
|
"beg_play_loc", app->beg_play_loc,
|
||||||
"end_play_loc", app->end_play_loc,
|
"end_play_loc", app->end_play_loc,
|
||||||
"dflt_perf_label", app->dflt_perf_label,
|
"dflt_perf_label", app->dflt_perf_label,
|
||||||
"live_mode_fl", app->useLiveMidiFl,
|
"live_mode_fl", app->useLiveMidiFl,
|
||||||
"enable_recording_fl", app->enableRecordFl,
|
"enable_recording_fl", app->enableRecordFl,
|
||||||
"midi_record_dir", midi_record_dir,
|
"midi_record_dir", midi_record_dir,
|
||||||
@ -3564,20 +3564,21 @@ cw::rc_t cw::preset_sel_app::main( const object_t* cfg, int argc, const char* ar
|
|||||||
{
|
{
|
||||||
|
|
||||||
rc_t rc;
|
rc_t rc;
|
||||||
app_t app = { .trackMidiFl = true,
|
app_t app = {};
|
||||||
.pvWndSmpCnt = 512,
|
app.trackMidiFl = true;
|
||||||
.sdBypassFl = false,
|
app.pvWndSmpCnt = 512;
|
||||||
.sdInGain = 1.0,
|
app.sdBypassFl = false;
|
||||||
.sdCeiling = 20.0,
|
app.sdInGain = 1.0;
|
||||||
.sdExpo = 2.0,
|
app.sdCeiling = 20.0;
|
||||||
.sdThresh = 60.0,
|
app.sdExpo = 2.0;
|
||||||
.sdUpr = -1.1,
|
app.sdThresh = 60.0;
|
||||||
.sdLwr = 2.0,
|
app.sdUpr = -1.1;
|
||||||
.sdMix = 0.0,
|
app.sdLwr = 2.0;
|
||||||
.cmpBypassFl = false,
|
app.sdMix = 0.0;
|
||||||
.dflt_perf_app_id = kInvalidId
|
app.cmpBypassFl = false;
|
||||||
|
app.dflt_perf_app_id = kInvalidId;
|
||||||
};
|
|
||||||
|
|
||||||
const object_t* params_cfg = nullptr;
|
const object_t* params_cfg = nullptr;
|
||||||
|
|
||||||
unsigned vtMapN = vtbl::get_ui_id_map_count();
|
unsigned vtMapN = vtbl::get_ui_id_map_count();
|
||||||
|
@ -723,7 +723,7 @@ unsigned cw::lex::getNextToken( handle_t h )
|
|||||||
}
|
}
|
||||||
|
|
||||||
// update the lexer state
|
// update the lexer state
|
||||||
p->curTokenId = maxIdx==kInvalidIdx ? kUnknownLexTId : p->mfp[ maxIdx ].typeId;
|
p->curTokenId = maxIdx==kInvalidIdx ? (unsigned)kUnknownLexTId : p->mfp[ maxIdx ].typeId;
|
||||||
p->curTokenCharIdx = p->ci;
|
p->curTokenCharIdx = p->ci;
|
||||||
p->curTokenCharCnt = maxCharCnt;
|
p->curTokenCharCnt = maxCharCnt;
|
||||||
|
|
||||||
|
@ -75,7 +75,8 @@ namespace cw
|
|||||||
} alsa_device_t;
|
} alsa_device_t;
|
||||||
|
|
||||||
#define _cmMpErrMsg( rc, alsaRc, str ) cwLogError(kOpFailRC,"%s : ALSA Error:%i %s",(str),(alsaRc),snd_strerror(alsaRc))
|
#define _cmMpErrMsg( rc, alsaRc, str ) cwLogError(kOpFailRC,"%s : ALSA Error:%i %s",(str),(alsaRc),snd_strerror(alsaRc))
|
||||||
#define _cmMpErrMsg1( rc, alsaRc, fmt, arg ) cwLogError(kOpFailRC, fmt"%s : ALSA Error:%i %s",(arg),(alsaRc),snd_strerror(alsaRc))
|
#define _cmMpErrMsg1( rc, alsaRc, fmt, arg ) cwLogError(kOpFailRC, fmt" : ALSA Error:%i %s",(arg),(alsaRc),snd_strerror(alsaRc))
|
||||||
|
#define _cmMpWarnMsg2( alsaRc, fmt, arg0, arg1 ) cwLogWarning(fmt" : ALSA Error:%i %s",(arg0),(arg1),(alsaRc),snd_strerror(alsaRc))
|
||||||
|
|
||||||
alsa_device_t* _handleToPtr( handle_t h ){ return handleToPtr<handle_t,alsa_device_t>(h); }
|
alsa_device_t* _handleToPtr( handle_t h ){ return handleToPtr<handle_t,alsa_device_t>(h); }
|
||||||
|
|
||||||
@ -301,8 +302,9 @@ namespace cw
|
|||||||
snd_seq_client_info_t* cip = NULL;
|
snd_seq_client_info_t* cip = NULL;
|
||||||
snd_seq_port_info_t* pip = NULL;
|
snd_seq_port_info_t* pip = NULL;
|
||||||
snd_seq_port_subscribe_t *subs = NULL;
|
snd_seq_port_subscribe_t *subs = NULL;
|
||||||
unsigned i,j,k,arc;
|
unsigned i,j,k;
|
||||||
|
int arc;
|
||||||
|
|
||||||
for(i=0; i<kCtoD_MapN; ++i)
|
for(i=0; i<kCtoD_MapN; ++i)
|
||||||
p->clientIdToDevIdxMap[i] = kInvalidIdx;
|
p->clientIdToDevIdxMap[i] = kInvalidIdx;
|
||||||
|
|
||||||
@ -354,11 +356,16 @@ namespace cw
|
|||||||
snd_seq_port_info_set_timestamp_queue(pip, p->alsa_queue);
|
snd_seq_port_info_set_timestamp_queue(pip, p->alsa_queue);
|
||||||
|
|
||||||
// create the client port
|
// create the client port
|
||||||
if((p->alsa_addr.port = snd_seq_create_port(p->h,pip)) < 0 )
|
//if((p->alsa_addr.port = snd_seq_create_port(p->h,pip)) < 0 )
|
||||||
|
if((arc = snd_seq_create_port(p->h,pip)) < 0 )
|
||||||
{
|
{
|
||||||
rc = _cmMpErrMsg(kOpFailRC,p->alsa_addr.port,"ALSA client port creation failed.");
|
rc = _cmMpErrMsg(kOpFailRC,arc,"ALSA client port creation failed.");
|
||||||
goto errLabel;
|
goto errLabel;
|
||||||
}
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
p->alsa_addr.port = arc;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
p->devCnt = 0;
|
p->devCnt = 0;
|
||||||
@ -426,7 +433,9 @@ namespace cw
|
|||||||
unsigned caps = snd_seq_port_info_get_capability(pip);
|
unsigned caps = snd_seq_port_info_get_capability(pip);
|
||||||
snd_seq_addr_t addr = *snd_seq_port_info_get_addr(pip);
|
snd_seq_addr_t addr = *snd_seq_port_info_get_addr(pip);
|
||||||
|
|
||||||
if( cwIsFlag(caps,SND_SEQ_PORT_CAP_READ) )
|
//printf("0x%x 0x%x %s %s\n",type,caps,name,port);
|
||||||
|
|
||||||
|
if( cwIsFlag(caps,SND_SEQ_PORT_CAP_READ) && cwIsFlag(caps,SND_SEQ_PORT_CAP_SUBS_READ) )
|
||||||
{
|
{
|
||||||
assert(j<p->devArray[i].iPortCnt);
|
assert(j<p->devArray[i].iPortCnt);
|
||||||
p->devArray[i].iPortArray[j].inputFl = true;
|
p->devArray[i].iPortArray[j].inputFl = true;
|
||||||
@ -443,12 +452,12 @@ namespace cw
|
|||||||
snd_seq_port_subscribe_set_time_update(subs, 1);
|
snd_seq_port_subscribe_set_time_update(subs, 1);
|
||||||
snd_seq_port_subscribe_set_time_real(subs, 1);
|
snd_seq_port_subscribe_set_time_real(subs, 1);
|
||||||
if((arc = snd_seq_subscribe_port(p->h, subs)) < 0)
|
if((arc = snd_seq_subscribe_port(p->h, subs)) < 0)
|
||||||
rc = _cmMpErrMsg1(kOpFailRC,arc,"Input port to app. subscription failed on port '%s'.",cwStringNullGuard(port));
|
_cmMpWarnMsg2(arc,"Input port to app. subscription failed on device:%s port '%s'.",cwStringNullGuard(name),cwStringNullGuard(port));
|
||||||
|
|
||||||
++j;
|
++j;
|
||||||
}
|
}
|
||||||
|
|
||||||
if( cwIsFlag(caps,SND_SEQ_PORT_CAP_WRITE) )
|
if( cwIsFlag(caps,SND_SEQ_PORT_CAP_WRITE) && cwIsFlag(caps,SND_SEQ_PORT_CAP_SUBS_WRITE) && cwIsNotFlag(type,SND_SEQ_PORT_TYPE_APPLICATION) )
|
||||||
{
|
{
|
||||||
assert(k<p->devArray[i].oPortCnt);
|
assert(k<p->devArray[i].oPortCnt);
|
||||||
p->devArray[i].oPortArray[k].inputFl = false;
|
p->devArray[i].oPortArray[k].inputFl = false;
|
||||||
@ -461,7 +470,7 @@ namespace cw
|
|||||||
snd_seq_port_subscribe_set_sender(subs, &p->alsa_addr);
|
snd_seq_port_subscribe_set_sender(subs, &p->alsa_addr);
|
||||||
snd_seq_port_subscribe_set_dest( subs, &addr);
|
snd_seq_port_subscribe_set_dest( subs, &addr);
|
||||||
if((arc = snd_seq_subscribe_port(p->h, subs)) < 0 )
|
if((arc = snd_seq_subscribe_port(p->h, subs)) < 0 )
|
||||||
rc = _cmMpErrMsg1(kOpFailRC,arc,"App to output port subscription failed on port '%s'.",cwStringNullGuard(port));
|
_cmMpWarnMsg2(arc,"App to output port subscription failed on device:%s port '%s'.",cwStringNullGuard(name), cwStringNullGuard(port));
|
||||||
|
|
||||||
++k;
|
++k;
|
||||||
}
|
}
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
#ifndef cwMidiPort_H
|
#ifndef cwMidiDevice_H
|
||||||
#define cwMidiPort_H
|
#define cwMidiDevice_H
|
||||||
|
|
||||||
|
|
||||||
namespace cw
|
namespace cw
|
||||||
|
@ -1832,11 +1832,11 @@ void cw::midi::file::calcNoteDurations( handle_t h, unsigned flags )
|
|||||||
{
|
{
|
||||||
unsigned k = ch*kMidiNoteCnt + d0;
|
unsigned k = ch*kMidiNoteCnt + d0;
|
||||||
|
|
||||||
// there should be no existing sounding note instance for this pitch
|
// if the note gate is not activated (i.e. key is up) but the note is still sounding (e.g. held by pedal)
|
||||||
if( noteGateM[k] == 0 && noteM[k] != NULL )
|
if( noteGateM[k] == 0 && noteM[k] != NULL )
|
||||||
{
|
{
|
||||||
if( warningFl )
|
//if( warningFl )
|
||||||
cwLogWarning("%i : Missing note-off instance for note on:%s",m->uid,midi::midiToSciPitch(d0,NULL,0));
|
// cwLogWarning("%i : Missing note-off instance for note on:%s",m->uid,midi::midiToSciPitch(d0,NULL,0));
|
||||||
|
|
||||||
if( cwIsFlag(flags,kDropReattacksMfFl) )
|
if( cwIsFlag(flags,kDropReattacksMfFl) )
|
||||||
{
|
{
|
||||||
|
@ -427,14 +427,13 @@ namespace cw
|
|||||||
{
|
{
|
||||||
if( p->cbFunc != nullptr )
|
if( p->cbFunc != nullptr )
|
||||||
{
|
{
|
||||||
packet_t pkt = {
|
packet_t pkt = {};
|
||||||
.cbArg = p->cbArg,
|
pkt.cbArg = p->cbArg;
|
||||||
.devIdx = p->base_dev_idx,
|
pkt.devIdx = p->base_dev_idx;
|
||||||
.portIdx = file_idx,
|
pkt.portIdx = file_idx;
|
||||||
.msgArray = msgA,
|
pkt.msgArray = msgA;
|
||||||
.msgCnt = msgN
|
pkt.msgCnt = msgN;
|
||||||
};
|
|
||||||
|
|
||||||
p->cbFunc( &pkt, 1 );
|
p->cbFunc( &pkt, 1 );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -405,10 +405,12 @@ namespace cw
|
|||||||
|
|
||||||
rc_t _validate_preset_id( const frag_t* frag, unsigned preset_id )
|
rc_t _validate_preset_id( const frag_t* frag, unsigned preset_id )
|
||||||
{
|
{
|
||||||
bool fl = (preset_id < frag->presetN) && (frag->presetA[ preset_id ].preset_idx == preset_id);
|
rc_t rc = kOkRC;
|
||||||
|
|
||||||
return fl ? kOkRC : cwLogError(kInvalidIdRC,"The preset id '%i' is invalid on the fragment at loc:%i.",preset_id,frag->endLoc);
|
if( (preset_id >= frag->presetN) || (frag->presetA[ preset_id ].preset_idx != preset_id) )
|
||||||
|
rc = cwLogError(kInvalidIdRC,"The preset id '%i' is invalid on the fragment at loc:%i.",preset_id,frag->endLoc);
|
||||||
|
|
||||||
|
return rc;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool _is_master_var_id( unsigned varId )
|
bool _is_master_var_id( unsigned varId )
|
||||||
|
@ -236,7 +236,7 @@ namespace cw
|
|||||||
|
|
||||||
if( perfMeasH.isValid() )
|
if( perfMeasH.isValid() )
|
||||||
{
|
{
|
||||||
perf_meas::result_t pmr = {0};
|
perf_meas::result_t pmr = {};
|
||||||
|
|
||||||
// Call performance measurement unit
|
// Call performance measurement unit
|
||||||
if( perf_meas::exec( perfMeasH, e, pmr ) == kOkRC && pmr.loc != kInvalidIdx && pmr.valueA != nullptr )
|
if( perf_meas::exec( perfMeasH, e, pmr ) == kOkRC && pmr.loc != kInvalidIdx && pmr.valueA != nullptr )
|
||||||
@ -603,7 +603,7 @@ cw::rc_t cw::score_follow_test::test( const object_t* cfg )
|
|||||||
perf_meas::handle_t perfMeasH;
|
perf_meas::handle_t perfMeasH;
|
||||||
perf_meas::params_t perf_meas_params;
|
perf_meas::params_t perf_meas_params;
|
||||||
|
|
||||||
test_t t = {0};
|
test_t t = {};
|
||||||
|
|
||||||
t.sf_args.enableFl = true;
|
t.sf_args.enableFl = true;
|
||||||
|
|
||||||
|
@ -670,7 +670,7 @@ cw::rc_t cw::score_follower::write_sync_perf_csv( handle_t h, const char* out_fn
|
|||||||
sectionLabel = e->section != nullptr ? e->section->label : "";
|
sectionLabel = e->section != nullptr ? e->section->label : "";
|
||||||
curBarNumb = std::max(bar,curBarNumb);
|
curBarNumb = std::max(bar,curBarNumb);
|
||||||
dlevel = e->dynLevel;
|
dlevel = e->dynLevel;
|
||||||
loc = resultA[i].oLocId == kInvalidId ? score_parse::kInvalidLocId : resultA[i].oLocId;
|
loc = resultA[i].oLocId == kInvalidId ? (unsigned)score_parse::kInvalidLocId : resultA[i].oLocId;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -606,7 +606,7 @@ namespace cw
|
|||||||
// Both of these assertions should have been previously verified
|
// Both of these assertions should have been previously verified
|
||||||
// by the score validation process.
|
// by the score validation process.
|
||||||
assert( set->locN >= 2 );
|
assert( set->locN >= 2 );
|
||||||
assert( set->evtCnt >= 0 );
|
//assert( set->evtCnt >= 0 );
|
||||||
|
|
||||||
bool printFl = false; //set->evtArray[0]->barNumb == 272;
|
bool printFl = false; //set->evtArray[0]->barNumb == 272;
|
||||||
|
|
||||||
|
@ -218,7 +218,7 @@ namespace cw
|
|||||||
// write the ref-note
|
// write the ref-note
|
||||||
for(ssf_ref_note_t* rn=r->refNoteL; rn!=nullptr; rn = rn->link)
|
for(ssf_ref_note_t* rn=r->refNoteL; rn!=nullptr; rn = rn->link)
|
||||||
{
|
{
|
||||||
unsigned pitch = rn->evt == nullptr ? midi::kInvalidMidiPitch : rn->evt->pitch;
|
unsigned pitch = rn->evt == nullptr ? (unsigned)midi::kInvalidMidiPitch : rn->evt->pitch;
|
||||||
unsigned cnt = rn->cnt > 1 ? rn->cnt : kInvalidCnt;
|
unsigned cnt = rn->cnt > 1 ? rn->cnt : kInvalidCnt;
|
||||||
bool noMatchFl = rn->cnt == 0;
|
bool noMatchFl = rn->cnt == 0;
|
||||||
if((rc = _write_rect_pitch( p, r->left-offset_x, rn->top, "ref_note", pitch, noMatchFl, cnt, rn->cwLocId )) != kOkRC )
|
if((rc = _write_rect_pitch( p, r->left-offset_x, rn->top, "ref_note", pitch, noMatchFl, cnt, rn->cwLocId )) != kOkRC )
|
||||||
|
@ -57,14 +57,14 @@ cw::time::spec_t cw::time::current_time()
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
unsigned long long cw::time::elapsedMicros( const spec_t& t0, const spec_t& t1 )
|
unsigned long long cw::time::elapsedMicros( const spec_t& t0, const spec_t& t1 )
|
||||||
{
|
{
|
||||||
const unsigned long long ns_per_sec = 1000000000;
|
const unsigned long long ns_per_sec = 1000000000;
|
||||||
const unsigned long long us_per_sec = 1000000;
|
const unsigned long long us_per_sec = 1000000;
|
||||||
const unsigned long long ns_per_us = 1000;
|
const unsigned long long ns_per_us = 1000;
|
||||||
|
|
||||||
// we assume that the time is normalized
|
// we assume that the time is normalized
|
||||||
assert( t0.tv_nsec < (const long long)ns_per_sec );
|
assert( t0.tv_nsec < (long long)ns_per_sec );
|
||||||
assert( t1.tv_nsec < (const long long)ns_per_sec );
|
assert( t1.tv_nsec < (long long)ns_per_sec );
|
||||||
|
|
||||||
if( t0.tv_sec > t1.tv_sec )
|
if( t0.tv_sec > t1.tv_sec )
|
||||||
{
|
{
|
||||||
|
18
cwUi.cpp
18
cwUi.cpp
@ -2116,7 +2116,8 @@ cw::rc_t cw::ui::registerAppIdMap( handle_t h, const appIdMap_t* map, unsigned
|
|||||||
cw::rc_t cw::ui::sendValueBool( handle_t h, unsigned uuId, bool value )
|
cw::rc_t cw::ui::sendValueBool( handle_t h, unsigned uuId, bool value )
|
||||||
{
|
{
|
||||||
ui_t* p = _handleToPtr(h);
|
ui_t* p = _handleToPtr(h);
|
||||||
value_t v = { .tid=kBoolTId };
|
value_t v = {};
|
||||||
|
v.tid = kBoolTId;
|
||||||
v.u.b = value;
|
v.u.b = value;
|
||||||
return _sendValue(p,kInvalidId,uuId,v);
|
return _sendValue(p,kInvalidId,uuId,v);
|
||||||
|
|
||||||
@ -2126,7 +2127,8 @@ cw::rc_t cw::ui::sendValueBool( handle_t h, unsigned uuId, bool value )
|
|||||||
cw::rc_t cw::ui::sendValueInt( handle_t h, unsigned uuId, int value )
|
cw::rc_t cw::ui::sendValueInt( handle_t h, unsigned uuId, int value )
|
||||||
{
|
{
|
||||||
ui_t* p = _handleToPtr(h);
|
ui_t* p = _handleToPtr(h);
|
||||||
value_t v = { .tid=kIntTId };
|
value_t v = {};
|
||||||
|
v.tid = kIntTId;
|
||||||
v.u.i = value;
|
v.u.i = value;
|
||||||
return _sendValue(p,kInvalidId,uuId,v);
|
return _sendValue(p,kInvalidId,uuId,v);
|
||||||
|
|
||||||
@ -2137,7 +2139,8 @@ cw::rc_t cw::ui::sendValueUInt( handle_t h, unsigned uuId, unsigned value )
|
|||||||
{
|
{
|
||||||
ui_t* p = _handleToPtr(h);
|
ui_t* p = _handleToPtr(h);
|
||||||
|
|
||||||
value_t v = { .tid=kUIntTId };
|
value_t v = {};
|
||||||
|
v.tid = kUIntTId;
|
||||||
v.u.u = value;
|
v.u.u = value;
|
||||||
return _sendValue(p,kInvalidId,uuId,v);
|
return _sendValue(p,kInvalidId,uuId,v);
|
||||||
|
|
||||||
@ -2147,7 +2150,8 @@ cw::rc_t cw::ui::sendValueUInt( handle_t h, unsigned uuId, unsigned value )
|
|||||||
cw::rc_t cw::ui::sendValueFloat( handle_t h, unsigned uuId, float value )
|
cw::rc_t cw::ui::sendValueFloat( handle_t h, unsigned uuId, float value )
|
||||||
{
|
{
|
||||||
ui_t* p = _handleToPtr(h);
|
ui_t* p = _handleToPtr(h);
|
||||||
value_t v = { .tid=kFloatTId };
|
value_t v = { };
|
||||||
|
v.tid = kFloatTId;
|
||||||
v.u.f = value;
|
v.u.f = value;
|
||||||
return _sendValue(p,kInvalidId,uuId,v);
|
return _sendValue(p,kInvalidId,uuId,v);
|
||||||
|
|
||||||
@ -2158,7 +2162,8 @@ cw::rc_t cw::ui::sendValueFloat( handle_t h, unsigned uuId, float value )
|
|||||||
cw::rc_t cw::ui::sendValueDouble( handle_t h, unsigned uuId, double value )
|
cw::rc_t cw::ui::sendValueDouble( handle_t h, unsigned uuId, double value )
|
||||||
{
|
{
|
||||||
ui_t* p = _handleToPtr(h);
|
ui_t* p = _handleToPtr(h);
|
||||||
value_t v = { .tid=kDoubleTId };
|
value_t v = {};
|
||||||
|
v.tid=kDoubleTId;
|
||||||
v.u.d = value;
|
v.u.d = value;
|
||||||
return _sendValue(p,kInvalidId,uuId,v);
|
return _sendValue(p,kInvalidId,uuId,v);
|
||||||
|
|
||||||
@ -2168,7 +2173,8 @@ cw::rc_t cw::ui::sendValueDouble( handle_t h, unsigned uuId, double value )
|
|||||||
cw::rc_t cw::ui::sendValueString( handle_t h, unsigned uuId, const char* value )
|
cw::rc_t cw::ui::sendValueString( handle_t h, unsigned uuId, const char* value )
|
||||||
{
|
{
|
||||||
ui_t* p = _handleToPtr(h);
|
ui_t* p = _handleToPtr(h);
|
||||||
value_t v = { .tid=kStringTId };
|
value_t v = {};
|
||||||
|
v.tid = kStringTId;
|
||||||
v.u.s = value;
|
v.u.s = value;
|
||||||
return _sendValue(p,kInvalidId,uuId,v);
|
return _sendValue(p,kInvalidId,uuId,v);
|
||||||
|
|
||||||
|
@ -207,7 +207,7 @@ namespace cw
|
|||||||
case kFloatId:
|
case kFloatId:
|
||||||
printf("Float: %f\n",v->u.f);
|
printf("Float: %f\n",v->u.f);
|
||||||
p->appFloat = v->u.f;
|
p->appFloat = v->u.f;
|
||||||
|
break;
|
||||||
|
|
||||||
case kPanelBtn1Id:
|
case kPanelBtn1Id:
|
||||||
{
|
{
|
||||||
|
@ -46,7 +46,7 @@ namespace cw
|
|||||||
{ kPtrVFl | kFloatVFl, "float_ptr", "p", sizeof(float) },
|
{ kPtrVFl | kFloatVFl, "float_ptr", "p", sizeof(float) },
|
||||||
{ kPtrVFl | kDoubleVFl, "double_ptr", "p", sizeof(double) },
|
{ kPtrVFl | kDoubleVFl, "double_ptr", "p", sizeof(double) },
|
||||||
|
|
||||||
{ 0, nullptr, 0 }
|
{ 0, nullptr, nullptr, 0 }
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -705,7 +705,7 @@ namespace cw
|
|||||||
cw::rc_t _set_pitch( vtbl_t* p, unsigned vseqPitch )
|
cw::rc_t _set_pitch( vtbl_t* p, unsigned vseqPitch )
|
||||||
{
|
{
|
||||||
rc_t rc = kOkRC;
|
rc_t rc = kOkRC;
|
||||||
if( 0<= vseqPitch && vseqPitch < 128)
|
if( vseqPitch < 128)
|
||||||
p->vseqPitch = vseqPitch;
|
p->vseqPitch = vseqPitch;
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
@ -716,7 +716,7 @@ namespace cw
|
|||||||
|
|
||||||
cw::rc_t _validate_midi_value( vtbl_t* p, unsigned midiValue )
|
cw::rc_t _validate_midi_value( vtbl_t* p, unsigned midiValue )
|
||||||
{
|
{
|
||||||
if( 0 <= midiValue && midiValue < 128 )
|
if( midiValue < 128 )
|
||||||
return kOkRC;
|
return kOkRC;
|
||||||
|
|
||||||
return _set_status(p,kInvalidArgRC,"%i is an invalid 8 bit MIDI value.",midiValue);
|
return _set_status(p,kInvalidArgRC,"%i is an invalid 8 bit MIDI value.",midiValue);
|
||||||
|
@ -180,8 +180,10 @@ namespace cw
|
|||||||
cwLogInfo("Websocket connection closed.\n");
|
cwLogInfo("Websocket connection closed.\n");
|
||||||
|
|
||||||
ws->_connSessionN -= 1;
|
ws->_connSessionN -= 1;
|
||||||
|
|
||||||
|
cwAssert( protoState->sessionN > 0 );
|
||||||
|
|
||||||
protoState->sessionN -= 1;
|
protoState->sessionN -= 1;
|
||||||
cwAssert( protoState->sessionN >= 0 );
|
|
||||||
|
|
||||||
if( ws->_cbFunc != nullptr)
|
if( ws->_cbFunc != nullptr)
|
||||||
ws->_cbFunc(ws->_cbArg,proto->id,sess->id,kDisconnectTId,nullptr,0);
|
ws->_cbFunc(ws->_cbArg,proto->id,sess->id,kDisconnectTId,nullptr,0);
|
||||||
@ -538,16 +540,16 @@ cw::rc_t cw::websock::create(
|
|||||||
int logs = LLL_USER | LLL_ERR | LLL_WARN | LLL_NOTICE;
|
int logs = LLL_USER | LLL_ERR | LLL_WARN | LLL_NOTICE;
|
||||||
lws_set_log_level(logs, nullptr);
|
lws_set_log_level(logs, nullptr);
|
||||||
|
|
||||||
p->_event_loop_ops_custom = {
|
p->_event_loop_ops_custom = {};
|
||||||
.name = "custom",
|
p->_event_loop_ops_custom.name = "custom";
|
||||||
.init_vhost_listen_wsi = _custom_sock_accept,
|
p->_event_loop_ops_custom.init_vhost_listen_wsi = _custom_sock_accept;
|
||||||
.init_pt = _custom_init_private,
|
p->_event_loop_ops_custom.init_pt = _custom_init_private;
|
||||||
.wsi_logical_close = _custom_wsi_logical_close,
|
p->_event_loop_ops_custom.wsi_logical_close = _custom_wsi_logical_close;
|
||||||
.sock_accept = _custom_sock_accept,
|
p->_event_loop_ops_custom.sock_accept = _custom_sock_accept;
|
||||||
.io = _custom_io,
|
p->_event_loop_ops_custom.io = _custom_io;
|
||||||
.evlib_size_pt = sizeof(struct pt_eventlibs_custom)
|
p->_event_loop_ops_custom.evlib_size_pt = sizeof(struct pt_eventlibs_custom);
|
||||||
};
|
|
||||||
|
|
||||||
|
|
||||||
p->_evlib_custom = {
|
p->_evlib_custom = {
|
||||||
.hdr = {
|
.hdr = {
|
||||||
"custom event loop",
|
"custom event loop",
|
||||||
|
Loading…
Reference in New Issue
Block a user