vorbisStreamSource.h 1.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960
  1. //--------------------------------------------
  2. // vorbisStreamSource.h
  3. // header for streaming audio source for Ogg Vorbis
  4. //
  5. // Kurtis Seebaldt
  6. //--------------------------------------------
  7. #ifndef _VORBISSTREAMSOURCE_H_
  8. #define _VORBISSTREAMSOURCE_H_
  9. #ifndef _AUDIOSTREAMSOURCE_H_
  10. #include "audio/audioStreamSource.h"
  11. #endif
  12. #ifndef TORQUE_OS_IOS
  13. #include "vorbis/vorbisfile.h"
  14. class VorbisStreamSource: public AudioStreamSource
  15. {
  16. public:
  17. VorbisStreamSource(const char *filename);
  18. virtual ~VorbisStreamSource();
  19. virtual bool initStream();
  20. virtual bool updateBuffers();
  21. virtual void freeStream();
  22. virtual F32 getElapsedTime();
  23. virtual F32 getTotalTime();
  24. private:
  25. ALuint mBufferList[NUMBUFFERS];
  26. S32 mNumBuffers;
  27. S32 mBufferSize;
  28. Stream *stream;
  29. bool bReady;
  30. bool bFinished;
  31. ALenum format;
  32. ALsizei size;
  33. ALsizei freq;
  34. ALuint DataSize;
  35. ALuint DataLeft;
  36. ALuint buffersinqueue;
  37. bool bBuffersAllocated;
  38. bool bVorbisFileInitialized;
  39. int current_section;
  40. OggVorbis_File vf;
  41. void clear();
  42. long oggRead(char *buffer,int length, int bigendianp,int *bitstream);
  43. void resetStream();
  44. void setNewFile(const char * file);
  45. };
  46. #endif
  47. #endif // _VORBISSTREAMSOURCE_H_