Beispiel #1
0
        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;
            }

        }
Beispiel #2
0
 void MainWnd_Closing(object sender, CancelEventArgs e)
 {
     if (mCurrentSource != null)
     {
         mCurrentSource.unRegisterEventHandler(mAudioListener);
         mCurrentSource = null;
     }
     mAudioMgr.Dispose();
     mAudioMgr = null;
 }
Beispiel #3
0
        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);
        }
Beispiel #4
0
 internal static HandleRef getCPtr(IAudioSource obj) {
   return (obj == null) ? new HandleRef(null, IntPtr.Zero) : obj.swigCPtr;
 }
Beispiel #5
0
 public virtual void release(IAudioSource source)
 {
     cAudioCSharpWrapperPINVOKE.IAudioManager_release(swigCPtr, IAudioSource.getCPtr(source));
 }
Beispiel #6
0
 internal static HandleRef getCPtr(IAudioSource obj)
 {
     return((obj == null) ? new HandleRef(null, IntPtr.Zero) : obj.swigCPtr);
 }
Beispiel #7
0
 public virtual void release(IAudioSource source) {
   cAudioCSharpWrapperPINVOKE.IAudioManager_release(swigCPtr, IAudioSource.getCPtr(source));
 }