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