~ubuntu-branches/ubuntu/utopic/libjaudiotagger-java/utopic

« back to all changes in this revision

Viewing changes to src/org/jaudiotagger/tag/id3/framebody/FrameBodyRVRB.java

  • Committer: Bazaar Package Importer
  • Author(s): Damien Raude-Morvan
  • Date: 2011-04-28 23:52:43 UTC
  • mfrom: (3.1.4 sid)
  • Revision ID: james.westby@ubuntu.com-20110428235243-pzalvw6lncis3ukf
Tags: 2.0.3-1
* d/control: Drop Depends on default-jre per Debian Java Policy as its
  a library package.
* d/watch: Fix to directly monitor SVN tags.
* Switch to 3.0 (quilt) format.
* Bump Standards-Version to 3.9.2 (no changes needed).

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
/*
2
 
 *  MusicTag Copyright (C)2003,2004
3
 
 *
4
 
 *  This library is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser
5
 
 *  General Public  License as published by the Free Software Foundation; either version 2.1 of the License,
6
 
 *  or (at your option) any later version.
7
 
 *
8
 
 *  This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even
9
 
 *  the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
10
 
 *  See the GNU Lesser General Public License for more details.
11
 
 *
12
 
 *  You should have received a copy of the GNU Lesser General Public License along with this library; if not,
13
 
 *  you can get a copy from http://www.opensource.org/licenses/lgpl-license.php or write to the Free Software
14
 
 *  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
15
 
 */
16
 
package org.jaudiotagger.tag.id3.framebody;
17
 
 
18
 
import org.jaudiotagger.tag.InvalidTagException;
19
 
import org.jaudiotagger.tag.datatype.DataTypes;
20
 
import org.jaudiotagger.tag.datatype.NumberFixedLength;
21
 
import org.jaudiotagger.tag.id3.ID3v24Frames;
22
 
 
23
 
import java.nio.ByteBuffer;
24
 
 
25
 
/**
26
 
 * Reverb frame.
27
 
 * <p/>
28
 
 * <p/>
29
 
 * Yet another subjective one. You may here adjust echoes of different
30
 
 * kinds. Reverb left/right is the delay between every bounce in ms.
31
 
 * Reverb bounces left/right is the number of bounces that should be
32
 
 * made. $FF equals an infinite number of bounces. Feedback is the
33
 
 * amount of volume that should be returned to the next echo bounce. $00
34
 
 * is 0%, $FF is 100%. If this value were $7F, there would be 50% volume
35
 
 * reduction on the first bounce, 50% of that on the second and so on.
36
 
 * Left to left means the sound from the left bounce to be played in the
37
 
 * left speaker, while left to right means sound from the left bounce to
38
 
 * be played in the right speaker.
39
 
 * </p><p>
40
 
 * 'Premix left to right' is the amount of left sound to be mixed in the
41
 
 * right before any reverb is applied, where $00 id 0% and $FF is 100%.
42
 
 * 'Premix right to left' does the same thing, but right to left.
43
 
 * Setting both premix to $FF would result in a mono output (if the
44
 
 * reverb is applied symmetric). There may only be one "RVRB" frame in
45
 
 * each tag.
46
 
 * </p><p><table border=0 width="70%">
47
 
 * <tr><td colspan=2> &lt;Header for 'Reverb', ID: "RVRB"&gt;</td></tr>
48
 
 * <tr><td>Reverb left (ms)                </td><td>$xx xx   </td></tr>
49
 
 * <tr><td>Reverb right (ms)               </td><td>$xx xx   </td></tr>
50
 
 * <tr><td>Reverb bounces, left            </td><td>$xx      </td></tr>
51
 
 * <tr><td>Reverb bounces, right           </td><td>$xx      </td></tr>
52
 
 * <tr><td>Reverb feedback, left to left   </td><td>$xx      </td></tr>
53
 
 * <tr><td>Reverb feedback, left to right  </td><td>$xx      </td></tr>
54
 
 * <tr><td>Reverb feedback, right to right </td><td>$xx      </td></tr>
55
 
 * <tr><td>Reverb feedback, right to left  </td><td>$xx      </td></tr>
56
 
 * <tr><td>Premix left to right            </td><td>$xx      </td></tr>
57
 
 * <tr><td>Premix right to left            </td><td>$xx      </td></tr>
58
 
 * </table></p>
59
 
 * <p/>
60
 
 * <p>For more details, please refer to the ID3 specifications:
61
 
 * <ul>
62
 
 * <li><a href="http://www.id3.org/id3v2.3.0.txt">ID3 v2.3.0 Spec</a>
63
 
 * </ul>
64
 
 *
65
 
 * @author : Paul Taylor
66
 
 * @author : Eric Farng
67
 
 * @version $Id: FrameBodyRVRB.java,v 1.14 2009/11/12 13:25:23 paultaylor Exp $
68
 
 */
69
 
public class FrameBodyRVRB extends AbstractID3v2FrameBody implements ID3v24FrameBody, ID3v23FrameBody
70
 
{
71
 
    /**
72
 
     * Creates a new FrameBodyRVRB datatype.
73
 
     */
74
 
    public FrameBodyRVRB()
75
 
    {
76
 
        //        this.setObject("Reverb Left", new Short((short) 0));
77
 
        //        this.setObject("Reverb Right", new Short((short) 0));
78
 
        //        this.setObject("Reverb Bounces Left", new Byte((byte) 0));
79
 
        //        this.setObject("Reverb Bounces Right", new Byte((byte) 0));
80
 
        //        this.setObject("Reverb Feedback Left To Left", new Byte((byte) 0));
81
 
        //        this.setObject("Reverb Feedback Left To Right", new Byte((byte) 0));
82
 
        //        this.setObject("Reverb Feedback Right To Right", new Byte((byte) 0));
83
 
        //        this.setObject("Reverb Feedback Right to Left", new Byte((byte) 0));
84
 
        //        this.setObject("Premix Left To Right", new Byte((byte) 0));
85
 
        //        this.setObject("Premix Right To Left", new Byte((byte) 0));
86
 
    }
87
 
 
88
 
    public FrameBodyRVRB(FrameBodyRVRB body)
89
 
    {
90
 
        super(body);
91
 
    }
92
 
 
93
 
    /**
94
 
     * Creates a new FrameBodyRVRB datatype.
95
 
     *
96
 
     * @param reverbLeft
97
 
     * @param reverbRight
98
 
     * @param reverbBouncesLeft
99
 
     * @param reverbBouncesRight
100
 
     * @param reverbFeedbackLeftToLeft
101
 
     * @param reverbFeedbackLeftToRight
102
 
     * @param reverbFeedbackRightToRight
103
 
     * @param reverbFeedbackRightToLeft
104
 
     * @param premixLeftToRight
105
 
     * @param premixRightToLeft
106
 
     */
107
 
    public FrameBodyRVRB(short reverbLeft, short reverbRight, byte reverbBouncesLeft, byte reverbBouncesRight, byte reverbFeedbackLeftToLeft, byte reverbFeedbackLeftToRight, byte reverbFeedbackRightToRight, byte reverbFeedbackRightToLeft, byte premixLeftToRight, byte premixRightToLeft)
108
 
    {
109
 
        this.setObjectValue(DataTypes.OBJ_REVERB_LEFT, reverbLeft);
110
 
        this.setObjectValue(DataTypes.OBJ_REVERB_RIGHT, reverbRight);
111
 
        this.setObjectValue(DataTypes.OBJ_REVERB_BOUNCE_LEFT, reverbBouncesLeft);
112
 
        this.setObjectValue(DataTypes.OBJ_REVERB_BOUNCE_RIGHT, reverbBouncesRight);
113
 
        this.setObjectValue(DataTypes.OBJ_REVERB_FEEDBACK_LEFT_TO_LEFT, reverbFeedbackLeftToLeft);
114
 
        this.setObjectValue(DataTypes.OBJ_REVERB_FEEDBACK_LEFT_TO_RIGHT, reverbFeedbackLeftToRight);
115
 
        this.setObjectValue(DataTypes.OBJ_REVERB_FEEDBACK_RIGHT_TO_RIGHT, reverbFeedbackRightToRight);
116
 
        this.setObjectValue(DataTypes.OBJ_REVERB_FEEDBACK_RIGHT_TO_LEFT, reverbFeedbackRightToLeft);
117
 
        this.setObjectValue(DataTypes.OBJ_PREMIX_LEFT_TO_RIGHT, premixLeftToRight);
118
 
        this.setObjectValue(DataTypes.OBJ_PREMIX_RIGHT_TO_LEFT, premixRightToLeft);
119
 
    }
120
 
 
121
 
    /**
122
 
     * Creates a new FrameBodyRVRB datatype.
123
 
     *
124
 
     * @param byteBuffer
125
 
     * @param frameSize
126
 
     * @throws InvalidTagException if unable to create framebody from buffer
127
 
     */
128
 
    public FrameBodyRVRB(ByteBuffer byteBuffer, int frameSize) throws InvalidTagException
129
 
    {
130
 
        super(byteBuffer, frameSize);
131
 
    }
132
 
 
133
 
    /**
134
 
     * The ID3v2 frame identifier
135
 
     *
136
 
     * @return the ID3v2 frame identifier  for this frame type
137
 
     */
138
 
    public String getIdentifier()
139
 
    {
140
 
        return ID3v24Frames.FRAME_ID_REVERB;
141
 
    }
142
 
 
143
 
 
144
 
    /**
145
 
     *
146
 
     */
147
 
    protected void setupObjectList()
148
 
    {
149
 
        objectList.add(new NumberFixedLength(DataTypes.OBJ_REVERB_LEFT, this, 2));
150
 
        objectList.add(new NumberFixedLength(DataTypes.OBJ_REVERB_RIGHT, this, 2));
151
 
        objectList.add(new NumberFixedLength(DataTypes.OBJ_REVERB_BOUNCE_LEFT, this, 1));
152
 
        objectList.add(new NumberFixedLength(DataTypes.OBJ_REVERB_BOUNCE_RIGHT, this, 1));
153
 
        objectList.add(new NumberFixedLength(DataTypes.OBJ_REVERB_FEEDBACK_LEFT_TO_LEFT, this, 1));
154
 
        objectList.add(new NumberFixedLength(DataTypes.OBJ_REVERB_FEEDBACK_LEFT_TO_RIGHT, this, 1));
155
 
        objectList.add(new NumberFixedLength(DataTypes.OBJ_REVERB_FEEDBACK_RIGHT_TO_RIGHT, this, 1));
156
 
        objectList.add(new NumberFixedLength(DataTypes.OBJ_REVERB_FEEDBACK_RIGHT_TO_LEFT, this, 1));
157
 
        objectList.add(new NumberFixedLength(DataTypes.OBJ_PREMIX_LEFT_TO_RIGHT, this, 1));
158
 
        objectList.add(new NumberFixedLength(DataTypes.OBJ_PREMIX_RIGHT_TO_LEFT, this, 1));
159
 
    }
160
 
}
 
1
/*
 
2
 *  MusicTag Copyright (C)2003,2004
 
3
 *
 
4
 *  This library is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser
 
5
 *  General Public  License as published by the Free Software Foundation; either version 2.1 of the License,
 
6
 *  or (at your option) any later version.
 
7
 *
 
8
 *  This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even
 
9
 *  the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
 
10
 *  See the GNU Lesser General Public License for more details.
 
11
 *
 
12
 *  You should have received a copy of the GNU Lesser General Public License along with this library; if not,
 
13
 *  you can get a copy from http://www.opensource.org/licenses/lgpl-license.php or write to the Free Software
 
14
 *  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
 
15
 */
 
16
package org.jaudiotagger.tag.id3.framebody;
 
17
 
 
18
import org.jaudiotagger.tag.InvalidTagException;
 
19
import org.jaudiotagger.tag.datatype.DataTypes;
 
20
import org.jaudiotagger.tag.datatype.NumberFixedLength;
 
21
import org.jaudiotagger.tag.id3.ID3v24Frames;
 
22
 
 
23
import java.nio.ByteBuffer;
 
24
 
 
25
/**
 
26
 * Reverb frame.
 
27
 * <p/>
 
28
 * <p/>
 
29
 * Yet another subjective one. You may here adjust echoes of different
 
30
 * kinds. Reverb left/right is the delay between every bounce in ms.
 
31
 * Reverb bounces left/right is the number of bounces that should be
 
32
 * made. $FF equals an infinite number of bounces. Feedback is the
 
33
 * amount of volume that should be returned to the next echo bounce. $00
 
34
 * is 0%, $FF is 100%. If this value were $7F, there would be 50% volume
 
35
 * reduction on the first bounce, 50% of that on the second and so on.
 
36
 * Left to left means the sound from the left bounce to be played in the
 
37
 * left speaker, while left to right means sound from the left bounce to
 
38
 * be played in the right speaker.
 
39
 * </p><p>
 
40
 * 'Premix left to right' is the amount of left sound to be mixed in the
 
41
 * right before any reverb is applied, where $00 id 0% and $FF is 100%.
 
42
 * 'Premix right to left' does the same thing, but right to left.
 
43
 * Setting both premix to $FF would result in a mono output (if the
 
44
 * reverb is applied symmetric). There may only be one "RVRB" frame in
 
45
 * each tag.
 
46
 * </p><p><table border=0 width="70%">
 
47
 * <tr><td colspan=2> &lt;Header for 'Reverb', ID: "RVRB"&gt;</td></tr>
 
48
 * <tr><td>Reverb left (ms)                </td><td>$xx xx   </td></tr>
 
49
 * <tr><td>Reverb right (ms)               </td><td>$xx xx   </td></tr>
 
50
 * <tr><td>Reverb bounces, left            </td><td>$xx      </td></tr>
 
51
 * <tr><td>Reverb bounces, right           </td><td>$xx      </td></tr>
 
52
 * <tr><td>Reverb feedback, left to left   </td><td>$xx      </td></tr>
 
53
 * <tr><td>Reverb feedback, left to right  </td><td>$xx      </td></tr>
 
54
 * <tr><td>Reverb feedback, right to right </td><td>$xx      </td></tr>
 
55
 * <tr><td>Reverb feedback, right to left  </td><td>$xx      </td></tr>
 
56
 * <tr><td>Premix left to right            </td><td>$xx      </td></tr>
 
57
 * <tr><td>Premix right to left            </td><td>$xx      </td></tr>
 
58
 * </table></p>
 
59
 * <p/>
 
60
 * <p>For more details, please refer to the ID3 specifications:
 
61
 * <ul>
 
62
 * <li><a href="http://www.id3.org/id3v2.3.0.txt">ID3 v2.3.0 Spec</a>
 
63
 * </ul>
 
64
 *
 
65
 * @author : Paul Taylor
 
66
 * @author : Eric Farng
 
67
 * @version $Id: FrameBodyRVRB.java 832 2009-11-12 13:25:38Z paultaylor $
 
68
 */
 
69
public class FrameBodyRVRB extends AbstractID3v2FrameBody implements ID3v24FrameBody, ID3v23FrameBody
 
70
{
 
71
    /**
 
72
     * Creates a new FrameBodyRVRB datatype.
 
73
     */
 
74
    public FrameBodyRVRB()
 
75
    {
 
76
        //        this.setObject("Reverb Left", new Short((short) 0));
 
77
        //        this.setObject("Reverb Right", new Short((short) 0));
 
78
        //        this.setObject("Reverb Bounces Left", new Byte((byte) 0));
 
79
        //        this.setObject("Reverb Bounces Right", new Byte((byte) 0));
 
80
        //        this.setObject("Reverb Feedback Left To Left", new Byte((byte) 0));
 
81
        //        this.setObject("Reverb Feedback Left To Right", new Byte((byte) 0));
 
82
        //        this.setObject("Reverb Feedback Right To Right", new Byte((byte) 0));
 
83
        //        this.setObject("Reverb Feedback Right to Left", new Byte((byte) 0));
 
84
        //        this.setObject("Premix Left To Right", new Byte((byte) 0));
 
85
        //        this.setObject("Premix Right To Left", new Byte((byte) 0));
 
86
    }
 
87
 
 
88
    public FrameBodyRVRB(FrameBodyRVRB body)
 
89
    {
 
90
        super(body);
 
91
    }
 
92
 
 
93
    /**
 
94
     * Creates a new FrameBodyRVRB datatype.
 
95
     *
 
96
     * @param reverbLeft
 
97
     * @param reverbRight
 
98
     * @param reverbBouncesLeft
 
99
     * @param reverbBouncesRight
 
100
     * @param reverbFeedbackLeftToLeft
 
101
     * @param reverbFeedbackLeftToRight
 
102
     * @param reverbFeedbackRightToRight
 
103
     * @param reverbFeedbackRightToLeft
 
104
     * @param premixLeftToRight
 
105
     * @param premixRightToLeft
 
106
     */
 
107
    public FrameBodyRVRB(short reverbLeft, short reverbRight, byte reverbBouncesLeft, byte reverbBouncesRight, byte reverbFeedbackLeftToLeft, byte reverbFeedbackLeftToRight, byte reverbFeedbackRightToRight, byte reverbFeedbackRightToLeft, byte premixLeftToRight, byte premixRightToLeft)
 
108
    {
 
109
        this.setObjectValue(DataTypes.OBJ_REVERB_LEFT, reverbLeft);
 
110
        this.setObjectValue(DataTypes.OBJ_REVERB_RIGHT, reverbRight);
 
111
        this.setObjectValue(DataTypes.OBJ_REVERB_BOUNCE_LEFT, reverbBouncesLeft);
 
112
        this.setObjectValue(DataTypes.OBJ_REVERB_BOUNCE_RIGHT, reverbBouncesRight);
 
113
        this.setObjectValue(DataTypes.OBJ_REVERB_FEEDBACK_LEFT_TO_LEFT, reverbFeedbackLeftToLeft);
 
114
        this.setObjectValue(DataTypes.OBJ_REVERB_FEEDBACK_LEFT_TO_RIGHT, reverbFeedbackLeftToRight);
 
115
        this.setObjectValue(DataTypes.OBJ_REVERB_FEEDBACK_RIGHT_TO_RIGHT, reverbFeedbackRightToRight);
 
116
        this.setObjectValue(DataTypes.OBJ_REVERB_FEEDBACK_RIGHT_TO_LEFT, reverbFeedbackRightToLeft);
 
117
        this.setObjectValue(DataTypes.OBJ_PREMIX_LEFT_TO_RIGHT, premixLeftToRight);
 
118
        this.setObjectValue(DataTypes.OBJ_PREMIX_RIGHT_TO_LEFT, premixRightToLeft);
 
119
    }
 
120
 
 
121
    /**
 
122
     * Creates a new FrameBodyRVRB datatype.
 
123
     *
 
124
     * @param byteBuffer
 
125
     * @param frameSize
 
126
     * @throws InvalidTagException if unable to create framebody from buffer
 
127
     */
 
128
    public FrameBodyRVRB(ByteBuffer byteBuffer, int frameSize) throws InvalidTagException
 
129
    {
 
130
        super(byteBuffer, frameSize);
 
131
    }
 
132
 
 
133
    /**
 
134
     * The ID3v2 frame identifier
 
135
     *
 
136
     * @return the ID3v2 frame identifier  for this frame type
 
137
     */
 
138
    public String getIdentifier()
 
139
    {
 
140
        return ID3v24Frames.FRAME_ID_REVERB;
 
141
    }
 
142
 
 
143
 
 
144
    /**
 
145
     *
 
146
     */
 
147
    protected void setupObjectList()
 
148
    {
 
149
        objectList.add(new NumberFixedLength(DataTypes.OBJ_REVERB_LEFT, this, 2));
 
150
        objectList.add(new NumberFixedLength(DataTypes.OBJ_REVERB_RIGHT, this, 2));
 
151
        objectList.add(new NumberFixedLength(DataTypes.OBJ_REVERB_BOUNCE_LEFT, this, 1));
 
152
        objectList.add(new NumberFixedLength(DataTypes.OBJ_REVERB_BOUNCE_RIGHT, this, 1));
 
153
        objectList.add(new NumberFixedLength(DataTypes.OBJ_REVERB_FEEDBACK_LEFT_TO_LEFT, this, 1));
 
154
        objectList.add(new NumberFixedLength(DataTypes.OBJ_REVERB_FEEDBACK_LEFT_TO_RIGHT, this, 1));
 
155
        objectList.add(new NumberFixedLength(DataTypes.OBJ_REVERB_FEEDBACK_RIGHT_TO_RIGHT, this, 1));
 
156
        objectList.add(new NumberFixedLength(DataTypes.OBJ_REVERB_FEEDBACK_RIGHT_TO_LEFT, this, 1));
 
157
        objectList.add(new NumberFixedLength(DataTypes.OBJ_PREMIX_LEFT_TO_RIGHT, this, 1));
 
158
        objectList.add(new NumberFixedLength(DataTypes.OBJ_PREMIX_RIGHT_TO_LEFT, this, 1));
 
159
    }
 
160
}