OpenRCT2/src/openrct2/audio/AudioMixer.h

74 lines
2.4 KiB
C
Raw Normal View History

/*****************************************************************************
* Copyright (c) 2014-2018 OpenRCT2 developers
*
* For a complete list of all authors, please refer to contributors.md
* Interested in contributing? Visit https://github.com/OpenRCT2/OpenRCT2
*
* OpenRCT2 is licensed under the GNU General Public License version 3.
*****************************************************************************/
2017-03-28 20:58:15 +02:00
#pragma once
2018-02-01 18:49:14 +01:00
#include "../common.h"
2018-06-22 22:57:16 +02:00
#define MIXER_VOLUME_MAX 128
#define MIXER_LOOP_NONE 0
#define MIXER_LOOP_INFINITE (-1)
enum MIXER_GROUP
{
MIXER_GROUP_SOUND,
MIXER_GROUP_RIDE_MUSIC,
MIXER_GROUP_TITLE_MUSIC,
};
2018-02-16 00:43:16 +01:00
namespace OpenRCT2::Audio
{
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;
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
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
vehicle sounds now using Mixer Fixed bug that caused widgets to miss draw. Fix #335 Merge pull request #505 from duncanspumpkin/gfx_rect Fixed bug that caused widgets to miss draw. fix #506 Paths can no longer be placed Merge branch 'master' of https://github.com/IntelOrca/OpenRCT2 vehicle sounds now using Mixer Fixed bug that caused widgets to miss draw. Fix #335 Merge pull request #505 from duncanspumpkin/gfx_rect Fixed bug that caused widgets to miss draw. fix #506 Paths can no longer be placed Merge branch 'master' of https://github.com/IntelOrca/OpenRCT2 Merge branch 'master' of https://github.com/zsilencer/OpenRCT2 Fixed bug that caused widgets to miss draw. Fix #335 Merge pull request #505 from duncanspumpkin/gfx_rect Fixed bug that caused widgets to miss draw. fix #506 Paths can no longer be placed Merge branch 'master' of https://github.com/IntelOrca/OpenRCT2 vehicle sounds now using Mixer Fixed bug that caused widgets to miss draw. Fix #335 Merge pull request #505 from duncanspumpkin/gfx_rect Fixed bug that caused widgets to miss draw. fix #506 Paths can no longer be placed Merge branch 'master' of https://github.com/IntelOrca/OpenRCT2 Merge branch 'master' of https://github.com/zsilencer/OpenRCT2 vehicle sounds now using Mixer Fixed bug that caused widgets to miss draw. Fix #335 Merge pull request #505 from duncanspumpkin/gfx_rect Fixed bug that caused widgets to miss draw. fix #506 Paths can no longer be placed Merge branch 'master' of https://github.com/IntelOrca/OpenRCT2 Merge branch 'master' of https://github.com/zsilencer/OpenRCT2
2014-10-07 04:21:55 +02:00
2018-06-22 22:57:16 +02:00
void Mixer_Init(const char* device);
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);
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);
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);
int32_t DStoMixerVolume(int32_t volume);
float DStoMixerPan(int32_t pan);
double DStoMixerRate(int32_t frequency);