wavestream.h
author Sam Lantinga <slouken@libsdl.org>
Wed, 04 Jan 2012 00:16:03 -0500
changeset 542 3de4970b36d4
parent 521 565549e046b0
child 601 05123263dab3
permissions -rw-r--r--
Fixed bug 1252 - Added Mix_LoadMUSType_RW() so you can tell SDL_mixer what type the music is

This involved a complete refactoring of the music loading so it's entirely rwops based and has improved music type detection code.
     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 /* This file supports streaming WAV files, without volume adjustment */
    25 
    26 #include <stdio.h>
    27 
    28 typedef struct {
    29 	SDL_RWops *rw;
    30 	SDL_bool freerw;
    31 	long  start;
    32 	long  stop;
    33 	SDL_AudioCVT cvt;
    34 } WAVStream;
    35 
    36 /* Initialize the WAVStream player, with the given mixer settings
    37    This function returns 0, or -1 if there was an error.
    38  */
    39 extern int WAVStream_Init(SDL_AudioSpec *mixer);
    40 
    41 /* Unimplemented */
    42 extern void WAVStream_SetVolume(int volume);
    43 
    44 /* Load a WAV stream from an SDL_RWops object */
    45 extern WAVStream *WAVStream_LoadSong_RW(SDL_RWops *rw, const char *magic, int freerw);
    46 
    47 /* Start playback of a given WAV stream */
    48 extern void WAVStream_Start(WAVStream *wave);
    49 
    50 /* Play some of a stream previously started with WAVStream_Start() */
    51 extern int WAVStream_PlaySome(Uint8 *stream, int len);
    52 
    53 /* Stop playback of a stream previously started with WAVStream_Start() */
    54 extern void WAVStream_Stop(void);
    55 
    56 /* Close the given WAV stream */
    57 extern void WAVStream_FreeSong(WAVStream *wave);
    58 
    59 /* Return non-zero if a stream is currently playing */
    60 extern int WAVStream_Active(void);