comparison src/ljvorbis.h @ 0:c84446dfb3f5

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