How to load a sound stored inside another instance of the control |
|
In certain situations your application may have the need to edit more sound files at the same time: this can be easily achieved instancing more than one control on your form. Each instance of the control can load the sound under editing inside a different instance of the same control through a call to the LoadSoundFromEditingSession method.
In other situations there could be the need to edit two or more different sounds separately, then mixing them inside one single instance of the control; just see the following scenario: we have two sound tracks stored on different files and we need to mix them inside one final single track after having applied a volume fade-in/fade-out to the beginning and end of each sound track. For this specific purpose we could proceed as follows
• | Create three instances of the control respectively named EditorTrack1, EditorTrack2 and EditorTrackFinal |
• | Load the first sound file into EditorTrack1 using its LoadSound method |
• | Load the second sound file into EditorTrack2 using its LoadSound method |
• | Apply a fade-in sliding volume to the beginning of the track loaded inside EditorTrack1 using the Effects.VolumeSlidingApply method |
• | Apply a fade-out sliding volume to the end of the track loaded inside EditorTrack1 using the Effects.VolumeSlidingApply method (note that you could also apply the fade-in/fade-out sliding volume by creating a volume automation procedure) |
• | Apply a fade-in sliding volume to the beginning of the track loaded inside EditorTrack2 using the Effects.VolumeSlidingApply method |
• | Apply a fade-out sliding volume to the end of the track loaded inside EditorTrack2 using the Effects.VolumeSlidingApply method (also in this case you could apply the fade-in/fade-out sliding volume by creating a volume automation procedure) |
• | Predispose the EditorTrackFinal instance to load the first edited track by calling the SetLoadingMode method with parameter LOAD_MODE_NEW |
• | Load the first edited track into the EditorTrackFinal instance calling the LoadSoundFromEditingSession method passing the Handle property of the EditorTrack1 instance. |
• | Choose the position, inside the sound loaded into the EditorTrackFinal instance, where the track still loaded inside EditorTrack2 will have to be mixed then fix this position by calling the SetMixingPos method |
• | Predispose the EditorTrackFinal instance to load the other track in mixing mode by calling the SetLoadingMode method with parameter LOAD_MODE_MIX |
• | Load the second edited track into the EditorTrackFinal instance calling again the LoadSoundFromEditingSession method passing the Handle property of the EditorTrack2 instance: in this case the new loaded sound will not replace the existing one but will be mixed at the position previously set through the SetMixingPos method |
This is a very simple scenario but, as you may understand, you could imagine a lot of different scenarios where you could insert a sound track at a given position or overwrite a range of the existing sound track at a given position.