2011-07-31 02:37:31 +00:00
|
|
|
/**
|
|
|
|
** Supermodel
|
|
|
|
** A Sega Model 3 Arcade Emulator.
|
|
|
|
** Copyright 2011 Bart Trzynadlowski
|
|
|
|
**
|
|
|
|
** This file is part of Supermodel.
|
|
|
|
**
|
|
|
|
** Supermodel is free software: you can redistribute it and/or modify it under
|
|
|
|
** the terms of the GNU General Public License as published by the Free
|
|
|
|
** Software Foundation, either version 3 of the License, or (at your option)
|
|
|
|
** any later version.
|
|
|
|
**
|
|
|
|
** Supermodel is distributed in the hope that it will be useful, but WITHOUT
|
|
|
|
** ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
|
|
|
** FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
|
|
|
|
** more details.
|
|
|
|
**
|
|
|
|
** You should have received a copy of the GNU General Public License along
|
|
|
|
** with Supermodel. If not, see <http://www.gnu.org/licenses/>.
|
|
|
|
**/
|
|
|
|
|
|
|
|
/*
|
|
|
|
* MPEG.cpp
|
|
|
|
*
|
|
|
|
* Header file for MPEG decoder based on AMP by Tomislav Uzalec, modified to
|
|
|
|
* play from memory buffers by R. Belmont for his music player, M1.
|
|
|
|
*/
|
|
|
|
|
|
|
|
#ifndef INCLUDED_MPEG_H
|
|
|
|
#define INCLUDED_MPEG_H
|
|
|
|
|
|
|
|
#include "Types.h"
|
|
|
|
|
|
|
|
|
|
|
|
/******************************************************************************
|
|
|
|
Functions
|
|
|
|
|
|
|
|
The MPEG decoder is not thread-safe and must not be used by multiple sources.
|
|
|
|
These functions are located in audio.cpp and getbits.cpp.
|
|
|
|
******************************************************************************/
|
|
|
|
|
2011-08-09 18:36:29 +00:00
|
|
|
/*
|
|
|
|
* MPEG_IsPlaying(void):
|
|
|
|
*
|
|
|
|
* Returns:
|
|
|
|
* TRUE if an MPEG stream is currently playing, otherwise FALSE.
|
|
|
|
*/
|
|
|
|
extern BOOL MPEG_IsPlaying(void);
|
|
|
|
|
2011-07-31 02:37:31 +00:00
|
|
|
/*
|
|
|
|
* MPEG_GetProgress(void):
|
|
|
|
*
|
|
|
|
* Returns:
|
2011-08-09 18:36:29 +00:00
|
|
|
* The current byte offset within the MPEG stream, relative to the start.
|
|
|
|
*/
|
|
|
|
extern int MPEG_GetProgress(void);
|
|
|
|
|
|
|
|
/*
|
|
|
|
* MPEG_SetOffset(pos):
|
|
|
|
*
|
|
|
|
* Sets the playback position within an MPEG stream.
|
|
|
|
*
|
|
|
|
* Parameters:
|
|
|
|
* pos Byte offset relative to the beginning of the current MPEG
|
|
|
|
* stream.
|
2011-07-31 02:37:31 +00:00
|
|
|
*/
|
2011-08-09 18:36:29 +00:00
|
|
|
extern void MPEG_SetOffset(int pos);
|
2011-07-31 02:37:31 +00:00
|
|
|
|
|
|
|
/*
|
|
|
|
* MPEG_SetLoop(loop, loopend):
|
|
|
|
*
|
|
|
|
* Sets the start and end offsets for looped playback.
|
|
|
|
*
|
|
|
|
* Parameters:
|
|
|
|
* loop Start address.
|
2011-08-28 04:37:41 +00:00
|
|
|
* loopend End offset. Must NOT be 0!
|
2011-07-31 02:37:31 +00:00
|
|
|
*/
|
|
|
|
extern void MPEG_SetLoop(const char *loop, int loopend);
|
|
|
|
|
|
|
|
/*
|
|
|
|
* MPEG_Decode(outputs, length):
|
|
|
|
*
|
|
|
|
* Decodes the requested number of samples from the currently playing MPEG
|
|
|
|
* stream and updates the internal play position. If an MPEG is not playing,
|
|
|
|
* writes silence (zeros).
|
|
|
|
*
|
|
|
|
* Parameters:
|
|
|
|
* outputs A two-element array of pointers to equal-length signed 16-
|
|
|
|
* bit sample buffers. The first is the left channel and the
|
|
|
|
* second is the right channel. Audio is decoded to these.
|
|
|
|
* length Number of samples to decode.
|
|
|
|
*/
|
|
|
|
extern void MPEG_Decode(INT16 **outputs, int length);
|
|
|
|
|
|
|
|
/*
|
|
|
|
* MPEG_PlayMemory(sa, length):
|
|
|
|
*
|
|
|
|
* Specifies the memory buffer to decode from. This initializes the playback
|
2011-08-09 18:36:29 +00:00
|
|
|
* process and will decode the first MPEG frame internally. The loop start
|
|
|
|
* position is cleared (set looping after this call).
|
2011-07-31 02:37:31 +00:00
|
|
|
*
|
|
|
|
* Parameters:
|
|
|
|
* sa Start address of MPEG stream.
|
|
|
|
* length Length in bytes.
|
|
|
|
*/
|
|
|
|
extern void MPEG_PlayMemory(const char *sa, int length);
|
|
|
|
|
|
|
|
/*
|
|
|
|
* MPEG_StopPlaying(void):
|
|
|
|
*
|
|
|
|
* Stop playing the current MPEG stream. The decoder will return silence.
|
|
|
|
*/
|
|
|
|
extern void MPEG_StopPlaying(void);
|
|
|
|
|
|
|
|
/*
|
|
|
|
* MPEG_Init(void):
|
|
|
|
*
|
|
|
|
* Initializes the MPEG decoder. This should be called once per program
|
|
|
|
* session. Allocates an internal buffer for MPEG decoding.
|
|
|
|
*
|
|
|
|
* Returns:
|
|
|
|
* OKAY if successful, FAIL if internal buffer could not be allocated.
|
|
|
|
*/
|
|
|
|
extern BOOL MPEG_Init(void);
|
|
|
|
|
|
|
|
/*
|
|
|
|
* MPEG_Shutdown(void):
|
|
|
|
*
|
|
|
|
* Shuts down the MPEG decoder. Releases internal memory.
|
|
|
|
*/
|
|
|
|
extern void MPEG_Shutdown(void);
|
|
|
|
|
|
|
|
|
|
|
|
#endif // INCLUDED_MPEG_H
|