/*
* Copyright 2011-2012 Arx Libertatis Team (see the AUTHORS file)
*
* This file is part of Arx Libertatis.
*
* Arx Libertatis 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.
*
* Arx Libertatis 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 Arx Libertatis. If not, see .
*/
/* Based on:
===========================================================================
ARX FATALIS GPL Source Code
Copyright (C) 1999-2010 Arkane Studios SA, a ZeniMax Media company.
This file is part of the Arx Fatalis GPL Source Code ('Arx Fatalis Source Code').
Arx Fatalis Source Code 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.
Arx Fatalis Source Code 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 Arx Fatalis Source Code. If not, see
.
In addition, the Arx Fatalis Source Code is also subject to certain additional terms. You should have received a copy of these
additional terms immediately following the terms and conditions of the GNU General Public License which accompanied the Arx
Fatalis Source Code. If not, please request a copy in writing from Arkane Studios at the address below.
If you have questions concerning this license or the applicable additional terms, you may contact in writing Arkane Studios, c/o
ZeniMax Media Inc., Suite 120, Rockville, Maryland 20850 USA.
===========================================================================
*/
#ifndef ARX_AUDIO_AUDIOGLOBAL_H
#define ARX_AUDIO_AUDIOGLOBAL_H
#include
#include
#include
#include "audio/AudioTypes.h"
#include "audio/AudioResource.h"
namespace res { class path; }
namespace audio {
class Backend;
class Ambiance;
class Environment;
class Sample;
class Mixer;
const ChannelFlags FLAG_ANY_3D_FX = FLAG_POSITION | FLAG_VELOCITY | FLAG_DIRECTION |
FLAG_CONE | FLAG_FALLOFF | FLAG_REVERBERATION;
// Audio device interface
extern Backend * backend;
// Global settings
extern res::path sample_path;
extern res::path ambiance_path;
extern res::path environment_path;
extern size_t stream_limit_bytes;
extern size_t session_time;
// Resources
extern ResourceList _mixer;
extern ResourceList _sample;
extern ResourceList _amb;
extern ResourceList _env;
//! Convert a value from time units to bytes
size_t unitsToBytes(size_t v, const PCMFormat & format, TimeUnit unit = UNIT_MS);
//! Convert a value from bytes to time units
size_t bytesToUnits(size_t v, const PCMFormat & format, TimeUnit unit = UNIT_MS);
inline float LinearToLogVolume(float volume) {
return 0.2F * (float)log10(volume) + 1.0F;
}
// TODO move to global math header
inline float clamp(float v, float min, float max) {
return std::min(max, std::max(min, v));
}
} // namespace audio
#endif // ARX_AUDIO_AUDIOGLOBAL_H