Adding Multiple Audio Tracks

Topics: Developer Forum, User Forum
Sep 7, 2010 at 6:56 PM

Hi all,

 

I'm trying to create a video that contains more that one audio file that plays from the start. I have used the follwing and the video and the first audio clip are fine. The video plays and the first sounds goes with the video until it stops, the next sound then begins to play. I would like both sounds to play at the same time any ideas?

 

 

 

public partial class Window1 : Window 

{

 

string outputFile = "c:\\Documents and Settings\\mphogue\\Desktop\\test.wmv";

 

ITimeline time = new DefaultTimeline();

 

 

public Window1()

{

InitializeComponent();

}

 

private void test()

{

 

IGroup vgroup = time.AddVideoGroup(32, 1280, 1024);

 

ITrack videoTrack = vgroup.AddTrack();

 

IClip clip1 = videoTrack.AddVideo("c:\\Documents and Settings\\mphogue\\Desktop\\video.avi");

 

ITrack audioTrack = time.AddAudioGroup().AddTrack();

 

 

audioTrack.AddAudio("C:\\Documents and Settings\\mphogue\\Desktop\\sound.avi", 0, videoTrack.Duration);

audioTrack.AddAudio("C:\\Documents and Settings\\mphogue\\Desktop\\DaDa_CMP.avi", 0, 0, videoTrack.Duration);

render();

}

 private voidrender()

{

IRenderer rend = new WindowsMediaRenderer(time, outputFile,WindowsMediaProfiles.HighQualityVideo);

rend.Render();

}

 

private void button1_Click(object sender, RoutedEventArgs e)

{

test();

}

}

Sep 8, 2010 at 8:20 PM

You need to add each audio file on a separate track for them to play at the same time, otherwise they'll play sequentially as they are on the same track.