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

Public Member Functions

 MusicStreamingWAV (string path)
 
override void Reset ()
 
- 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)
 
override void Stop (AudioStopOptions options)
 

Protected Member Functions

override void PrepareStream ()
 
- Protected Member Functions inherited from Terraria.ModLoader.Audio.MusicStreaming
virtual void FillBuffer (byte[] buffer)
 

Private Attributes

long dataStart = -1
 

Additional Inherited Members

- Static Public Member Functions inherited from Terraria.ModLoader.Audio.Music
static implicit operator Music (Cue cue)
 
- 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 138 of file MusicWrappers.cs.

Constructor & Destructor Documentation

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

Definition at line 142 of file MusicWrappers.cs.

Member Function Documentation

override void Terraria.ModLoader.Audio.MusicStreamingWAV.PrepareStream ( )
protectedvirtual

Implements Terraria.ModLoader.Audio.MusicStreaming.

Definition at line 144 of file MusicWrappers.cs.

144  {
145  if (dataStart >= 0) {
146  stream.Position = dataStart;
147  return;
148  }
149 
150  var reader = new BinaryReader(stream);
151  int chunkID = reader.ReadInt32();
152  int fileSize = reader.ReadInt32();
153  int riffType = reader.ReadInt32();
154  int fmtID = reader.ReadInt32();
155  int fmtSize = reader.ReadInt32();
156  int fmtCode = reader.ReadInt16();
157  channels = (AudioChannels)reader.ReadInt16();
158  sampleRate = reader.ReadInt32();
159  int fmtAvgBPS = reader.ReadInt32();
160  int fmtBlockAlign = reader.ReadInt16();
161  int bitDepth = reader.ReadInt16();
162 
163  if (fmtSize == 18) {
164  // Read any extra values
165  int fmtExtraSize = reader.ReadInt16();
166  reader.ReadBytes(fmtExtraSize);
167  }
168 
169  int dataID = reader.ReadInt32();
170  int dataSize = reader.ReadInt32();
171  dataStart = stream.Position;
172  }
override void Terraria.ModLoader.Audio.MusicStreamingWAV.Reset ( )
virtual

Implements Terraria.ModLoader.Audio.Music.

Definition at line 174 of file MusicWrappers.cs.

174  {
175  if (stream != null)
176  stream.Position = dataStart;
177  }

Member Data Documentation

long Terraria.ModLoader.Audio.MusicStreamingWAV.dataStart = -1
private

Definition at line 140 of file MusicWrappers.cs.