Merge branch 'loc_fix'
This commit is contained in:
commit
b8ca52082d
@ -300,8 +300,10 @@ namespace cw
|
|||||||
|
|
||||||
unsigned insertLoc; // last valid insert location id received from the GUI
|
unsigned insertLoc; // last valid insert location id received from the GUI
|
||||||
|
|
||||||
unsigned minLoc; // min/max locations of the currently loaded performance
|
unsigned minScoreLoc; // min/max locations of the currently loaded score
|
||||||
unsigned maxLoc;
|
unsigned maxScoreLoc; //
|
||||||
|
unsigned minPerfLoc; // min/max locations of the currently loaded performance
|
||||||
|
unsigned maxPerfLoc;
|
||||||
|
|
||||||
unsigned beg_play_loc; // beg/end play loc's from the UI
|
unsigned beg_play_loc; // beg/end play loc's from the UI
|
||||||
unsigned end_play_loc;
|
unsigned end_play_loc;
|
||||||
@ -1416,7 +1418,7 @@ namespace cw
|
|||||||
//io::uiSendValue( app->ioH, uiFindElementUuId(app->ioH,kCurMidiEvtCntId), midi_record_play::event_index(app->mrpH) );
|
//io::uiSendValue( app->ioH, uiFindElementUuId(app->ioH,kCurMidiEvtCntId), midi_record_play::event_index(app->mrpH) );
|
||||||
//io::uiSendValue( app->ioH, uiFindElementUuId(app->ioH,kTotalMidiEvtCntId), midi_record_play::event_count(app->mrpH) );
|
//io::uiSendValue( app->ioH, uiFindElementUuId(app->ioH,kTotalMidiEvtCntId), midi_record_play::event_count(app->mrpH) );
|
||||||
|
|
||||||
io::uiSendValue( app->ioH, uiFindElementUuId(app->ioH,kTotalMidiEvtCntId), app->maxLoc-app->minLoc );
|
io::uiSendValue( app->ioH, uiFindElementUuId(app->ioH,kTotalMidiEvtCntId), app->maxPerfLoc-app->minPerfLoc );
|
||||||
}
|
}
|
||||||
|
|
||||||
// Update the UI with the value from the the fragment data record.
|
// Update the UI with the value from the the fragment data record.
|
||||||
@ -1585,7 +1587,10 @@ namespace cw
|
|||||||
// _clear_status(app);
|
// _clear_status(app);
|
||||||
//else
|
//else
|
||||||
if( !enableFl )
|
if( !enableFl )
|
||||||
|
{
|
||||||
_set_status(app,"Invalid fragment play range. beg:%i end:%i",begPlayLoc,endPlayLoc);
|
_set_status(app,"Invalid fragment play range. beg:%i end:%i",begPlayLoc,endPlayLoc);
|
||||||
|
cwLogError(kInvalidArgRC,"Invalid fragment play range. beg:%i end:%i",begPlayLoc,endPlayLoc);
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1776,9 +1781,9 @@ namespace cw
|
|||||||
|
|
||||||
// Set the fragment beg/end play range
|
// Set the fragment beg/end play range
|
||||||
get_value( app->psH, fragId, preset_sel::kBegPlayLocVarId, kInvalidId, fragBegLoc );
|
get_value( app->psH, fragId, preset_sel::kBegPlayLocVarId, kInvalidId, fragBegLoc );
|
||||||
uiSetNumbRange( app->ioH, io::uiFindElementUuId(app->ioH, fragPanelUuId, kFragBegPlayLocId, fragChanId), app->minLoc, app->maxLoc, 1, 0, fragBegLoc );
|
|
||||||
uiSetNumbRange( app->ioH, io::uiFindElementUuId(app->ioH, fragPanelUuId, kFragEndPlayLocId, fragChanId), app->minLoc, app->maxLoc, 1, 0, endLoc );
|
|
||||||
|
|
||||||
|
uiSetNumbRange( app->ioH, io::uiFindElementUuId(app->ioH, fragPanelUuId, kFragBegPlayLocId, fragChanId), app->minScoreLoc, app->maxScoreLoc, 1, 0, fragBegLoc );
|
||||||
|
uiSetNumbRange( app->ioH, io::uiFindElementUuId(app->ioH, fragPanelUuId, kFragEndPlayLocId, fragChanId), app->minScoreLoc, app->maxScoreLoc, 1, 0, endLoc );
|
||||||
|
|
||||||
// Attach blobs to the UI to allow convenient access back to the prese_sel data record
|
// Attach blobs to the UI to allow convenient access back to the prese_sel data record
|
||||||
_frag_set_ui_blob(app, io::uiFindElementUuId(app->ioH, fragPanelUuId, kFragInGainId, fragChanId), fragId, preset_sel::kInGainVarId, kInvalidId );
|
_frag_set_ui_blob(app, io::uiFindElementUuId(app->ioH, fragPanelUuId, kFragInGainId, fragChanId), fragId, preset_sel::kInGainVarId, kInvalidId );
|
||||||
@ -1831,6 +1836,8 @@ namespace cw
|
|||||||
goto errLabel;
|
goto errLabel;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
get_loc_range(app->psH,app->minScoreLoc,app->maxScoreLoc);
|
||||||
|
|
||||||
// Settting psNextFrag to a non-null value causes the
|
// Settting psNextFrag to a non-null value causes the
|
||||||
app->psNextFrag = preset_sel::get_fragment_base(app->psH);
|
app->psNextFrag = preset_sel::get_fragment_base(app->psH);
|
||||||
|
|
||||||
@ -1890,6 +1897,7 @@ namespace cw
|
|||||||
return rc;
|
return rc;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
rc_t _restore_fragment_data( app_t* app )
|
rc_t _restore_fragment_data( app_t* app )
|
||||||
{
|
{
|
||||||
rc_t rc = kOkRC;
|
rc_t rc = kOkRC;
|
||||||
@ -1920,6 +1928,8 @@ namespace cw
|
|||||||
goto errLabel;
|
goto errLabel;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
get_loc_range(app->psH,app->minScoreLoc,app->maxScoreLoc);
|
||||||
|
|
||||||
//preset_sel::report( app->psH );
|
//preset_sel::report( app->psH );
|
||||||
|
|
||||||
f = preset_sel::get_fragment_base(app->psH);
|
f = preset_sel::get_fragment_base(app->psH);
|
||||||
@ -1944,7 +1954,7 @@ namespace cw
|
|||||||
|
|
||||||
return rc;
|
return rc;
|
||||||
}
|
}
|
||||||
|
*/
|
||||||
rc_t _on_ui_save( app_t* app )
|
rc_t _on_ui_save( app_t* app )
|
||||||
{
|
{
|
||||||
rc_t rc = kOkRC;
|
rc_t rc = kOkRC;
|
||||||
@ -2005,8 +2015,8 @@ namespace cw
|
|||||||
// allocate the locMap[]
|
// allocate the locMap[]
|
||||||
app->locMap = mem::resizeZ<loc_map_t>( app->locMap, midiEventN );
|
app->locMap = mem::resizeZ<loc_map_t>( app->locMap, midiEventN );
|
||||||
app->locMapN = midiEventN;
|
app->locMapN = midiEventN;
|
||||||
app->minLoc = INVALID_LOC;
|
app->minPerfLoc = INVALID_LOC;
|
||||||
app->maxLoc = INVALID_LOC;
|
app->maxPerfLoc = INVALID_LOC;
|
||||||
|
|
||||||
// allocate the the player msg array
|
// allocate the the player msg array
|
||||||
m = mem::allocZ<midi_record_play::midi_msg_t>( midiEventN );
|
m = mem::allocZ<midi_record_play::midi_msg_t>( midiEventN );
|
||||||
@ -2029,15 +2039,15 @@ namespace cw
|
|||||||
|
|
||||||
if( e->loc != INVALID_LOC )
|
if( e->loc != INVALID_LOC )
|
||||||
{
|
{
|
||||||
if( app->minLoc == INVALID_LOC )
|
if( app->minPerfLoc == INVALID_LOC )
|
||||||
app->minLoc = e->loc;
|
app->minPerfLoc = e->loc;
|
||||||
else
|
else
|
||||||
app->minLoc = std::min(app->minLoc,e->loc);
|
app->minPerfLoc = std::min(app->minPerfLoc,e->loc);
|
||||||
|
|
||||||
if( app->maxLoc == INVALID_LOC )
|
if( app->maxPerfLoc == INVALID_LOC )
|
||||||
app->maxLoc = e->loc;
|
app->maxPerfLoc = e->loc;
|
||||||
else
|
else
|
||||||
app->maxLoc = std::max(app->maxLoc,e->loc);
|
app->maxPerfLoc = std::max(app->maxPerfLoc,e->loc);
|
||||||
}
|
}
|
||||||
|
|
||||||
++i;
|
++i;
|
||||||
@ -2054,7 +2064,7 @@ namespace cw
|
|||||||
|
|
||||||
midiEventCntRef = midiEventN;
|
midiEventCntRef = midiEventN;
|
||||||
|
|
||||||
cwLogInfo("%i MIDI events loaded from score. Loc Min:%i Max:%i", midiEventN , app->minLoc, app->maxLoc);
|
cwLogInfo("%i MIDI events loaded from score. Loc Min:%i Max:%i", midiEventN , app->minPerfLoc, app->maxPerfLoc);
|
||||||
}
|
}
|
||||||
|
|
||||||
errLabel:
|
errLabel:
|
||||||
@ -2122,7 +2132,7 @@ namespace cw
|
|||||||
cwLogInfo("Loading");
|
cwLogInfo("Loading");
|
||||||
_set_status(app,"Loading...");
|
_set_status(app,"Loading...");
|
||||||
|
|
||||||
// load the performance or score
|
// load the performance
|
||||||
if((rc= perf_score::create( app->scoreH, perf_fn )) != kOkRC )
|
if((rc= perf_score::create( app->scoreH, perf_fn )) != kOkRC )
|
||||||
{
|
{
|
||||||
cwLogError(rc,"Score create failed on '%s'.",perf_fn);
|
cwLogError(rc,"Score create failed on '%s'.",perf_fn);
|
||||||
@ -2153,12 +2163,12 @@ namespace cw
|
|||||||
io::uiSetEnable( app->ioH, io::uiFindElementUuId( app->ioH, kInsertLocId ), true );
|
io::uiSetEnable( app->ioH, io::uiFindElementUuId( app->ioH, kInsertLocId ), true );
|
||||||
|
|
||||||
// set the UI begin/end play to the locations of the newly loaded performance
|
// set the UI begin/end play to the locations of the newly loaded performance
|
||||||
app->end_play_loc = app->maxLoc;
|
app->end_play_loc = app->maxPerfLoc;
|
||||||
app->beg_play_loc = app->minLoc;
|
app->beg_play_loc = app->minPerfLoc;
|
||||||
|
|
||||||
// Update the master range of the play beg/end number widgets
|
// Update the master range of the play beg/end number widgets
|
||||||
io::uiSetNumbRange( app->ioH, io::uiFindElementUuId(app->ioH, kBegPlayLocNumbId), app->minLoc, app->maxLoc, 1, 0, app->beg_play_loc );
|
io::uiSetNumbRange( app->ioH, io::uiFindElementUuId(app->ioH, kBegPlayLocNumbId), app->minPerfLoc, app->maxPerfLoc, 1, 0, app->beg_play_loc );
|
||||||
io::uiSetNumbRange( app->ioH, io::uiFindElementUuId(app->ioH, kEndPlayLocNumbId), app->minLoc, app->maxLoc, 1, 0, app->end_play_loc );
|
io::uiSetNumbRange( app->ioH, io::uiFindElementUuId(app->ioH, kEndPlayLocNumbId), app->minPerfLoc, app->maxPerfLoc, 1, 0, app->end_play_loc );
|
||||||
|
|
||||||
io::uiSetEnable( app->ioH, io::uiFindElementUuId( app->ioH, kBegPlayLocNumbId ), true );
|
io::uiSetEnable( app->ioH, io::uiFindElementUuId( app->ioH, kBegPlayLocNumbId ), true );
|
||||||
io::uiSetEnable( app->ioH, io::uiFindElementUuId( app->ioH, kEndPlayLocNumbId ), true );
|
io::uiSetEnable( app->ioH, io::uiFindElementUuId( app->ioH, kEndPlayLocNumbId ), true );
|
||||||
@ -2170,8 +2180,8 @@ namespace cw
|
|||||||
io::uiSetEnable( app->ioH, io::uiFindElementUuId( app->ioH, kSfResetBtnId ), true );
|
io::uiSetEnable( app->ioH, io::uiFindElementUuId( app->ioH, kSfResetBtnId ), true );
|
||||||
io::uiSetEnable( app->ioH, io::uiFindElementUuId( app->ioH, kSfResetLocNumbId ), true );
|
io::uiSetEnable( app->ioH, io::uiFindElementUuId( app->ioH, kSfResetLocNumbId ), true );
|
||||||
|
|
||||||
io::uiSetNumbRange( app->ioH, io::uiFindElementUuId(app->ioH, kSfResetLocNumbId), app->minLoc, app->maxLoc, 1, 0, app->beg_play_loc );
|
io::uiSetNumbRange( app->ioH, io::uiFindElementUuId(app->ioH, kSfResetLocNumbId), app->minPerfLoc, app->maxPerfLoc, 1, 0, app->beg_play_loc );
|
||||||
io::uiSendValue( app->ioH, io::uiFindElementUuId(app->ioH, kSfResetLocNumbId), app->minLoc);
|
io::uiSendValue( app->ioH, io::uiFindElementUuId(app->ioH, kSfResetLocNumbId), app->minPerfLoc);
|
||||||
|
|
||||||
cwLogInfo("'%s' loaded.",perf_fn);
|
cwLogInfo("'%s' loaded.",perf_fn);
|
||||||
|
|
||||||
|
@ -14,6 +14,8 @@
|
|||||||
#include "cwScoreParse.h"
|
#include "cwScoreParse.h"
|
||||||
#include "cwSfScore.h"
|
#include "cwSfScore.h"
|
||||||
|
|
||||||
|
#define INVALID_LOC 0
|
||||||
|
|
||||||
namespace cw
|
namespace cw
|
||||||
{
|
{
|
||||||
namespace preset_sel
|
namespace preset_sel
|
||||||
@ -872,7 +874,7 @@ cw::rc_t cw::preset_sel::create( handle_t& hRef, const object_t* cfg )
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
// allocate the label array
|
// allocate the alt label array
|
||||||
p->altLabelN = alt_labelL->child_count() + 1;
|
p->altLabelN = alt_labelL->child_count() + 1;
|
||||||
p->altLabelA = mem::allocZ<alt_label_t>(p->altLabelN);
|
p->altLabelA = mem::allocZ<alt_label_t>(p->altLabelN);
|
||||||
|
|
||||||
@ -953,6 +955,25 @@ const char* cw::preset_sel::alt_label( handle_t h, unsigned alt_idx )
|
|||||||
return _alt_index_to_label(p,alt_idx);
|
return _alt_index_to_label(p,alt_idx);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void cw::preset_sel::get_loc_range( handle_t h, unsigned& minLocRef, unsigned& maxLocRef )
|
||||||
|
{
|
||||||
|
preset_sel_t* p = _handleToPtr(h);
|
||||||
|
|
||||||
|
if( p->fragL == nullptr )
|
||||||
|
{
|
||||||
|
minLocRef = INVALID_LOC;
|
||||||
|
maxLocRef = INVALID_LOC;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
minLocRef = 1;
|
||||||
|
|
||||||
|
for(const frag_t* f = p->fragL; f!=nullptr; f=f->link)
|
||||||
|
maxLocRef = f->endLoc;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
unsigned cw::preset_sel::fragment_count( handle_t h )
|
unsigned cw::preset_sel::fragment_count( handle_t h )
|
||||||
{
|
{
|
||||||
preset_sel_t* p = _handleToPtr(h);
|
preset_sel_t* p = _handleToPtr(h);
|
||||||
|
@ -81,6 +81,8 @@ namespace cw
|
|||||||
unsigned alt_count( handle_t h );
|
unsigned alt_count( handle_t h );
|
||||||
const char* alt_label( handle_t h, unsigned alt_idx );
|
const char* alt_label( handle_t h, unsigned alt_idx );
|
||||||
|
|
||||||
|
void get_loc_range( handle_t h, unsigned& minLocRef, unsigned& maxLocRef );
|
||||||
|
|
||||||
unsigned fragment_count( handle_t h );
|
unsigned fragment_count( handle_t h );
|
||||||
const frag_t* get_fragment_base( handle_t h );
|
const frag_t* get_fragment_base( handle_t h );
|
||||||
const frag_t* get_fragment( handle_t h, unsigned fragId );
|
const frag_t* get_fragment( handle_t h, unsigned fragId );
|
||||||
|
Loading…
Reference in New Issue
Block a user