示例#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);
        }