Exemplo n.º 1
0
        public SoundInstance CreateInstance(AudioEngine audio, float volume = 1.0f)
        {
            uint sampleStart = (uint)Math.Round(sliceStart * audio.audioSpec.freq);
            uint sampleEnd   = (uint)Math.Round(sliceEnd * audio.audioSpec.freq);

            sampleStart *= audio.bytesPerSample;
            sampleEnd   *= audio.bytesPerSample;

            if (sampleEnd > soundFile.data.data.Length)
            {
                sampleEnd = 0;
            }
            if (sampleStart > soundFile.data.data.Length)
            {
                sampleStart = 0;
            }

            return(SoundInstance.CreateSlice(soundFile.data, sampleStart, sampleEnd, volume));
        }