Terraria ModLoader  0.11.4
A framework for Terraria mods
Terraria.ModLoader.Audio.MusicStreamingOGG Class Reference
+ Inheritance diagram for Terraria.ModLoader.Audio.MusicStreamingOGG:
+ Collaboration diagram for Terraria.ModLoader.Audio.MusicStreamingOGG:

Public Member Functions

 MusicStreamingOGG (string path)
 
override void Reset ()
 
override void Stop (AudioStopOptions options)
 
- Public Member Functions inherited from Terraria.ModLoader.Audio.MusicStreaming
 MusicStreaming (string path)
 
override void CheckBuffer ()
 
void Dispose ()
 
override void Pause ()
 
override void Play ()
 
override void Resume ()
 
override void SetVariable (string name, float value)
 

Static Public Member Functions

static void Convert (float[] floatBuf, byte[] buffer)
 
- Static Public Member Functions inherited from Terraria.ModLoader.Audio.Music
static implicit operator Music (Cue cue)
 

Protected Member Functions

override void FillBuffer (byte[] buffer)
 
override void PrepareStream ()
 

Private Attributes

float[] floatBuf
 
VorbisReader reader
 

Additional Inherited Members

- Public Attributes inherited from Terraria.ModLoader.Audio.MusicStreaming
override bool IsPaused => instance != null && instance.State == SoundState.Paused
 
override bool IsPlaying => instance != null && instance.State != SoundState.Stopped
 
- Protected Attributes inherited from Terraria.ModLoader.Audio.MusicStreaming
AudioChannels channels
 
int sampleRate
 
Stream stream
 
- Properties inherited from Terraria.ModLoader.Audio.Music
abstract bool IsPaused [get]
 
abstract bool IsPlaying [get]
 

Detailed Description

Definition at line 210 of file MusicWrappers.cs.

Constructor & Destructor Documentation

Terraria.ModLoader.Audio.MusicStreamingOGG.MusicStreamingOGG ( string  path)

Definition at line 215 of file MusicWrappers.cs.

Member Function Documentation

static void Terraria.ModLoader.Audio.MusicStreamingOGG.Convert ( float[]  floatBuf,
byte[]  buffer 
)
static

Definition at line 249 of file MusicWrappers.cs.

Referenced by Terraria.ModLoader.Mod.LoadSound().

249  {
250  for (int i = 0; i < floatBuf.Length; i++) {
251  short val = (short)(floatBuf[i] * short.MaxValue);
252  buffer[i * 2] = (byte)val;
253  buffer[i * 2 + 1] = (byte)(val >> 8);
254  }
255  }

+ Here is the caller graph for this function:

override void Terraria.ModLoader.Audio.MusicStreamingOGG.FillBuffer ( byte[]  buffer)
protectedvirtual

Reimplemented from Terraria.ModLoader.Audio.MusicStreaming.

Definition at line 223 of file MusicWrappers.cs.

223  {
224  if (floatBuf == null)
225  floatBuf = new float[buffer.Length/2];
226 
227  int read = reader.ReadSamples(floatBuf, 0, floatBuf.Length);
228  if (read < floatBuf.Length) {
229  Reset();
230  reader.ReadSamples(floatBuf, read, floatBuf.Length - read);
231  }
232 
234  }
static void Convert(float[] floatBuf, byte[] buffer)
override void Terraria.ModLoader.Audio.MusicStreamingOGG.PrepareStream ( )
protectedvirtual

Implements Terraria.ModLoader.Audio.MusicStreaming.

Definition at line 217 of file MusicWrappers.cs.

217  {
218  reader = new VorbisReader(stream, true);
219  sampleRate = reader.SampleRate;
220  channels = (AudioChannels)reader.Channels;
221  }
override void Terraria.ModLoader.Audio.MusicStreamingOGG.Reset ( )
virtual

Implements Terraria.ModLoader.Audio.Music.

Definition at line 244 of file MusicWrappers.cs.

244  {
245  if (reader != null)
246  reader.DecodedPosition = 0;
247  }
override void Terraria.ModLoader.Audio.MusicStreamingOGG.Stop ( AudioStopOptions  options)
virtual

Reimplemented from Terraria.ModLoader.Audio.MusicStreaming.

Definition at line 236 of file MusicWrappers.cs.

236  {
237  base.Stop(options);
238 
239  reader.Dispose();
240  reader = null;
241  floatBuf = null;
242  }

Member Data Documentation

float [] Terraria.ModLoader.Audio.MusicStreamingOGG.floatBuf
private

Definition at line 213 of file MusicWrappers.cs.

VorbisReader Terraria.ModLoader.Audio.MusicStreamingOGG.reader
private

Definition at line 212 of file MusicWrappers.cs.