Copyright © 2005-2019 MultiMedia Soft

LoadSound method

Previous pageReturn to chapter overviewNext page

Remarks

 

Loads a song from the specified file. The song file can be a stream, a MOD music file or a CD audio track. If the file is in RAW format use the LoadSoundFromRawFile method.

 

Accepted stream formats are: MP1, MP2, MP3, MP4 (***), AIFF, AAC, M4A, AC3, FLAC, WavPack, ALAC, WAV, OGG Vorbis, WMA (*),  ASF (**), WMV (**), W64, AU, PAF, SVX, NIST, VOC, IRCAM, PVF, CAF, Speex, Musepack, Monkey's Audio (APE), OPUS.

 

Formats wrapped inside a RIFF container (for example GSM 6.10, ADPCM, CCITT, etc. ) are supported if the specific ACM (Audio Compression Manager) codec is installed inside the system.

 

Multi-channel WAV, AIFF, OGG Vorbis and WMA formats are accepted if the output sound card supports speakers assignment and have WDM drivers installed: it's important to note that multi-channel sound files won't allow changing Tempo, Pitch and Playback rate and won't support DMO or EAX effects..

 

Accepted MOD formats are: MOD, MTM, S3M, XM, IT and MO3

Accepted CD audio tracks format is CDA; CD tracks can be loaded with the LoadTrackFromCD method also.

 

Other formats not supported natively may be loaded through DirectShow: for formats not supported natively you can enable the automatic usage of DirectShow on a specific player by invoking the DirectShowAutoLoadEnable method with parameter "true". After a sound or video file has been loaded, you may eventually verify if its rendering is performed through DirectShow by invoking the IsDirectShowLoadedFile method.

 

A successful call to this method invokes the CallbackForPlayersEvents delegate with the nEvent parameter set to EV_SOUND_LOADED.

 

 

Syntax

 

[Visual Basic]

Public Function LoadSound (

nPlayerIndex as Int16,

strFileName as String

) as enumErrorCodes


 

[C#]

public enumErrorCodes LoadSound (

Int16 nPlayerIndex,

string strFileName

);


 

[C++]

public: enumErrorCodes LoadSound (

Int16 nPlayerIndex,

string strFileName

);


 

 

 

Parameter

Description

 

 

nPlayerIndex

Number representing the zero-based index of the player that will load the sound

strFilename

String containing the name of the song file to load. It can be a full path name (ex. c:\mysounds\sound.mp3) or a filename (ex: sound.mp3) if the SoundsDirectory property has already been specified.

 

 

Return value

 

Value

Meaning

 

 

enumErrorCodes.NOERROR (0)

The song file has been loaded successfully.

Negative value

An error occurred: see the LastError property for further error details or for a list of the possible error values.

 

(*) Requires Microsoft Windows Media Format modules already installed on the target PC: you can verify the presence of these modules through a call to the IsWmaAvailable method.

(**) Performs sound tracks only (no video): requires Microsoft Windows Media Format modules already installed on the target PC

(***) Performs sound tracks only (no video)

The Windows Media Format modules can be installed using the redistribution setup package (wmfdist.exe) provided by Microsoft. Details about the integration of these modules inside your own setup package can be found on the following link of the official Microsoft web site (note that in the future this link could change due to the Microsoft site maintenance).