public virtual bool Init() { SND_DMA.Init(); if (SND_DMA.sound_started) { return(true); } return(false); }
public virtual void RawSamples(int samples, int rate, int width, int channels, ByteBuffer data) { SND_DMA.RawSamples(samples, rate, width, channels, data); }
public virtual void StartLocalSound(string sound) { SND_DMA.StartLocalSound(sound); }
public virtual void EndRegistration() { SND_DMA.EndRegistration(); }
public virtual sfx_t RegisterSound(string sample) { return(SND_DMA.RegisterSound(sample)); }
public virtual void BeginRegistration() { SND_DMA.BeginRegistration(); }
public virtual void Update(float[] origin, float[] forward, float[] right, float[] up) { SND_DMA.Update(origin, forward, right, up); }
public virtual void StopAllSounds() { SND_DMA.StopAllSounds(); }
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); }
public virtual void Shutdown() { SND_DMA.Shutdown(); }
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; } }