int AIFFFile::ReadMonoSample(short *Sample) { int retcode; float y; double y64; unsigned long int_y; Uint64 int_y64; switch(CommDat.sampleSize) { case 8: unsigned char x; retcode = Read(&x, 1); *Sample = (short(x) << 8); break; case 12: case 16: retcode = Read(Sample, 2); *Sample = Mot_Swap_16(*Sample); break; case 24: int_y = 0; retcode = Read(&int_y, 3); int_y = Mot_Swap_32(int_y); *Sample = (short) (int_y / 65536); break; case 32: retcode = Read(&int_y, 4); int_y = Mot_Swap_32(int_y); if(Use_Floats) { IntToFloat((int *) &y, int_y); *Sample = (short) (y * 32767.0f); } else { *Sample = (short) (int_y / 65536); } break; case 64: retcode = Read(&int_y64, 8); int_y64 = Mot_Swap_64(int_y64); Int64ToDouble((Uint64 *) &y64, int_y64); *Sample = (short) (y64 * 32767.0); break; default: retcode = 0; } return retcode; }
void CFloatVariable::SetInteger(const int Value) { m_Value = IntToFloat(Value); }
double CIntegerVariable::GetFloat(void) const { return IntToFloat(m_Value); }
int AIFFFile::ReadStereoSample(short *L, short *R) { int retcode = 0; unsigned char x[2]; short y[2]; float z[2]; double z64[2]; long int_z[2]; Uint64 int_z64[2]; switch(CommDat.sampleSize) { case 8: retcode = Read(x, 2); *L = (short (x[0]) << 8); *R = (short (x[1]) << 8); break; case 12: case 16: retcode = Read(y, 4); y[0] = Mot_Swap_16(y[0]); y[1] = Mot_Swap_16(y[1]); *L = short(y[0]); *R = short(y[1]); break; case 24: int_z[0] = 0; int_z[1] = 0; retcode = Read(&int_z[0], 3); retcode = Read(&int_z[1], 3); int_z[0] = Mot_Swap_32(int_z[0]); int_z[1] = Mot_Swap_32(int_z[1]); *L = (short) (int_z[0] / 65536); *R = (short) (int_z[1] / 65536); break; case 32: retcode = Read(int_z, 8); int_z[0] = Mot_Swap_32(int_z[0]); int_z[1] = Mot_Swap_32(int_z[1]); if(Use_Floats) { IntToFloat((int *) &z[0], int_z[0]); IntToFloat((int *) &z[1], int_z[1]); *L = (short) (z[0] * 32767.0f); *R = (short) (z[1] * 32767.0f); } else { *L = (short) (int_z[0] / 65536); *R = (short) (int_z[1] / 65536); } break; case 64: retcode = Read(int_z64, 16); int_z64[0] = Mot_Swap_64(int_z64[0]); int_z64[1] = Mot_Swap_64(int_z64[1]); Int64ToDouble((Uint64 *) &z64[0], int_z64[0]); Int64ToDouble((Uint64 *) &z64[1], int_z64[1]); *L = (short) (z64[0] * 32767.0); *R = (short) (z64[1] * 32767.0); break; default: retcode = 0; } return retcode; }