You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

54 lines
1.3KB

  1. /*
  2. Copyright (C) 2006-2011 Nasca Octavian Paul
  3. Author: Nasca Octavian Paul
  4. This program is free software; you can redistribute it and/or modify
  5. it under the terms of version 2 of the GNU General Public License
  6. as published by the Free Software Foundation.
  7. This program is distributed in the hope that it will be useful,
  8. but WITHOUT ANY WARRANTY; without even the implied warranty of
  9. MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  10. GNU General Public License (version 2) for more details.
  11. You should have received a copy of the GNU General Public License (version 2)
  12. along with this program; if not, write to the Free Software Foundation,
  13. Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
  14. */
  15. #ifndef VORBISOUTPUT_H
  16. #define VORBISOUTPUT_H
  17. #include <string>
  18. #include <stdio.h>
  19. #include <vorbis/vorbisenc.h>
  20. #ifndef REALTYPE
  21. #define REALTYPE float
  22. #endif
  23. class VorbisOutputS{
  24. public:
  25. VorbisOutputS();
  26. ~VorbisOutputS();
  27. bool newfile(std::string filename,int samplerate,REALTYPE quality=3.5);//quality 0.0-10.0
  28. void close();
  29. void write(int nsmps, REALTYPE *smpsl,REALTYPE *smpr);
  30. private:
  31. bool opened;
  32. ogg_stream_state os;
  33. ogg_page og;
  34. ogg_packet op;
  35. vorbis_info vi;
  36. vorbis_comment vc;
  37. vorbis_dsp_state vd;
  38. vorbis_block vb;
  39. FILE *outfile;
  40. };
  41. #endif