00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
#ifndef AUDIOSAMPLE_HPP
00023
#define AUDIOSAMPLE_HPP
00024
00025
#include <qshared.h>
00026
00027
#include "SoundAttributes.h"
00028
00029
00030 typedef unsigned long SamplePos;
00031
00032 class CAudioSample
00033 {
00034
private:
00035
void Init();
00036
void ReInit();
00037
void Reset();
00038
void CalculateOffsets()
const;
00039
00040
protected:
00041 struct SampleData:
public QShared
00042 {
00043 SoundAttributes Attributes;
00044 int BytesPerSample;
00045 int PositionOffset[SoundAttributes::MaxPosition];
00046
00047 void *
pMemBuffer;
00048 SamplePos BufLength;
00049
00050 SamplePos BufStartOffset;
00051 } *
m_pData;
00052
00053
00054
CAudioSample(
const SoundAttributes &attrs, SamplePos buffer_length);
00055
00056
void SetSoundAttributes(
const SoundAttributes &) const;
00057
int GetBytesPerSample() const;
00058
00059
bool CreateBuffer(const
SoundAttributes &attrs, SamplePos buffer_length);
00060
00061
void Detach();
00062
00063 public:
00064
CAudioSample();
00065 CAudioSample(const CAudioSample &);
00066 virtual ~CAudioSample();
00067
00068 CAudioSample &operator =(const CAudioSample &audio_sample);
00069
00070
00071
SoundAttributes GetSoundAttributes() const;
00072
bool IsNull() const;
00073
00074 virtual SamplePos TotalLength() const;
00075 virtual
bool CanSeek() const;
00076 virtual
bool SeekTo(SamplePos offset);
00077
00078 virtual
int GetValue(SamplePos offset,
SoundAttributes::Position channel) const;
00079 virtual
void SetValue(SamplePos offset,
SoundAttributes::Position channel,
int value);
00080 };
00081
00082 #endif