You can specify a path to an external audio file with "external_audio" property. You can do it for MFile or MFReader object the moment you open a source:
myFile.FileNameSet(pathToMyFile, "external_audio=c:\MP3_audio.mp3"); // MPlatform SDK
myReader.ReaderOpen(pathToMyFile, "external_audio=c:\MP3_audio.mp3"); // MFormats SDK
Or you can specify it with the PropsSet method:
(myFile as IMProps).PropsSet("file::external_audio", "c:\MP3_audio.mp3"); // MPlatform SDK
(myReader as IMProps).PropsSet("external_audio", "c:\MP3_audio.mp3"); // MFormats SDK
Also, you can specify an offset position for the external audio file to start its playback from the desired position with "external_audio_offset" property with the same way:
(myFile as IMProps).PropsSet("file::external_audio_offset", "15.0"); // to start playback from 15th second
And you can specify an audio track for the external audio file with "external_audio_track" property:
(myFile as IMProps).PropsSet("external_audio_track", "1"); // to set the 2nd audio track to be used
You can use multiple audio files as external audio tracks for a given video file:
(myFile as IMProps).PropsSet("file::external_audio", "c:\FirstTrack.mp3"); // MPlatform SDK
(myFile as IMProps).PropsSet("file::external_audio.1", "c:\SecondTrack.mp3"); // MPlatform SDK
(myFile as IMProps).PropsSet("file::external_audio.2", "c:\ThirdTrack.wav"); // MPlatform SDK
myReader.PropsSet("external_audio", "first.mp3"); // MFormats SDK
myReader.PropsSet("external_audio.1", "second.mp3"); // MFormats SDK
myReader.PropsSet("external_audio.2", "third.mp3"); // MFormats SDK
Note that all properties (except external_audio_offset and external_audio_track) for external audio objects are always set by default. For example, you can't specify mxf.index_path for external .mxf audio files.
How to disable original audio
Just specify "audio_track" property of your source object to "-1":
(myFile as IMProps).PropsSet("file::audio_track", "-1"); // to mute the original audio
External image for audio files
If you use an audio file as a source and you need to use some cover image during its playback you should specify "img_stub" property. You can use an HEX-code of a color or a path to an image as a value for this property:
(myFile as IMProps).PropsSet("file::img_stub", "c:\myTestBG.png");
Usage for MPlaylist and MMixer objects
For MPlaylist items or MMixer streams, the approach is the same. For example:
(myItem as IMProps).PropsSet("file::external_audio", "c:\MP3_audio.mp3");