misc_wav.h 1.6 KB

1234567891011121314151617181920212223242526272829303132333435363738394041
  1. /*
  2. misc_wav.h
  3. Copyright (c) 2004 NoisyB
  4. This library is free software; you can redistribute it and/or
  5. modify it under the terms of the GNU Lesser General Public
  6. License as published by the Free Software Foundation; either
  7. version 2.1 of the License, or (at your option) any later version.
  8. This library is distributed in the hope that it will be useful,
  9. but WITHOUT ANY WARRANTY; without even the implied warranty of
  10. MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
  11. Lesser General Public License for more details.
  12. You should have received a copy of the GNU Lesser General Public
  13. License along with this library; if not, write to the Free Software
  14. Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
  15. */
  16. #ifndef MISC_WAV_H
  17. #define MISC_WAV_H
  18. /*
  19. misc_wav_header() read/(over-)write a wav header
  20. mode == "r", "rb", "w", "wb", etc...
  21. it does NOT insert a wav header
  22. misc_wav_generator() generate a SQUARE_WAVE or SINE_WAVE
  23. */
  24. extern int misc_wav_write_header (FILE *fh, int channels, int freq,
  25. int bytespersecond, int blockalign,
  26. int bitspersample, int data_length);
  27. // TODO: remove these
  28. #define misc_wav_write_header_v2(fh,c,f,bit,dl) misc_wav_write_header(fh, c, f, (bit*c*f)/8, (bit*c)/8, bit, dl)
  29. #define misc_wav_write_header_v3(fh,dl) misc_wav_write_header (fh, 2, 44100, 176400, 4, 16, dl)
  30. #define SQUARE_WAVE 0
  31. #define SINE_WAVE 1
  32. extern void misc_wav_generator (unsigned char *bit, int bitLength,
  33. float volume, int wavType);
  34. #endif // MISC_WAV_H