| 1 | package org.farng.mp3.id3; |
| 2 | |
| 3 | import org.farng.mp3.InvalidTagException; |
| 4 | import org.farng.mp3.object.ObjectNumberFixedLength; |
| 5 | |
| 6 | import java.io.IOException; |
| 7 | import java.io.RandomAccessFile; |
| 8 | |
| 9 | /** |
| 10 | * <h3>4.13. Reverb</h3> |
| 11 | * <p/> |
| 12 | * <p> Yet another subjective frame, with which you can adjust echoes of<br> different kinds. |
| 13 | * Reverb left/right is the delay between every bounce<br> in ms. Reverb bounces left/right is the number |
| 14 | * of bounces that should<br> be made. $FF equals an infinite number of bounces. Feedback is the<br> |
| 15 | * amount of volume that should be returned to the next echo bounce. $00<br> |
| 16 | * <p/> |
| 17 | * is 0%, $FF is 100%. If this value were $7F, there would be 50% volume<br> reduction on the |
| 18 | * first bounce, 50% of that on the second and so on.<br> Left to left means the sound from the left bounce |
| 19 | * to be played in the<br> left speaker, while left to right means sound from the left bounce to<br> |
| 20 | * be played in the right speaker.</p> |
| 21 | * <p/> |
| 22 | * <p> 'Premix left to right' is the amount of left sound to be mixed in the<br> right before |
| 23 | * any reverb is applied, where $00 id 0% and $FF is 100%.<br> 'Premix right to left' does the same thing, |
| 24 | * but right to left.<br> Setting both premix to $FF would result in a mono output (if the<br> |
| 25 | * reverb is applied symmetric). There may only be one "RVRB" |
| 26 | * <p/> |
| 27 | * frame in<br> each tag.</p> |
| 28 | * <p/> |
| 29 | * <p> <Header for 'Reverb', ID: "RVRB"><br> Reverb |
| 30 | * left (ms) $xx xx<br> |
| 31 | * <p/> |
| 32 | * Reverb right (ms) |
| 33 | * $xx xx<br> Reverb bounces, left |
| 34 | * $xx<br> Reverb bounces, right |
| 35 | * $xx<br> |
| 36 | * <p/> |
| 37 | * Reverb feedback, left to left $xx<br> Reverb |
| 38 | * feedback, left to right $xx<br> Reverb feedback, right to right $xx<br> |
| 39 | * <p/> |
| 40 | * Reverb feedback, right to left $xx<br> Premix left to |
| 41 | * right $xx<br> Premix |
| 42 | * right to left $xx<br> |
| 43 | * <p/> |
| 44 | * </p> |
| 45 | * |
| 46 | * @author Eric Farng |
| 47 | * @version $Revision: 1.4 $ |
| 48 | */ |
| 49 | public class FrameBodyRVRB extends AbstractID3v2FrameBody { |
| 50 | |
| 51 | /** |
| 52 | * Creates a new FrameBodyRVRB object. |
| 53 | */ |
| 54 | public FrameBodyRVRB() { |
| 55 | super(); |
| 56 | } |
| 57 | |
| 58 | /** |
| 59 | * Creates a new FrameBodyRVRB object. |
| 60 | */ |
| 61 | public FrameBodyRVRB(final FrameBodyRVRB body) { |
| 62 | super(body); |
| 63 | } |
| 64 | |
| 65 | /** |
| 66 | * Creates a new FrameBodyRVRB object. |
| 67 | */ |
| 68 | public FrameBodyRVRB(final short reverbLeft, |
| 69 | final short reverbRight, |
| 70 | final byte reverbBouncesLeft, |
| 71 | final byte reverbBouncesRight, |
| 72 | final byte reverbFeedbackLeftToLeft, |
| 73 | final byte reverbFeedbackLeftToRight, |
| 74 | final byte reverbFeedbackRightToRight, |
| 75 | final byte reverbFeedbackRightToLeft, |
| 76 | final byte premixLeftToRight, |
| 77 | final byte premixRightToLeft) { |
| 78 | setObject("Reverb Left", new Short(reverbLeft)); |
| 79 | setObject("Reverb Right", new Short(reverbRight)); |
| 80 | setObject("Reverb Bounces Left", new Byte(reverbBouncesLeft)); |
| 81 | setObject("Reverb Bounces Right", new Byte(reverbBouncesRight)); |
| 82 | setObject("Reverb Feedback Left To Left", new Byte(reverbFeedbackLeftToLeft)); |
| 83 | setObject("Reverb Feedback Left To Right", new Byte(reverbFeedbackLeftToRight)); |
| 84 | setObject("Reverb Feedback Right To Right", new Byte(reverbFeedbackRightToRight)); |
| 85 | setObject("Reverb Feedback Right to Left", new Byte(reverbFeedbackRightToLeft)); |
| 86 | setObject("Premix Left To Right", new Byte(premixLeftToRight)); |
| 87 | setObject("Premix Right To Left", new Byte(premixRightToLeft)); |
| 88 | } |
| 89 | |
| 90 | /** |
| 91 | * Creates a new FrameBodyRVRB object. |
| 92 | */ |
| 93 | public FrameBodyRVRB(final RandomAccessFile file) throws IOException, InvalidTagException { |
| 94 | this.read(file); |
| 95 | } |
| 96 | |
| 97 | public String getIdentifier() { |
| 98 | return "RVRB"; |
| 99 | } |
| 100 | |
| 101 | protected void setupObjectList() { |
| 102 | appendToObjectList(new ObjectNumberFixedLength("Reverb Left", 2)); |
| 103 | appendToObjectList(new ObjectNumberFixedLength("Reverb Right", 2)); |
| 104 | appendToObjectList(new ObjectNumberFixedLength("Reverb Bounces Left", 1)); |
| 105 | appendToObjectList(new ObjectNumberFixedLength("Reverb Bounces Right", 1)); |
| 106 | appendToObjectList(new ObjectNumberFixedLength("Reverb Feedback Left To Left", 1)); |
| 107 | appendToObjectList(new ObjectNumberFixedLength("Reverb Feedback Left To Right", 1)); |
| 108 | appendToObjectList(new ObjectNumberFixedLength("Reverb Feedback Right To Right", 1)); |
| 109 | appendToObjectList(new ObjectNumberFixedLength("Reverb Feedback Right to Left", 1)); |
| 110 | appendToObjectList(new ObjectNumberFixedLength("Premix Left To Right", 1)); |
| 111 | appendToObjectList(new ObjectNumberFixedLength("Premix Right To Left", 1)); |
| 112 | } |
| 113 | } |