Exemplo n.º 1
0
        public override bool OnInitialize()
        {
            base.OnInitialize();

            _fileId         = Header->_fileId;
            _playerId       = Header->_playerId;
            _volume         = Header->_volume;
            _playerPriority = Header->_playerPriority;
            _soundType      = Header->_soundType;
            _remoteFilter   = Header->_remoteFilter;
            _panMode        = Header->_panMode;
            _panCurve       = Header->_panCurve;
            _actorPlayerId  = Header->_actorPlayerId;
            _p1             = Header->_userParam1;
            _p2             = Header->_userParam2;

            INFOHeader *info = RSARNode.Header->INFOBlock;

            _sound3dParam = *Header->GetParam3dRef(&info->_collection);

            VoidPtr addr = Header->GetSoundInfoRef(&info->_collection);

            switch (Header->_soundInfoRef._dataType)
            {
            case 1: _seqInfo = *(SeqSoundInfo *)addr; break;

            case 2: _strmInfo = *(StrmSoundInfo *)addr; break;

            case 3: _waveInfo = *(WaveSoundInfo *)addr; break;
            }

            _soundFileNode = RSARNode.Files[_fileId];
            _soundFileNode.AddSoundRef(this);

            if (_soundFileNode is RSEQNode)
            {
                foreach (RSEQLabelNode r in _soundFileNode.Children)
                {
                    if (_seqInfo._dataID == r.Id)
                    {
                        _seqLabl = r;
                        break;
                    }
                }
            }

            if (_waveInfo._soundIndex >= 0 &&
                _soundFileNode is RWSDNode &&
                _soundFileNode.Children.Count > 0 &&
                _soundFileNode.Children[0].Children.Count > _waveInfo._soundIndex)
            {
                _waveDataNode = _soundFileNode.Children[0].Children[_waveInfo._soundIndex] as RWSDDataNode;
                if (_waveDataNode != null)
                {
                    _waveDataNode._refs.Add(this);
                }
            }

            return(false);
        }
Exemplo n.º 2
0
        protected override void OnPopulate()
        {
            int count;

            if (_index == 0)
            {
                RWSD_DATAHeader *header = Header;
                VoidPtr          offset = &header->_list;
                count = header->_list._numEntries;

                LabelItem[] list = ((RWSDNode)_parent)._labels; //Get labels from parent
                ((RWSDNode)_parent)._labels = null;             //Clear labels, no more use for them!

                for (int i = 0; i < count; i++)
                {
                    RWSDDataNode node = new RWSDDataNode();
                    node._offset = offset;
                    if (list != null)
                    {
                        node._soundIndex = list[i].Tag;
                        node._name       = list[i].String;
                    }
                    node.Initialize(this, header->_list.Get(offset, i), 0);
                }
            }
            else
            {
                RWSD_WAVEHeader *header = (RWSD_WAVEHeader *)Header;
                count = header->_entries;
                for (int i = 0; i < count; i++)
                {
                    new RWSDSoundNode().Initialize(this, header->GetEntry(i), 0);
                }
            }
        }
Exemplo n.º 3
0
 public IAudioStream[] CreateStreams()
 {
     _stream = null;
     if (_soundFileNode is RWSDNode)
     {
         RWSDDataNode d = _waveDataNode as RWSDDataNode;
         if (d != null && _soundFileNode.Children.Count > 1 && _soundFileNode.Children[1].Children.Count > d._part3._waveIndex && d._part3._waveIndex >= 0)
         {
             _stream = (_soundFileNode.Children[1].Children[d._part3._waveIndex] as RSARFileAudioNode).CreateStreams()[0];
         }
     }
     return(new IAudioStream[] { _stream });
 }
Exemplo n.º 4
0
        public IAudioStream CreateStream()
        {
            if (_soundNode == null)
            {
                return(null);
            }

            if (_soundNode is RWSDNode)
            {
                RWSDDataNode  d = _soundNode.Children[0].Children[PackIndex] as RWSDDataNode;
                RWSDSoundNode s = _soundNode.Children[1].Children[d.Part3[0].Index] as RWSDSoundNode;
                return(s.CreateStream());
            }
            else
            {
                return(null);
            }
        }
Exemplo n.º 5
0
        protected override void OnPopulate()
        {
            RSARNode         rsar         = RSARNode;
            SYMBHeader *     symb         = null;
            RuintList *      soundList    = null;
            INFOSoundEntry **soundIndices = null;
            VoidPtr          soundOffset  = null;
            INFOSoundEntry * sEntry;
            RWSDGroupNode    g;
            RWSDHeader *     rwsd = Header;
            RWSD_DATAHeader *data = rwsd->Data;
            //RWSD_WAVEHeader* wave = rwsd->Wave;
            RuintList *list = &data->_list;
            //RuintList* waveList = &wave->_list;
            int count = list->_numEntries;

            //Get sound info from RSAR (mainly for names)
            if (rsar != null)
            {
                symb         = rsar.Header->SYMBBlock;
                soundOffset  = &rsar.Header->INFOBlock->_collection;
                soundList    = rsar.Header->INFOBlock->Sounds;
                soundIndices = (INFOSoundEntry **)Marshal.AllocHGlobal(count * 4);

                //int sIndex = 0;
                int soundCount = soundList->_numEntries;
                for (int i = 0; i < soundCount; i++)
                {
                    if ((sEntry = (INFOSoundEntry *)soundList->Get(soundOffset, i))->_fileId == _fileIndex)
                    {
                        soundIndices[((INFOSoundPart2 *)sEntry->GetPart2(soundOffset))->_soundIndex] = sEntry;
                    }
                }
            }
            (g = new RWSDGroupNode()).Initialize(this, Header->Data, Header->_dataLength);
            for (int i = 0; i < count; i++)
            {
                RWSD_DATAEntry *entry = (RWSD_DATAEntry *)list->Get(list, i);
                RWSDDataNode    node  = new RWSDDataNode();
                node._offset = list;
                node.Initialize(g, entry, 0);

                //Attach from INFO block
                if (soundIndices != null)
                {
                    sEntry     = soundIndices[i];
                    node._name = symb->GetStringEntry(sEntry->_stringId);
                }
            }

            if (soundIndices != null)
            {
                Marshal.FreeHGlobal((IntPtr)soundIndices);
            }

            //Get labels
            RSARNode parent;
            int      count2 = Header->Data->_list._numEntries;

            if ((_labels == null) && ((parent = RSARNode) != null))
            {
                _labels = new LabelItem[count2];// new string[count];

                //Get them from RSAR
                SYMBHeader *symb2 = parent.Header->SYMBBlock;
                INFOHeader *info  = parent.Header->INFOBlock;

                VoidPtr    offset     = &info->_collection;
                RuintList *soundList2 = info->Sounds;
                count2 = soundList2->_numEntries;

                INFOSoundEntry *entry;
                for (int i = 0; i < count2; i++)
                {
                    if ((entry = (INFOSoundEntry *)soundList2->Get(offset, i))->_fileId == _fileIndex)
                    {
                        _labels[((INFOSoundPart2 *)entry->GetPart2(offset))->_soundIndex] = new LabelItem()
                        {
                            Tag = i, String = symb2->GetStringEntry(entry->_stringId)
                        }
                    }
                }
                ;
            }

            new RWSDGroupNode().Initialize(this, Header->Wave, Header->_waveLength);
        }
Exemplo n.º 6
0
        public override void OnPopulate()
        {
            RWSDHeader* rwsd = Header;
            RWSD_DATAHeader* data = rwsd->Data;
            RuintList* list = &data->_list;
            int count = list->_numEntries;

            new RWSDDataGroupNode().Initialize(this, Header->Data, Header->_dataLength);
            if (Header->_waveOffset > 0 && VersionMinor < 3)
                new RWSDSoundGroupNode().Initialize(this, Header->Wave, Header->_waveLength);
            else if (VersionMinor >= 3)
                new RWARNode() { _name = "Audio" }.Initialize(this, _audioSource.Address, _audioSource.Length);

            //Get labels
            RSARNode parent;
            int count2 = Header->Data->_list._numEntries;
            if ((_labels == null) && ((parent = RSARNode) != null))
            {
                //Get them from RSAR
                SYMBHeader* symb2 = parent.Header->SYMBBlock;
                INFOHeader* info = parent.Header->INFOBlock;

                VoidPtr offset = &info->_collection;
                RuintList* soundList2 = info->Sounds;
                count2 = soundList2->_numEntries;

                _labels = new LabelItem[count2];

                INFOSoundEntry* entry;
                for (uint i = 0; i < count2; i++)
                    if ((entry = (INFOSoundEntry*)soundList2->Get(offset, (int)i))->_fileId == _fileIndex)
                    {
                        int x = ((WaveSoundInfo*)entry->GetSoundInfoRef(offset))->_soundIndex;
                        _labels[x] = new LabelItem() { Tag = i, String = symb2->GetStringEntry(entry->_stringId) };
                    }
            }

            for (int i = 0; i < count; i++)
            {
                RWSD_DATAEntry* entry = (RWSD_DATAEntry*)list->Get(list, i);
                RWSDDataNode node = new RWSDDataNode() { _name = _labels[i].String };
                node._offset = list;
                node.Initialize(Children[0], entry, 0);
            }
        }
Exemplo n.º 7
0
        public override void OnPopulate()
        {
            RWSDHeader *     rwsd = Header;
            RWSD_DATAHeader *data = rwsd->Data;
            RuintList *      list = &data->_list;
            int count             = list->_numEntries;

            new RWSDDataGroupNode().Initialize(this, Header->Data, Header->_dataLength);
            if (Header->_waveOffset > 0 && VersionMinor < 3)
            {
                new RWSDSoundGroupNode().Initialize(this, Header->Wave, Header->_waveLength);
            }
            else if (VersionMinor >= 3)
            {
                new RWARNode {
                    _name = "Audio"
                }.Initialize(this, _audioSource.Address, _audioSource.Length);
            }

            //Get labels
            RSARNode parent;

            if (_labels == null && (parent = RSARNode) != null)
            {
                //Get them from RSAR
                SYMBHeader *symb2 = parent.Header->SYMBBlock;
                INFOHeader *info  = parent.Header->INFOBlock;

                VoidPtr    offset    = &info->_collection;
                RuintList *soundList = info->Sounds;
                int        count2    = soundList->_numEntries;

                _labels = new LabelItem[count2];

                INFOSoundEntry *entry;
                for (uint i = 0; i < count2; i++)
                {
                    if ((entry = (INFOSoundEntry *)soundList->Get(offset, (int)i))->_fileId == _fileIndex)
                    {
                        int x = ((WaveSoundInfo *)entry->GetSoundInfoRef(offset))->_soundIndex;
                        if (x >= 0 && x < count2)
                        {
                            _labels[x] = new LabelItem {
                                Tag = i, String = symb2->GetStringEntry(entry->_stringId)
                            };
                        }
                    }
                }
            }

            for (int i = 0; i < count; i++)
            {
                string name = "Entry" + i;
                if (_labels != null && i < _labels.Length)
                {
                    name = _labels[i].String;
                }

                RWSD_DATAEntry *entry = (RWSD_DATAEntry *)list->Get(list, i);
                RWSDDataNode    node  = new RWSDDataNode {
                    _name = name
                };
                node._offset = list;
                node.Initialize(Children[0], entry, 0);
            }
        }