Newer
Older
monitord / lame-3.97 / frontend / .svn / text-base / get_audio.h.svn-base
  1. /*
  2. * Get Audio routines include file
  3. *
  4. * Copyright (c) 1999 Albert L Faber
  5. *
  6. * This library is free software; you can redistribute it and/or
  7. * modify it under the terms of the GNU Library General Public
  8. * License as published by the Free Software Foundation; either
  9. * version 2 of the License, or (at your option) any later version.
  10. *
  11. * This library is distributed in the hope that it will be useful,
  12. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  13. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
  14. * Library General Public License for more details.
  15. *
  16. * You should have received a copy of the GNU Library General Public
  17. * License along with this library; if not, write to the
  18. * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
  19. * Boston, MA 02111-1307, USA.
  20. */
  21.  
  22.  
  23. #ifndef LAME_GET_AUDIO_H
  24. #define LAME_GET_AUDIO_H
  25. #include "lame.h"
  26. #include <stdio.h>
  27.  
  28. typedef enum sound_file_format_e {
  29. sf_unknown,
  30. sf_raw,
  31. sf_wave,
  32. sf_aiff,
  33. sf_mp1, /* MPEG Layer 1, aka mpg */
  34. sf_mp2, /* MPEG Layer 2 */
  35. sf_mp3, /* MPEG Layer 3 */
  36. sf_ogg
  37. } sound_file_format;
  38.  
  39.  
  40.  
  41.  
  42. FILE *init_outfile ( char *outPath, int decode );
  43. void init_infile(lame_global_flags *, char *inPath);
  44. void close_infile(void);
  45. int get_audio(lame_global_flags * const gfp, int buffer[2][1152]);
  46. int get_audio16(lame_global_flags * const gfp, short buffer[2][1152]);
  47. int WriteWaveHeader(FILE * const fp, const int pcmbytes,
  48. const int freq, const int channels, const int bits);
  49.  
  50.  
  51.  
  52. /* the simple lame decoder */
  53. /* After calling lame_init(), lame_init_params() and
  54. * init_infile(), call this routine to read the input MP3 file
  55. * and output .wav data to the specified file pointer
  56. * lame_decoder will ignore the first 528 samples, since these samples
  57. * represent the mpglib decoding delay (and are all 0).
  58. *skip = number of additional
  59. * samples to skip, to (for example) compensate for the encoder delay,
  60. * only used when decoding mp3
  61. */
  62. int lame_decoder(lame_global_flags *gfp,FILE *outf,int skip, char *inPath, char *outPath);
  63.  
  64.  
  65.  
  66. void SwapBytesInWords( short *loc, int words );
  67.  
  68.  
  69.  
  70. #ifdef LIBSNDFILE
  71.  
  72. #include "sndfile.h"
  73.  
  74.  
  75. #else
  76. /*****************************************************************
  77. * LAME/ISO built in audio file I/O routines
  78. *******************************************************************/
  79. #include "portableio.h"
  80.  
  81.  
  82. typedef struct blockAlign_struct {
  83. unsigned long offset;
  84. unsigned long blockSize;
  85. } blockAlign;
  86.  
  87. typedef struct IFF_AIFF_struct {
  88. short numChannels;
  89. unsigned long numSampleFrames;
  90. short sampleSize;
  91. double sampleRate;
  92. unsigned long sampleType;
  93. blockAlign blkAlgn;
  94. } IFF_AIFF;
  95.  
  96. extern int aiff_read_headers(FILE*, IFF_AIFF*);
  97. extern int aiff_seek_to_sound_data(FILE*);
  98. extern int aiff_write_headers(FILE*, IFF_AIFF*);
  99. extern int parse_wavheader(void);
  100. extern int parse_aiff(const char fn[]);
  101. extern void aiff_check(const char*, IFF_AIFF*, int*);
  102.  
  103.  
  104.  
  105. #endif /* ifdef LIBSNDFILE */
  106. #endif /* ifndef LAME_GET_AUDIO_H */
  107.