Beispiel #1
0
        private void fillInitialBuffers()
        {
            for (int i = 0; i < bufferIDs.Length; i++)
            {
                byte[] bytes = codec.GetData(bufferSize, source.Looping);

                if (bytes.Length == 0)
                {
                    return;
                }

                alBufferData(bufferIDs[i], format, bytes, bytes.Length, codec.SampleRate);
                Audio.CheckALError("Could not set Buffer Data");

                alSourceQueueBuffers(source.ID, bufferIDs[i]);
                Audio.CheckALError("Could not queue Buffer");
            }
        }
Beispiel #2
0
        internal static byte[] Decode(string file, out float length, out int channels, out int samples, out int sampleRate, out int bitDepth)
        {
            AudioCodec codec = new AudioCodec(file);

            length     = codec.Length;
            channels   = codec.Channels;
            samples    = codec.Samples;
            sampleRate = codec.SampleRate;
            bitDepth   = codec.BitDepth;
            byte[] bytes = codec.GetData(codec.Size);
            codec.Destroy();
            return(bytes);
        }