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

C++ GetLittleLong函数代码示例

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

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



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

示例1: 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


示例2: FindNextChunk

void FindNextChunk(char *name)
{
	while (1)
	{
		data_p=last_chunk;

		if (data_p >= iff_end)
		{	// didn't find the chunk
			data_p = NULL;
			return;
		}
		
		data_p += 4;
		iff_chunk_len = GetLittleLong();
		if (iff_chunk_len < 0)
		{
			data_p = NULL;
			return;
		}
//		if (iff_chunk_len > 1024*1024)
//			Sys_Error ("FindNextChunk: %i length is past the 1 meg sanity limit", iff_chunk_len);
		data_p -= 8;
		last_chunk = data_p + 8 + ( (iff_chunk_len + 1) & ~1 );
		if (!strncmp((char *)data_p, name, 4))
			return;
	}
}
开发者ID:AbandonedCart,项目名称:XperiaPlayNative,代码行数:27,代码来源:snd_mem.c


示例3: FindNextChunk

static void FindNextChunk(char *name)
{
	while (1)
	{
		data_p=last_chunk;

		if (data_p >= iff_end)
		{	// didn't find the chunk
			data_p = NULL;
			return;
		}
		
		data_p += 4;
		iff_chunk_len = GetLittleLong();
		if (iff_chunk_len < 0)
		{
			data_p = NULL;
			return;
		}
		data_p -= 8;
		last_chunk = data_p + 8 + ( (iff_chunk_len + 1) & ~1 );
		if (!strncmp((char *)data_p, name, 4))
			return;
	}
}
开发者ID:elhobbs,项目名称:quake3,代码行数:25,代码来源:snd_mem.c


示例4: FindNextChunk

static void
FindNextChunk(const char *name, const char *filename)
{
   while (1)
   {
      /* Need at least 8 bytes for a chunk */
      if (last_chunk + 8 >= iff_end)
      {
         data_p = NULL;
         return;
      }

      data_p = last_chunk + 4;
      iff_chunk_len = GetLittleLong();
      if (iff_chunk_len < 0 || iff_chunk_len > iff_end - data_p) {
         Con_DPrintf("Bad \"%s\" chunk length (%d) in wav file %s\n",
               name, iff_chunk_len, filename);
         data_p = NULL;
         return;
      }
      last_chunk = data_p + ((iff_chunk_len + 1) & ~1);
      data_p -= 8;
      if (!strncmp((const char *)data_p, name, 4))
         return;
   }
}
开发者ID:libretro,项目名称:tyrquake,代码行数:26,代码来源:snd_mem.c


示例5: FindNextChunk

void FindNextChunk(char *name)
{
  while (1) {
    data_p = last_chunk;
    data_p += 4;

    if (data_p >= iff_end) {
      data_p = NULL;
      return;
    }

    iff_chunk_len = GetLittleLong();

    if (iff_chunk_len < 0) {
      data_p = NULL;
      return;
    }

    data_p -= 8;
    last_chunk = data_p + 8 + ((iff_chunk_len + 1) & ~1);

    if (!strncmp((const char *) data_p, name, 4)) {
      return;
    }
  }
}
开发者ID:greck2908,项目名称:qengine,代码行数:26,代码来源:wave.c


示例6: DumpChunks

void DumpChunks(void) {
    char str[5];

    str[4] = 0;
    data_p = iff_data;
    do {
        memcpy(str, data_p, 4);
        data_p += 4;
        iff_chunk_len = GetLittleLong();
        Con_Printf("%p : %s (%d)\n", (data_p - 4), str, iff_chunk_len);
        data_p += (iff_chunk_len + 1) & ~1;
    } while (data_p < iff_end);
}
开发者ID:OldTimes-Software,项目名称:KatanaEngine,代码行数:13,代码来源:audio_wav.cpp


示例7: FindNextChunk

static void FindNextChunk (const char *name)
{
	while (1)
	{
	// Need at least 8 bytes for a chunk
		if (last_chunk + 8 >= iff_end)
		{
			data_p = NULL;
			return;
		}

		data_p = last_chunk + 4;
		iff_chunk_len = GetLittleLong();
		if (iff_chunk_len < 0 || iff_chunk_len > iff_end - data_p)
		{
			data_p = NULL;
			return;
		}
		last_chunk = data_p + ((iff_chunk_len + 1) & ~1);
		data_p -= 8;
		if (!strncmp((char *)data_p, name, 4))
			return;
	}
}
开发者ID:basecq,项目名称:q2dos,代码行数:24,代码来源:snd_mem.c


示例8: GetWavinfo

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

	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;
	format = GetLittleShort();
	if (format != 1)
	{
		Com_Printf("Microsoft PCM format only\n");
		return info;
	}

	info.channels = GetLittleShort();
	info.rate = GetLittleLong();
	data_p += 4+2;
	info.width = GetLittleShort() / 8;

// get cue chunk
	FindChunk("cue ");
	if (data_p)
	{
		data_p += 32;
		info.loopstart = GetLittleLong();
//		Com_Printf("loopstart=%d\n", sfx->loopstart);

	// if the next chunk is a LIST chunk, look for a cue length marker
		FindNextChunk ("LIST");
		if (data_p)
		{
			if (!strncmp ((char *)data_p + 28, "mark", 4))
			{	// this is not a proper parse, but it works with cooledit...
				data_p += 24;
				i = GetLittleLong ();	// samples in loop
				info.samples = info.loopstart + i;
//				Com_Printf("looped length: %i\n", i);
			}
		}
	}
	else
		info.loopstart = -1;

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

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

	if (info.samples)
	{
		if (samples < info.samples)
			Com_Error (ERR_DROP, "Sound %s has a bad loop length", name);
	}
	else
		info.samples = samples;

	info.dataofs = data_p - wav;
	
	return info;
}
开发者ID:AbandonedCart,项目名称:XperiaPlayNative,代码行数:98,代码来源:snd_mem.c



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


鲜花

握手

雷人

路过

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

请发表评论

全部评论

专题导读
上一篇:
C++ GetLocalAngles函数代码示例发布时间:2022-05-30
下一篇:
C++ GetListCtrl函数代码示例发布时间: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