PDL-Audio

 view release on metacpan or  search on metacpan

sndlib/headers.c  view on Meta::CPAN

 * the Atari .avr files appear to be 8000 Hz, mono, 8-bit linear unsigned data with an unknown header of 128 words
 * apparently there was a change in format sometime in the 90's.
 * 
 * The actual avr files I've found on the net are either garbled, or
 * something is wrong with this definition (taken from CMJ and www.wotsit.org's avr.txt). 
 * SGI dmconvert assumes big-endian here -- this is an Atari format, so it's probably safe to assume big-endian.
 */

static int read_avr_header(int chan)
{
  int dsize,dsigned,i;
  chans = mus_big_endian_short((unsigned char *)(hdrbuf+12));
  if (chans == 0) chans=1; else chans=2;
  data_location = 128;
  data_size = mus_big_endian_int((unsigned char *)(hdrbuf+26));
  header_distributed = 0;
  srate = mus_big_endian_unsigned_short((unsigned char *)(hdrbuf+24));
  dsize = mus_big_endian_short((unsigned char *)(hdrbuf+14));
  dsigned = mus_big_endian_short((unsigned char *)(hdrbuf+16));
  if (dsize == 16) 
    {
      if (dsigned == 0)
	data_format = SNDLIB_16_UNSIGNED;
      else data_format = SNDLIB_16_LINEAR;
    }
  else 
    {
      if (dsigned == 0) 
	data_format = SNDLIB_8_UNSIGNED;
      else data_format = SNDLIB_8_LINEAR;
    }
  if (seek_and_read(chan,(unsigned char *)hdrbuf,64,64) <= 0)
    {
      mus_error(MUS_HEADER_READ_FAILED,"AVR header looks wrong");
      return(-1);
    }
  comment_start = 64;
  i = 0;



( run in 1.663 second using v1.01-cache-2.11-cpan-71847e10f99 )