title: Add effects to audio and save the new audio using FMOD in iPhone
body: <p>I am adding effects in audio file using FMOD and saving the audio with effects to the documents directory. The problem i am facing is, if the audio has stopped, FMOD keeps on writing data to the file. What should i use to stop FMOD writing data if the audio has finished ?
  Below is my code... </p>
  
  <pre><code>- (void)startFMODToAddEffects
  {
  FMOD_RESULT result = FMOD_OK;
  
  unsigned int  version       = 0;
  
  /*
   Create a System object and initialize
   */
  result = FMOD::System_Create(&amp;system);
  ERRCHECK(result);
  
  result = system-&gt;getVersion(&amp;version);
  ERRCHECK(result);
  
  if (version &lt; FMOD_VERSION)
  {
      fprintf(stderr, "You are using an old version of FMOD %08x.  This program requires %08x\n", version, FMOD_VERSION);
      exit(-1);
  }
  
  char buffer[200] = {0};
  NSString *tFileName=[NSString stringWithFormat:@"%@/Part2.m4a", [NSSearchPathForDirectoriesInDomains(NSDocumentDirectory, NSUserDomainMask, YES) objectAtIndex:0]];
  [tFileName getCString:buffer maxLength:200 encoding:NSASCIIStringEncoding];
  
  char cDest[200] = {0};
  NSString *fileName=[NSString stringWithFormat:@"%@/Part2WithEffect.wav", [NSSearchPathForDirectoriesInDomains(NSDocumentDirectory, NSUserDomainMask, YES) objectAtIndex:0]];
  [fileName getCString:cDest maxLength:200 encoding:NSASCIIStringEncoding];
  
  result = system-&gt;setOutput(FMOD_OUTPUTTYPE_WAVWRITER);
  ERRCHECK(result);
  
  result = system-&gt;init(32, FMOD_INIT_NORMAL | FMOD_INIT_ENABLE_PROFILE, cDest);
  ERRCHECK(result);
  
  result = system-&gt;createStream(buffer, FMOD_SOFTWARE, NULL, &amp;sound);
  ERRCHECK(result);
  
  result = system-&gt;playSound(FMOD_CHANNEL_FREE, sound, false, &amp;channel);
  ERRCHECK(result);
  
  result = system-&gt;createDSPByType(FMOD_DSP_TYPE_LOWPASS, &amp;dsplowpass);
  ERRCHECK(result);
  
  result = system-&gt;addDSP(dsplowpass, NULL);
  ERRCHECK(result);
  }
  </code></pre>