2014-09-06 03:29:22 +02:00
|
|
|
/*****************************************************************************
|
2018-06-15 14:07:34 +02:00
|
|
|
* Copyright (c) 2014-2018 OpenRCT2 developers
|
2014-09-06 03:29:22 +02:00
|
|
|
*
|
2018-06-15 14:07:34 +02:00
|
|
|
* For a complete list of all authors, please refer to contributors.md
|
|
|
|
* Interested in contributing? Visit https://github.com/OpenRCT2/OpenRCT2
|
2014-09-06 03:29:22 +02:00
|
|
|
*
|
2018-06-15 14:07:34 +02:00
|
|
|
* OpenRCT2 is licensed under the GNU General Public License version 3.
|
2014-09-06 03:29:22 +02:00
|
|
|
*****************************************************************************/
|
|
|
|
|
2017-03-28 20:58:15 +02:00
|
|
|
#pragma once
|
2014-09-06 03:29:22 +02:00
|
|
|
|
2018-02-01 18:49:14 +01:00
|
|
|
#include "../common.h"
|
2017-01-02 18:08:01 +01:00
|
|
|
|
2018-06-22 22:57:16 +02:00
|
|
|
#define MIXER_VOLUME_MAX 128
|
|
|
|
#define MIXER_LOOP_NONE 0
|
|
|
|
#define MIXER_LOOP_INFINITE (-1)
|
2014-09-06 03:29:22 +02:00
|
|
|
|
2017-01-02 18:08:01 +01:00
|
|
|
enum MIXER_GROUP
|
2014-09-06 03:29:22 +02:00
|
|
|
{
|
2017-01-02 18:08:01 +01:00
|
|
|
MIXER_GROUP_SOUND,
|
|
|
|
MIXER_GROUP_RIDE_MUSIC,
|
|
|
|
MIXER_GROUP_TITLE_MUSIC,
|
2014-09-06 03:29:22 +02:00
|
|
|
};
|
|
|
|
|
2018-02-16 00:43:16 +01:00
|
|
|
namespace OpenRCT2::Audio
|
2014-09-06 03:29:22 +02:00
|
|
|
{
|
2017-03-28 20:58:15 +02:00
|
|
|
interface IAudioSource;
|
|
|
|
interface IAudioChannel;
|
2017-01-02 03:19:07 +01:00
|
|
|
|
2017-03-28 20:58:15 +02:00
|
|
|
/**
|
|
|
|
* Provides an audio stream by mixing multiple audio channels together.
|
|
|
|
*/
|
|
|
|
interface IAudioMixer
|
|
|
|
{
|
|
|
|
virtual ~IAudioMixer() = default;
|
2017-01-02 03:19:07 +01:00
|
|
|
|
2018-06-22 22:57:16 +02:00
|
|
|
virtual void Init(const char* device) abstract;
|
2017-03-28 20:58:15 +02:00
|
|
|
virtual void Close() abstract;
|
|
|
|
virtual void Lock() abstract;
|
|
|
|
virtual void Unlock() abstract;
|
2018-06-22 22:57:16 +02:00
|
|
|
virtual IAudioChannel* Play(IAudioSource * source, int32_t loop, bool deleteondone, bool deletesourceondone) abstract;
|
2017-03-28 20:58:15 +02:00
|
|
|
virtual void Stop(IAudioChannel * channel) abstract;
|
|
|
|
virtual bool LoadMusic(size_t pathid) abstract;
|
|
|
|
virtual void SetVolume(float volume) abstract;
|
2014-09-06 03:29:22 +02:00
|
|
|
|
2018-06-22 22:57:16 +02:00
|
|
|
virtual IAudioSource* GetSoundSource(int32_t id) abstract;
|
|
|
|
virtual IAudioSource* GetMusicSource(int32_t id) abstract;
|
2017-03-28 20:58:15 +02:00
|
|
|
};
|
2018-05-04 22:40:09 +02:00
|
|
|
} // namespace OpenRCT2::Audio
|
2014-09-06 03:29:22 +02:00
|
|
|
|
2018-02-01 18:49:14 +01:00
|
|
|
#ifndef DSBPAN_LEFT
|
2018-07-21 16:17:06 +02:00
|
|
|
# define DSBPAN_LEFT (-10000)
|
2018-02-01 18:49:14 +01:00
|
|
|
#endif
|
|
|
|
#ifndef DSBPAN_RIGHT
|
2018-07-21 16:17:06 +02:00
|
|
|
# define DSBPAN_RIGHT 10000
|
2017-03-28 20:58:15 +02:00
|
|
|
#endif
|
2014-10-07 04:21:55 +02:00
|
|
|
|
2018-06-22 22:57:16 +02:00
|
|
|
void Mixer_Init(const char* device);
|
2018-06-20 17:28:51 +02:00
|
|
|
void* Mixer_Play_Effect(size_t id, int32_t loop, int32_t volume, float pan, double rate, int32_t deleteondone);
|
2018-02-01 18:49:14 +01:00
|
|
|
void Mixer_Stop_Channel(void* channel);
|
2018-06-20 17:28:51 +02:00
|
|
|
void Mixer_Channel_Volume(void* channel, int32_t volume);
|
2018-02-01 18:49:14 +01:00
|
|
|
void Mixer_Channel_Pan(void* channel, float pan);
|
|
|
|
void Mixer_Channel_Rate(void* channel, double rate);
|
2018-06-20 17:28:51 +02:00
|
|
|
int32_t Mixer_Channel_IsPlaying(void* channel);
|
|
|
|
uint64_t Mixer_Channel_GetOffset(void* channel);
|
|
|
|
int32_t Mixer_Channel_SetOffset(void* channel, uint64_t offset);
|
|
|
|
void Mixer_Channel_SetGroup(void* channel, int32_t group);
|
|
|
|
void* Mixer_Play_Music(int32_t pathId, int32_t loop, int32_t streaming);
|
2018-02-01 18:49:14 +01:00
|
|
|
void Mixer_SetVolume(float volume);
|
|
|
|
|
2018-06-20 17:28:51 +02:00
|
|
|
int32_t DStoMixerVolume(int32_t volume);
|
|
|
|
float DStoMixerPan(int32_t pan);
|
|
|
|
double DStoMixerRate(int32_t frequency);
|