本文整理汇总了C#中Microsoft.Xna.Framework.Audio.SoundBank.GetWave方法的典型用法代码示例。如果您正苦于以下问题:C# SoundBank.GetWave方法的具体用法?C# SoundBank.GetWave怎么用?C# SoundBank.GetWave使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Microsoft.Xna.Framework.Audio.SoundBank
的用法示例。
在下文中一共展示了SoundBank.GetWave方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: XactSound
public XactSound (SoundBank soundBank, BinaryReader soundReader, uint soundOffset)
{
long oldPosition = soundReader.BaseStream.Position;
soundReader.BaseStream.Seek (soundOffset, SeekOrigin.Begin);
byte flags = soundReader.ReadByte ();
complexSound = (flags & 1) != 0;
uint category = soundReader.ReadUInt16 ();
soundReader.ReadByte (); //unkn
uint volume = soundReader.ReadUInt16 (); //maybe pitch?
soundReader.ReadByte (); //unkn
uint entryLength = soundReader.ReadUInt16 ();
uint numClips = 0;
if (complexSound) {
numClips = (uint)soundReader.ReadByte ();
} else {
uint trackIndex = soundReader.ReadUInt16 ();
byte waveBankIndex = soundReader.ReadByte ();
wave = soundBank.GetWave(waveBankIndex, trackIndex);
}
if ( (flags & 0x1E) != 0 ) {
uint extraDataLen = soundReader.ReadUInt16 ();
//TODO: Parse RPC+DSP stuff
// extraDataLen - 2, we need to account for extraDataLen itself!
soundReader.BaseStream.Seek (extraDataLen - 2, SeekOrigin.Current);
}
if (complexSound) {
soundClips = new XactClip[numClips];
for (int i=0; i<numClips; i++) {
soundReader.ReadByte (); //unkn
uint clipOffset = soundReader.ReadUInt32 ();
soundReader.ReadUInt32 (); //unkn
soundClips[i] = new XactClip(soundBank, soundReader, clipOffset);
}
}
var audioCategory = soundBank.AudioEngine.Categories[category];
audioCategory.AddSound(this);
soundReader.BaseStream.Seek (oldPosition, SeekOrigin.Begin);
}
示例2: XactSound
public XactSound(SoundBank soundBank, BinaryReader soundReader, uint soundOffset)
{
long position = soundReader.BaseStream.Position;
soundReader.BaseStream.Seek((long) soundOffset, SeekOrigin.Begin);
byte num1 = soundReader.ReadByte();
this.complexSound = ((int) num1 & 1) != 0;
uint num2 = (uint) soundReader.ReadUInt16();
int num3 = (int) soundReader.ReadByte();
uint num4 = (uint) soundReader.ReadUInt16();
int num5 = (int) soundReader.ReadByte();
uint num6 = (uint) soundReader.ReadUInt16();
uint num7 = 0U;
if (this.complexSound)
{
num7 = (uint) soundReader.ReadByte();
}
else
{
uint trackIndex = (uint) soundReader.ReadUInt16();
byte waveBankIndex = soundReader.ReadByte();
this.wave = soundBank.GetWave(waveBankIndex, trackIndex);
}
if (((int) num1 & 30) != 0)
{
uint num8 = (uint) soundReader.ReadUInt16();
soundReader.BaseStream.Seek((long) num8, SeekOrigin.Current);
}
if (this.complexSound)
{
this.soundClips = new XactClip[(IntPtr) num7];
for (int index = 0; (long) index < (long) num7; ++index)
{
int num8 = (int) soundReader.ReadByte();
uint clipOffset = soundReader.ReadUInt32();
int num9 = (int) soundReader.ReadUInt32();
this.soundClips[index] = new XactClip(soundBank, soundReader, clipOffset);
}
}
soundReader.BaseStream.Seek(position, SeekOrigin.Begin);
}
示例3: XactClip
public XactClip (SoundBank soundBank, BinaryReader clipReader, uint clipOffset)
{
long oldPosition = clipReader.BaseStream.Position;
clipReader.BaseStream.Seek (clipOffset, SeekOrigin.Begin);
byte numEvents = clipReader.ReadByte();
events = new ClipEvent[numEvents];
for (int i=0; i<numEvents; i++) {
uint eventInfo = clipReader.ReadUInt32();
uint eventId = eventInfo & 0x1F;
switch (eventId) {
case 1:
EventPlayWave evnt = new EventPlayWave();
clipReader.ReadUInt32 (); //unkn
uint trackIndex = clipReader.ReadUInt16 ();
byte waveBankIndex = clipReader.ReadByte ();
//unkn
clipReader.ReadByte ();
clipReader.ReadUInt16 ();
clipReader.ReadUInt16 ();
evnt.wave = soundBank.GetWave(waveBankIndex, trackIndex);
events[i] = evnt;
break;
default:
throw new NotImplementedException();
}
events[i].clip = this;
}
clipReader.BaseStream.Seek (oldPosition, SeekOrigin.Begin);
}
示例4: XactClip
public XactClip(SoundBank soundBank, BinaryReader clipReader, uint clipOffset)
{
long position = clipReader.BaseStream.Position;
clipReader.BaseStream.Seek((long) clipOffset, SeekOrigin.Begin);
byte num1 = clipReader.ReadByte();
this.events = new XactClip.ClipEvent[(int) num1];
for (int index = 0; index < (int) num1; ++index)
{
if ((int) (clipReader.ReadUInt32() & 31U) != 1)
throw new NotImplementedException();
XactClip.EventPlayWave eventPlayWave = new XactClip.EventPlayWave();
int num2 = (int) clipReader.ReadUInt32();
uint trackIndex = (uint) clipReader.ReadUInt16();
byte waveBankIndex = clipReader.ReadByte();
int num3 = (int) clipReader.ReadByte();
int num4 = (int) clipReader.ReadUInt16();
int num5 = (int) clipReader.ReadUInt16();
eventPlayWave.wave = soundBank.GetWave(waveBankIndex, trackIndex);
this.events[index] = (XactClip.ClipEvent) eventPlayWave;
this.events[index].clip = this;
}
clipReader.BaseStream.Seek(position, SeekOrigin.Begin);
}
示例5: XactClip
public XactClip (SoundBank soundBank, BinaryReader clipReader, uint clipOffset)
{
long oldPosition = clipReader.BaseStream.Position;
clipReader.BaseStream.Seek (clipOffset, SeekOrigin.Begin);
byte numEvents = clipReader.ReadByte();
events = new ClipEvent[numEvents];
for (int i=0; i<numEvents; i++) {
uint eventInfo = clipReader.ReadUInt32();
uint eventId = eventInfo & 0x1F;
switch (eventId) {
case 1:
EventPlayWave evnt = new EventPlayWave();
clipReader.ReadUInt32 (); //unkn
uint trackIndex = clipReader.ReadUInt16 ();
byte waveBankIndex = clipReader.ReadByte ();
var loopCount = clipReader.ReadByte ();
// if loopCount == 255 its an infinite loop
// otherwise it loops n times..
// unknown
clipReader.ReadUInt16 ();
clipReader.ReadUInt16 ();
evnt.wave = soundBank.GetWave(waveBankIndex, trackIndex);
evnt.wave.IsLooped = loopCount == 255;
events[i] = evnt;
break;
default:
throw new NotSupportedException();
}
events[i].clip = this;
}
clipReader.BaseStream.Seek (oldPosition, SeekOrigin.Begin);
}