music_ogg.h
author Sam Lantinga <slouken@libsdl.org>
Sun, 08 Nov 2009 18:40:07 +0000
changeset 474 a2c238c0c4b2
parent 386 695494546b3c
child 518 8bc9b5fd2aae
permissions -rw-r--r--
Don't break binary compatibility!
     1 /*
     2     SDL_mixer:  An audio mixer library based on the SDL library
     3     Copyright (C) 1997-2009 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 #ifdef OGG_USE_TREMOR
    30 #include <tremor/ivorbisfile.h>
    31 #else
    32 #include <vorbis/vorbisfile.h>
    33 #endif
    34 
    35 typedef struct {
    36 	int playing;
    37 	int volume;
    38 	OggVorbis_File vf;
    39 	int section;
    40 	SDL_AudioCVT cvt;
    41 	int len_available;
    42 	Uint8 *snd_available;
    43 } OGG_music;
    44 
    45 /* Initialize the Ogg Vorbis player, with the given mixer settings
    46    This function returns 0, or -1 if there was an error.
    47  */
    48 extern int OGG_init(SDL_AudioSpec *mixer);
    49 
    50 /* Set the volume for an OGG stream */
    51 extern void OGG_setvolume(OGG_music *music, int volume);
    52 
    53 /* Load an OGG stream from the given file */
    54 extern OGG_music *OGG_new(const char *file);
    55 
    56 /* Load an OGG stream from an SDL_RWops object */
    57 extern OGG_music *OGG_new_RW(SDL_RWops *rw);
    58 
    59 /* Start playback of a given OGG stream */
    60 extern void OGG_play(OGG_music *music);
    61 
    62 /* Return non-zero if a stream is currently playing */
    63 extern int OGG_playing(OGG_music *music);
    64 
    65 /* Play some of a stream previously started with OGG_play() */
    66 extern int OGG_playAudio(OGG_music *music, Uint8 *stream, int len);
    67 
    68 /* Stop playback of a stream previously started with OGG_play() */
    69 extern void OGG_stop(OGG_music *music);
    70 
    71 /* Close the given OGG stream */
    72 extern void OGG_delete(OGG_music *music);
    73 
    74 /* Jump (seek) to a given position (time is in seconds) */
    75 extern void OGG_jump_to_time(OGG_music *music, double time);
    76 
    77 #endif /* OGG_MUSIC */