music_mpg.h
author Ozkan Sezer <sezeroz@gmail.com>
Thu, 11 Oct 2018 11:50:10 +0300
branchSDL-1.2
changeset 902 6c862e733898
permissions -rw-r--r--
remove smpeg support completely and backport libmpg123 support instead.
sezeroz@902
     1
/*
sezeroz@902
     2
    SDL_mixer:    An audio mixer library based on the SDL library
sezeroz@902
     3
    Copyright (C) 1997-2017 Sam Lantinga <slouken@libsdl.org>
sezeroz@902
     4
sezeroz@902
     5
    This software is provided 'as-is', without any express or implied
sezeroz@902
     6
    warranty.    In no event will the authors be held liable for any damages
sezeroz@902
     7
    arising from the use of this software.
sezeroz@902
     8
sezeroz@902
     9
    Permission is granted to anyone to use this software for any purpose,
sezeroz@902
    10
    including commercial applications, and to alter it and redistribute it
sezeroz@902
    11
    freely, subject to the following restrictions:
sezeroz@902
    12
sezeroz@902
    13
    1. The origin of this software must not be misrepresented; you must not
sezeroz@902
    14
         claim that you wrote the original software. If you use this software
sezeroz@902
    15
         in a product, an acknowledgment in the product documentation would be
sezeroz@902
    16
         appreciated but is not required.
sezeroz@902
    17
    2. Altered source versions must be plainly marked as such, and must not be
sezeroz@902
    18
         misrepresented as being the original software.
sezeroz@902
    19
    3. This notice may not be removed or altered from any source distribution.
sezeroz@902
    20
*/
sezeroz@902
    21
sezeroz@902
    22
#ifdef MP3_MUSIC
sezeroz@902
    23
sezeroz@902
    24
#include <mpg123.h>
sezeroz@902
    25
sezeroz@902
    26
typedef struct
sezeroz@902
    27
{
sezeroz@902
    28
    SDL_RWops* src;
sezeroz@902
    29
    int freesrc;
sezeroz@902
    30
sezeroz@902
    31
    SDL_AudioSpec mixer;
sezeroz@902
    32
sezeroz@902
    33
    int playing;
sezeroz@902
    34
    int volume;
sezeroz@902
    35
sezeroz@902
    36
    mpg123_handle* handle;
sezeroz@902
    37
sezeroz@902
    38
    int gotformat;
sezeroz@902
    39
    SDL_AudioCVT cvt;
sezeroz@902
    40
    Uint8 buf[8192];
sezeroz@902
    41
    size_t len_available;
sezeroz@902
    42
    Uint8* snd_available;
sezeroz@902
    43
}
sezeroz@902
    44
mpg_data;
sezeroz@902
    45
sezeroz@902
    46
mpg_data* mpg_new_rw(SDL_RWops *src, SDL_AudioSpec* mixer, int freesrc);
sezeroz@902
    47
void mpg_delete(mpg_data* m);
sezeroz@902
    48
sezeroz@902
    49
void mpg_start(mpg_data* m);
sezeroz@902
    50
void mpg_stop(mpg_data* m);
sezeroz@902
    51
int mpg_playing(mpg_data* m);
sezeroz@902
    52
sezeroz@902
    53
int mpg_get_samples(mpg_data* m, Uint8* stream, int len);
sezeroz@902
    54
void mpg_seek(mpg_data* m, double seconds);
sezeroz@902
    55
void mpg_volume(mpg_data* m, int volume);
sezeroz@902
    56
sezeroz@902
    57
#endif
sezeroz@902
    58