本文整理汇总了C#中Microsoft.Xna.Framework.Audio.AudioEngine.INTERNAL_addWaveBank方法的典型用法代码示例。如果您正苦于以下问题:C# AudioEngine.INTERNAL_addWaveBank方法的具体用法?C# AudioEngine.INTERNAL_addWaveBank怎么用?C# AudioEngine.INTERNAL_addWaveBank使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Microsoft.Xna.Framework.Audio.AudioEngine
的用法示例。
在下文中一共展示了AudioEngine.INTERNAL_addWaveBank方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: LoadWaveBank
//.........这里部分代码省略.........
(entryLength & ((1 << 21) - 1)) *
alignment;
entryPlayLength =
(entryLength >> 21) & ((1 << 11) - 1);
// FIXME: Deviation Length
reader.BaseStream.Seek(
curOffset + metadataElementSize,
SeekOrigin.Begin
);
if (curEntry == (numEntries - 1))
{
// Last track, last length.
entryLength = lengths[4];
}
else
{
entryLength = (
(
reader.ReadUInt32() &
((1 << 21) - 1)
) * alignment
);
}
entryPlayLength = entryLength - entryPlayOffset;
}
else
{
if (metadataElementSize >= 4)
reader.ReadUInt32(); // Flags/Duration, unused
if (metadataElementSize >= 8)
entryFormat = reader.ReadUInt32();
if (metadataElementSize >= 12)
entryPlayOffset = reader.ReadUInt32();
if (metadataElementSize >= 16)
entryPlayLength = reader.ReadUInt32();
if (metadataElementSize >= 20)
entryLoopOffset = reader.ReadUInt32();
if (metadataElementSize >= 24)
entryLoopLength = reader.ReadUInt32();
else
{
// FIXME: This is a bit hacky.
if (entryPlayLength != 0)
{
entryPlayLength = lengths[4];
}
}
}
// Update seek offsets
curOffset += metadataElementSize;
entryPlayOffset += playRegionOffset;
// Parse Format for Wavedata information
uint entryCodec = (entryFormat >> 0) & ((1 << 2) - 1);
uint entryChannels = (entryFormat >> 2) & ((1 << 3) - 1);
uint entryFrequency = (entryFormat >> (2 + 3)) & ((1 << 18) - 1);
uint entryAlignment = (entryFormat >> (2 + 3 + 18)) & ((1 << 8) - 1);
uint entryBitDepth = (entryFormat >> (2 + 3 + 18 + 8));
if (streaming)
{
INTERNAL_soundStreamEntries[curEntry] = new SoundStreamEntry(
entryPlayOffset,
entryPlayLength,
entryCodec,
entryFrequency,
entryChannels,
entryLoopOffset,
entryLoopLength,
entryAlignment,
entryBitDepth
);
}
else
{
SoundStreamEntry filler = new SoundStreamEntry(
entryPlayOffset,
entryPlayLength,
entryCodec,
entryFrequency,
entryChannels,
entryLoopOffset,
entryLoopLength,
entryAlignment,
entryBitDepth
);
LoadWaveEntry(filler, (ushort) curEntry, reader);
}
}
// Add this WaveBank to the AudioEngine Dictionary
audioEngine.INTERNAL_addWaveBank(INTERNAL_name, this);
// Finally.
IsDisposed = false;
IsPrepared = true;
}