music_ogg.h
author Sam Lantinga <slouken@libsdl.org>
Sun, 04 Jan 2004 17:41:55 +0000
changeset 241 503416fca921
parent 155 53f259dae79d
child 246 9fa5d0f9d042
permissions -rw-r--r--
Updated copyright information for 2004 (Happy New Year!)
     1 /*
     2     SDL_mixer:  An audio mixer library based on the SDL library
     3     Copyright (C) 1997-2004 Sam Lantinga
     4 
     5     This library is free software; you can redistribute it and/or
     6     modify it under the terms of the GNU Library General Public
     7     License as published by the Free Software Foundation; either
     8     version 2 of the License, or (at your option) any later version.
     9 
    10     This library is distributed in the hope that it will be useful,
    11     but WITHOUT ANY WARRANTY; without even the implied warranty of
    12     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
    13     Library General Public License for more details.
    14 
    15     You should have received a copy of the GNU Library General Public
    16     License along with this library; if not, write to the Free
    17     Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
    18 
    19     Sam Lantinga
    20     slouken@libsdl.org
    21 */
    22 
    23 /* $Id$ */
    24 
    25 #ifdef OGG_MUSIC
    26 
    27 /* This file supports Ogg Vorbis music streams */
    28 
    29 #include <vorbis/vorbisfile.h>
    30 
    31 typedef struct {
    32 	int playing;
    33 	int volume;
    34 	OggVorbis_File vf;
    35 	int section;
    36 	SDL_AudioCVT cvt;
    37 	int len_available;
    38 	Uint8 *snd_available;
    39 } OGG_music;
    40 
    41 /* Initialize the Ogg Vorbis player, with the given mixer settings
    42    This function returns 0, or -1 if there was an error.
    43  */
    44 extern int OGG_init(SDL_AudioSpec *mixer);
    45 
    46 /* Set the volume for an OGG stream */
    47 extern void OGG_setvolume(OGG_music *music, int volume);
    48 
    49 /* Load an OGG stream from the given file */
    50 extern OGG_music *OGG_new(const char *file);
    51 
    52 /* Start playback of a given OGG stream */
    53 extern void OGG_play(OGG_music *music);
    54 
    55 /* Return non-zero if a stream is currently playing */
    56 extern int OGG_playing(OGG_music *music);
    57 
    58 /* Play some of a stream previously started with OGG_play() */
    59 extern void OGG_playAudio(OGG_music *music, Uint8 *stream, int len);
    60 
    61 /* Stop playback of a stream previously started with OGG_play() */
    62 extern void OGG_stop(OGG_music *music);
    63 
    64 /* Close the given OGG stream */
    65 extern void OGG_delete(OGG_music *music);
    66 
    67 /* Jump (seek) to a given position (time is in seconds) */
    68 extern void OGG_jump_to_time(OGG_music *music, double time);
    69 
    70 #endif /* OGG_MUSIC */