get_audio.h 2.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990
  1. /*
  2. * Get Audio routines include file
  3. *
  4. * Copyright (c) 1999 Albert L Faber
  5. * 2010 Robert Hegemann
  6. *
  7. * This library is free software; you can redistribute it and/or
  8. * modify it under the terms of the GNU Library General Public
  9. * License as published by the Free Software Foundation; either
  10. * version 2 of the License, or (at your option) any later version.
  11. *
  12. * This library is distributed in the hope that it will be useful,
  13. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  14. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
  15. * Library General Public License for more details.
  16. *
  17. * You should have received a copy of the GNU Library General Public
  18. * License along with this library; if not, write to the
  19. * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
  20. * Boston, MA 02111-1307, USA.
  21. */
  22. #ifndef LAME_GET_AUDIO_H
  23. #define LAME_GET_AUDIO_H
  24. #include "lame.h"
  25. #include <stdio.h>
  26. #ifdef __cplusplus
  27. extern "C" {
  28. #endif
  29. typedef enum sound_file_format_e {
  30. sf_unknown,
  31. sf_raw,
  32. sf_wave,
  33. sf_aiff,
  34. sf_mp1, /* MPEG Layer 1, aka mpg */
  35. sf_mp2, /* MPEG Layer 2 */
  36. sf_mp3, /* MPEG Layer 3 */
  37. sf_mp123, /* MPEG Layer 1,2 or 3; whatever .mp3, .mp2, .mp1 or .mpg contains */
  38. sf_ogg
  39. } sound_file_format;
  40. int is_mpeg_file_format( int input_format );
  41. int init_infile(lame_t gfp, char const * inPath);
  42. int samples_to_skip_at_start(void);
  43. int samples_to_skip_at_end(void);
  44. void close_infile(void);
  45. int get_audio(lame_t gfp, int buffer[2][1152]);
  46. int get_audio16(lame_t gfp, short buffer[2][1152]);
  47. int get_audio_float(lame_t gfp, float buffer[2][1152]);
  48. int get_audio_double(lame_t gfp, double buffer[2][1152]);
  49. hip_t get_hip(void);
  50. FILE *init_outfile(char const *outPath, int decode);
  51. int WriteWaveHeader(FILE * const fp, int pcmbytes, int freq, int channels, int bits);
  52. void put_audio16(FILE* outf, short Buffer[2][1152], int iread, int nch);
  53. /*
  54. struct AudioReader;
  55. typedef struct AudioReader* AudioReader;
  56. AudioReader ar_open(lame_t gfp, char const* inPath);
  57. int ar_samplesToSkipAtStart(AudioReader ar);
  58. int ar_samplesToSkipAtEnd(AudioReader ar);
  59. void ar_close(AudioReader ar);
  60. int ar_readInt(AudioReader ar, lame_t gfp, int buffer[2][1152]);
  61. int ar_readShort(AudioReader ar, lame_t gfp, short buffer[2][1152]);
  62. int ar_readFloat(AudioReader ar, lame_t gfp, float buffer[2][1152]);
  63. struct AudioWriter;
  64. typedef struct AudioWriter* AudioWriter;
  65. AudioWriter aw_open(lame_t gfp, char const* outPath, int pcmbystes, int freq, int channels, int bits);
  66. int aw_writeWaveHeader(AudioWriter aw);
  67. int aw_write(AudioWriter aw, short buffer[2][1152], int n);
  68. int aw_write(AudioWriter aw, float buffer[2][1152], int n);
  69. */
  70. extern size_t sizeOfOldTag(lame_t gf);
  71. extern unsigned char* getOldTag(lame_t gf);
  72. #ifdef _cplusplus
  73. }
  74. #endif
  75. #endif /* ifndef LAME_GET_AUDIO_H */