2021-11-06 02:26:55 +00:00
|
|
|
#ifndef cwPresetSel_h
|
|
|
|
#define cwPresetSel_h
|
|
|
|
|
|
|
|
|
|
|
|
namespace cw
|
|
|
|
{
|
|
|
|
namespace preset_sel
|
|
|
|
{
|
|
|
|
typedef handle< struct preset_sel_str > handle_t;
|
|
|
|
|
|
|
|
typedef struct preset_str
|
|
|
|
{
|
|
|
|
bool playFl; // play this preset
|
2022-05-21 15:22:22 +00:00
|
|
|
bool seqFl; // play this preset during sequencing.
|
2021-11-06 02:26:55 +00:00
|
|
|
unsigned preset_idx; // preset index into preset_labelA[].
|
2021-12-12 21:46:12 +00:00
|
|
|
unsigned order; //
|
2021-11-06 02:26:55 +00:00
|
|
|
} preset_t;
|
|
|
|
|
|
|
|
typedef struct frag_str
|
|
|
|
{
|
2021-12-26 03:17:10 +00:00
|
|
|
unsigned fragId; // Unique fragment id
|
|
|
|
unsigned guiUuId; // GUI UUId associated with this fragment
|
2021-12-12 21:46:12 +00:00
|
|
|
unsigned endLoc; // The endLoc is included in this fragment. The begin loc is f->prev->endLoc+1
|
|
|
|
time::spec_t endTimestamp;
|
2021-11-06 02:26:55 +00:00
|
|
|
|
2021-12-28 01:29:37 +00:00
|
|
|
double igain;
|
|
|
|
double ogain;
|
2021-11-06 02:26:55 +00:00
|
|
|
double wetDryGain;
|
|
|
|
double fadeOutMs;
|
2021-12-28 01:29:37 +00:00
|
|
|
unsigned begPlayLoc;
|
|
|
|
unsigned endPlayLoc;
|
|
|
|
char* note;
|
2021-11-06 02:26:55 +00:00
|
|
|
|
|
|
|
preset_t* presetA;
|
|
|
|
unsigned presetN;
|
2021-11-14 17:00:17 +00:00
|
|
|
|
|
|
|
bool uiSelectFl;
|
2022-05-21 15:22:22 +00:00
|
|
|
bool seqAllFl; // Set if all preset.seqFl's should be treated as though they are set to true.
|
2021-11-14 17:00:17 +00:00
|
|
|
|
2021-11-06 02:26:55 +00:00
|
|
|
struct frag_str* link;
|
2021-12-12 21:46:12 +00:00
|
|
|
struct frag_str* prev;
|
2021-11-06 02:26:55 +00:00
|
|
|
} frag_t;
|
|
|
|
|
|
|
|
|
|
|
|
enum {
|
2021-12-26 03:17:10 +00:00
|
|
|
kGuiUuIdVarId,
|
|
|
|
kBegLocVarId,
|
2021-11-06 02:26:55 +00:00
|
|
|
kEndLocVarId,
|
2021-12-28 01:29:37 +00:00
|
|
|
kInGainVarId,
|
|
|
|
kOutGainVarId,
|
2021-11-06 02:26:55 +00:00
|
|
|
kFadeOutMsVarId,
|
|
|
|
kWetGainVarId,
|
2021-12-28 01:29:37 +00:00
|
|
|
kBegPlayLocVarId,
|
|
|
|
kEndPlayLocVarId,
|
|
|
|
kPlayBtnVarId,
|
2022-05-21 15:22:22 +00:00
|
|
|
kPlaySeqBtnVarId,
|
|
|
|
kPlaySeqAllBtnVarId,
|
2021-12-28 01:29:37 +00:00
|
|
|
kNoteVarId,
|
2021-11-06 02:26:55 +00:00
|
|
|
|
2022-05-21 15:22:22 +00:00
|
|
|
kPresetOrderVarId, // preset order value
|
|
|
|
kPresetSelectVarId, // select a preset to play
|
|
|
|
kPresetSeqSelectVarId, // sequence preset selections to play
|
|
|
|
kPlayEnableVarId, // include in the segment to play
|
|
|
|
kDryFlVarId, // play this fragment dry
|
2022-01-03 01:24:58 +00:00
|
|
|
|
|
|
|
|
|
|
|
kBaseMasterVarId, // All 'master' variables have id's greater than kBaseMasterVarId
|
|
|
|
kMasterWetInGainVarId,
|
|
|
|
kMasterWetOutGainVarId,
|
|
|
|
kMasterDryGainVarId,
|
|
|
|
kMasterSyncDelayMsVarId
|
2021-11-06 02:26:55 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
rc_t create( handle_t& hRef, const object_t* cfg );
|
|
|
|
rc_t destroy( handle_t& hRef );
|
|
|
|
|
|
|
|
unsigned preset_count( handle_t h );
|
|
|
|
const char* preset_label( handle_t h, unsigned preset_idx );
|
|
|
|
|
2021-12-12 21:46:12 +00:00
|
|
|
unsigned fragment_count( handle_t h );
|
2021-11-06 02:26:55 +00:00
|
|
|
const frag_t* get_fragment_base( handle_t h );
|
2021-12-12 21:46:12 +00:00
|
|
|
const frag_t* get_fragment( handle_t h, unsigned fragId );
|
2021-12-26 03:17:10 +00:00
|
|
|
const frag_t* gui_id_to_fragment(handle_t h, unsigned guiUuId );
|
2021-12-30 02:45:19 +00:00
|
|
|
|
|
|
|
unsigned frag_to_gui_id( handle_t h, unsigned fragId, bool showErrorFl=true );
|
|
|
|
unsigned gui_to_frag_id( handle_t h, unsigned guiUuId, bool showErrorFl=true );
|
2021-11-14 17:00:17 +00:00
|
|
|
|
2021-12-26 03:17:10 +00:00
|
|
|
rc_t create_fragment( handle_t h, unsigned end_loc, time::spec_t endTimestamp, unsigned& fragIdRef );
|
2021-11-06 02:26:55 +00:00
|
|
|
rc_t delete_fragment( handle_t h, unsigned fragId );
|
|
|
|
|
2022-12-12 17:26:26 +00:00
|
|
|
bool is_fragment_end_loc( handle_t h, unsigned loc );
|
2022-01-22 14:43:52 +00:00
|
|
|
|
|
|
|
// Return the fragment id of the 'selected' fragment.
|
2021-11-14 17:00:17 +00:00
|
|
|
unsigned ui_select_fragment_id( handle_t h );
|
2022-01-22 14:43:52 +00:00
|
|
|
|
|
|
|
// Set the 'select_flag' on this fragment and remove it from all others.
|
2021-12-12 21:46:12 +00:00
|
|
|
void ui_select_fragment( handle_t h, unsigned fragId, bool selectFl );
|
2021-11-14 17:00:17 +00:00
|
|
|
|
|
|
|
|
2021-11-06 02:26:55 +00:00
|
|
|
rc_t set_value( handle_t h, unsigned fragId, unsigned varId, unsigned presetId, bool value );
|
|
|
|
rc_t set_value( handle_t h, unsigned fragId, unsigned varId, unsigned presetId, unsigned value );
|
|
|
|
rc_t set_value( handle_t h, unsigned fragId, unsigned varId, unsigned presetId, double value );
|
2021-12-28 01:29:37 +00:00
|
|
|
rc_t set_value( handle_t h, unsigned fragId, unsigned varId, unsigned presetId, const char* value );
|
2021-11-06 02:26:55 +00:00
|
|
|
|
2021-12-28 01:29:37 +00:00
|
|
|
rc_t get_value( handle_t h, unsigned fragId, unsigned varId, unsigned presetId, bool& valueRef );
|
|
|
|
rc_t get_value( handle_t h, unsigned fragId, unsigned varId, unsigned presetId, unsigned& valueRef );
|
|
|
|
rc_t get_value( handle_t h, unsigned fragId, unsigned varId, unsigned presetId, double& valueRef );
|
|
|
|
rc_t get_value( handle_t h, unsigned fragId, unsigned varId, unsigned presetId, const char*& valueRef );
|
2021-12-12 21:46:12 +00:00
|
|
|
|
|
|
|
// Call this function to determine which fragment the timestamp 'ts' is contained by.
|
2021-12-28 01:29:37 +00:00
|
|
|
// This function is optimized to be called in time sensitive functions where 'ts' is expected to be increasing.
|
2021-12-12 21:46:12 +00:00
|
|
|
// If 'ts' is past the last defined fragment then the last fragment is returned.
|
|
|
|
// If no fragments are defined 'frag_Ref' is set to nullptr.
|
|
|
|
// The return value is true when the value of frag_Ref changes from the previous call.
|
2022-05-06 20:06:24 +00:00
|
|
|
void track_timestamp_reset( handle_t h );
|
2021-12-12 21:46:12 +00:00
|
|
|
bool track_timestamp( handle_t h, const time::spec_t& ts, const cw::preset_sel::frag_t*& frag_Ref );
|
|
|
|
|
2022-10-15 13:24:53 +00:00
|
|
|
// Same as track_timestamp_???() but tracks the score 'loc' instead of timestamp.
|
2022-10-01 22:52:12 +00:00
|
|
|
void track_loc_reset( handle_t h );
|
|
|
|
bool track_loc( handle_t h, unsigned loc, const cw::preset_sel::frag_t*& frag_Ref );
|
|
|
|
|
2021-12-12 21:46:12 +00:00
|
|
|
// Return the preset index marked to play on this fragment.
|
2023-01-21 16:49:07 +00:00
|
|
|
unsigned fragment_play_preset_index( handle_t h, const frag_t* frag, unsigned preset_seq_idx=kInvalidIdx );
|
2022-05-21 15:22:22 +00:00
|
|
|
|
|
|
|
// Return the count of presets whose 'seqFl' is set.
|
|
|
|
unsigned fragment_seq_count( handle_t h, unsigned fragId );
|
2021-11-06 02:26:55 +00:00
|
|
|
|
|
|
|
rc_t write( handle_t h, const char* fn );
|
|
|
|
rc_t read( handle_t h, const char* fn );
|
2021-12-12 21:46:12 +00:00
|
|
|
rc_t report( handle_t h );
|
2023-09-13 00:28:29 +00:00
|
|
|
|
|
|
|
rc_t translate_frags( const object_t* obj );
|
2021-11-06 02:26:55 +00:00
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
#endif
|