public StreamingSource(AudioManager mgr, StreamingSound snd, uint id, string info)
 {
     manager   = mgr;
     ID        = id;
     sound     = snd;
     this.info = info;
 }
Beispiel #2
0
        public static StreamingSound Open(Stream stream)
        {
            var dec   = new Decoder(stream);
            var sound = new StreamingSound();

            sound.Data = dec;
            switch (dec.Format)
            {
            case LdFormat.Mono8:
                sound.Format = Al.AL_FORMAT_MONO8;
                break;

            case LdFormat.Mono16:
                sound.Format = Al.AL_FORMAT_MONO16;
                break;

            case LdFormat.Stereo8:
                sound.Format = Al.AL_FORMAT_STEREO8;
                break;

            case LdFormat.Stereo16:
                sound.Format = Al.AL_FORMAT_STEREO16;
                break;
            }
            sound.Frequency = dec.Frequency;
            return(sound);
        }
Beispiel #3
0
        public static StreamingSound GetSound(Stream stream, RiffLoader ParsedHeader)
        {
            bool IsMono = false;

            if (ParsedHeader != null)
            {
                if (ParsedHeader.Channels == 1)
                {
                    IsMono = true;
                }
            }
            var mp3 = new MP3Sharp.MP3Stream(stream, IsMono);
            var snd = new StreamingSound();

            snd.Data = mp3;
            if (mp3.Format == MP3Sharp.SoundFormat.Pcm16BitMono)
            {
                snd.Format = Al.AL_FORMAT_MONO16;
            }
            else
            {
                snd.Format = Al.AL_FORMAT_STEREO16;
            }
            snd.Frequency = mp3.Frequency;
            return(snd);
        }
Beispiel #4
0
        public static StreamingSound GetSound(Stream stream)
        {
            var reader = new VorbisReader(stream, true);
            var snd    = new StreamingSound();

            snd.Data      = new VorbisStream(reader);
            snd.Frequency = reader.SampleRate;
            snd.Format    = ALUtils.GetFormat(reader.Channels, 16);
            return(snd);
        }
Beispiel #5
0
        public static StreamingSound GetSound(Stream stream)
        {
            var mp3 = new MP3Sharp.MP3Stream(stream);
            var snd = new StreamingSound();

            snd.Data = mp3;
            if (mp3.Format == MP3Sharp.SoundFormat.Pcm16BitMono)
            {
                snd.Format = Al.AL_FORMAT_MONO16;
            }
            else
            {
                snd.Format = Al.AL_FORMAT_STEREO16;
            }
            snd.Frequency = mp3.Frequency;
            return(snd);
        }
Beispiel #6
0
        public static StreamingSound GetSound(Stream stream)
        {
            RiffLoader file = new RiffLoader(stream);

            if (file.Format == WaveFormat.PCM)
            {
                var snd = new StreamingSound();
                snd.Format    = ALUtils.GetFormat(file.m_Channels, file.Bits);
                snd.Frequency = file.Frequency;
                snd.Size      = file.dataLength;
                snd.Data      = file.GetDataStream();
                return(snd);
            }
            else if (file.Format == WaveFormat.MP3)
            {
                return(Mp3Utils.GetSound(file.GetDataStream(), file));
            }
            throw new NotSupportedException();
        }
Beispiel #7
0
 internal StreamingSource CreateStreaming(StreamingSound sound)
 {
     return(new StreamingSource(this, sound, streamingSources.Dequeue()));
 }
 public StreamingSource(AudioManager mgr, StreamingSound snd, uint id)
 {
     manager = mgr;
     ID      = id;
     sound   = snd;
 }