void _3dsLoader::processNextChunk(Chunk &parentChunk, Wrapper &model) const { while(!parentChunk.endOfFile()) { Chunk currentChunk(parentChunk); // It is normal to encounter unknown chunks every once in a while. switch(currentChunk.getID()) { case VERSION: processVersionChunk(currentChunk); break; case OBJECTINFO: processObjectInfoChunk(currentChunk, model); break; case OBJECT: processObjectChunk(currentChunk, model); break; case MATERIAL: processMaterialChunk(currentChunk, model); break; } } }
bool SoundFile::setupPlayChunk() { int c; int n = framesPerChunk(); int ret = blockingRead(stream, tempWindowBuffer, n); if(equalLoudness()) ret = blockingRead(filteredStream, tempWindowBufferFiltered, n); if(ret < n) return false; lock(); for(c=0; c<numChannels(); c++) { channels(c)->shift_left(n); toChannelBuffer(c, n); if(gdata->doingActive() && channels(c) == gdata->getActiveChannel()) { channels(c)->processChunk(currentChunk()+1); } } setCurrentChunk(currentStreamChunk()); unlock(); return true; }
Engine::Model _3dsLoader::loadKeyFrame(const string &fileName) const { // Open the file File file(fileName, true); if(!file.loaded()) { FAIL("Failed to open 3DS file: " + fileName); } // Make sure this is a 3DS file Chunk currentChunk(file); if(currentChunk.getID() != PRIMARY) { FAIL("PRIMARY chunk not found! This is not a valid 3DS file: " + fileName); } // recursively load all chunks Wrapper wrapper; processNextChunk(currentChunk, wrapper); return wrapper.model; }
//------------------------------------------------------------------------------ double SoundFile::timeAtCurrentChunk(void) const { return timeAtChunk(currentChunk()); }
bool SoundFile::inFile() { int c = currentChunk(); return (c >= 0 && c < totalChunks()); }