This project is read-only.
The following Code demonstrates how to build a source chain:
public IWaveSource BuildASourceChain()
    IWaveSource fileSource = CodecFactory.Instance.GetCodec(@"C:\Temp\test.mp3");

    VolumeSource volumeSource = new VolumeSource(fileSource);
    PanSource panSource = new PanSource(volumeSource);

    IWaveSource panWaveSource = panSource.ToWaveSource();

    DmoEchoEffect echoEffect = new DmoEchoEffect(panWaveSource);

    volumeSource.Volume = 0.5f; //50% volume
    echoEffect.LeftDelay = 500; //500 ms
    echoEffect.RightDelay = 250; //250 ms

    return echoEffect;

You can connect multiple components with each other. If you would play the returned IWaveSource of the BuildASourceChain-method, all included components would be affected. As a result, the volume of the playback would be 50% and you would hear an echo effect.
If you dispose the echoEffect, all other connected components will be disposed automatically. If you dispose the volumeSource, the volumeSource and the fileSource will be disposed (but not the panSource and the echoEffect).
If you read from the echoEffect, the components would be included in the following way (simplified):

  1. The Read-method of the echoEffect gets called
  2. The echoEffect calls the Read-method of the panWaveSource
  3. The panWaveSource calls the Read-method of the panSource
  4. The panSource calls the Read-method of the volumeSource
  5. The volumeSource calls the Read-method of the fileSource
  6. The fileSource returns the number of read bytes
  7. The volumeSource reduces the volume to 50% and returns the number of processed samples (because it is a ISampleSource – see “Create a wave source”)
  8. The panSource changes the balance (in this case, no balance is set) and returns the number of processed samples
  9. The panWaveSource converts the read samples into raw bytes and returns the number of bytes
  10. The echoEffect applies an echo effect and returns the number of processed bytes

Last edited Apr 19, 2014 at 12:29 PM by filoe, version 2


No comments yet.