@dbeachy1, can you produce an "How-to" about playing mp3 from MFD with XRsound2 Beta please? I haven't found anything in documentation
Check out the XRSound
CreateIntance methods in
Orbitersdk\XRSound\xrsound.h. The first one is unchanged from XRSound version 1, but the second one is new, and allows you to create an instance of XRSound identified by an arbitrary (but unique within a given Orbiter scenario!) module name rather than an Orbiter vessel instance:
// Create an instance of an XRSound proxy object for the named *module*; invoke this from your module's clbkSimulationStart method.
// pUniqueModuleName: arbitrary name uniquely identifying the calling module; typically, this should match the filename of your Orbiter module DLL, excluding the ".dll" extension.
// Returns: instance of XRSound proxy to use with the specified pUniqueModuleName.
// NOTE: do not forget to delete the returned proxy object when you no longer need it (e.g., in your module's clbkSimulationEnd method).
static XRSound *CreateInstance(const char *pUniqueModuleName);
Since XRSound uses the
pUniqueModuleName value to uniquely identify which Orbiter module is calling it, it is best to pass the name of your Orbiter module's DLL here; e.g., if your custom MP3 Orbiter module is installed as
MyCoolMp3Player.dll, it's best to pass "MyCoolMp3Player" as the
pUniqueModuleName here. As I said, module names are arbitrary, but they must be unique within a given Orbiter installation.
Once you have your XRSound instance from that call, all the other API calls are the same as in XRSound version 1; i.e., you can call
LoadWav,
PlayWav,
StopWav, etc. from your module as you wish.
I keep meaning to release XRSound 2.0, since the 2.0 beta has been around for over a year now. :lol: There have been no code changes since beta 3, so I'll see if I can get version 2.0 released in the near future.
As a side note, XRSound 2.0 is backwards-compatible with XRSound 1.0-enabled vessels as well; i.e., you can use XRSound 1.0 vessels with XRSound 2.0 installed in your Orbiter instance, and everything should work.
Please let me know if you find any bugs when using XRSound from a module (i.e., a non-vessel). :thumbup:
EDIT:
Actually not just MP3 format, but FLAC, Windows stuff and a bunch of other formats should be included as well. My music library is primarily FLAC.
BTW the sound engine that XRSound uses,
irrKlang Pro 1.6,
supports these sound file formats:
- RIFF WAVE (*.wav)
- Ogg Vorbis (*.ogg)
- MPEG-1 Audio Layer 3 (*.mp3)
- Free Lossless Audio Codec (*.flac)
- Amiga Modules (*.mod)
- Impulse Tracker (*.it)
- Scream Tracker 3 (*.s3d)
- Fast Tracker 2 (*.xm)
irrKlang also supports third-party plugins to support additional sound formats as well.