Documentation for module: Audio
Former-commit-id: 4546f9db5579c219d708f87b7062104d24ec6da2
This commit is contained in:
@@ -7,11 +7,21 @@
|
||||
|
||||
namespace Nz
|
||||
{
|
||||
/*!
|
||||
* \ingroup audio
|
||||
* \brief Mixes channels in mono
|
||||
*
|
||||
* \param input Input buffer with multiples channels
|
||||
* \param output Output butter for mono
|
||||
* \param channelCount Number of channels
|
||||
* \param frameCount Number of frames
|
||||
*
|
||||
* \remark The input buffer may be the same as the output one
|
||||
*/
|
||||
template<typename T>
|
||||
void MixToMono(T* input, T* output, unsigned int channelCount, unsigned int frameCount)
|
||||
{
|
||||
///DOC: Le buffer d'entrée peut être le même que le buffer de sortie
|
||||
// Pour éviter l'overflow, on utilise comme accumulateur un type assez grand, (u)int 64 bits pour les entiers, double pour les flottants
|
||||
// To avoid overflow, we use, as an accumulator, a type which is large enough: (u)int 64 bits for integers, double for floatings
|
||||
typedef typename std::conditional<std::is_unsigned<T>::value, UInt64, Int64>::type BiggestInt;
|
||||
typedef typename std::conditional<std::is_integral<T>::value, BiggestInt, double>::type Biggest;
|
||||
|
||||
@@ -19,7 +29,7 @@ namespace Nz
|
||||
{
|
||||
Biggest acc = Biggest(0);
|
||||
for (unsigned int j = 0; j < channelCount; ++j)
|
||||
acc += input[i*channelCount + j];
|
||||
acc += input[i * channelCount + j];
|
||||
|
||||
output[i] = static_cast<T>(acc / channelCount);
|
||||
}
|
||||
|
||||
@@ -27,18 +27,23 @@
|
||||
#ifndef NAZARA_CONFIG_AUDIO_HPP
|
||||
#define NAZARA_CONFIG_AUDIO_HPP
|
||||
|
||||
/// Modifier la configuration d'un module nécessite une recompilation quasi-intégrale de celui-ci et de ceux en héritant
|
||||
/*!
|
||||
* \defgroup audio (NazaraAudio) Audio module
|
||||
* Audio/System module including classes to handle music, sound, etc...
|
||||
*/
|
||||
|
||||
// Utilise un manager de mémoire pour gérer les allocations dynamiques (détecte les leaks au prix d'allocations/libérations dynamiques plus lentes)
|
||||
/// Each modification of a parameter needs a recompilation of the module
|
||||
|
||||
// Use the MemoryManager to manage dynamic allocations (can detect memory leak but allocations/frees are slower)
|
||||
#define NAZARA_AUDIO_MANAGE_MEMORY 0
|
||||
|
||||
// Active les tests de sécurité supplémentaires (Teste notamment les arguments des fonctions, conseillé pour le développement)
|
||||
// Activate the security tests based on the code (Advised for development)
|
||||
#define NAZARA_AUDIO_SAFE 1
|
||||
|
||||
// Le nombre de buffers utilisés lors du streaming d'objets audio (Au moins deux)
|
||||
// The number of buffers used for audio streaming (At least two)
|
||||
#define NAZARA_AUDIO_STREAMED_BUFFER_COUNT 2
|
||||
|
||||
/// Vérification des valeurs et types de certaines constantes
|
||||
/// Checking the values and types of certain constants
|
||||
#include <Nazara/Audio/ConfigCheck.hpp>
|
||||
|
||||
#if !defined(NAZARA_STATIC)
|
||||
|
||||
@@ -7,12 +7,12 @@
|
||||
#ifndef NAZARA_CONFIG_CHECK_AUDIO_HPP
|
||||
#define NAZARA_CONFIG_CHECK_AUDIO_HPP
|
||||
|
||||
/// Ce fichier sert à vérifier la valeur des constantes du fichier Config.hpp
|
||||
/// This file is used to check the constant values defined in Config.hpp
|
||||
|
||||
#include <type_traits>
|
||||
#define NazaraCheckTypeAndVal(name, type, op, val, err) static_assert(std::is_ ##type <decltype(name)>::value && name op val, #type err)
|
||||
|
||||
// On force la valeur de MANAGE_MEMORY en mode debug
|
||||
// We force the value of MANAGE_MEMORY in debug
|
||||
#if defined(NAZARA_DEBUG) && !NAZARA_AUDIO_MANAGE_MEMORY
|
||||
#undef NAZARA_AUDIO_MANAGE_MEMORY
|
||||
#define NAZARA_AUDIO_MANAGE_MEMORY 0
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
// This file is part of the "Nazara Engine - Audio module"
|
||||
// For conditions of distribution and use, see copyright notice in Config.hpp
|
||||
|
||||
// On suppose que Debug.hpp a déjà été inclus, tout comme Config.hpp
|
||||
// We assume that Debug.hpp has already been included, same thing for Config.hpp
|
||||
#if NAZARA_AUDIO_MANAGE_MEMORY
|
||||
#undef delete
|
||||
#undef new
|
||||
|
||||
@@ -13,7 +13,7 @@ namespace Nz
|
||||
{
|
||||
AudioFormat_Unknown = -1,
|
||||
|
||||
// La valeur entière est le nombre de canaux possédés par ce format
|
||||
// The integer value is the number of channels used by the format
|
||||
AudioFormat_Mono = 1,
|
||||
AudioFormat_Stereo = 2,
|
||||
AudioFormat_Quad = 4,
|
||||
|
||||
@@ -15,18 +15,18 @@
|
||||
#include <Nazara/Core/String.hpp>
|
||||
#include <vector>
|
||||
|
||||
// Inclusion des headers OpenAL
|
||||
// Inclusion of OpenAL headers
|
||||
|
||||
// Étant donné que les headers OpenAL ne nous permettent pas de n'avoir que les signatures sans les pointeurs de fonctions
|
||||
// Et que je ne souhaite pas les modifier, je suis contraint de les placer dans un espace de nom différent pour ensuite
|
||||
// remettre dans l'espace global les choses intéressantes (les typedef notamment)
|
||||
// OpenAL headers does not allow us to only get the signatures without the pointers to the functions
|
||||
// And I do no want to modify them, I'm obliged to put them in a different namespace
|
||||
// to put only interesting things back in the global namespace (specially typedef)
|
||||
namespace OpenALDetail
|
||||
{
|
||||
#include <AL/al.h>
|
||||
#include <AL/alc.h>
|
||||
}
|
||||
|
||||
// Si quelqu'un a une meilleure idée ...
|
||||
// If someone has a better idea ...
|
||||
using OpenALDetail::ALboolean;
|
||||
using OpenALDetail::ALbyte;
|
||||
using OpenALDetail::ALchar;
|
||||
|
||||
@@ -7,6 +7,13 @@
|
||||
|
||||
namespace Nz
|
||||
{
|
||||
/*!
|
||||
* \brief Creates a new sound buffer from the arguments
|
||||
* \return A reference to the newly created sound buffer
|
||||
*
|
||||
* \param args Arguments for the sound buffer
|
||||
*/
|
||||
|
||||
template<typename... Args>
|
||||
SoundBufferRef SoundBuffer::New(Args&&... args)
|
||||
{
|
||||
|
||||
@@ -12,7 +12,7 @@
|
||||
#include <Nazara/Audio/Enums.hpp>
|
||||
#include <Nazara/Math/Vector3.hpp>
|
||||
|
||||
///TODO: Faire hériter SoundEmitter de Node
|
||||
///TODO: Inherit SoundEmitter from Node
|
||||
|
||||
namespace Nz
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user