/// <summary> /// Initialize The Audio Engine /// </summary> /// <param name="NbChannel">Set Number Of Maximum Channels To Use</param> public void Initialize() { RESULT result; result = Factory.System_Create(ref system); if (EngineError != null) { EngineError(result); } uint version = 0; result = system.getVersion(ref version); if (EngineError != null) { EngineError(result); } if (version < VERSION.number) { throw new ApplicationException("Error! You are using an old version of FMOD " + version.ToString("X") + ". This program requires " + VERSION.number.ToString("X") + "."); } result = system.init(1, INITFLAG.NORMAL, (IntPtr)null); if (EngineError != null) { EngineError(result); } channelCallback = new CHANNEL_CALLBACK(OnEndMusic); }
public void SetCallback(Action<ChannelControlCallbackType, IntPtr, IntPtr> callback) { //Remove previous callback RemoveCallback(); //Passing in null to set removes any existing callbacks if (callback == null) return; //Keep a reference to the callback handler //Create a callback which wraps the actual callback //This will clean itself up when the "end" event happens var callbackFunction = new CHANNEL_CALLBACK((channelraw, controltype, type, commanddata1, commanddata2) => { //Call the real callback callback((ChannelControlCallbackType)type, commanddata1, commanddata2); //Clean up as necessary if (type == CHANNELCONTROL_CALLBACK_TYPE.END) { // End of sound, we can release our callback handle now _callbackHandle = null; } return RESULT.OK; }); //Set the callback into FMOD _fmod.setCallback(callbackFunction).Check(); // Hold the delegate object in memory _callbackHandle = callbackFunction; }
public static void Initialize(int NbChannel) { if (ViewerSettings.ActivateSound) { RESULT result; result = Factory.System_Create(ref system); if (EngineError != null) { EngineError(result); } uint version = 0; result = system.getVersion(ref version); if (EngineError != null) { EngineError(result); } if (version < VERSION.number) { LogTools.WriteError("Error! You are using an old version of FMOD " + version.ToString("X") + ". This program requires " + VERSION.number.ToString("X") + "."); throw new ApplicationException("Error! You are using an old version of FMOD " + version.ToString("X") + ". This program requires " + VERSION.number.ToString("X") + "."); } result = system.init(NbChannel, INITFLAGS.NORMAL, (IntPtr)null); if (EngineError != null) { EngineError(result); } channelMusicCallback = new CHANNEL_CALLBACK(OnEndMusic); channelSoundCallback = new CHANNEL_CALLBACK(OnEndSound); channelVoiceCallback = new CHANNEL_CALLBACK(OnEndVoice); } }
public void SetCallback(Action <ChannelControlCallbackType, IntPtr, IntPtr> callback) { //Remove previous callback RemoveCallback(); //Passing in null to set removes any existing callbacks if (callback == null) { return; } //Keep a reference to the callback handler //Create a callback which wraps the actual callback //This will clean itself up when the "end" event happens var callbackFunction = new CHANNEL_CALLBACK((channelraw, controltype, type, commanddata1, commanddata2) => { //Call the real callback callback((ChannelControlCallbackType)type, commanddata1, commanddata2); //Clean up as necessary if (type == CHANNELCONTROL_CALLBACK_TYPE.END) { // End of sound, we can release our callback handle now _callbackHandle = null; } return(RESULT.OK); }); //Set the callback into FMOD _fmod.setCallback(callbackFunction).Check(); // Hold the delegate object in memory _callbackHandle = callbackFunction; }
/// <summary> /// Initializes a new instance of the <see cref="FMODAudioTrack"/> class. /// Loads the file and creates sound and channel /// </summary> internal FMODAudioTrack([NotNull] FMODAudioEngine engine, string filePath) { _engine = engine; MODE creationMode = MODE.HARDWARE | MODE.CREATESTREAM | MODE.LOOP_OFF; FMODErr.Check(_engine.System.createSound(filePath, creationMode, ref _sound)); // keep a reference on the callback delegate for passing to unmanaged code _channelCallbackDelegate = new CHANNEL_CALLBACK(OnPlaybackEnd); }
public WavEffect(FMOD.System system, string path, bool loop, float baseVol) { this.system = system; callback = new CHANNEL_CALLBACK(SyncCallback); baseVolume = baseVol; volume = 1; system.createSound(path, MODE.SOFTWARE | (loop ? MODE.LOOP_NORMAL : MODE.LOOP_OFF), ref sound); channel = new Channel(); playCount = 0; }
public MusicPlayer() { RESULT result; result = Factory.System_Create(ref system); ErrCheck(result); uint version = 0; result = system.getVersion(ref version); ErrCheck(result); if (version < VERSION.number) throw new ApplicationException("Error! You are using an old version of FMOD " + version.ToString("X") + ". This program requires " + VERSION.number.ToString("X") + "."); result = system.init(32, INITFLAGS.NORMAL, (IntPtr)null); ErrCheck(result); channelCallback = new CHANNEL_CALLBACK(OnEndMusic); }
public Music(FMOD.System system, string intropath, string looppath, float baseVol) { this.system = system; callback = new CHANNEL_CALLBACK(SyncCallback); baseVolume = baseVol; volume = 1; if (looppath != null) { system.createSound(looppath, MODE.LOOP_NORMAL, ref loop); } if (intropath != null) { system.createSound(intropath, MODE.DEFAULT, ref intro); } Playing = false; }
public MediaManager(RadegastInstance instance) { Instance = instance; manager = this; if (MainProgram.s_CommandLineOpts.DisableSound) { SoundSystemAvailable = false; return; } endCallback = new CHANNEL_CALLBACK(DispatchEndCallback); allBuffers = new Dictionary <UUID, BufferSound>(); // Start the background thread that does all the FMOD calls. soundThread = new Thread(CommandLoop) { IsBackground = true, Name = "SoundThread" }; soundThread.Start(); // Start the background thread that updates listerner position. listenerThread = new Thread(ListenerUpdate) { IsBackground = true, Name = "ListenerThread" }; listenerThread.Start(); Instance.ClientChanged += new EventHandler <ClientChangedEventArgs>(Instance_ClientChanged); // Wait for init to complete initDone.WaitOne(); initDone = null; }
public RESULT setCallback(CHANNEL_CALLBACK callback) { return(FMOD_Channel_SetCallback(channelraw, callback)); }
public RESULT setCallback(CHANNEL_CALLBACK callback) { return(FMOD5_ChannelGroup_SetCallback(handle, callback)); }
public RESULT setCallback(CHANNEL_CALLBACK callback) { return ChannelControl.FMOD5_ChannelGroup_SetCallback(this.rawPtr, callback); }
private static extern RESULT FMOD_Channel_SetCallback(IntPtr channel, CHANNEL_CALLBACKTYPE type, CHANNEL_CALLBACK callback, int command);
public RESULT setCallback(CHANNEL_CALLBACKTYPE type, CHANNEL_CALLBACK callback, int command) { return(Channel.FMOD_Channel_SetCallback(channelraw, type, callback, command)); }
private static extern RESULT FMOD_Channel_SetCallback(IntPtr channel, CHANNEL_CALLBACK callback);
private static extern RESULT FMOD5_ChannelGroup_SetCallback(IntPtr channelgroup, CHANNEL_CALLBACK callback);
public RESULT setCallback(CHANNEL_CALLBACK callback) { return FMOD_Channel_SetCallback(channelraw, callback); }
public RESULT setCallback(CHANNEL_CALLBACK callback) { return(ChannelControl.FMOD5_ChannelGroup_SetCallback(this.rawPtr, callback)); }
public RESULT setCallback(CHANNEL_CALLBACK callback) { return FMOD_ChannelGroup_SetCallback(rawPtr, callback); }
public RESULT setCallback(CHANNEL_CALLBACKTYPE type, CHANNEL_CALLBACK callback, int command) { return FMOD_Channel_SetCallback(channelraw, type, callback, command); }
public Music(FMOD.System system, string intropath, string looppath, float baseVol) { this.system = system; callback = new CHANNEL_CALLBACK(SyncCallback); baseVolume = baseVol; volume = 1; if (looppath != null) system.createSound(looppath, MODE.LOOP_NORMAL, ref loop); if (intropath != null) { system.createSound(intropath, MODE.DEFAULT, ref intro); } Playing = false; }