@Test public void testAddTempo() { final FrameBodySYTC body = new FrameBodySYTC(); body.addTempo(10, 0); body.addTempo(5, 0); body.addTempo(5, 1); body.addTempo(11, 400); final Map<Long, Integer> timingCodes = body.getTempi(); Assert.assertEquals(0, (int)timingCodes.get(10L)); Assert.assertEquals(1, (int)timingCodes.get(5L)); Assert.assertEquals(400, (int)timingCodes.get(11L)); long lastTimestamp = 0; for (final Long timestamp : timingCodes.keySet()) { Assert.assertTrue(timestamp >= lastTimestamp); lastTimestamp = timestamp; } }
public void addTempo(final long timestamp, final int tempo) { removeTempo(timestamp); final List<SynchronisedTempoCode> codes = (List<SynchronisedTempoCode>)getObjectValue(DataTypes.OBJ_SYNCHRONISED_TEMPO_LIST); int insertIndex = 0; if (!codes.isEmpty() && codes.get(0).getTimestamp() <= timestamp) { for (final SynchronisedTempoCode code : codes) { final long translatedTimestamp = code.getTimestamp(); if (timestamp < translatedTimestamp) { break; } insertIndex++; } } codes.add(insertIndex, new SynchronisedTempoCode(DataTypes.OBJ_SYNCHRONISED_TEMPO, this, tempo, timestamp)); }
FrameBodySYTC extends AbstractID3v2FrameBody implements ID3v24FrameBody, ID3v23FrameBody { public void addTempo(final long timestamp, final int tempo) { removeTempo(timestamp); final List<SynchronisedTempoCode> codes = (List<SynchronisedTempoCode>)getObjectValue(DataTypes.OBJ_SYNCHRONISED_TEMPO_LIST); int insertIndex = 0; if (!codes.isEmpty() && codes.get(0).getTimestamp() <= timestamp) { for (final SynchronisedTempoCode code : codes) { final long translatedTimestamp = code.getTimestamp(); if (timestamp < translatedTimestamp) { break; } insertIndex++; } } codes.add(insertIndex, new SynchronisedTempoCode(DataTypes.OBJ_SYNCHRONISED_TEMPO, this, tempo, timestamp)); } }
FrameBodySYTC extends AbstractID3v2FrameBody implements ID3v24FrameBody, ID3v23FrameBody { public void addTempo(final long timestamp, final int tempo) { removeTempo(timestamp); final List<SynchronisedTempoCode> codes = (List<SynchronisedTempoCode>)getObjectValue(DataTypes.OBJ_SYNCHRONISED_TEMPO_LIST); int insertIndex = 0; if (!codes.isEmpty() && codes.get(0).getTimestamp() <= timestamp) { for (final SynchronisedTempoCode code : codes) { final long translatedTimestamp = code.getTimestamp(); if (timestamp < translatedTimestamp) { break; } insertIndex++; } } codes.add(insertIndex, new SynchronisedTempoCode(DataTypes.OBJ_SYNCHRONISED_TEMPO, this, tempo, timestamp)); } FrameBodySYTC();  FrameBodySYTC(final int timestampFormat, final byte[] tempo);  FrameBodySYTC(final ByteBuffer byteBuffer, final int frameSize);  FrameBodySYTC(final Buffer byteBuffer, final int frameSize);  FrameBodySYTC(final FrameBodySYTC body); }
FrameBodySYTC extends AbstractID3v2FrameBody implements ID3v24FrameBody, ID3v23FrameBody { public void addTempo(final long timestamp, final int tempo) { removeTempo(timestamp); final List<SynchronisedTempoCode> codes = (List<SynchronisedTempoCode>)getObjectValue(DataTypes.OBJ_SYNCHRONISED_TEMPO_LIST); int insertIndex = 0; if (!codes.isEmpty() && codes.get(0).getTimestamp() <= timestamp) { for (final SynchronisedTempoCode code : codes) { final long translatedTimestamp = code.getTimestamp(); if (timestamp < translatedTimestamp) { break; } insertIndex++; } } codes.add(insertIndex, new SynchronisedTempoCode(DataTypes.OBJ_SYNCHRONISED_TEMPO, this, tempo, timestamp)); } FrameBodySYTC();  FrameBodySYTC(final int timestampFormat, final byte[] tempo);  FrameBodySYTC(final ByteBuffer byteBuffer, final int frameSize);  FrameBodySYTC(final Buffer byteBuffer, final int frameSize);  FrameBodySYTC(final FrameBodySYTC body); int getTimestampFormat(); void setTimestampFormat(final int timestampFormat); Map<Long, Integer> getTempi(); List<Long> getTimestamps(); void addTempo(final long timestamp, final int tempo); boolean removeTempo(final long timestamp); void clearTempi(); @Override String getIdentifier(); @Override void read(final ByteBuffer byteBuffer); }
FrameBodySYTC extends AbstractID3v2FrameBody implements ID3v24FrameBody, ID3v23FrameBody { public void addTempo(final long timestamp, final int tempo) { removeTempo(timestamp); final List<SynchronisedTempoCode> codes = (List<SynchronisedTempoCode>)getObjectValue(DataTypes.OBJ_SYNCHRONISED_TEMPO_LIST); int insertIndex = 0; if (!codes.isEmpty() && codes.get(0).getTimestamp() <= timestamp) { for (final SynchronisedTempoCode code : codes) { final long translatedTimestamp = code.getTimestamp(); if (timestamp < translatedTimestamp) { break; } insertIndex++; } } codes.add(insertIndex, new SynchronisedTempoCode(DataTypes.OBJ_SYNCHRONISED_TEMPO, this, tempo, timestamp)); } FrameBodySYTC();  FrameBodySYTC(final int timestampFormat, final byte[] tempo);  FrameBodySYTC(final ByteBuffer byteBuffer, final int frameSize);  FrameBodySYTC(final Buffer byteBuffer, final int frameSize);  FrameBodySYTC(final FrameBodySYTC body); int getTimestampFormat(); void setTimestampFormat(final int timestampFormat); Map<Long, Integer> getTempi(); List<Long> getTimestamps(); void addTempo(final long timestamp, final int tempo); boolean removeTempo(final long timestamp); void clearTempi(); @Override String getIdentifier(); @Override void read(final ByteBuffer byteBuffer); static final int MPEG_FRAMES; static final int MILLISECONDS; }