Beispiel #1
0
        void PlayCurrentSound(IAudioOutput[] outputs, float volume)
        {
            for (int i = 0; i < monoOutputs.Length; i++)
            {
                IAudioOutput output = outputs[i];
                if (output == null)
                {
                    output = MakeSoundOutput(outputs, i);
                }
                if (!output.DoneRawAsync())
                {
                    continue;
                }

                LastChunk l = output.Last;
                if (l.Channels == 0 || (l.Channels == chunk.Channels && l.BitsPerSample == chunk.BitsPerSample &&
                                        l.SampleRate == chunk.SampleRate))
                {
                    PlaySound(output, volume); return;
                }
            }

            // This time we try to play the sound on all possible devices,
            // even if it requires the expensive case of recreating a device
            for (int i = 0; i < monoOutputs.Length; i++)
            {
                IAudioOutput output = outputs[i];
                if (!output.DoneRawAsync())
                {
                    continue;
                }

                PlaySound(output, volume); return;
            }
        }
Beispiel #2
0
 public void SetVoxelInExistingChunk(int x, int y, int z, Voxel voxel)
 {
     GetNextChunk(x, y, z, false);
     if (LastChunk != null)
     {
         VoxelChunk.ConvertWorldToLocal(ref x, ref y, ref z);
         LastChunk.SetVoxel(x, y, z, voxel, !InBatchMode);
     }
 }
Beispiel #3
0
        public Voxel GetVoxel(int x, int y, int z)
        {
            GetNextChunk(x, y, z, false);
            if (LastChunk != null)
            {
                VoxelChunk.ConvertWorldToLocal(ref x, ref y, ref z);
                return(LastChunk.GetVoxel(x, y, z));
            }

            return(new Voxel());
        }