diff src/ljvorbis.h @ 0:c84446dfb3f5

initial add
author paulo@localhost
date Fri, 13 Mar 2009 00:39:12 -0700
parents
children
line diff
     1.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.2 +++ b/src/ljvorbis.h	Fri Mar 13 00:39:12 2009 -0700
     1.3 @@ -0,0 +1,76 @@
     1.4 +/*
     1.5 +
     1.6 +ljvorbis.h
     1.7 +Simple wrapper around vorbisfile for use with the Allegro library
     1.8 +copyright 2006 Damian Yerrick
     1.9 +based on vorbisfile example
    1.10 +copyright 1994-2004 Xiph.Org Foundation
    1.11 +licensed under a BSD style license set forth in COPYING-OGG.txt
    1.12 +
    1.13 +*/
    1.14 +
    1.15 +#ifndef LJVORBIS_H
    1.16 +#define LJVORBIS_H
    1.17 +
    1.18 +#include <vorbis/codec.h>
    1.19 +#include <vorbis/vorbisfile.h>
    1.20 +#include <allegro.h>
    1.21 +
    1.22 +typedef struct LJVorbis {
    1.23 +  FILE *fp;
    1.24 +  AUDIOSTREAM *voice;
    1.25 +  OggVorbis_File vf;
    1.26 +  int bitstream;
    1.27 +  unsigned int bufferSize;
    1.28 +  unsigned int rate;
    1.29 +  unsigned long int length;
    1.30 +  unsigned long int loopPoint;
    1.31 +  unsigned char channels;
    1.32 +  unsigned char paused;
    1.33 +} LJVorbis;
    1.34 +
    1.35 +/**
    1.36 + * Creates a new LJVorbis instance.
    1.37 + * @param filename the name of the .ogg file to open
    1.38 + * @return an LJVorbis pointer
    1.39 + */
    1.40 +LJVorbis *LJVorbis_open(const char *filename);
    1.41 +
    1.42 +/**
    1.43 + * Sets the loop point of an LJVorbis.  If it is past the end
    1.44 + * of the file, sets the loop point to the start of the file.
    1.45 + * @param loopPoint the sample number to seek back to
    1.46 + */
    1.47 +void LJVorbis_setLoop(LJVorbis *ogg, unsigned long int loopPoint);
    1.48 +
    1.49 +/**
    1.50 + * Starts or restarts an LJVorbis playing in a new Allegro voice.
    1.51 + * @param bufferSize the size of the Allegro audio buffer in samples
    1.52 + * @param vol the Allegro volume (0-255?)
    1.53 + * @param pan the Allegro pan value (0=left, 256=right)
    1.54 + */
    1.55 +int LJVorbis_start(LJVorbis *ogg, int bufferSize, int vol, int pan);
    1.56 +
    1.57 +/**
    1.58 + * Stops an LJVorbis and frees its Allegro voice.
    1.59 + */
    1.60 +void LJVorbis_stop(LJVorbis *ogg);
    1.61 +
    1.62 +/**
    1.63 + * Destroys an LJVorbis instance entirely.
    1.64 + */
    1.65 +void LJVorbis_close(LJVorbis *ogg);
    1.66 +
    1.67 +/**
    1.68 + * Pauses or resumes an LJVorbis.
    1.69 + * @param value 0 to pause, or nonzero to resume
    1.70 + */
    1.71 +void LJVorbis_pause(LJVorbis *ogg, int value);
    1.72 +
    1.73 +/**
    1.74 + * Processes an LJVorbis
    1.75 + * Must be called periodically, at least once every bufferSize samples.
    1.76 + */
    1.77 +int LJVorbis_poll(LJVorbis *ogg);
    1.78 +
    1.79 +#endif