uint32 PackageIterator::LegacyIterator::Package (Generics::DataElementContainer& dataFrame)
{
	uint32 result = 0;

	if (IsValid())
	{
		uint32 index = m_Offset;

		// Make sure we are on the right type for this index...
		do
		{
			uint32 offset = m_Index.GetNumber<uint32, Generics::ENDIAN_LITTLE>(index+8);
			uint32 size   = m_Index.GetNumber<uint32, Generics::ENDIAN_LITTLE>(index+12);
			result += size;

			// Add this frame to the container, it is a valid one.
			dataFrame.Back (Generics::DataElement (m_Storage, offset, size));

			do
			{
				index += IndexChunkSize();

			} while ((index < m_Index.Size()) && (IsValidChunk(index) == false));

		} while ((index < m_Index.Size()) && (IsStartChunk(index) == false)) ;
	}

	return (result);
}
bool PackageIterator::LegacyIterator::Next()
{
	// MOve on to the new index..
	if (m_Offset == NUMBER_MAX_UNSIGNED(uint32))
	{
		m_Offset = 0;
	}
	else if (m_Offset < m_Index.Size())
	{
		m_Offset += IndexChunkSize();
	}

	// Make sure we are on the right type for this index...
	while ((m_Offset < m_Index.Size()) && ((IsValidChunk(m_Offset) == false) || (IsStartChunk(m_Offset) == false)))
	{
		m_Offset += IndexChunkSize();
	}

	return (IsValid());
}
Beispiel #3
0
void cSoundStream::Synchronize(const vRenderingPropertiesBase *props)
{
    if(!props)
        return;

    const vSoundStreamProperties *stream_props = dynamic_cast<const vSoundStreamProperties*>(props);

    if(!stream_props)
        return;

    // rewrite state given by the renderer
    SetState(stream_props->GetState());

    // Update chunks sent to rendering
    ClearBoundQueue();
    for(TArrayList::const_iterator it = stream_props->GetQueue().begin(); it != stream_props->GetQueue().end(); ++it)
    {
        m_FreeChunks.remove(*it);
        if(IsValidChunk(*it))
            m_BoundChunks.push_back(*it);
    }
};
uint32 PackageIterator::LegacyIterator::Size () const
{
	uint32 size = 0;

	if (IsValid())
	{
		uint32 index = m_Offset;

		// Make sure we are on the right type for this index...
		do
		{
			size += m_Index.GetNumber<uint32, Generics::ENDIAN_LITTLE>(index+12);

			do
			{
				index += IndexChunkSize();

			} while ((index < m_Index.Size()) && (IsValidChunk(index) == false));

		} while ((index < m_Index.Size()) && (IsStartChunk(index) == false)) ;
	}

	return (size);
}