private void BtnOpenClick(object sender, EventArgs e) { btnPlay.Text = "Play"; btnPlay.Enabled = false; btnStop.Enabled = false; currentPostion.Value = 0; mUpdateTimer.Stop(); if (mCurrentSource != null) { mCurrentSource.unRegisterEventHandler(mAudioListener); mAudioMgr.release(mCurrentSource); mCurrentSource = null; } var openFileDlg = new OpenFileDialog(); if (openFileDlg.ShowDialog() == DialogResult.OK) { var file = openFileDlg.FileName; mCurrentSource = mAudioMgr.create("musicFile", file); mCurrentSource.registerEventHandler(mAudioListener); fileNFO.Text = "File:" + file.Substring(file.LastIndexOf("\\") + 1) + " | Length: " + (mCurrentSource.getTotalAudioTime() / 60).ToString("#.00") + " min"; btnPlay.Enabled = true; } }
void MainWnd_Closing(object sender, CancelEventArgs e) { if (mCurrentSource != null) { mCurrentSource.unRegisterEventHandler(mAudioListener); mCurrentSource = null; } mAudioMgr.Dispose(); mAudioMgr = null; }
public virtual IAudioSource play3D(string filename, cVector3 position, bool playLooped) { IntPtr cPtr = cAudioCSharpWrapperPINVOKE.IAudioManager_play3D__SWIG_1(swigCPtr, filename, cVector3.getCPtr(position), playLooped); IAudioSource ret = (cPtr == IntPtr.Zero) ? null : new IAudioSource(cPtr, false); if (cAudioCSharpWrapperPINVOKE.SWIGPendingException.Pending) { throw cAudioCSharpWrapperPINVOKE.SWIGPendingException.Retrieve(); } return(ret); }
internal static HandleRef getCPtr(IAudioSource obj) { return (obj == null) ? new HandleRef(null, IntPtr.Zero) : obj.swigCPtr; }
public virtual void release(IAudioSource source) { cAudioCSharpWrapperPINVOKE.IAudioManager_release(swigCPtr, IAudioSource.getCPtr(source)); }
internal static HandleRef getCPtr(IAudioSource obj) { return((obj == null) ? new HandleRef(null, IntPtr.Zero) : obj.swigCPtr); }