Browse Source

cmDspBuiltIn.c Added useThreadFl to WaveTable DSP Object.

useThreadFl allows the background file loading thread to be enabled and disabled.
master
kpl 11 years ago
parent
commit
d7578b9866
1 changed files with 6 additions and 3 deletions
  1. 6
    3
      dsp/cmDspBuiltIn.c

+ 6
- 3
dsp/cmDspBuiltIn.c View File

@@ -2778,6 +2778,7 @@ typedef struct
2778 2778
   unsigned       onSymId;
2779 2779
   unsigned       offSymId;
2780 2780
   unsigned       doneSymId;
2781
+  bool           useThreadFl;
2781 2782
  } cmDspWaveTable_t;
2782 2783
 
2783 2784
 bool _cmDspWaveTableThreadFunc( void* param);
@@ -2823,6 +2824,8 @@ cmDspInst_t*  _cmDspWaveTableAlloc(cmDspCtx_t* ctx, cmDspClass_t* classPtr, unsi
2823 2824
   cmDspSetDefaultDouble(ctx, &p->inst, kGainWtId,  0,     1.0 );
2824 2825
   cmDspSetDefaultUInt(  ctx, &p->inst, kFIdxWtId,  0,     0 );
2825 2826
 
2827
+  p->useThreadFl = false;
2828
+
2826 2829
   return &p->inst;
2827 2830
 }
2828 2831
 
@@ -3069,10 +3072,10 @@ cmDspRC_t _cmDspWaveTableStartFileLoadThread( cmDspCtx_t* ctx, cmDspWaveTable_t*
3069 3072
   if( p->loadFileFl )
3070 3073
     return cmDspInstErr(ctx,&p->inst,kInvalidStateDspRC,"The audio file '%s' was not loaded because another file is in the process of being loaded.",cmStringNullGuard(fn));  
3071 3074
 
3072
-  if(cmThreadIsValid(p->thH) == false)
3075
+  if(p->useThreadFl && cmThreadIsValid(p->thH) == false)
3073 3076
     cmThreadCreate(&p->thH,_cmDspWaveTableThreadFunc,p,ctx->rpt);
3074 3077
 
3075
-  if( cmThreadIsValid(p->thH) == false )
3078
+  if(p->useThreadFl && cmThreadIsValid(p->thH) == false )
3076 3079
     return cmDspInstErr(ctx,&p->inst,kInvalidStateDspRC,"The audio file '%s' was not loaded because the audio load thread is invalid.",cmStringNullGuard(fn));
3077 3080
 
3078 3081
   p->loadFileFl = true;
@@ -3080,7 +3083,7 @@ cmDspRC_t _cmDspWaveTableStartFileLoadThread( cmDspCtx_t* ctx, cmDspWaveTable_t*
3080 3083
   cmDspSetUInt(ctx,&p->inst,kShapeWtId,kSilenceWtId);
3081 3084
   cmDspSetStrcz(ctx,&p->inst,kFnWtId,fn);
3082 3085
 
3083
-  if(1)
3086
+  if( p->useThreadFl == false )
3084 3087
   {
3085 3088
     // use non-threaded load
3086 3089
     if((rc = _cmDspWaveTableInitAudioFile(p->ctx,p)) != kOkDspRC )

Loading…
Cancel
Save