wavestream.h
author Ozkan Sezer <sezeroz@gmail.com>
Thu, 11 Oct 2018 11:50:10 +0300
branchSDL-1.2
changeset 902 6c862e733898
parent 542 3de4970b36d4
child 601 05123263dab3
permissions -rw-r--r--
remove smpeg support completely and backport libmpg123 support instead.
slouken@0
     1
/*
slouken@518
     2
  SDL_mixer:  An audio mixer library based on the SDL library
slouken@518
     3
  Copyright (C) 1997-2012 Sam Lantinga <slouken@libsdl.org>
slouken@0
     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@0
     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@0
    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@0
    20
*/
slouken@0
    21
slouken@140
    22
/* $Id$ */
slouken@138
    23
slouken@0
    24
/* This file supports streaming WAV files, without volume adjustment */
slouken@0
    25
slouken@0
    26
#include <stdio.h>
slouken@0
    27
slouken@0
    28
typedef struct {
slouken@381
    29
	SDL_RWops *rw;
slouken@381
    30
	SDL_bool freerw;
slouken@0
    31
	long  start;
slouken@0
    32
	long  stop;
slouken@0
    33
	SDL_AudioCVT cvt;
slouken@0
    34
} WAVStream;
slouken@0
    35
slouken@0
    36
/* Initialize the WAVStream player, with the given mixer settings
slouken@0
    37
   This function returns 0, or -1 if there was an error.
slouken@0
    38
 */
slouken@0
    39
extern int WAVStream_Init(SDL_AudioSpec *mixer);
slouken@0
    40
slouken@0
    41
/* Unimplemented */
slouken@0
    42
extern void WAVStream_SetVolume(int volume);
slouken@0
    43
slouken@381
    44
/* Load a WAV stream from an SDL_RWops object */
slouken@521
    45
extern WAVStream *WAVStream_LoadSong_RW(SDL_RWops *rw, const char *magic, int freerw);
slouken@381
    46
slouken@0
    47
/* Start playback of a given WAV stream */
slouken@0
    48
extern void WAVStream_Start(WAVStream *wave);
slouken@0
    49
slouken@0
    50
/* Play some of a stream previously started with WAVStream_Start() */
slouken@407
    51
extern int WAVStream_PlaySome(Uint8 *stream, int len);
slouken@0
    52
slouken@0
    53
/* Stop playback of a stream previously started with WAVStream_Start() */
slouken@0
    54
extern void WAVStream_Stop(void);
slouken@0
    55
slouken@0
    56
/* Close the given WAV stream */
slouken@0
    57
extern void WAVStream_FreeSong(WAVStream *wave);
slouken@0
    58
slouken@0
    59
/* Return non-zero if a stream is currently playing */
slouken@64
    60
extern int WAVStream_Active(void);