예제 #1
0
 public override void Dispose()
 {
     var sound = CurrentLoop;
     CurrentLoop = null;
     ExitLooper = true;
     LoopThread.Join();
     base.Dispose();
 }
예제 #2
0
파일: SpriteBase.cs 프로젝트: qwook/hungry
 public virtual void Dispose()
 {
     if (_Frames != null) {
         for (int i = 0; i < _Frames.Length; i++) {
             _Frames [i].Dispose ();
             _Frames [i] = null;
         }
         _Frames = null;
     }
     _Sound = null;
 }
예제 #3
0
 public void SetLoop(object loop_me, bool restart = false)
 {
     lock (CurrentLoopLock) {
         Sound new_loop = Sound.Get (loop_me);
         bool change = (new_loop != CurrentLoop);
         ResetLooper = change || restart;
         if(ResetLooper)
         {
             if(CurrentLoop != null)
                 CurrentLoop.Stop();
             if(change)
                 CurrentLoop = new_loop;
         }
     }
 }
예제 #4
0
파일: Sound.cs 프로젝트: Apelsin/positron
        protected static Sound LoadWaveFileAbsolute(string title, string file_path)
        {
            if(!System.IO.File.Exists(file_path))
                throw new FileNotFoundException("File missing: ", file_path);
            int buffer_id = AL.GenBuffer();
            int source_id = AL.GenSource();
            //            if(XRam.IsInitialized)
            //                XRam.SetBufferMode(1, ref buffer_id, XRamExtension.XRamStorage.Hardware);

            int channels, bits_per_sample, sample_rate;
            byte[] sound_data = LoadWave(File.Open(file_path, FileMode.Open), out channels, out bits_per_sample, out sample_rate);
            AL.BufferData(buffer_id, GetSoundFormat(channels, bits_per_sample), sound_data, sound_data.Length, sample_rate);
            AL.Source(source_id, ALSourcei.Buffer, buffer_id);
            double duration = (double)sound_data.Length / (double)(sample_rate * channels * bits_per_sample / 8);
            return (Sound)(Sounds[title] = new Sound(buffer_id, source_id, duration));
        }