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