本文整理匯總了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;
}