⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 pcm.c

📁 Vovida 社区开源的 SIP 协议源码
💻 C
📖 第 1 页 / 共 5 页
字号:
	total /= psf->bytewidth ;	if (total < len)		psf->error = SFE_SHORT_READ ;		return total ;} /* pcm_read_bet2s */static intpcm_read_let2s (SF_PRIVATE *psf, short *ptr, int len){	unsigned int readcount, thisread ;	int		bytecount, bufferlen ;	int		index = 0, total = 0 ;	bufferlen = SF_BUFFER_LEN - (SF_BUFFER_LEN % psf->blockwidth) ;	bytecount = len * psf->bytewidth ;	while (bytecount > 0)	{	readcount = (bytecount >= bufferlen) ? bufferlen : bytecount ;		thisread = fread (psf->buffer, 1, readcount, psf->file) ;		let2s_array ((tribyte*) (psf->buffer), thisread / psf->bytewidth, ptr, index) ;		total += thisread ;		if (thisread < readcount)			break ;		index += thisread / psf->bytewidth ;		bytecount -= thisread ;		} ;	total /= psf->bytewidth ;	if (total < len)		psf->error = SFE_SHORT_READ ;		return total ;} /* pcm_read_let2s */static intpcm_read_bei2s (SF_PRIVATE *psf, short *ptr, int len){	unsigned int readcount, thisread ;	int		bytecount, bufferlen ;	int		index = 0, total = 0 ;	bufferlen = SF_BUFFER_LEN - (SF_BUFFER_LEN % psf->blockwidth) ;	bytecount = len * psf->bytewidth ;	while (bytecount > 0)	{	readcount = (bytecount >= bufferlen) ? bufferlen : bytecount ;		thisread = fread (psf->buffer, 1, readcount, psf->file) ;		bei2s_array ((int*) (psf->buffer), thisread / psf->bytewidth, ptr, index) ;		total += thisread ;		if (thisread < readcount)			break ;		index += thisread / psf->bytewidth ;		bytecount -= thisread ;		} ;	total /= psf->bytewidth ;	if (total < len)		psf->error = SFE_SHORT_READ ;		return total ;} /* pcm_read_bei2s */static intpcm_read_lei2s (SF_PRIVATE *psf, short *ptr, int len){	unsigned int readcount, thisread ;	int		bytecount, bufferlen ;	int		index = 0, total = 0 ;	bufferlen = SF_BUFFER_LEN - (SF_BUFFER_LEN % psf->blockwidth) ;	bytecount = len * psf->bytewidth ;	while (bytecount > 0)	{	readcount = (bytecount >= bufferlen) ? bufferlen : bytecount ;		thisread = fread (psf->buffer, 1, readcount, psf->file) ;		lei2s_array ((int*) (psf->buffer), thisread / psf->bytewidth, ptr, index) ;		total += thisread ;		if (thisread < readcount)			break ;		index += thisread / psf->bytewidth ;		bytecount -= thisread ;		} ;	total /= psf->bytewidth ;	if (total < len)		psf->error = SFE_SHORT_READ ;		return total ;} /* pcm_read_lei2s *//*-----------------------------------------------------------------------------------------------*/static intpcm_read_sc2i (SF_PRIVATE *psf, int *ptr, int len){	unsigned int readcount, thisread ;	int		bytecount, bufferlen ;	int		index = 0, total = 0 ;	bufferlen = SF_BUFFER_LEN - (SF_BUFFER_LEN % psf->blockwidth) ;	bytecount = len * psf->bytewidth ;	while (bytecount > 0)	{	readcount = (bytecount >= bufferlen) ? bufferlen : bytecount ;		thisread = fread (psf->buffer, 1, readcount, psf->file) ;		sc2i_array ((signed char*) (psf->buffer), thisread / psf->bytewidth, ptr, index) ;		total += thisread ;		if (thisread < readcount)			break ;		index += thisread / psf->bytewidth ;		bytecount -= thisread ;		} ;		total /= psf->bytewidth ;	if (total < len)		psf->error = SFE_SHORT_READ ;		return total ;} /* pcm_read_sc2i */static intpcm_read_uc2i (SF_PRIVATE *psf, int *ptr, int len){	unsigned int readcount, thisread ;	int		bytecount, bufferlen ;	int		index = 0, total = 0 ;	bufferlen = SF_BUFFER_LEN - (SF_BUFFER_LEN % psf->blockwidth) ;	bytecount = len * psf->bytewidth ;	while (bytecount > 0)	{	readcount = (bytecount >= bufferlen) ? bufferlen : bytecount ;		thisread = fread (psf->buffer, 1, readcount, psf->file) ;		uc2i_array ((unsigned char*) (psf->buffer), thisread / psf->bytewidth, ptr, index) ;		total += thisread ;		if (thisread < readcount)			break ;		index += thisread / psf->bytewidth ;		bytecount -= thisread ;		} ;		total /= psf->bytewidth ;	if (total < len)		psf->error = SFE_SHORT_READ ;		return total ;} /* pcm_read_uc2i */static intpcm_read_bes2i (SF_PRIVATE *psf, int *ptr, int len){	unsigned int readcount, thisread ;	int		bytecount, bufferlen ;	int		index = 0, total = 0 ;	bufferlen = SF_BUFFER_LEN - (SF_BUFFER_LEN % psf->blockwidth) ;	bytecount = len * psf->bytewidth ;	while (bytecount > 0)	{	readcount = (bytecount >= bufferlen) ? bufferlen : bytecount ;		thisread = fread (psf->buffer, 1, readcount, psf->file) ;		bes2i_array ((short*) (psf->buffer), thisread / psf->bytewidth, ptr, index) ;		total += thisread ;		if (thisread < readcount)			break ;		index += thisread / psf->bytewidth ;		bytecount -= thisread ;		} ;	total /= psf->bytewidth ;	if (total < len)		psf->error = SFE_SHORT_READ ;		return total ;} /* pcm_read_bes2i */static intpcm_read_les2i (SF_PRIVATE *psf, int *ptr, int len){	unsigned int readcount, thisread ;	int		bytecount, bufferlen ;	int		index = 0, total = 0 ;	bufferlen = SF_BUFFER_LEN - (SF_BUFFER_LEN % psf->blockwidth) ;	bytecount = len * psf->bytewidth ;	while (bytecount > 0)	{	readcount = (bytecount >= bufferlen) ? bufferlen : bytecount ;		thisread = fread (psf->buffer, 1, readcount, psf->file) ;		les2i_array ((short*) (psf->buffer), thisread / psf->bytewidth, ptr, index) ;		total += thisread ;		if (thisread < readcount)			break ;		index += thisread / psf->bytewidth ;		bytecount -= thisread ;		} ;	total /= psf->bytewidth ;	if (total < len)		psf->error = SFE_SHORT_READ ;		return total ;} /* pcm_read_les2i */static intpcm_read_bet2i (SF_PRIVATE *psf, int *ptr, int len){	unsigned int readcount, thisread ;	int		bytecount, bufferlen ;	int		index = 0, total = 0 ;	bufferlen = SF_BUFFER_LEN - (SF_BUFFER_LEN % psf->blockwidth) ;	bytecount = len * psf->bytewidth ;	while (bytecount > 0)	{	readcount = (bytecount >= bufferlen) ? bufferlen : bytecount ;		thisread = fread (psf->buffer, 1, readcount, psf->file) ;		bet2i_array ((tribyte*) (psf->buffer), thisread / psf->bytewidth, ptr, index) ;		total += thisread ;		if (thisread < readcount)			break ;		index += thisread / psf->bytewidth ;		bytecount -= thisread ;		} ;	total /= psf->bytewidth ;	if (total < len)		psf->error = SFE_SHORT_READ ;		return total ;} /* pcm_read_bet2i */static intpcm_read_let2i (SF_PRIVATE *psf, int *ptr, int len){	unsigned int readcount, thisread ;	int		bytecount, bufferlen ;	int		index = 0, total = 0 ;	bufferlen = SF_BUFFER_LEN - (SF_BUFFER_LEN % psf->blockwidth) ;	bytecount = len * psf->bytewidth ;	while (bytecount > 0)	{	readcount = (bytecount >= bufferlen) ? bufferlen : bytecount ;		thisread = fread (psf->buffer, 1, readcount, psf->file) ;		let2i_array ((tribyte*) (psf->buffer), thisread / psf->bytewidth, ptr, index) ;		total += thisread ;		if (thisread < readcount)			break ;		index += thisread / psf->bytewidth ;		bytecount -= thisread ;		} ;	total /= psf->bytewidth ;	if (total < len)		psf->error = SFE_SHORT_READ ;		return total ;} /* pcm_read_let2i */static intpcm_read_bei2i (SF_PRIVATE *psf, int *ptr, int len){	int		total ;	total = fread (ptr, 1, len * sizeof (int), psf->file) ;	if (CPU_IS_LITTLE_ENDIAN)		endswap_int_array	(ptr, len) ;	total /= psf->bytewidth ;	if (total < len)		psf->error = SFE_SHORT_READ ;		return total ;} /* pcm_read_bei2i */static intpcm_read_lei2i (SF_PRIVATE *psf, int *ptr, int len){	int		total ;	total = fread (ptr, 1, len * sizeof (int), psf->file) ;	if (CPU_IS_BIG_ENDIAN)		endswap_int_array	(ptr, len) ;	total /= psf->bytewidth ;	if (total < len)		psf->error = SFE_SHORT_READ ;		return total ;} /* pcm_read_lei2i *//*-----------------------------------------------------------------------------------------------*/static intpcm_read_sc2f (SF_PRIVATE *psf, float *ptr, int len){	unsigned int readcount, thisread ;	int		bytecount, bufferlen ;	int		index = 0, total = 0 ;	bufferlen = SF_BUFFER_LEN - (SF_BUFFER_LEN % psf->blockwidth) ;	bytecount = len * psf->bytewidth ;	while (bytecount > 0)	{	readcount = (bytecount >= bufferlen) ? bufferlen : bytecount ;		thisread = fread (psf->buffer, 1, readcount, psf->file) ;		sc2f_array ((signed char*) (psf->buffer), thisread / psf->bytewidth, ptr, index, 1.0) ;		total += thisread ;		if (thisread < readcount)			break ;		index += thisread / psf->bytewidth ;		bytecount -= thisread ;		} ;	total /= psf->bytewidth ;	if (total < len)		psf->error = SFE_SHORT_READ ;		return total ;} /* pcm_read_sc2f */static intpcm_read_uc2f (SF_PRIVATE *psf, float *ptr, int len){	unsigned int readcount, thisread ;	int		bytecount, bufferlen ;	int		index = 0, total = 0 ;	bufferlen = SF_BUFFER_LEN - (SF_BUFFER_LEN % psf->blockwidth) ;	bytecount = len * psf->bytewidth ;	while (bytecount > 0)	{	readcount = (bytecount >= bufferlen) ? bufferlen : bytecount ;		thisread = fread (psf->buffer, 1, readcount, psf->file) ;		uc2f_array ((unsigned char*) (psf->buffer), thisread / psf->bytewidth, ptr, index, 1.0) ;		total += thisread ;		if (thisread < readcount)			break ;		index += thisread / psf->bytewidth ;		bytecount -= thisread ;		} ;	total /= psf->bytewidth ;	if (total < len)		psf->error = SFE_SHORT_READ ;		return total ;} /* pcm_read_uc2f */static intpcm_read_bes2f (SF_PRIVATE *psf, float *ptr, int len){	unsigned int readcount, thisread ;	int		bytecount, bufferlen ;	int		index = 0, total = 0 ;	bufferlen = SF_BUFFER_LEN - (SF_BUFFER_LEN % psf->blockwidth) ;	bytecount = len * psf->bytewidth ;	while (bytecount > 0)	{	readcount = (bytecount >= bufferlen) ? bufferlen : bytecount ;		thisread = fread (psf->buffer, 1, readcount, psf->file) ;		bes2f_array ((short*) (psf->buffer), thisread / psf->bytewidth, ptr, index, 1.0) ;		total += thisread ;		if (thisread < readcount)			break ;		index += thisread / psf->bytewidth ;		bytecount -= thisread ;		} ;	total /= psf->bytewidth ;	if (total < len)		psf->error = SFE_SHORT_READ ;		return total ;} /* pcm_read_bes2f */static intpcm_read_les2f (SF_PRIVATE *psf, float *ptr, int len){	unsigned int readcount, thisread ;	int		bytecount, bufferlen ;	int		index = 0, total = 0 ;	bufferlen = SF_BUFFER_LEN - (SF_BUFFER_LEN % psf->blockwidth) ;	bytecount = len * psf->bytewidth ;	while (bytecount > 0)	{	readcount = (bytecount >= bufferlen) ? bufferlen : bytecount ;		thisread = fread (psf->buffer, 1, readcount, psf->file) ;		les2f_array ((short*) (psf->buffer), thisread / psf->bytewidth, ptr, index, 1.0) ;		total += thisread ;		if (thisread < readcount)			break ;		index += thisread / psf->bytewidth ;		bytecount -= thisread ;		} ;	total /= psf->bytewidth ;	if (total < len)		psf->error = SFE_SHORT_READ ;		return total ;} /* pcm_read_les2f */static intpcm_read_bet2f (SF_PRIVATE *psf, float *ptr, int len){	unsigned int readcount, thisread ;	int		bytecount, bufferlen ;	int		index = 0, total = 0 ;	bufferlen = SF_BUFFER_LEN - (SF_BUFFER_LEN % psf->blockwidth) ;	bytecount = len * psf->bytewidth ;	while (bytecount > 0)	{	readcount = (bytecount >= bufferlen) ? bufferlen : bytecount ;		thisread = fread (psf->buffer, 1, readcount, psf->file) ;		bet2f_array ((tribyte*) (psf->buffer), thisread / psf->bytewidth, ptr, index, 1.0) ;		total += thisread ;		if (thisread < readcount)			break ;		index += thisread / psf->bytewidth ;		bytecount -= thisread ;		} ;	total /= psf->bytewidth ;	if (total < len)		psf->error = SFE_SHORT_READ ;		return total ;} /* pcm_read_bet2f */

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -