2009-08-21 20:21:05 +00:00
|
|
|
/*
|
|
|
|
* This file is part of OpenTTD.
|
|
|
|
* OpenTTD 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, version 2.
|
|
|
|
* OpenTTD 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 OpenTTD. If not, see <http://www.gnu.org/licenses/>.
|
|
|
|
*/
|
|
|
|
|
2008-05-06 15:11:33 +00:00
|
|
|
/** @file mixer.h Functions to mix sound samples. */
|
2007-03-03 04:04:22 +00:00
|
|
|
|
2005-03-12 09:38:03 +00:00
|
|
|
#ifndef MIXER_H
|
|
|
|
#define MIXER_H
|
|
|
|
|
2007-03-07 12:11:48 +00:00
|
|
|
struct MixerChannel;
|
2005-03-12 09:38:03 +00:00
|
|
|
|
2018-11-04 11:58:42 +00:00
|
|
|
/**
|
|
|
|
* Type of callback functions for supplying PCM music.
|
|
|
|
* A music decoder/renderer implements this function and installs it with MxSetMusicSource, which also returns the sample rate used.
|
|
|
|
* @param buffer Pointer to interleaved 2-channel signed 16 bit PCM data buffer, guaranteed to be 0-initialized.
|
|
|
|
* @param samples number of samples that must be filled into \c buffer.
|
|
|
|
*/
|
|
|
|
typedef void(*MxStreamCallback)(int16 *buffer, size_t samples);
|
|
|
|
|
2005-03-12 09:38:03 +00:00
|
|
|
bool MxInitialize(uint rate);
|
2007-07-24 17:01:23 +00:00
|
|
|
void MxMixSamples(void *buffer, uint samples);
|
2005-03-12 09:38:03 +00:00
|
|
|
|
2007-07-24 17:01:23 +00:00
|
|
|
MixerChannel *MxAllocateChannel();
|
2009-08-09 23:04:08 +00:00
|
|
|
void MxSetChannelRawSrc(MixerChannel *mc, int8 *mem, size_t size, uint rate, bool is16bit);
|
2010-03-06 11:08:31 +00:00
|
|
|
void MxSetChannelVolume(MixerChannel *mc, uint volume, float pan);
|
2005-03-12 09:46:07 +00:00
|
|
|
void MxActivateChannel(MixerChannel*);
|
2005-03-12 09:38:03 +00:00
|
|
|
|
2018-11-04 11:58:42 +00:00
|
|
|
uint32 MxSetMusicSource(MxStreamCallback music_callback);
|
|
|
|
|
2005-09-18 20:56:44 +00:00
|
|
|
#endif /* MIXER_H */
|