Пример #1
0
        public override Sound CreateSound(ReadOnlySpan <byte> pcm, short channels, short sampleSize, int frequency)
        {
            var sound = new ALSound();

            sound.Write(pcm, channels, sampleSize, frequency);
            return(sound);
        }
Пример #2
0
        public override Sound LoadSound(Stream stream, AudioFormat format)
        {
            using var decoder = Decoder.Create(stream, format);

            var sound = new ALSound();

            try
            {
                decoder.Load(sound.buffer);
            }
            catch
            {
                sound.Dispose();
                throw;
            }

            return(sound);
        }