wavestream.h
author Sam Lantinga <slouken@libsdl.org>
Sun, 08 Nov 2009 18:40:07 +0000
changeset 474 a2c238c0c4b2
parent 407 73a92ea2c061
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 /* This file supports streaming WAV files, without volume adjustment */
    26 
    27 #include <stdio.h>
    28 
    29 typedef struct {
    30 	SDL_RWops *rw;
    31 	SDL_bool freerw;
    32 	long  start;
    33 	long  stop;
    34 	SDL_AudioCVT cvt;
    35 } WAVStream;
    36 
    37 /* Initialize the WAVStream player, with the given mixer settings
    38    This function returns 0, or -1 if there was an error.
    39  */
    40 extern int WAVStream_Init(SDL_AudioSpec *mixer);
    41 
    42 /* Unimplemented */
    43 extern void WAVStream_SetVolume(int volume);
    44 
    45 /* Load a WAV stream from the given file */
    46 extern WAVStream *WAVStream_LoadSong(const char *file, const char *magic);
    47 
    48 /* Load a WAV stream from an SDL_RWops object */
    49 extern WAVStream *WAVStream_LoadSong_RW(SDL_RWops *rw, const char *magic);
    50 
    51 /* Start playback of a given WAV stream */
    52 extern void WAVStream_Start(WAVStream *wave);
    53 
    54 /* Play some of a stream previously started with WAVStream_Start() */
    55 extern int WAVStream_PlaySome(Uint8 *stream, int len);
    56 
    57 /* Stop playback of a stream previously started with WAVStream_Start() */
    58 extern void WAVStream_Stop(void);
    59 
    60 /* Close the given WAV stream */
    61 extern void WAVStream_FreeSong(WAVStream *wave);
    62 
    63 /* Return non-zero if a stream is currently playing */
    64 extern int WAVStream_Active(void);