Ignore:
Timestamp:
Mar 18, 2008, 9:36:56 PM (15 years ago)
Author:
Sam Hocevar
Message:
  • Get rid of ugly tabs and trailing spaces everywhere.
File:
1 edited

Legend:

Unmodified
Added
Removed
  • abuse/trunk/src/imlib/readwav.cpp

    r56 r124  
    5050  fp->read(&chunk.id,4);
    5151  chunk.size=fp->read_uint32();
    52   fp->read(&chunk.type,4); 
     52  fp->read(&chunk.type,4);
    5353}
    5454
     
    6262{
    6363  fmt.fmt_tag=fp->read_uint16();
    64   fmt.channels=fp->read_uint16(); 
     64  fmt.channels=fp->read_uint16();
    6565  fmt.samplesps=fp->read_uint32();
    66   fmt.avg_bytesps=fp->read_uint32(); 
    67   fmt.align=fp->read_uint16(); 
     66  fmt.avg_bytesps=fp->read_uint32();
     67  fmt.align=fp->read_uint16();
    6868}
    6969
     
    7272{
    7373  read_wav_format(pcm.wf,fp);
    74   pcm.bitsps=fp->read_uint16(); 
     74  pcm.bitsps=fp->read_uint16();
    7575}
    7676
     
    8888
    8989  /***************  Write the chunk ***************************/
    90   fp->write((void *)"RIFF",4); 
     90  fp->write((void *)"RIFF",4);
    9191  fp->write_uint32(data_size+36);
    9292  fp->write((void *)"WAVE",4);
     
    9696  fp->write((void *)"fmt ",4);
    9797  fp->write_uint32(16);
    98  
    99  
     98
     99
    100100  /************** Write PCM ***********************************/
    101101  fp->write_uint16(1);          // format_tag
     
    105105  fp->write_uint16(1);    // alignment? Don't know what this does?
    106106  fp->write_uint16(8);    // 8 bits per sample
    107  
     107
    108108  /************* Write data tag ******************************/
    109109  fp->write((void *)"data",4);
     
    128128  if (fp->open_failure())
    129129  { delete fp; return NULL; }
    130   read_chunk(chunk,fp);     
     130  read_chunk(chunk,fp);
    131131  if (memcmp(chunk.type,"WAVE",4)!=0)
    132132  {
    133133    printf("Bad WAV file (chunk) %s\n",filename);
    134134    delete fp;
    135     return NULL;   
     135    return NULL;
    136136  }
    137  
     137
    138138  read_tag(tag,fp);
    139139  if (memcmp(tag.id,"fmt ",4)!=0)
     
    157157    return NULL;
    158158  }
    159  
    160   data_size=tag.size; 
     159
     160  data_size=tag.size;
    161161  data=(unsigned char *)jmalloc(tag.size,"WAV data");
    162162  ERROR(data,"Malloc error");
    163163
    164   sample_rate=pcm.wf.samplesps;     
     164  sample_rate=pcm.wf.samplesps;
    165165  ERROR((unsigned int)fp->read(data,tag.size)==tag.size,"Premature end of file");
    166166  ERROR(pcm.bitsps==8,"Only 8-bit samples supported");
    167   ERROR(pcm.wf.channels==1,"Only mono samples supported"); 
    168   ERROR(pcm.wf.align==1,"Bad block alignment");   
     167  ERROR(pcm.wf.channels==1,"Only mono samples supported");
     168  ERROR(pcm.wf.align==1,"Bad block alignment");
    169169  delete fp;
    170170  return data;
Note: See TracChangeset for help on using the changeset viewer.