• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

C++ FindChunk函数代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了C++中FindChunk函数的典型用法代码示例。如果您正苦于以下问题:C++ FindChunk函数的具体用法?C++ FindChunk怎么用?C++ FindChunk使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。



在下文中一共展示了FindChunk函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。

示例1: CreateFile

HRESULT AudioData::LoadXwma(LPCTSTR strFileName)
{
	// Open the file
	HANDLE hFile = CreateFile(
		strFileName,
		GENERIC_READ,
		FILE_SHARE_READ,
		NULL,
		OPEN_EXISTING,
		0,
		NULL );

	if( INVALID_HANDLE_VALUE == hFile )
		return HRESULT_FROM_WIN32( GetLastError() );

	if( INVALID_SET_FILE_POINTER == SetFilePointer( hFile, 0, NULL, FILE_BEGIN ) )
		return HRESULT_FROM_WIN32( GetLastError() );


	DWORD dwChunkSize;
	DWORD dwChunkPosition;
	//check the file type, should be fourccWAVE or 'XWMA'
	FindChunk(hFile,fourccRIFF,dwChunkSize, dwChunkPosition );
	DWORD filetype;
	ReadChunkData(hFile,&filetype,sizeof(DWORD),dwChunkPosition);
	if (filetype != fourccXWMA)
		return E_FAIL;


	//Locate the 'fmt ' chunk, and copy its contents into a WAVEFORMATEXTENSIBLE structure.
	FindChunk(hFile,fourccFMT, dwChunkSize, dwChunkPosition );
	ReadChunkData(hFile, &wfx, dwChunkSize, dwChunkPosition );


	//fill out the audio data buffer with the contents of the fourccDATA chunk
	FindChunk(hFile,fourccDATA,dwChunkSize, dwChunkPosition );
	BYTE * pDataBuffer = new BYTE[dwChunkSize];
	ReadChunkData(hFile, pDataBuffer, dwChunkSize, dwChunkPosition);


	//Populate an XAUDIO2_BUFFER structure.
	buffer.AudioBytes = dwChunkSize;  //buffer containing audio data
	buffer.pAudioData = pDataBuffer;  //size of the audio buffer in bytes
	buffer.Flags = XAUDIO2_END_OF_STREAM; // tell the source voice not to expect any data after this buffer


	//fill out the wma data buffer with the contents of the fourccDPDS chunk
	FindChunk(hFile, fourccDPDS, dwChunkSize, dwChunkPosition);
	UINT32 * pDataBufferWma = new UINT32[dwChunkSize/sizeof(UINT32)];
	ReadChunkData(hFile, pDataBufferWma, dwChunkSize, dwChunkPosition);

	//Populate an XAUDIO2_BUFFER_WMA structure.
	wmabuffer.PacketCount = dwChunkSize/sizeof(UINT32);
	wmabuffer.pDecodedPacketCumulativeBytes = pDataBufferWma;

	// Don't forget to close the file.
	CloseHandle(hFile);

	return S_OK;
}
开发者ID:ChenHanTsai,项目名称:Dragon_Ball_Pong,代码行数:60,代码来源:audiodata.cpp


示例2: GetWavinfo

/*
============
GetWavinfo
============
*/
static wavinfo_t GetWavinfo( char *name, byte *wav, int wavlength ) {
	wavinfo_t info;

	Com_Memset( &info, 0, sizeof( info ) );

	if ( !wav ) {
		return info;
	}

	iff_data = wav;
	iff_end = wav + wavlength;

// find "RIFF" chunk
	FindChunk( "RIFF" );
	if ( !( data_p && !strncmp( (char *)data_p + 8, "WAVE", 4 ) ) ) {
		Com_Printf( "Missing RIFF/WAVE chunks\n" );
		return info;
	}

// get "fmt " chunk
	iff_data = data_p + 12;
// DumpChunks ();

	FindChunk( "fmt " );
	if ( !data_p ) {
		Com_Printf( "Missing fmt chunk\n" );
		return info;
	}
	data_p += 8;
	info.format = GetLittleShort();
	info.channels = GetLittleShort();
	info.rate = GetLittleLong();
	data_p += 4 + 2;
	info.width = GetLittleShort() / 8;

	if ( info.format != 1 ) {

#if defined RTCW_ET
		Com_Printf( "Unsupported format: %s\n", GetWaveFormatName( info.format ) );
#endif // RTCW_XX

		Com_Printf( "Microsoft PCM format only\n" );
		return info;
	}


// find data chunk
	FindChunk( "data" );
	if ( !data_p ) {
		Com_Printf( "Missing data chunk\n" );
		return info;
	}

	data_p += 4;
	info.samples = GetLittleLong() / info.width;
	info.dataofs = data_p - wav;

	return info;
}
开发者ID:bibendovsky,项目名称:rtcw,代码行数:64,代码来源:snd_mem.cpp


示例3: f

std::shared_ptr<Sound_Engine::Sound> Sound_Engine::LoadSound(std::string file){
	std::string::size_type po = file.find_last_of('\\');
	if(po == std::string::npos) po = file.find_last_of('/');// couldnt find it with the double slashes, try a single forward slash
	if(po == std::string::npos) {// no slashes.. there must be no path on this string so append our asset directory to where the sounds are stored
		file = Internal::Asset_Dir + "Sound\\" + file;
	}// else the user specified some sort of directory, so use that instead.
		
	std::ifstream f(file.c_str(), std::ios::beg | std::ios::binary);
	assert(f);
	// see if the sound data has been loaded already
	std::map<std::string, std::weak_ptr<Internal::Sub_Sound>>::iterator soundloaded = Internal::LoadedSounds.find(file);
	if(soundloaded != Internal::LoadedSounds.end()) {// the data exists
		std::shared_ptr<Internal::Sub_Sound> ptr(soundloaded->second.lock());
		if(ptr){// the sound data still exists
			std::shared_ptr<Sound_Engine::Sound> sound_ptr = std::make_shared<Sound_Engine::Sound>();// create a new source 
			sound_ptr->InternalSound = ptr;
			Internal::Sources[sound_ptr.get()] = sound_ptr;// insert into the sources
			return sound_ptr;
		}
	}
	std::shared_ptr<Sound_Engine::Sound> retsound = std::make_shared<Sound_Engine::Sound>();
	Internal::Sources[retsound.get()] = retsound;
	retsound->InternalSound = std::make_shared<Internal::Sub_Sound>();
	Internal::LoadedSounds[file]=retsound->InternalSound;

	retsound->InternalSound->buffer.Flags = XAUDIO2_END_OF_STREAM; // tell the source voice not to expect any data after this buffer

	DWORD dwChunkSize(0);
	DWORD dwChunkPosition(0);
	//check the file type, should be fourccWAVE or 'XWMA'
	FindChunk(f,fourccRIFF,dwChunkSize, dwChunkPosition );
	DWORD filetype(0);
	ReadChunkData(f, &filetype, sizeof(DWORD), dwChunkPosition);
	if (filetype != fourccWAVE){
		if(filetype != fourccXWMA){
			f.close();
			OUTPUT_DEBUG_MSG("File is not a .wav, or a xwma file... uh oh");
			assert(true);
		}
	}
	FindChunk(f,fourccFMT, dwChunkSize, dwChunkPosition );
	ReadChunkData(f, &retsound->InternalSound->wfx, dwChunkSize, dwChunkPosition );
	FindChunk(f,fourccDATA,dwChunkSize, dwChunkPosition );
	retsound->InternalSound->buffer.AudioBytes = dwChunkSize;  //buffer containing audio data
	BYTE *temp = new BYTE[dwChunkSize];  //size of the audio buffer in bytes
	retsound->InternalSound->buffer.pAudioData = temp;
	ReadChunkData(f, temp, dwChunkSize, dwChunkPosition);
	if(filetype == fourccXWMA){// the file is an xwma file... we need an extra peice of data
		FindChunk(f,fourccDPDS, dwChunkSize, dwChunkPosition );
		// the chunksize is how many bytess there are, so we have to divide by sizeof(uint32t) to get the number of uint32's in the buffer
		//so chunksize will be like 24, but that is how many bytes, we need 24/4 which is 6. Because there are 6 uint32's
		retsound->InternalSound->wmaBuffer.PacketCount = dwChunkSize / sizeof(UINT32); 
		UINT32 *temp2 = new UINT32[retsound->InternalSound->wmaBuffer.PacketCount];
		ReadChunkData(f, temp2, dwChunkSize, dwChunkPosition);
		retsound->InternalSound->wmaBuffer.pDecodedPacketCumulativeBytes= temp2;
	}
	f.close();
	return retsound;
}
开发者ID:LazyNarwhal,项目名称:Destination_Toolkit,代码行数:59,代码来源:SoundEngine.cpp


示例4: CreateFile

	bool Audio::AddAudioFile(const char* i_AudioPath, bool bLoop, float i_InitialVolume)
	{
		WAVEFORMATEXTENSIBLE wfx = { 0 };
		XAUDIO2_BUFFER buffer = { 0 };

		// Open the file
		HANDLE hFile = CreateFile(
			i_AudioPath,
			GENERIC_READ,
			FILE_SHARE_READ,
			NULL,
			OPEN_EXISTING,
			0,
			NULL);


		SetFilePointer(hFile, 0, NULL, FILE_BEGIN);

		DWORD dwChunkSize;
		DWORD dwChunkPosition;
		//check the file type, should be fourccWAVE or 'XWMA'
		FindChunk(hFile, fourccRIFF, dwChunkSize, dwChunkPosition);
		DWORD filetype;
		ReadChunkData(hFile, &filetype, sizeof(DWORD), dwChunkPosition);
		if (filetype != fourccWAVE)
			return false;

		FindChunk(hFile, fourccFMT, dwChunkSize, dwChunkPosition);
		ReadChunkData(hFile, &wfx, dwChunkSize, dwChunkPosition);

		//fill out the audio data buffer with the contents of the fourccDATA chunk
		FindChunk(hFile, fourccDATA, dwChunkSize, dwChunkPosition);
		BYTE * pDataBuffer = new BYTE[dwChunkSize];
		ReadChunkData(hFile, pDataBuffer, dwChunkSize, dwChunkPosition);

		buffer.AudioBytes = dwChunkSize;  //buffer containing audio data
		buffer.pAudioData = pDataBuffer;  //size of the audio buffer in bytes
		buffer.Flags = XAUDIO2_END_OF_STREAM; // tell the source voice not to expect any data after this buffer
		if (bLoop)
		{
			buffer.LoopLength = 0;
			buffer.LoopCount = XAUDIO2_LOOP_INFINITE;
		}

		HRESULT hr;
		IXAudio2SourceVoice* pSourceVoice;
		if (FAILED(hr = s_pXAudio2->CreateSourceVoice(&pSourceVoice, (WAVEFORMATEX*)&wfx)))
			return false;

		if (FAILED(hr = pSourceVoice->SubmitSourceBuffer(&buffer)))
			return false;

		pSourceVoice->SetVolume(i_InitialVolume);

		s_SourceVoices.push_back(pSourceVoice);
		s_AudioBuffers.push_back(buffer);
	}
开发者ID:snkulkarni92,项目名称:CPPGameEngine,代码行数:57,代码来源:Audio.cpp


示例5: FindChunk

	bool SPWavFile::LoadWave()
	{
		if (path == L"")
		{
			return false;
		}

		DWORD dwChunkSize;
		DWORD dwChunkPosition;
		DWORD filetype;

		// Check the file type, should be fourccWAVE or 'XWMA'

		FindChunk(fourccRIFF, dwChunkSize, dwChunkPosition );		
		ReadChunkData(&filetype, sizeof(DWORD), dwChunkPosition);

		if (filetype != fourccWAVE)
		{
			return false;
		}

		// Locate the 'fmt ' chunk, and copy its contents into a
		// WAVEFORMATEXTENSIBLE structure.

		FindChunk(fourccFMT, dwChunkSize, dwChunkPosition );
		ReadChunkData(&wfx, dwChunkSize, dwChunkPosition );

		// 
		// Find the beginning position and the size of stream data.
		// 

		FindChunk(fourccDATA, soundDataLength, soundDataOffset);
		SetPosition(soundDataOffset);

		//
		// Calculate sound length.
		// 

		int stereo = wfx.nChannels;
		int numberBytePerChannalSample = wfx.wBitsPerSample / 8;
		int bytePerSample = stereo * numberBytePerChannalSample;
		int sampleRate = wfx.nSamplesPerSec;
		float seconds = soundDataLength / (float)(sampleRate * bytePerSample);
		songLength = seconds;

		// 
		// Set loaded flag.
		// 

		isLoaded = true;

		return true;
	}
开发者ID:weimingtom,项目名称:spengine-1,代码行数:53,代码来源:SPWavFile.cpp


示例6: ZeroMemory

void Sound::loadMusic(IXAudio2SourceVoice* &voice, std::string filename, BYTE* &soundBuffer, UINT32* &xwmaBuffer)
{
	WAVEFORMATEXTENSIBLE wfx;
	ZeroMemory(&wfx, sizeof(WAVEFORMATEXTENSIBLE));
	
	HANDLE fileHandle = CreateFile((const char*) filename.c_str(), GENERIC_READ, FILE_SHARE_READ, NULL, OPEN_EXISTING, 0, NULL);
	
	DWORD chunkSize = 0;
	DWORD chunkPos = 0;
	DWORD fileType = 0;

	FindChunk(fileHandle, 'FFIR', chunkSize, chunkPos);
	ReadChunkData(fileHandle, &fileType, sizeof(DWORD), chunkPos);

	FindChunk(fileHandle, ' tmf', chunkSize, chunkPos);
	ReadChunkData(fileHandle, &wfx, chunkSize, chunkPos);


	// Read in audio data
	FindChunk(fileHandle, 'atad', chunkSize, chunkPos);
	soundBuffer = new BYTE[chunkSize];
	ReadChunkData(fileHandle, soundBuffer, chunkSize, chunkPos);

	
	XAUDIO2_BUFFER buffer;
	ZeroMemory(&buffer, sizeof(XAUDIO2_BUFFER));

	buffer.AudioBytes = chunkSize;
	buffer.pAudioData = soundBuffer;
	buffer.Flags = XAUDIO2_END_OF_STREAM;
	buffer.LoopCount = XAUDIO2_LOOP_INFINITE;
	
	XAUDIO2_BUFFER_WMA wmaBuffer;
	ZeroMemory(&wmaBuffer, sizeof(XAUDIO2_BUFFER_WMA));
	
	FindChunk(fileHandle, 'sdpd', chunkSize, chunkPos);
	// Divide chunk size by sizeof(DWORD) and assign
	wmaBuffer.PacketCount = chunkSize / 4;
	
	xwmaBuffer = (UINT32*) new BYTE[chunkSize];
	ReadChunkData(fileHandle, xwmaBuffer, chunkSize, chunkPos);
	wmaBuffer.pDecodedPacketCumulativeBytes = xwmaBuffer;
	
	audio->CreateSourceVoice(&voice, (WAVEFORMATEX*) &wfx, XAUDIO2_VOICE_USEFILTER, 2.0f, NULL, &musicSendList, NULL);
	voice->SubmitSourceBuffer(&buffer, &wmaBuffer);

	CloseHandle(fileHandle);
}
开发者ID:NinjaMeTimbers,项目名称:CPSC-585-Game-Project,代码行数:48,代码来源:Sound.cpp


示例7: NewChunk

CHUNK_t* NewChunk(SAVESTATE_t* save, const char *tag) {
	int chunk = save->chunk_count;

	if (FindChunk(save, tag) != NULL) {
		return NULL;
	}

	if (save->chunks[chunk] != NULL) {
		return NULL;
	}
	save->chunks[chunk] = (CHUNK_t *) malloc(sizeof(CHUNK_t));
	if (!save->chunks[chunk]) {
		return NULL;
	}

	save->chunks[chunk]->tag[0]	= tag[0];
	save->chunks[chunk]->tag[1]	= tag[1];
	save->chunks[chunk]->tag[2]	= tag[2];
	save->chunks[chunk]->tag[3]	= tag[3];
	save->chunks[chunk]->size	= 0;
	save->chunks[chunk]->data	= NULL;
	save->chunks[chunk]->pnt	= 0;
	save->chunk_count++;
	return save->chunks[chunk];
}
开发者ID:DragonNeos,项目名称:wabbitemu-psp,代码行数:25,代码来源:savestate.c


示例8: MarkChunkAsPadding

	bool MarkChunkAsPadding ( LFA_FileRef inFileRef, RiffState & inOutRiffState, long riffType, long tagID, long subtypeID )
	{
		UInt32 len;
		UInt64 pos;
		atag tag;
	
		try {
	
			bool found = FindChunk ( inOutRiffState, tagID, riffType, subtypeID, NULL, &len, &pos );
			if ( ! found ) return false;
	
			if ( subtypeID != 0 ) {
				pos -= 12;
			} else {
				pos -= 8;
			}

			tag.id = MakeUns32LE ( ckidPremierePadding );
			LFA_Seek ( inFileRef, pos, SEEK_SET );
			LFA_Write ( inFileRef, &tag, 4 );
	
			pos += 8;
			AddTag ( inOutRiffState, ckidPremierePadding, len, pos, 0, 0, 0 );
	
		} catch(...) {
	
			return false;	// If a write fails, it throws, so we return false.
	
		}
	
		return true;
	}
开发者ID:JJWTimmer,项目名称:Uforia,代码行数:32,代码来源:RIFF_Support.cpp


示例9: NewChunk

CHUNK_t* NewChunk(SAVESTATE_t* save, const char *tag) {
	int chunk = save->chunk_count;

	if (FindChunk(save, tag) != nullptr) {
		printf("Error: chunk '%s' already exists", tag);
		return nullptr;
	}

	if (save->chunks[chunk] != nullptr) {
		puts("Error new chunk was not null.");
	}
	save->chunks[chunk] = (CHUNK_t *) malloc(sizeof(CHUNK_t));
	if (!save->chunks[chunk]) {
		puts("Chunk could not be created");
		return nullptr;
	}

	save->chunks[chunk]->tag[0]	= tag[0];
	save->chunks[chunk]->tag[1]	= tag[1];
	save->chunks[chunk]->tag[2]	= tag[2];
	save->chunks[chunk]->tag[3]	= tag[3];
	save->chunks[chunk]->size	= 0;
	save->chunks[chunk]->data	= nullptr;
	save->chunks[chunk]->pnt	= 0;
	save->chunk_count++;
	return save->chunks[chunk];
}
开发者ID:elfprince13,项目名称:cli-wabbitemu,代码行数:27,代码来源:savestate.cpp


示例10: FindSectorIndexBySample

sint64 VDAVIReadIndex::NextKey(sint64 samplePos) const {
	if (samplePos < 0) {
		if (IsKey(0))
			return true;
		samplePos = 0;
	}

	if (samplePos >= mSampleCount)
		return -1;

	uint32 sectorIndex = FindSectorIndexBySample(samplePos);
	uint32 sampleOffset;
	uint32 chunkIndex;
	IndexEntry *ient = FindChunk(samplePos, sectorIndex, sampleOffset, chunkIndex);

	while(++chunkIndex < mChunkCount) {
		ient = &mIndex[chunkIndex >> kBlockSizeBits][chunkIndex & kBlockMask];
		if ((sint32)ient->mSizeAndKeyFrameFlag < 0) {
			sectorIndex = FindSectorIndexByChunk(chunkIndex);

			return mSectors[sectorIndex].mChunkOffset + ient->mSampleOffset;
		}
	}

	return -1;
}
开发者ID:AbsoluteDestiny,项目名称:vapoursynth,代码行数:26,代码来源:AVIReadIndex.cpp


示例11: GetRomOnly

char* GetRomOnly(SAVESTATE_t *save, int *size) {
	CHUNK_t* chunk = FindChunk(save, ROM_tag);
	*size = 0;
	if (!chunk) return nullptr;
	*size = chunk->size;
	return (char *) chunk->data;
}
开发者ID:elfprince13,项目名称:cli-wabbitemu,代码行数:7,代码来源:savestate.cpp


示例12: LoadLCD

void LoadLCD(SAVESTATE_t* save, LCD_t* lcd) {
	CHUNK_t* chunk = FindChunk(save,LCD_tag);
	chunk->pnt = 0;

	lcd->active		= ReadInt(chunk);
	lcd->word_len	= ReadInt(chunk);
	lcd->x			= ReadInt(chunk);
	lcd->y			= ReadInt(chunk);
	lcd->z			= ReadInt(chunk);
	lcd->cursor_mode		= (LCD_CURSOR_MODE) ReadInt(chunk);
	lcd->contrast	= ReadInt(chunk);
	lcd->base_level	= ReadInt(chunk);

	ReadBlock(chunk, lcd->display, DISPLAY_SIZE);
	lcd->front		= ReadInt(chunk);
	ReadBlock(chunk,  (unsigned char *) lcd->queue, LCD_MAX_SHADES * DISPLAY_SIZE);
	lcd->shades		= ReadInt(chunk);
	lcd->mode		= (LCD_MODE) ReadInt(chunk);
	lcd->time		= ReadDouble(chunk);
	lcd->ufps		= ReadDouble(chunk);
	lcd->ufps_last	= ReadDouble(chunk);
	lcd->lastgifframe= ReadDouble(chunk);
	lcd->write_avg	= ReadDouble(chunk);
	lcd->write_last = ReadDouble(chunk);
}
开发者ID:elfprince13,项目名称:cli-wabbitemu,代码行数:25,代码来源:savestate.cpp


示例13: NearestKey

sint64 VDAVIReadIndex::PrevKey(sint64 samplePos) const {
	if (samplePos <= 0)
		return -1;

	if (samplePos >= mSampleCount)
		return NearestKey(samplePos);

	uint32 sectorIndex = FindSectorIndexBySample(samplePos);
	uint32 sampleOffset;
	uint32 chunkIndex;
	IndexEntry *ient = FindChunk(samplePos, sectorIndex, sampleOffset, chunkIndex);

	if (chunkIndex == 0)
		return -1;

	--chunkIndex;
	for(;;) {
		ient = &mIndex[chunkIndex >> kBlockSizeBits][chunkIndex & kBlockMask];
		if ((sint32)ient->mSizeAndKeyFrameFlag < 0) {
			sectorIndex = FindSectorIndexByChunk(chunkIndex);

			return mSectors[sectorIndex].mChunkOffset + ient->mSampleOffset;
		}

		if (!chunkIndex)
			break;


		chunkIndex -= ient->mPrevKeyDistance;
	}

	return -1;
}
开发者ID:AbsoluteDestiny,项目名称:vapoursynth,代码行数:33,代码来源:AVIReadIndex.cpp


示例14: LoadBasicChunks

/**
 * LoadBasicChunks
 */
void LoadBasicChunks(void) {
	byte *cptr;
	int numObjects;

	// Allocate RAM for savescene data
	InitialiseSaveScenes();

	// CHUNK_TOTAL_ACTORS seems to be missing in the released version, hard coding a value
	// TODO: Would be nice to just change 511 to MAX_SAVED_ALIVES
	cptr = FindChunk(MASTER_SCNHANDLE, CHUNK_TOTAL_ACTORS);
	RegisterActors((cptr != NULL) ? READ_LE_UINT32(cptr) : 511);

	// CHUNK_TOTAL_GLOBALS seems to be missing in some versions.
	// So if it is missing, set a reasonably high value for the number of globals.
	cptr = FindChunk(MASTER_SCNHANDLE, CHUNK_TOTAL_GLOBALS);
	RegisterGlobals((cptr != NULL) ? READ_LE_UINT32(cptr) : 512);

	cptr = FindChunk(INV_OBJ_SCNHANDLE, CHUNK_TOTAL_OBJECTS);
	numObjects = (cptr != NULL) ? READ_LE_UINT32(cptr) : 0;

	cptr = FindChunk(INV_OBJ_SCNHANDLE, CHUNK_OBJECTS);

#ifdef SCUMM_BIG_ENDIAN
	//convert to native endianness
	INV_OBJECT *io = (INV_OBJECT *)cptr;
	for (int i = 0; i < numObjects; i++, io++) {
		io->id        = FROM_LE_32(io->id);
		io->hIconFilm = FROM_LE_32(io->hIconFilm);
		io->hScript   = FROM_LE_32(io->hScript);
		io->attribute = FROM_LE_32(io->attribute);
	}
#endif

	RegisterIcons(cptr, numObjects);

	cptr = FindChunk(MASTER_SCNHANDLE, CHUNK_TOTAL_POLY);
	if (cptr != NULL)
		MaxPolygons(*cptr);

	if (TinselV2) {
		// Global processes
		cptr = FindChunk(MASTER_SCNHANDLE, CHUNK_NUM_PROCESSES);
		assert(cptr && (*cptr < 100));
		int num = *cptr;
		cptr = FindChunk(MASTER_SCNHANDLE, CHUNK_PROCESSES);
		assert(!num || cptr);
		GlobalProcesses(num, cptr);

		// CdPlay() stuff
		cptr = FindChunk(MASTER_SCNHANDLE, CHUNK_CDPLAY_HANDLE);
		assert(cptr);
		uint32 playHandle = READ_LE_UINT32(cptr);
		assert(playHandle < 512);
		SetCdPlayHandle(playHandle);
	}
}
开发者ID:havlenapetr,项目名称:Scummvm,代码行数:59,代码来源:tinsel.cpp


示例15: ReadHeader

		void ReadHeader()
		{
			FindChunk("RIFF");
			size = read_value<int>();
			
			unsigned char data[4];
			stream.read(data, sizeof(data));
			Compare(data, "WAVE");
		}
开发者ID:davidajulio,项目名称:hx,代码行数:9,代码来源:wave_reader.hpp


示例16: LoadCPU

void LoadCPU(SAVESTATE_t* save, CPU_t* cpu) {
	CHUNK_t* chunk = FindChunk(save, CPU_tag);
	chunk->pnt = 0;
	
	cpu->a = ReadChar(chunk);
	cpu->f = ReadChar(chunk);
	cpu->b = ReadChar(chunk);
	cpu->c = ReadChar(chunk);
	cpu->d = ReadChar(chunk);
	cpu->e = ReadChar(chunk);
	cpu->h = ReadChar(chunk);
	cpu->l = ReadChar(chunk);
	
	cpu->ap = ReadChar(chunk);
	cpu->fp = ReadChar(chunk);
	cpu->bp = ReadChar(chunk);
	cpu->cp = ReadChar(chunk);
	cpu->dp = ReadChar(chunk);
	cpu->ep = ReadChar(chunk);
	cpu->hp = ReadChar(chunk);
	cpu->lp = ReadChar(chunk);

	cpu->ixl = ReadChar(chunk);
	cpu->ixh = ReadChar(chunk);
	cpu->iyl = ReadChar(chunk);
	cpu->iyh = ReadChar(chunk);
	
	cpu->pc = ReadShort(chunk);
	cpu->sp = ReadShort(chunk);

	cpu->i = ReadChar(chunk);
	cpu->r = ReadChar(chunk);
	cpu->bus = ReadChar(chunk);

	cpu->imode = ReadInt(chunk);

	cpu->interrupt = ReadInt(chunk);
	cpu->ei_block = ReadInt(chunk);
	cpu->iff1 = ReadInt(chunk);
	cpu->iff2 = ReadInt(chunk);
	cpu->halt = ReadInt(chunk);
	
	cpu->read = ReadInt(chunk);
	cpu->write = ReadInt(chunk);
	cpu->output = ReadInt(chunk);
	cpu->input = ReadInt(chunk);
	
	cpu->prefix = ReadInt(chunk);
	int i;
	for(i = 0; i < 256; i++) {
		interrupt_t *val = &cpu->pio.interrupt[i];
		val->interrupt_val = ReadInt(chunk);
		val->skip_factor = ReadInt(chunk);
		val->skip_count = ReadInt(chunk);
	}
	
}
开发者ID:elfprince13,项目名称:cli-wabbitemu,代码行数:57,代码来源:savestate.cpp


示例17: LoadTIMER

void LoadTIMER(SAVESTATE_t* save, timerc* time) {
	CHUNK_t* chunk = FindChunk(save,TIMER_tag);
	chunk->pnt = 0;

	time->tstates	= ReadLong(chunk);
	time->freq		= (uint32_t) ReadLong(chunk);
	time->elapsed	= ReadDouble(chunk);
	time->lasttime	= ReadDouble(chunk);	// this isn't used.
}
开发者ID:elfprince13,项目名称:cli-wabbitemu,代码行数:9,代码来源:savestate.cpp


示例18: FX_4BYTEALIGN

void* CFX_StaticStore::Alloc(size_t size) {
  size = FX_4BYTEALIGN(size);
  ASSERT(size != 0);
  FX_STATICSTORECHUNK* pChunk = FindChunk(size);
  ASSERT(pChunk->iFreeSize >= size);
  uint8_t* p = (uint8_t*)pChunk;
  p += sizeof(FX_STATICSTORECHUNK) + pChunk->iChunkSize - pChunk->iFreeSize;
  pChunk->iFreeSize -= size;
  m_iAllocatedSize += size;
  return p;
}
开发者ID:hfiguiere,项目名称:pdfium,代码行数:11,代码来源:fgas_memory.cpp


示例19: chunk

	LevelChunk* Level::GetChunk(const Vector2i& index)
	{
		SharedPtr<LevelChunk> chunk(FindChunk(index));
		if (chunk) return chunk;

		chunk = new LevelChunk(_context);
		chunk->Init(this, index);
		_chunks.Add(chunk);

		return chunk;
	}
开发者ID:kolyden,项目名称:engine-old,代码行数:11,代码来源:Level.cpp


示例20: LoadSoundFromFile

void LoadSoundFromFile(LPCWSTR filename, WAVEFORMATEX& waveFormat, XAUDIO2_BUFFER& buffer)
{
	// Open the file
	HANDLE hFile = CreateFile(filename, GENERIC_READ, FILE_SHARE_READ, NULL, OPEN_EXISTING, 0, NULL);

	if(INVALID_HANDLE_VALUE == hFile)
		exit(EXIT_FAILURE);

	if(INVALID_SET_FILE_POINTER == SetFilePointer(hFile, 0, NULL, FILE_BEGIN))
		exit(EXIT_FAILURE);

	//locate the riff chunk and check the filetype
	DWORD dwChunkSize;
	DWORD dwChunkPosition;
	//check the file type, should be fourccWAVE or 'XWMA'
	FindChunk(hFile, fourccRIFF, dwChunkSize, dwChunkPosition);
	DWORD filetype;
	ReadChunkData(hFile,&filetype, sizeof(DWORD), dwChunkPosition);
	if(filetype != fourccWAVE)
		exit(EXIT_FAILURE);

	//locate the "fmt" chunk and copy it into a WAVEFMTEXTENSIBLE structure (wfx)
	//WAVEFORMATEXTENSIBLE wfx = {0};
	FindChunk(hFile,fourccFMT, dwChunkSize, dwChunkPosition);
	ReadChunkData(hFile, &waveFormat, dwChunkSize, dwChunkPosition);

	//Locate the 'data' chunk, and read its contents into a buffer
	//fill out the audio data buffer with the contents of the fourccDATA chunk
	FindChunk(hFile,fourccDATA, dwChunkSize, dwChunkPosition);
	BYTE * pDataBuffer = new BYTE[dwChunkSize];
	ReadChunkData(hFile, pDataBuffer, dwChunkSize, dwChunkPosition);

	//Populate an XAUDIO2_BUFFER structure
	buffer.AudioBytes = dwChunkSize;  //buffer containing audio data
	buffer.pAudioData = pDataBuffer;  //size of the audio buffer in bytes
	buffer.Flags = XAUDIO2_END_OF_STREAM; // tell the source voice not to expect any data after this buffer
}
开发者ID:ppeschke,项目名称:sf2,代码行数:37,代码来源:XAudio.cpp



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
C++ FindClient函数代码示例发布时间:2022-05-30
下一篇:
C++ FindChild函数代码示例发布时间:2022-05-30
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap