if (true)
return;
// unspecified:
{
final AudioFormat f1 = new AudioFormat(AudioFormat.DOLBYAC3);
assertEquals(f1.computeDuration(0), -1L);
assertEquals(f1.computeDuration(1), -1L);
assertEquals(f1.computeDuration(1000), -1L);
}
final AudioFormat f0 = new AudioFormat(AudioFormat.DOLBYAC3, 2.0, 1, 2, 3, 4, 5, 6.0, Format.byteArray);
{
assertEquals(f0.computeDuration(0), 0L);
assertEquals(f0.computeDuration(1), 266666000L);
assertEquals(f0.computeDuration(1000), 266666666000L);
}
// public AudioFormat(String encoding, double sampleRate,
// int sampleSizeInBits, int channels, int endian, int signed,
// int frameSizeInBits, double frameRate, Class dataType)
// sampleRate - DOES NOT AFFECT.
{
final AudioFormat f1 = new AudioFormat(AudioFormat.DOLBYAC3, 4.0, 1, 2, 3, 4, 5, 6.0, Format.byteArray);
assertEquals(f1.computeDuration(0), f0.computeDuration(0));
assertEquals(f1.computeDuration(1), f0.computeDuration(1));
assertEquals(f1.computeDuration(1000), f0.computeDuration(1000));
}
// sampleRate - DOES NOT AFFECT.
{
final AudioFormat f1 = new AudioFormat(AudioFormat.DOLBYAC3, Format.NOT_SPECIFIED, 1, 2, 3, 4, 5, 6.0, Format.byteArray);
assertEquals(f1.computeDuration(0), f0.computeDuration(0));
assertEquals(f1.computeDuration(1), f0.computeDuration(1));
assertEquals(f1.computeDuration(1000), f0.computeDuration(1000));
}
// sampleSizeInBits - DOES NOT AFFECT.
{
final AudioFormat f1 = new AudioFormat(AudioFormat.DOLBYAC3, 2.0, 2, 2, 3, 4, 5, 6.0, Format.byteArray);
assertEquals(f1.computeDuration(0), f0.computeDuration(0));
assertEquals(f1.computeDuration(1), f0.computeDuration(1));
assertEquals(f1.computeDuration(1000), f0.computeDuration(1000));
}
// sampleSizeInBits - DOES NOT AFFECT.
{
final AudioFormat f1 = new AudioFormat(AudioFormat.DOLBYAC3, 2.0, 16, 2, 3, 4, 5, 6.0, Format.shortArray);
assertEquals(f1.computeDuration(0), f0.computeDuration(0));
assertEquals(f1.computeDuration(1), f0.computeDuration(1));
assertEquals(f1.computeDuration(1000), f0.computeDuration(1000));
}
// sampleSizeInBits - DOES NOT AFFECT.
{
final AudioFormat f1 = new AudioFormat(AudioFormat.DOLBYAC3, 2.0, 32, 2, 3, 4, 5, 6.0, Format.intArray);
assertEquals(f1.computeDuration(0), f0.computeDuration(0));
assertEquals(f1.computeDuration(1), f0.computeDuration(1));
assertEquals(f1.computeDuration(1000), f0.computeDuration(1000));
}
// sampleSizeInBits - DOES NOT AFFECT.
{
final AudioFormat f1 = new AudioFormat(AudioFormat.DOLBYAC3, 2.0, Format.NOT_SPECIFIED, 2, 3, 4, 5, 6.0, Format.intArray);
assertEquals(f1.computeDuration(0), f0.computeDuration(0));
assertEquals(f1.computeDuration(1), f0.computeDuration(1));
assertEquals(f1.computeDuration(1000), f0.computeDuration(1000));
}
// channels - DOES NOT AFFECT.
{
final AudioFormat f1 = new AudioFormat(AudioFormat.DOLBYAC3, 2.0, 8, 3, 3, 4, 5, 6.0, Format.byteArray);
assertEquals(f1.computeDuration(0), f0.computeDuration(0));
assertEquals(f1.computeDuration(1), f0.computeDuration(1));
assertEquals(f1.computeDuration(1000), f0.computeDuration(1000));
}
// channels - DOES NOT AFFECT.
{
final AudioFormat f1 = new AudioFormat(AudioFormat.DOLBYAC3, 2.0, 8, 1, 3, 4, 5, 6.0, Format.byteArray);
assertEquals(f1.computeDuration(0), f0.computeDuration(0));
assertEquals(f1.computeDuration(1), f0.computeDuration(1));
assertEquals(f1.computeDuration(1000), f0.computeDuration(1000));
}
// channels - DOES NOT AFFECT.
{
final AudioFormat f1 = new AudioFormat(AudioFormat.DOLBYAC3, 2.0, 8, Format.NOT_SPECIFIED, 3, 4, 5, 6.0, Format.byteArray);
assertEquals(f1.computeDuration(0), f0.computeDuration(0));
assertEquals(f1.computeDuration(1), f0.computeDuration(1));
assertEquals(f1.computeDuration(1000), f0.computeDuration(1000));
}
// endian - DOES NOT AFFECT.
{
final AudioFormat f1 = new AudioFormat(AudioFormat.DOLBYAC3, 2.0, 1, 2, 4, 4, 5, 6.0, Format.byteArray);
assertEquals(f1.computeDuration(0), f0.computeDuration(0));
assertEquals(f1.computeDuration(1), f0.computeDuration(1));
assertEquals(f1.computeDuration(1000), f0.computeDuration(1000));
}
// endian - DOES NOT AFFECT.
{
final AudioFormat f1 = new AudioFormat(AudioFormat.DOLBYAC3, 2.0, 1, 2, 0, 4, 5, 6.0, Format.byteArray);
assertEquals(f1.computeDuration(0), f0.computeDuration(0));
assertEquals(f1.computeDuration(1), f0.computeDuration(1));
assertEquals(f1.computeDuration(1000), f0.computeDuration(1000));
}
// endian - DOES NOT AFFECT.
{
final AudioFormat f1 = new AudioFormat(AudioFormat.DOLBYAC3, 2.0, 1, 2, 1, 4, 5, 6.0, Format.byteArray);
assertEquals(f1.computeDuration(0), f0.computeDuration(0));
assertEquals(f1.computeDuration(1), f0.computeDuration(1));
assertEquals(f1.computeDuration(1000), f0.computeDuration(1000));
}
// endian - DOES NOT AFFECT.
{
final AudioFormat f1 = new AudioFormat(AudioFormat.DOLBYAC3, 2.0, 1, 2, Format.NOT_SPECIFIED, 4, 5, 6.0, Format.byteArray);
assertEquals(f1.computeDuration(0), f0.computeDuration(0));
assertEquals(f1.computeDuration(1), f0.computeDuration(1));
assertEquals(f1.computeDuration(1000), f0.computeDuration(1000));
}
// signed: - DOES NOT AFFECT.
{
final AudioFormat f1 = new AudioFormat(AudioFormat.DOLBYAC3, 2.0, 1, 2, 3, 5, 5, 6.0, Format.byteArray);
assertEquals(f1.computeDuration(0), f0.computeDuration(0));
assertEquals(f1.computeDuration(1), f0.computeDuration(1));
assertEquals(f1.computeDuration(1000), f0.computeDuration(1000));
}
// signed: - DOES NOT AFFECT.
{
final AudioFormat f1 = new AudioFormat(AudioFormat.DOLBYAC3, 2.0, 1, 2, 3, 0, 5, 6.0, Format.byteArray);
assertEquals(f1.computeDuration(0), f0.computeDuration(0));
assertEquals(f1.computeDuration(1), f0.computeDuration(1));
assertEquals(f1.computeDuration(1000), f0.computeDuration(1000));
}
// signed: - DOES NOT AFFECT.
{
final AudioFormat f1 = new AudioFormat(AudioFormat.DOLBYAC3, 2.0, 1, 2, 3, 1, 5, 6.0, Format.byteArray);
assertEquals(f1.computeDuration(0), f0.computeDuration(0));
assertEquals(f1.computeDuration(1), f0.computeDuration(1));
assertEquals(f1.computeDuration(1000), f0.computeDuration(1000));
}
// signed: - DOES NOT AFFECT.
{
final AudioFormat f1 = new AudioFormat(AudioFormat.DOLBYAC3, 2.0, 1, 2, 3, Format.NOT_SPECIFIED, 5, 6.0, Format.byteArray);
assertEquals(f1.computeDuration(0), f0.computeDuration(0));
assertEquals(f1.computeDuration(1), f0.computeDuration(1));
assertEquals(f1.computeDuration(1000), f0.computeDuration(1000));
}
// dataType - DOES NOT AFFECT.
{
final AudioFormat f1 = new AudioFormat(AudioFormat.DOLBYAC3, 2.0, 1, 2, 3, 4, 5, 6.0, Format.intArray);
assertEquals(f1.computeDuration(0), f0.computeDuration(0));
assertEquals(f1.computeDuration(1), f0.computeDuration(1));
assertEquals(f1.computeDuration(1000), f0.computeDuration(1000));
}
// dataType - DOES NOT AFFECT.
{
final AudioFormat f1 = new AudioFormat(AudioFormat.DOLBYAC3, 2.0, 1, 2, 3, 4, 5, 6.0, Format.shortArray);
assertEquals(f1.computeDuration(0), f0.computeDuration(0));
assertEquals(f1.computeDuration(1), f0.computeDuration(1));
assertEquals(f1.computeDuration(1000), f0.computeDuration(1000));
}
{
final AudioFormat f1 = new AudioFormat(AudioFormat.DOLBYAC3, 4.0, 1, 2, 3, 4, 5, 6.0, Format.byteArray);
assertEquals(f1.computeDuration(0), f0.computeDuration(0));
assertEquals(f1.computeDuration(1), f0.computeDuration(1));
assertEquals(f1.computeDuration(1000), f0.computeDuration(1000));
compare(f1, 0);
compare(f1, 1);
compare(f1, 1000);
}
// assertEquals(f0.computeDuration(0), 0L);
// assertEquals(f0.computeDuration(1), 266,666,000L);
// assertEquals(f0.computeDuration(1000), 266666666000L);
// frameSizeInBits: AFFECTS - inversely
{
final AudioFormat f1 = new AudioFormat(AudioFormat.DOLBYAC3, 2.0, 1, 2, 3, 4, 6, 6.0, Format.byteArray);
assertEquals(f1.computeDuration(0), 0L);
assertEquals(f1.computeDuration(1), 222222000L);
assertEquals(f1.computeDuration(1000), 222222166000L);
compare(f1, 0);
compare(f1, 1);
compare(f1, 1000);
}
// frameRate: AFFECTS - inversely
{
final AudioFormat f1 = new AudioFormat(AudioFormat.DOLBYAC3, 2.0, 1, 2, 3, 4, 5, 7.0, Format.byteArray);
assertEquals(f1.computeDuration(0), 0L);
assertEquals(f1.computeDuration(1), 228571000L);
assertEquals(f1.computeDuration(1000), 228571428000L);
compare(f1, 0);
compare(f1, 1);
compare(f1, 1000);
}