當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。