music_modplug.h
author Sam Lantinga <slouken@libsdl.org>
Sun, 09 Jun 2013 16:22:42 -0700
changeset 639 f8901a7ff3f1
parent 617 87116a42526e
child 695 6a5e6d8d6a35
permissions -rw-r--r--
Switched from mikmod to libmodplug, which is now in the public domain.
This allows us to add MOD support for iOS and Android, yay!
slouken@639
     1
/*
slouken@639
     2
  SDL_mixer:  An audio mixer library based on the SDL library
slouken@639
     3
  Copyright (C) 1997-2013 Sam Lantinga <slouken@libsdl.org>
slouken@639
     4
slouken@639
     5
  This software is provided 'as-is', without any express or implied
slouken@639
     6
  warranty.  In no event will the authors be held liable for any damages
slouken@639
     7
  arising from the use of this software.
slouken@639
     8
slouken@639
     9
  Permission is granted to anyone to use this software for any purpose,
slouken@639
    10
  including commercial applications, and to alter it and redistribute it
slouken@639
    11
  freely, subject to the following restrictions:
slouken@639
    12
slouken@639
    13
  1. The origin of this software must not be misrepresented; you must not
slouken@639
    14
     claim that you wrote the original software. If you use this software
slouken@639
    15
     in a product, an acknowledgment in the product documentation would be
slouken@639
    16
     appreciated but is not required.
slouken@639
    17
  2. Altered source versions must be plainly marked as such, and must not be
slouken@639
    18
     misrepresented as being the original software.
slouken@639
    19
  3. This notice may not be removed or altered from any source distribution.
slouken@639
    20
*/
slouken@639
    21
slouken@481
    22
#ifdef MODPLUG_MUSIC
slouken@481
    23
slouken@481
    24
#include "modplug.h"
slouken@481
    25
#include "SDL_rwops.h"
slouken@481
    26
#include "SDL_audio.h"
slouken@481
    27
#include "SDL_mixer.h"
slouken@481
    28
slouken@481
    29
typedef struct {
slouken@617
    30
    ModPlugFile *file;
slouken@617
    31
    int playing;
slouken@481
    32
} modplug_data;
slouken@481
    33
slouken@481
    34
int modplug_init(SDL_AudioSpec *mixer);
slouken@481
    35
slouken@481
    36
/* Uninitialize the music players */
slouken@481
    37
void modplug_exit(void);
slouken@481
    38
slouken@481
    39
/* Set the volume for a modplug stream */
slouken@481
    40
void modplug_setvolume(modplug_data *music, int volume);
slouken@481
    41
slouken@481
    42
/* Load a modplug stream from an SDL_RWops object */
slouken@521
    43
modplug_data *modplug_new_RW(SDL_RWops *rw, int freerw);
slouken@481
    44
slouken@481
    45
/* Start playback of a given modplug stream */
slouken@481
    46
void modplug_play(modplug_data *music);
slouken@481
    47
slouken@481
    48
/* Return non-zero if a stream is currently playing */
slouken@481
    49
int modplug_playing(modplug_data *music);
slouken@481
    50
slouken@481
    51
/* Play some of a stream previously started with modplug_play() */
slouken@481
    52
int modplug_playAudio(modplug_data *music, Uint8 *stream, int len);
slouken@481
    53
slouken@481
    54
/* Stop playback of a stream previously started with modplug_play() */
slouken@481
    55
void modplug_stop(modplug_data *music);
slouken@481
    56
slouken@481
    57
/* Close the given modplug stream */
slouken@481
    58
void modplug_delete(modplug_data *music);
slouken@481
    59
slouken@481
    60
/* Jump (seek) to a given position (time is in seconds) */
slouken@481
    61
void modplug_jump_to_time(modplug_data *music, double time);
slouken@481
    62
slouken@639
    63
#endif /* MODPLUG_MUSIC */