Home | Namespaces | Hierarchy | Alphabetical List | Class list | Files | Namespace Members | Class members | File members

ik_SAudioStreamFormat.h

Go to the documentation of this file.
00001 // Copyright (C) 2002-2008 Nikolaus Gebhardt
00002 // This file is part of the "irrKlang" library.
00003 // For conditions of distribution and use, see copyright notice in irrKlang.h
00004 
00005 #ifndef __S_IRRKLANG_AUDIO_STREAM_FORMAT_H_INCLUDED__
00006 #define __S_IRRKLANG_AUDIO_STREAM_FORMAT_H_INCLUDED__
00007 
00008 #include "ik_IRefCounted.h"
00009 
00010 
00011 namespace irrklang
00012 {
00013 
00015         enum ESampleFormat
00016         {
00018                 ESF_U8, 
00019 
00021                 ESF_S16 
00022         };
00023 
00024 
00026         struct SAudioStreamFormat
00027         {
00029                 ik_s32 ChannelCount; 
00030 
00032 
00033                 ik_s32 FrameCount;              
00034 
00036                 ik_s32 SampleRate;
00037                 
00039                 ESampleFormat SampleFormat;
00040 
00042                 inline ik_s32 getSampleSize() const
00043                 {
00044                         return (SampleFormat == ESF_U8) ? 1 : 2;
00045                 }
00046 
00048                 inline ik_s32 getFrameSize() const
00049                 {
00050                         return ChannelCount * getSampleSize();
00051                 }
00052 
00054                 /* Returns an invalid negative value when the stream has an unknown lenght */
00055                 inline ik_s32 getSampleDataSize() const
00056                 {
00057                         return getFrameSize() * FrameCount;
00058                 }
00059 
00061                 inline ik_s32 getBytesPerSecond() const
00062                 {
00063                         return getFrameSize() * SampleRate;
00064                 }
00065         };
00066 
00067 
00068 } // end namespace irrklang
00069 
00070 #endif
00071 

irrKlang Audio Library
The irrKlang Engine Documentation © 2003-2007 by Nikolaus Gebhardt. Generated on Sun Oct 12 13:44:49 2008 by Doxygen (1.5.4)