Mercurial > hg > index.fcgi > lj > lj046
annotate src/ljvorbis.h @ 3:17286938e22a
change DS alt. rotate key to rotate twice
author | paulo@localhost |
---|---|
date | Wed, 08 Apr 2009 21:50:13 -0700 |
parents | |
children |
rev | line source |
---|---|
paulo@0 | 1 /* |
paulo@0 | 2 |
paulo@0 | 3 ljvorbis.h |
paulo@0 | 4 Simple wrapper around vorbisfile for use with the Allegro library |
paulo@0 | 5 copyright 2006 Damian Yerrick |
paulo@0 | 6 based on vorbisfile example |
paulo@0 | 7 copyright 1994-2004 Xiph.Org Foundation |
paulo@0 | 8 licensed under a BSD style license set forth in COPYING-OGG.txt |
paulo@0 | 9 |
paulo@0 | 10 */ |
paulo@0 | 11 |
paulo@0 | 12 #ifndef LJVORBIS_H |
paulo@0 | 13 #define LJVORBIS_H |
paulo@0 | 14 |
paulo@0 | 15 #include <vorbis/codec.h> |
paulo@0 | 16 #include <vorbis/vorbisfile.h> |
paulo@0 | 17 #include <allegro.h> |
paulo@0 | 18 |
paulo@0 | 19 typedef struct LJVorbis { |
paulo@0 | 20 FILE *fp; |
paulo@0 | 21 AUDIOSTREAM *voice; |
paulo@0 | 22 OggVorbis_File vf; |
paulo@0 | 23 int bitstream; |
paulo@0 | 24 unsigned int bufferSize; |
paulo@0 | 25 unsigned int rate; |
paulo@0 | 26 unsigned long int length; |
paulo@0 | 27 unsigned long int loopPoint; |
paulo@0 | 28 unsigned char channels; |
paulo@0 | 29 unsigned char paused; |
paulo@0 | 30 } LJVorbis; |
paulo@0 | 31 |
paulo@0 | 32 /** |
paulo@0 | 33 * Creates a new LJVorbis instance. |
paulo@0 | 34 * @param filename the name of the .ogg file to open |
paulo@0 | 35 * @return an LJVorbis pointer |
paulo@0 | 36 */ |
paulo@0 | 37 LJVorbis *LJVorbis_open(const char *filename); |
paulo@0 | 38 |
paulo@0 | 39 /** |
paulo@0 | 40 * Sets the loop point of an LJVorbis. If it is past the end |
paulo@0 | 41 * of the file, sets the loop point to the start of the file. |
paulo@0 | 42 * @param loopPoint the sample number to seek back to |
paulo@0 | 43 */ |
paulo@0 | 44 void LJVorbis_setLoop(LJVorbis *ogg, unsigned long int loopPoint); |
paulo@0 | 45 |
paulo@0 | 46 /** |
paulo@0 | 47 * Starts or restarts an LJVorbis playing in a new Allegro voice. |
paulo@0 | 48 * @param bufferSize the size of the Allegro audio buffer in samples |
paulo@0 | 49 * @param vol the Allegro volume (0-255?) |
paulo@0 | 50 * @param pan the Allegro pan value (0=left, 256=right) |
paulo@0 | 51 */ |
paulo@0 | 52 int LJVorbis_start(LJVorbis *ogg, int bufferSize, int vol, int pan); |
paulo@0 | 53 |
paulo@0 | 54 /** |
paulo@0 | 55 * Stops an LJVorbis and frees its Allegro voice. |
paulo@0 | 56 */ |
paulo@0 | 57 void LJVorbis_stop(LJVorbis *ogg); |
paulo@0 | 58 |
paulo@0 | 59 /** |
paulo@0 | 60 * Destroys an LJVorbis instance entirely. |
paulo@0 | 61 */ |
paulo@0 | 62 void LJVorbis_close(LJVorbis *ogg); |
paulo@0 | 63 |
paulo@0 | 64 /** |
paulo@0 | 65 * Pauses or resumes an LJVorbis. |
paulo@0 | 66 * @param value 0 to pause, or nonzero to resume |
paulo@0 | 67 */ |
paulo@0 | 68 void LJVorbis_pause(LJVorbis *ogg, int value); |
paulo@0 | 69 |
paulo@0 | 70 /** |
paulo@0 | 71 * Processes an LJVorbis |
paulo@0 | 72 * Must be called periodically, at least once every bufferSize samples. |
paulo@0 | 73 */ |
paulo@0 | 74 int LJVorbis_poll(LJVorbis *ogg); |
paulo@0 | 75 |
paulo@0 | 76 #endif |