cwWaveTableBank.h/cpp : Fixed memory leak and added loadThreadCnt arg. to create().
This commit is contained in:
parent
b19671dbdc
commit
e6524ea945
@ -167,20 +167,21 @@ namespace cw
|
|||||||
|
|
||||||
for(unsigned i=0; i<p->instrN; ++i )
|
for(unsigned i=0; i<p->instrN; ++i )
|
||||||
_destroy_instr(p->instrA[i]);
|
_destroy_instr(p->instrA[i]);
|
||||||
|
|
||||||
|
mem::release(p->instrA);
|
||||||
mem::release(p);
|
mem::release(p);
|
||||||
return rc;
|
return rc;
|
||||||
}
|
}
|
||||||
|
|
||||||
unsigned _alloc_wt( const wt_bank_t* p,
|
unsigned _alloc_wt( const wt_bank_t* p,
|
||||||
wt_t* wt,
|
wt_t* wt,
|
||||||
wt_tid_t tid,
|
wt_tid_t tid,
|
||||||
srate_t srate,
|
srate_t srate,
|
||||||
const sample_t* aV,
|
const sample_t* aV,
|
||||||
unsigned posn_smp_idx,
|
unsigned posn_smp_idx,
|
||||||
unsigned aN,
|
unsigned aN,
|
||||||
double hz,
|
double hz,
|
||||||
double rms)
|
double rms)
|
||||||
{
|
{
|
||||||
wt->tid = tid;
|
wt->tid = tid;
|
||||||
wt->aN = aN;
|
wt->aN = aN;
|
||||||
@ -396,7 +397,7 @@ namespace cw
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
cw::rc_t cw::wt_bank::create( handle_t& hRef, unsigned padSmpN, const char* instr_json_fname )
|
cw::rc_t cw::wt_bank::create( handle_t& hRef, unsigned padSmpN, const char* instr_json_fname, unsigned loadThreadCnt )
|
||||||
{
|
{
|
||||||
rc_t rc = kOkRC;
|
rc_t rc = kOkRC;
|
||||||
|
|
||||||
@ -409,7 +410,7 @@ cw::rc_t cw::wt_bank::create( handle_t& hRef, unsigned padSmpN, const char* inst
|
|||||||
hRef.set(p);
|
hRef.set(p);
|
||||||
|
|
||||||
if( instr_json_fname != nullptr )
|
if( instr_json_fname != nullptr )
|
||||||
if((rc = load(hRef,instr_json_fname)) != kOkRC )
|
if((rc = load(hRef,instr_json_fname,loadThreadCnt)) != kOkRC )
|
||||||
{
|
{
|
||||||
hRef.clear();
|
hRef.clear();
|
||||||
}
|
}
|
||||||
@ -536,6 +537,7 @@ errLabel:
|
|||||||
|
|
||||||
//_audio_buf_free(abuf);
|
//_audio_buf_free(abuf);
|
||||||
|
|
||||||
|
mem::release(argsA);
|
||||||
mem::release(taskA);
|
mem::release(taskA);
|
||||||
destroy(threadTasksH);
|
destroy(threadTasksH);
|
||||||
|
|
||||||
|
@ -19,7 +19,7 @@ namespace cw
|
|||||||
typedef struct dsp::multi_ch_wt_seq_osc::multi_ch_wt_seq_str<sample_t,srate_t> multi_ch_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 create( handle_t& hRef, unsigned padSmpN, const char* instr_json_fname=nullptr, unsigned loadThreadCnt=16 );
|
||||||
rc_t destroy( handle_t& hRef );
|
rc_t destroy( handle_t& hRef );
|
||||||
|
|
||||||
void report( handle_t h );
|
void report( handle_t h );
|
||||||
|
Loading…
Reference in New Issue
Block a user