cwWaveTableBank.h/cpp : Removed dead code. Added instr_pitch_velocities().

Implemented get_wave_table().
This commit is contained in:
kevin 2024-07-31 17:15:10 -04:00
parent 9260db5b56
commit 3de88dfc32
2 changed files with 198 additions and 1228 deletions

File diff suppressed because it is too large Load Diff

View File

@ -1,72 +1,6 @@
#ifndef cwWaveTableBank_h
#define cwWaveTableBank_h
#ifdef NOT_DEF
namespace cw
{
namespace wt_bank
{
typedef handle<struct wt_bank_str> handle_t;
typedef dsp::sample_t sample_t;
typedef dsp::srate_t srate_t;
typedef enum {
kAttackTId,
kLoopTId,
kInvalidTId
} seg_tid_t;
typedef struct seg_str
{
seg_tid_t tid;
double cost;
unsigned cyc_per_loop; // count of cycles in the loop
sample_t* aV; // aV[ padN + aN + padN ]
unsigned aN; // Count of unique samples
unsigned padN; // Count of pre/post repeat samples
} seg_t;
typedef struct ch_str
{
unsigned ch_idx;
unsigned segN;
seg_t* segA; // segV[ segN ]
} ch_t;
typedef struct wt_str
{
unsigned instr_id;
srate_t srate;
unsigned pitch;
unsigned vel;
unsigned chN;
ch_t* chA; // chA[ chN ]
} wt_t;
rc_t create( handle_t& hRef, const char* dir, unsigned padN );
rc_t destroy( handle_t& hRef );
void report( handle_t h );
unsigned instr_count( handle_t h );
unsigned instr_index( handle_t h, const char* instr_label );
const wt_t* get_wave_table( handle_t h, unsigned instr_idx, unsigned pitch, unsigned vel );
rc_t gen_notes( handle_t h, unsigned instr_idx, const unsigned* pitchA, const unsigned* velA, unsigned noteN, double dur_secs, const char* out_fname, double inter_note_gap_secs=0.1 );
rc_t test( const test::test_args_t& args );
}
}
#endif
namespace cw
{
@ -74,31 +8,16 @@ namespace cw
{
typedef handle<struct wt_bank_str> handle_t;
typedef dsp::sample_t sample_t;
typedef dsp::srate_t srate_t;
typedef struct wt_str
{
unsigned cyc_per_loop; // count of cycles in the loop
sample_t* aV; // aV[ padN + aN + padN ]
unsigned aN; // Count of unique samples
double rms;
double hz;
} wt_t;
typedef struct wt_seq_str
{
wt_t* wtA;
unsigned wtN;
} wt_seq_t;
typedef struct multi_ch_wt_seq_str
{
unsigned chN;
wt_seq_t* chA;
} multi_ch_wt_seq_t;
typedef dsp::sample_t sample_t;
typedef dsp::srate_t srate_t;
rc_t create( handle_t& hRef, unsigned padSmpN );
typedef dsp::wt_osc::wt_tid_t wt_tid_t;
typedef struct dsp::wt_osc::wt_str<sample_t,srate_t> wt_t;
typedef struct dsp::wt_seq_osc::wt_seq_str<sample_t,srate_t> wt_seq_t;
typedef struct dsp::multi_ch_wt_seq_osc::multi_ch_wt_seq_str<sample_t,srate_t> multi_ch_wt_seq_t;
rc_t create( handle_t& hRef, unsigned padSmpN, const char* instr_json_fname=nullptr );
rc_t destroy( handle_t& hRef );
void report( handle_t h );
@ -108,11 +27,12 @@ namespace cw
unsigned instr_count( handle_t h );
unsigned instr_index( handle_t h, const char* instr_label );
const wt_t* get_wave_table( handle_t h, unsigned instr_idx, unsigned pitch, unsigned vel );
rc_t gen_notes( handle_t h, unsigned instr_idx, const unsigned* pitchA, const unsigned* velA, unsigned noteN, double dur_secs, const char* out_fname, double inter_note_gap_secs=0.1 );
// Return the actual measured velocities, not the interpolated velocities, for a given instr/pitch.
rc_t instr_pitch_velocities( handle_t h, unsigned instr_idx, unsigned pitch, unsigned* velA, unsigned velCnt, unsigned& velCnt_Ref );
rc_t get_wave_table( handle_t h, unsigned instr_idx, unsigned pitch, unsigned vel, multi_ch_wt_seq_t const* & mcs_Ref );
rc_t test( const test::test_args_t& args );
}