first commit
This commit is contained in:
46
include/framework/audio/sample_format.h
Normal file
46
include/framework/audio/sample_format.h
Normal file
@ -0,0 +1,46 @@
|
||||
/* -----------------------------------------------------------------------------
|
||||
GSFramework
|
||||
Copyright 2001-2013 Emmanuel Julien. All Rights Reserved.
|
||||
----------------------------------------------------------------------------- */
|
||||
|
||||
|
||||
#ifndef __NSAMPLEFORMAT__
|
||||
#define __NSAMPLEFORMAT__
|
||||
|
||||
|
||||
#include "ntypes.h"
|
||||
|
||||
|
||||
namespace GS {
|
||||
|
||||
/*!
|
||||
@short Sample format.
|
||||
@author Emmanuel Julien (ejulien@nworks.fr)
|
||||
*/
|
||||
struct SampleFormat
|
||||
{
|
||||
enum Format
|
||||
{
|
||||
Format_PCM = 0,
|
||||
#if __PLATFORM_NINTENDO_WII__
|
||||
Format_Wii_ADPCM
|
||||
#endif
|
||||
};
|
||||
|
||||
Format format;
|
||||
uint channels;
|
||||
|
||||
uint frequency;
|
||||
uchar resolution;
|
||||
|
||||
/// Get the PCM data memory footprint a given number of samples in this format.
|
||||
uint GetPCMDataSize(uint sample_count) const
|
||||
{ return (sample_count * channels * resolution) / 8; }
|
||||
|
||||
SampleFormat(Format _format = Format_PCM, uint _channels = 2, uint _frequency = 48000, uchar _bit_per_sample = 16) : format(_format), channels(_channels), frequency(_frequency), resolution(_bit_per_sample) {}
|
||||
};
|
||||
|
||||
} // GS
|
||||
|
||||
|
||||
#endif // __NSAMPLEFORMAT__
|
||||
Reference in New Issue
Block a user