Beispiel #1
0
        /// <summary>
        /// Creates a new ogg-filestream.
        /// </summary>
        /// <param name="stream">The ogg-filestream.</param>
        /// <param name="bufferCount">The amount of buffers to use.</param>
        public OggStream(Stream stream, int bufferCount = defaultBufferCount)
        {
            this.BufferCount = bufferCount;

            this.Buffer = new SoundBuffer(bufferCount);
            this.Source = new Source();

            //if (ALHelper.XRam.IsInitialized)
            //{
            //    ALHelper.XRam.SetBufferMode(BufferCount, ref alBufferIds[0], XRamExtension.XRamStorage.Hardware);
            //    ALHelper.Check();
            //}

            this.Volume = 1;
            this.Pitch  = 1;

            if (AudioManager.Instance.Efx.IsInitialized)
            {
                alFilterId = AudioManager.Instance.Efx.GenFilter();
                AudioManager.Instance.Efx.Filter(alFilterId, EfxFilteri.FilterType, (int)EfxFilterType.Lowpass);
                AudioManager.Instance.Efx.Filter(alFilterId, EfxFilterf.LowpassGain, 1);
                this.lowPassGain = 1;
            }

            this.underlyingStream = stream;
        }
Beispiel #2
0
 /// <summary>
 /// Adds a new sound buffer to be played by this source.
 /// </summary>
 /// <param name="buffer"></param>
 public void QueueBuffer(SoundBuffer buffer)
 {
     this.QueueBuffers(buffer.Handles.Length, buffer.Handles);
 }
Beispiel #3
0
 private SoundFile(SoundBufferData bufferData)
 {
     this.buffer = SoundBuffer.FromData(bufferData);
 }
Beispiel #4
0
 /// <summary>
 /// Creates a new soundbuffer from an uncompressed wave-file.
 /// </summary>
 /// <param name="file">The file to load the data from.</param>
 /// <returns>A SoundBuffer object containing the data from the specified file.</returns>
 public static SoundBuffer FromWav(Stream file)
 {
     return(SoundBuffer.FromData(SoundBufferData.FromWav(file)));
 }
Beispiel #5
0
 /// <summary>
 /// Creates a new soundbuffer from an uncompressed wave-file.
 /// </summary>
 /// <param name="file">The file to load the data from.</param>
 /// <returns>A SoundBuffer object containing the data from the specified file.</returns>
 public static SoundBuffer FromWav(string file)
 {
     return(SoundBuffer.FromWav(File.OpenRead(file)));
 }