view src/ljvorbis.h @ 1:38c62fded078

initial builds (linux and lj.nds)
author paulo@localhost
date Fri, 13 Mar 2009 01:10:13 -0700
parents
children
line source
1 /*
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
10 */
12 #ifndef LJVORBIS_H
13 #define LJVORBIS_H
15 #include <vorbis/codec.h>
16 #include <vorbis/vorbisfile.h>
17 #include <allegro.h>
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;
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);
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);
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);
54 /**
55 * Stops an LJVorbis and frees its Allegro voice.
56 */
57 void LJVorbis_stop(LJVorbis *ogg);
59 /**
60 * Destroys an LJVorbis instance entirely.
61 */
62 void LJVorbis_close(LJVorbis *ogg);
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);
70 /**
71 * Processes an LJVorbis
72 * Must be called periodically, at least once every bufferSize samples.
73 */
74 int LJVorbis_poll(LJVorbis *ogg);
76 #endif