music_ogg.h
author Sam Lantinga <slouken@libsdl.org>
Sat, 28 Jan 2012 13:15:19 -0500
changeset 580 5d5483acd03d
parent 542 3de4970b36d4
child 601 05123263dab3
child 920 6d8ba24cbbd6
permissions -rw-r--r--
Updated framework project for SDL2
     1 /*
     2   SDL_mixer:  An audio mixer library based on the SDL library
     3   Copyright (C) 1997-2012 Sam Lantinga <slouken@libsdl.org>
     4 
     5   This software is provided 'as-is', without any express or implied
     6   warranty.  In no event will the authors be held liable for any damages
     7   arising from the use of this software.
     8 
     9   Permission is granted to anyone to use this software for any purpose,
    10   including commercial applications, and to alter it and redistribute it
    11   freely, subject to the following restrictions:
    12 
    13   1. The origin of this software must not be misrepresented; you must not
    14      claim that you wrote the original software. If you use this software
    15      in a product, an acknowledgment in the product documentation would be
    16      appreciated but is not required.
    17   2. Altered source versions must be plainly marked as such, and must not be
    18      misrepresented as being the original software.
    19   3. This notice may not be removed or altered from any source distribution.
    20 */
    21 
    22 /* $Id$ */
    23 
    24 #ifdef OGG_MUSIC
    25 
    26 /* This file supports Ogg Vorbis music streams */
    27 
    28 #ifdef OGG_USE_TREMOR
    29 #include <tremor/ivorbisfile.h>
    30 #else
    31 #include <vorbis/vorbisfile.h>
    32 #endif
    33 
    34 typedef struct {
    35 	SDL_RWops *rw;
    36 	int freerw;
    37 	int playing;
    38 	int volume;
    39 	OggVorbis_File vf;
    40 	int section;
    41 	SDL_AudioCVT cvt;
    42 	int len_available;
    43 	Uint8 *snd_available;
    44 } OGG_music;
    45 
    46 /* Initialize the Ogg Vorbis player, with the given mixer settings
    47    This function returns 0, or -1 if there was an error.
    48  */
    49 extern int OGG_init(SDL_AudioSpec *mixer);
    50 
    51 /* Set the volume for an OGG stream */
    52 extern void OGG_setvolume(OGG_music *music, int volume);
    53 
    54 /* Load an OGG stream from an SDL_RWops object */
    55 extern OGG_music *OGG_new_RW(SDL_RWops *rw, int freerw);
    56 
    57 /* Start playback of a given OGG stream */
    58 extern void OGG_play(OGG_music *music);
    59 
    60 /* Return non-zero if a stream is currently playing */
    61 extern int OGG_playing(OGG_music *music);
    62 
    63 /* Play some of a stream previously started with OGG_play() */
    64 extern int OGG_playAudio(OGG_music *music, Uint8 *stream, int len);
    65 
    66 /* Stop playback of a stream previously started with OGG_play() */
    67 extern void OGG_stop(OGG_music *music);
    68 
    69 /* Close the given OGG stream */
    70 extern void OGG_delete(OGG_music *music);
    71 
    72 /* Jump (seek) to a given position (time is in seconds) */
    73 extern void OGG_jump_to_time(OGG_music *music, double time);
    74 
    75 #endif /* OGG_MUSIC */