Upgrade Audio (part 2)

This commit is contained in:
Jérôme Leclercq
2021-05-24 22:09:47 +02:00
parent ac57b3fbf4
commit 8cdd0b51cb
15 changed files with 158 additions and 104 deletions

View File

@@ -2,11 +2,52 @@
// This file is part of the "Nazara Engine - Audio module"
// For conditions of distribution and use, see copyright notice in Config.hpp
#include <Nazara/Audio/Algorithm.hpp>
#include <Nazara/Core/Error.hpp>
#include <Nazara/Audio/Debug.hpp>
namespace Nz
{
/*!
* \ingroup audio
* \brief Get the number of channels occupied by an audio format
* \returns The number of channels occupied by an audio format (mono returns 1, stero returns 2, etc.)
*
* \param format A valid audio format
*
* \remark The format must be valid (using AudioFormat::Unknown will trigger an error)
*/
UInt32 GetChannelCount(AudioFormat format)
{
NazaraAssert(format != AudioFormat::Unknown, "invalid audio format");
switch (format)
{
case AudioFormat::Unknown: //< Just to make the compiler stop complaining
break;
case AudioFormat::U16_Mono:
return 1;
case AudioFormat::U16_Stereo:
return 2;
case AudioFormat::U16_Quad:
return 4;
case AudioFormat::U16_5_1:
return 6;
case AudioFormat::U16_6_1:
return 7;
case AudioFormat::U16_7_1:
return 8;
}
return 0;
}
/*!
* \ingroup audio
* \brief Mixes channels in mono