00001 /* 00002 Copyright (C) 2005 The Pentagram team 00003 00004 This program is free software; you can redistribute it and/or 00005 modify it under the terms of the GNU General Public License 00006 as published by the Free Software Foundation; either version 2 00007 of the License, or (at your option) any later version. 00008 00009 This program is distributed in the hope that it will be useful, 00010 but WITHOUT ANY WARRANTY; without even the implied warranty of 00011 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 00012 GNU General Public License for more details. 00013 00014 You should have received a copy of the GNU General Public License 00015 along with this program; if not, write to the Free Software 00016 Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. 00017 */ 00018 #ifndef AUDIOSAMPLE_H_INCLUDED 00019 #define AUDIOSAMPLE_H_INCLUDED 00020 00021 class IDataSource; 00022 00023 namespace Pentagram { 00024 00025 class AudioSample 00026 { 00027 protected: 00028 uint32 sample_rate; 00029 uint32 bits; 00030 bool stereo; 00031 int frame_size; 00032 uint32 decompressor_size; 00033 uint32 length; 00034 00035 uint32 buffer_size; 00036 uint8 *buffer; 00037 00038 public: 00039 AudioSample(uint8 *buffer, uint32 size); 00040 virtual ~AudioSample(void); 00041 00042 inline uint32 getRate() const { return sample_rate; } 00043 inline uint32 getBits() const { return bits; } 00044 inline bool isStereo() const { return stereo; } 00045 inline uint32 getFrameSize() const { return frame_size; } 00046 inline uint32 getDecompressorDataSize() const { return decompressor_size; } 00047 00049 inline uint32 getLength() const { return length; } 00050 00051 virtual void initDecompressor(void *DecompData) const = 0; 00052 virtual uint32 decompressFrame(void *DecompData, void *samples) const = 0; 00053 virtual void rewind(void *DecompData) const = 0; 00054 }; 00055 00056 }; 00057 00058 #endif //AUDIOSAMPLE_H_INCLUDED