How to mixing audio tracks?
|
How to mixing audio tracks |
Assuming you drag the Movie Maker Timeline Control on form and add three button on form. Change the text of button1 to "Add Video", Change the text of button2 to "Add Audio Track2", Change the text of button3 to "Play".
Add following code in Button1 click event.
private void button1_Click(object sender, EventArgs e) axTimelineControl1.SetScale((float)0.1); string strVideo1 = "C:\\yourfolder\\yourvideo1.mpg"; float iVideo1Duration = axTimelineControl1.GetMediaDuration(strVideo1); axTimelineControl1.AddVideoClip(axTimelineControl1.GetVideo1TrackIndex(), strVideo1, 0, iVideo1Duration, 0); axTimelineControl1.AddAudioClip(axTimelineControl1.GetAudio1TrackIndex(), strVideo1, 0, iVideo1Duration, 0, 1); } |
Add following code in Button2 click event. it will set the audio track 2 to visible. set the effect, transition, text, image track to invisible. Assume the duration of video 1 is 30 second. so the duration of strAudio2 same as strVideo1. Increase the volume of strAudio2 to 200%.
private void button2_Click(object sender, EventArgs e) axTimelineControl1.SetTrackVisible(axTimelineControl1.GetAudio2TrackIndex(), 1); axTimelineControl1.SetTrackVisible(axTimelineControl1.GetEffectTrackIndex(), 0); axTimelineControl1.SetTrackVisible(axTimelineControl1.GetTransitionTrackIndex(), 0); axTimelineControl1.SetTrackVisible(axTimelineControl1.GetTextTrackIndex(), 0); axTimelineControl1.SetTrackVisible(axTimelineControl1.GetImageTrackIndex(), 0); string strAudio2 = "C:\\yourfolder\\youraudio.mp3"; axTimelineControl1.AddAudioClip(axTimelineControl1.GetAudio2TrackIndex(), strAudio2, 0, 30, 0,(float)2.0); } |
Add following code in Button3 click event.