mkxp/src/audio.h

80 lines
2.0 KiB
C
Raw Normal View History

2013-09-01 14:27:21 +00:00
/*
** audio.h
**
** This file is part of mkxp.
**
** Copyright (C) 2013 Jonas Kulla <Nyocurio@gmail.com>
**
** mkxp 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 2 of the License, or
** (at your option) any later version.
**
** mkxp 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 mkxp. If not, see <http://www.gnu.org/licenses/>.
*/
#ifndef AUDIO_H
#define AUDIO_H
/* Concerning the 'pos' parameter:
* RGSS3 actually doesn't specify a format for this,
* it's only implied that it is a numerical value
* (must be 0 on invalid cases), and it's not used for
* anything outside passing it back into bgm/bgs_play.
* We use this freedom to define pos to be a float,
* in seconds of playback. (RGSS3 seems to use large
* integers that _look_ like sample offsets but I can't
* quite make out their meaning yet) */
2013-09-01 14:27:21 +00:00
struct AudioPrivate;
struct Config;
2013-09-01 14:27:21 +00:00
class Audio
{
public:
void bgmPlay(const char *filename,
int volume = 100,
int pitch = 100,
float pos = 0);
2013-09-01 14:27:21 +00:00
void bgmStop();
void bgmFade(int time);
void bgsPlay(const char *filename,
int volume = 100,
int pitch = 100,
float pos = 0);
2013-09-01 14:27:21 +00:00
void bgsStop();
void bgsFade(int time);
void mePlay(const char *filename,
int volume = 100,
int pitch = 100);
2013-09-01 14:27:21 +00:00
void meStop();
void meFade(int time);
void sePlay(const char *filename,
int volume = 100,
int pitch = 100);
2013-09-01 14:27:21 +00:00
void seStop();
void setupMidi();
float bgmPos();
float bgsPos();
2013-09-01 14:27:21 +00:00
private:
Audio(const Config &conf);
~Audio();
friend struct SharedStatePrivate;
2013-09-01 14:27:21 +00:00
AudioPrivate *p;
};
#endif // AUDIO_H