paulo@0: /* paulo@0: paulo@0: ljvorbis.h paulo@0: Simple wrapper around vorbisfile for use with the Allegro library paulo@0: copyright 2006 Damian Yerrick paulo@0: based on vorbisfile example paulo@0: copyright 1994-2004 Xiph.Org Foundation paulo@0: licensed under a BSD style license set forth in COPYING-OGG.txt paulo@0: paulo@0: */ paulo@0: paulo@0: #ifndef LJVORBIS_H paulo@0: #define LJVORBIS_H paulo@0: paulo@0: #include paulo@0: #include paulo@0: #include paulo@0: paulo@0: typedef struct LJVorbis { paulo@0: FILE *fp; paulo@0: AUDIOSTREAM *voice; paulo@0: OggVorbis_File vf; paulo@0: int bitstream; paulo@0: unsigned int bufferSize; paulo@0: unsigned int rate; paulo@0: unsigned long int length; paulo@0: unsigned long int loopPoint; paulo@0: unsigned char channels; paulo@0: unsigned char paused; paulo@0: } LJVorbis; paulo@0: paulo@0: /** paulo@0: * Creates a new LJVorbis instance. paulo@0: * @param filename the name of the .ogg file to open paulo@0: * @return an LJVorbis pointer paulo@0: */ paulo@0: LJVorbis *LJVorbis_open(const char *filename); paulo@0: paulo@0: /** paulo@0: * Sets the loop point of an LJVorbis. If it is past the end paulo@0: * of the file, sets the loop point to the start of the file. paulo@0: * @param loopPoint the sample number to seek back to paulo@0: */ paulo@0: void LJVorbis_setLoop(LJVorbis *ogg, unsigned long int loopPoint); paulo@0: paulo@0: /** paulo@0: * Starts or restarts an LJVorbis playing in a new Allegro voice. paulo@0: * @param bufferSize the size of the Allegro audio buffer in samples paulo@0: * @param vol the Allegro volume (0-255?) paulo@0: * @param pan the Allegro pan value (0=left, 256=right) paulo@0: */ paulo@0: int LJVorbis_start(LJVorbis *ogg, int bufferSize, int vol, int pan); paulo@0: paulo@0: /** paulo@0: * Stops an LJVorbis and frees its Allegro voice. paulo@0: */ paulo@0: void LJVorbis_stop(LJVorbis *ogg); paulo@0: paulo@0: /** paulo@0: * Destroys an LJVorbis instance entirely. paulo@0: */ paulo@0: void LJVorbis_close(LJVorbis *ogg); paulo@0: paulo@0: /** paulo@0: * Pauses or resumes an LJVorbis. paulo@0: * @param value 0 to pause, or nonzero to resume paulo@0: */ paulo@0: void LJVorbis_pause(LJVorbis *ogg, int value); paulo@0: paulo@0: /** paulo@0: * Processes an LJVorbis paulo@0: * Must be called periodically, at least once every bufferSize samples. paulo@0: */ paulo@0: int LJVorbis_poll(LJVorbis *ogg); paulo@0: paulo@0: #endif