Exemple #1
0
 public virtual bool Init()
 {
     SND_DMA.Init();
     if (SND_DMA.sound_started)
     {
         return(true);
     }
     return(false);
 }
Exemple #2
0
 public virtual void RawSamples(int samples, int rate, int width, int channels, ByteBuffer data)
 {
     SND_DMA.RawSamples(samples, rate, width, channels, data);
 }
Exemple #3
0
 public virtual void StartLocalSound(string sound)
 {
     SND_DMA.StartLocalSound(sound);
 }
Exemple #4
0
 public virtual void EndRegistration()
 {
     SND_DMA.EndRegistration();
 }
Exemple #5
0
 public virtual sfx_t RegisterSound(string sample)
 {
     return(SND_DMA.RegisterSound(sample));
 }
Exemple #6
0
 public virtual void BeginRegistration()
 {
     SND_DMA.BeginRegistration();
 }
Exemple #7
0
 public virtual void Update(float[] origin, float[] forward, float[] right, float[] up)
 {
     SND_DMA.Update(origin, forward, right, up);
 }
Exemple #8
0
 public virtual void StopAllSounds()
 {
     SND_DMA.StopAllSounds();
 }
Exemple #9
0
 public virtual void StartSound(float[] origin, int entnum, int entchannel, sfx_t sfx, float fvol, float attenuation, float timeofs)
 {
     SND_DMA.StartSound(origin, entnum, entchannel, sfx, fvol, attenuation, timeofs);
 }
Exemple #10
0
 public virtual void Shutdown()
 {
     SND_DMA.Shutdown();
 }
Exemple #11
0
        public static void PaintChannels(Int32 endtime)
        {
            Int32       i;
            Int32       end;
            channel_t   ch;
            sfxcache_t  sc;
            Int32       ltime, count;
            playsound_t ps;

            snd_vol = ( Int32 )(s_volume.value * 256);
            while (paintedtime < endtime)
            {
                end = endtime;
                if (endtime - paintedtime > PAInt32Buffer_SIZE)
                {
                    end = paintedtime + PAInt32Buffer_SIZE;
                }
                while (true)
                {
                    ps = s_pendingplays.next;
                    if (ps == s_pendingplays)
                    {
                        break;
                    }
                    if (ps.begin <= paintedtime)
                    {
                        SND_DMA.IssuePlaysound(ps);
                        continue;
                    }

                    if (ps.begin < end)
                    {
                        end = ( Int32 )ps.begin;
                    }
                    break;
                }

                if (s_rawend < paintedtime)
                {
                    for (i = 0; i < (end - paintedtime) * 2; i++)
                    {
                        paInt32Buffer.Put(i, 0);
                    }
                }
                else
                {
                    Int32 s;
                    Int32 stop;
                    stop = (end < s_rawend) ? end : s_rawend;
                    for (i = paintedtime; i < stop; i++)
                    {
                        s = i & (MAX_RAW_SAMPLES - 1);
                        paInt32Buffer.Put((i - paintedtime) * 2, s_rawsamples.Get(2 * s));
                        paInt32Buffer.Put((i - paintedtime) * 2 + 1, s_rawsamples.Get(2 * s) + 1);
                    }

                    for ( ; i < end; i++)
                    {
                        paInt32Buffer.Put((i - paintedtime) * 2, 0);
                        paInt32Buffer.Put((i - paintedtime) * 2 + 1, 0);
                    }
                }

                for (i = 0; i < MAX_CHANNELS; i++)
                {
                    ch    = channels[i];
                    ltime = paintedtime;
                    while (ltime < end)
                    {
                        if (ch.sfx == null || (ch.leftvol == 0 && ch.rightvol == 0))
                        {
                            break;
                        }
                        count = end - ltime;
                        if (ch.end - ltime < count)
                        {
                            count = ch.end - ltime;
                        }
                        sc = WaveLoader.LoadSound(ch.sfx);
                        if (sc == null)
                        {
                            break;
                        }
                        if (count > 0 && ch.sfx != null)
                        {
                            if (sc.width == 1)
                            {
                                PaintChannelFrom8(ch, sc, count, ltime - paintedtime);
                            }
                            else
                            {
                                PaintChannelFrom16(ch, sc, count, ltime - paintedtime);
                            }
                            ltime += count;
                        }

                        if (ltime >= ch.end)
                        {
                            if (ch.autosound)
                            {
                                ch.pos = 0;
                                ch.end = ltime + sc.length;
                            }
                            else if (sc.loopstart >= 0)
                            {
                                ch.pos = sc.loopstart;
                                ch.end = ltime + sc.length - ch.pos;
                            }
                            else
                            {
                                ch.sfx = null;
                            }
                        }
                    }
                }

                TransferPaInt32Buffer(end);
                paintedtime = end;
            }
        }