当前位置: 首页>>代码示例>>C#>>正文


C# AudioEngine.INTERNAL_addWaveBank方法代码示例

本文整理汇总了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;
        }
开发者ID:khbecker,项目名称:FNA,代码行数:101,代码来源:WaveBank.cs


注:本文中的Microsoft.Xna.Framework.Audio.AudioEngine.INTERNAL_addWaveBank方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。