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

📄 sread.f

📁 lpc 2400 bps语音编解码程序
💻 F
字号:
	function sread(fd, buf, len)
	include 'contrl.fh'
	integer sread, swrite, spd_read, spd_write
	integer fd, len, RECLEN, i, n
	real buf(len), RSCALE, t, t2
	parameter (RECLEN=1024)
	integer*2 rec(RECLEN)
	parameter (RSCALE=1./32768.)

	if (len .gt. RECLEN) stop 'sread: too long'
	n = spd_read(fd, rec, 2*len) / 2
	do i = 1, n
	    buf(i) = rec(i)*RSCALE
	end do
	sread = n
	return

	entry swrite(fd, buf, len)
	if (len .gt. RECLEN) stop 'swrite: too long'
	do i = 1, len
	    t = 32768.*buf(i)
	    t2 = max(-32768.,min(32767.,t))
	    if (t .ne. t2) iclip = iclip + 1
	    rec(i) = t2
	end do
	n = spd_write(fd, rec, 2*len) / 2
	if (n .ne. len) stop 'swrite: I/O error'
	swrite = n
	return
	end

⌨️ 快捷键说明

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