3
Copyright (C) 2001 Martin Vogt
5
This program is free software; you can redistribute it and/or modify
6
it under the terms of the GNU Library General Public License as published by
7
the Free Software Foundation.
9
For more information look at the file COPYRIGHT in this package
18
#define convMacro(in,dtemp,tmp) \
20
dtemp = ((((65536.0 * 65536.0 * 16)+(65536.0 * 0.5))* 65536.0))+(in[0]); \
21
tmp = ((*(int *)&dtemp) - 0x80000000); \
25
} else if (tmp<-32768) { \
31
PCMFrame::PCMFrame(int size) {
32
data=new short int[size];
35
// this format has a sampleSize of 16, signed, endian==machine
36
this->sampleSize=sizeof(short int)*8;
38
this->lBigEndian=AUDIOFRAME_BIGENDIAN;
39
setFrameType(_FRAME_AUDIO_PCM);
43
PCMFrame::~PCMFrame() {
48
void PCMFrame::putFloatData(float* left,float* right,int copyLen) {
50
if (left != NULL) destSize++;
51
if (right != NULL) destSize++;
53
if ((len+destSize) > size) {
54
cout << "cannot copy putFloatData L/R version . Does not fit"<<endl;
63
convMacro(left,dtemp,tmp);
64
data[len++]=(short int)tmp;
65
convMacro(right,dtemp,tmp);
66
data[len++]=(short int)tmp;
74
convMacro(left,dtemp,tmp);
75
data[len++]=(short int)tmp;
77
// right channel empty
85
// select right channel
87
convMacro(right,dtemp,tmp);
88
data[len++]=(short int)tmp;
90
// left channel already copied
94
cout << "unknown stereo value in pcmFrame"<<endl;
99
void PCMFrame::putFloatData(float* in,int lenCopy) {
101
if ((len+lenCopy) > size) {
102
cout << "cannot copy putFloatData. Does not fit"<<endl;
108
convMacro(in,dtemp,tmp);
109
data[len++]=(short int)tmp;