using System; using System.Runtime.InteropServices; enum EMusicAffiliation {Menu, Action, NoAction, Win, Lose, Credits}; class SoundEngine //Version: 19.3.2007 { /*NOTE: * (for detail information see "SoundEngine.rtf") * * MusicAffiliation-values: * 0 = Menu * 1 = Action * 2 = NoAction * 3 = Win * 4 = Lose * 5 = Credits * n>5 = (free) * * Volume-Datawidth: * 0..100 * * Balance-Datawidth: * -100..100 * * ChannelCount: * min: 2 * def: 16 * * SetNoiseParams(...) function return value: * 0 means ok * -1 means error while assigning volume * -2 means error while assigning balance * -3 means parameter "ChannelID" was out of bounds * */ //#############################custom functions##################################### [DllImport("SoundEngine.dll")] public static extern void DestroyEngine(); [DllImport("SoundEngine.dll")] public static extern string GetDeviceInfo(); [DllImport("SoundEngine.dll")] public static extern string GetVersion(); [DllImport("SoundEngine.dll")] public static extern void ShowVersionDialog(); [DllImport("SoundEngine.dll")] public static extern void SetTotalVolume(int Volume); [DllImport("SoundEngine.dll")] public static extern int GetTotalVolume(); [DllImport("SoundEngine.dll")] public static extern void SetChannelCount(int Count); [DllImport("SoundEngine.dll")] public static extern int GetChannelCount(); [DllImport("SoundEngine.dll")] public static extern void StopAll(); [DllImport("SoundEngine.dll")] public static extern void FadeOutAll(int FadeSeconds); //#############################noise functions##################################### [DllImport("SoundEngine.dll")] public static extern int PreloadNoise(string FileName); [DllImport("SoundEngine.dll")] public static extern int PlayNoise(int PreloadID, bool Loop, ref uint SoundPlayID); [DllImport("SoundEngine.dll")] public static extern int SetNoiseParams(uint SoundPlayID, int Volume, int Balance); [DllImport("SoundEngine.dll")] public static extern int SetNoiseParamsEx(uint SoundPlayID, int Distance, int Angle); [DllImport("SoundEngine.dll")] public static extern void SetMaxDistance(int Distance); [DllImport("SoundEngine.dll")] public static extern int GetMaxDistance(); [DllImport("SoundEngine.dll")] public static extern void StopNoise(uint SoundPlayID); [DllImport("SoundEngine.dll")] public static extern void StopAllNoises(); [DllImport("SoundEngine.dll")] public static extern int FadeOutNoise(uint SoundPlayID, int FadeSeconds); [DllImport("SoundEngine.dll")] public static extern void FadeOutAllNoises(int FadeSeconds); [DllImport("SoundEngine.dll")] public static extern void SetNoiseVariation(bool Value); [DllImport("SoundEngine.dll")] public static extern bool GetNoiseVariation(); [DllImport("SoundEngine.dll")] public static extern void SetNoiseTransponation(bool Value); [DllImport("SoundEngine.dll")] public static extern bool GetNoiseTransponation(); [DllImport("SoundEngine.dll")] public static extern void SetNoisesVolume(int Volume); [DllImport("SoundEngine.dll")] public static extern int GetNoisesVolume(); //#############################music functions##################################### [DllImport("SoundEngine.dll")] public static extern int RegisterMusicFile(string MusicFile, EMusicAffiliation MusicAffiliation); [DllImport("SoundEngine.dll")] public static extern int StartMusic(EMusicAffiliation MusicAffiliation); [DllImport("SoundEngine.dll")] public static extern void SetMusicVolume(int Volume); [DllImport("SoundEngine.dll")] public static extern int GetMusicVolume(); [DllImport("SoundEngine.dll")] public static extern void SetShuffleMusicTracks(bool Shuffle); [DllImport("SoundEngine.dll")] public static extern bool GetShuffleMusicTracks(); [DllImport("SoundEngine.dll")] public static extern void StopMusic(); [DllImport("SoundEngine.dll")] public static extern void FadeOutMusic(int FadeSeconds); [DllImport("SoundEngine.dll")] public static extern string GetCurrentTrack(); [DllImport("SoundEngine.dll")] public static extern EMusicAffiliation GetCurrentAffiliation(); [DllImport("SoundEngine.dll")] public static extern int GetTrackTotalSecs(); [DllImport("SoundEngine.dll")] public static extern int GetTrackCurrSecs(); [DllImport("SoundEngine.dll")] public static extern string SecsToTimeStr(int Secs); [DllImport("SoundEngine.dll")] [return:MarshalAs(UnmanagedType.LPArray, SizeConst=8)] public static extern byte[] GetFFTData(ref int total); [DllImport("SoundEngine.dll")] public static extern string GetFFTData2(ref int total); [DllImport("SoundEngine.dll")] public static extern void GetFFTDataEx([MarshalAs(UnmanagedType.LPArray, SizeConst=8)] out byte[] FFTData, out int total); // [DllImport("SoundEngine.dll")] // public static extern void NextTrack(); }