PageRenderTime 25ms CodeModel.GetById 13ms app.highlight 8ms RepoModel.GetById 1ms app.codeStats 0ms

/src/Zend/Media/Id3/Frame/Rvrb.php

http://php-reader.googlecode.com/
PHP | 331 lines | 125 code | 35 blank | 171 comment | 1 complexity | 10e10ee040f01aa2df9987205dfbe8c4 MD5 | raw file
  1<?php
  2/**
  3 * Zend Framework
  4 *
  5 * LICENSE
  6 *
  7 * This source file is subject to the new BSD license that is bundled
  8 * with this package in the file LICENSE.txt.
  9 * It is also available through the world-wide-web at this URL:
 10 * http://framework.zend.com/license/new-bsd
 11 * If you did not receive a copy of the license and are unable to
 12 * obtain it through the world-wide-web, please send an email
 13 * to license@zend.com so we can send you a copy immediately.
 14 *
 15 * @category   Zend
 16 * @package    Zend_Media
 17 * @subpackage ID3
 18 * @copyright  Copyright (c) 2005-2009 Zend Technologies USA Inc. (http://www.zend.com) 
 19 * @license    http://framework.zend.com/license/new-bsd     New BSD License
 20 * @version    $Id: Rvrb.php 177 2010-03-09 13:13:34Z svollbehr $
 21 */
 22
 23/**#@+ @ignore */
 24require_once 'Zend/Media/Id3/Frame.php';
 25/**#@-*/
 26
 27/**
 28 * The <i>Reverb</i> is yet another subjective frame, with which you can adjust
 29 * echoes of different kinds. Reverb left/right is the delay between every
 30 * bounce in milliseconds. Reverb bounces left/right is the number of bounces
 31 * that should be made. $FF equals an infinite number of bounces. Feedback is
 32 * the amount of volume that should be returned to the next echo bounce. $00 is
 33 * 0%, $FF is 100%. If this value were $7F, there would be 50% volume reduction
 34 * on the first bounce, 50% of that on the second and so on. Left to left means
 35 * the sound from the left bounce to be played in the left speaker, while left
 36 * to right means sound from the left bounce to be played in the right speaker.
 37 *
 38 * Premix left to right is the amount of left sound to be mixed in the right
 39 * before any reverb is applied, where $00 id 0% and $FF is 100%. Premix right
 40 * to left does the same thing, but right to left. Setting both premix to $FF
 41 * would result in a mono output (if the reverb is applied symmetric). There
 42 * may only be one RVRB frame in each tag.
 43 *
 44 * @category   Zend
 45 * @package    Zend_Media
 46 * @subpackage ID3
 47 * @author     Sven Vollbehr <sven@vollbehr.eu>
 48 * @author     Ryan Butterfield <buttza@gmail.com>
 49 * @copyright  Copyright (c) 2005-2009 Zend Technologies USA Inc. (http://www.zend.com) 
 50 * @license    http://framework.zend.com/license/new-bsd     New BSD License
 51 * @version    $Id: Rvrb.php 177 2010-03-09 13:13:34Z svollbehr $
 52 */
 53final class Zend_Media_Id3_Frame_Rvrb extends Zend_Media_Id3_Frame
 54{
 55    /** @var integer */
 56    private $_reverbLeft;
 57
 58    /** @var integer */
 59    private $_reverbRight;
 60
 61    /** @var integer */
 62    private $_reverbBouncesLeft;
 63
 64    /** @var integer */
 65    private $_reverbBouncesRight;
 66
 67    /** @var integer */
 68    private $_reverbFeedbackLtoL;
 69
 70    /** @var integer */
 71    private $_reverbFeedbackLtoR;
 72
 73    /** @var integer */
 74    private $_reverbFeedbackRtoR;
 75
 76    /** @var integer */
 77    private $_reverbFeedbackRtoL;
 78
 79    /** @var integer */
 80    private $_premixLtoR;
 81
 82    /** @var integer */
 83    private $_premixRtoL;
 84
 85    /**
 86     * Constructs the class with given parameters and parses object related
 87     * data.
 88     *
 89     * @param Zend_Io_Reader $reader The reader object.
 90     * @param Array $options The options array.
 91     */
 92    public function __construct($reader = null, &$options = array())
 93    {
 94        parent::__construct($reader, $options);
 95
 96        if ($this->_reader === null) {
 97            return;
 98        }
 99
100        $this->_reverbLeft  = $this->_reader->readUInt16BE();
101        $this->_reverbRight = $this->_reader->readUInt16BE();
102        $this->_reverbBouncesLeft  = $this->_reader->readUInt8();
103        $this->_reverbBouncesRight = $this->_reader->readUInt8();
104        $this->_reverbFeedbackLtoL = $this->_reader->readUInt8();
105        $this->_reverbFeedbackLtoR = $this->_reader->readUInt8();
106        $this->_reverbFeedbackRtoR = $this->_reader->readUInt8();
107        $this->_reverbFeedbackRtoL = $this->_reader->readUInt8();
108        $this->_premixLtoR  = $this->_reader->readUInt8();
109        $this->_premixRtoL  = $this->_reader->readUInt8();
110    }
111
112    /**
113     * Returns the left reverb.
114     *
115     * @return integer
116     */
117    public function getReverbLeft() 
118    {
119        return $this->_reverbLeft; 
120    }
121
122    /**
123     * Sets the left reverb.
124     *
125     * @param integer $reverbLeft The left reverb.
126     */
127    public function setReverbLeft($reverbLeft)
128    {
129        return $this->_reverbLeft = $reverbLeft;
130    }
131
132    /**
133     * Returns the right reverb.
134     *
135     * @return integer
136     */
137    public function getReverbRight() 
138    {
139        return $this->_reverbRight; 
140    }
141
142    /**
143     * Sets the right reverb.
144     *
145     * @param integer $reverbRight The right reverb.
146     */
147    public function setReverbRight($reverbRight)
148    {
149        return $this->_reverbRight = $reverbRight;
150    }
151
152    /**
153     * Returns the left reverb bounces.
154     *
155     * @return integer
156     */
157    public function getReverbBouncesLeft() 
158    {
159        return $this->_reverbBouncesLeft; 
160    }
161
162    /**
163     * Sets the left reverb bounces.
164     *
165     * @param integer $reverbBouncesLeft The left reverb bounces.
166     */
167    public function setReverbBouncesLeft($reverbBouncesLeft)
168    {
169        $this->_reverbBouncesLeft = $reverbBouncesLeft;
170    }
171
172    /**
173     * Returns the right reverb bounces.
174     *
175     * @return integer
176     */
177    public function getReverbBouncesRight() 
178    {
179        return $this->_reverbBouncesRight; 
180    }
181
182    /**
183     * Sets the right reverb bounces.
184     *
185     * @param integer $reverbBouncesRight The right reverb bounces.
186     */
187    public function setReverbBouncesRight($reverbBouncesRight)
188    {
189        $this->_reverbBouncesRight = $reverbBouncesRight;
190    }
191
192    /**
193     * Returns the left-to-left reverb feedback.
194     *
195     * @return integer
196     */
197    public function getReverbFeedbackLtoL() 
198    {
199        return $this->_reverbFeedbackLtoL; 
200    }
201
202    /**
203     * Sets the left-to-left reverb feedback.
204     *
205     * @param integer $reverbFeedbackLtoL The left-to-left reverb feedback.
206     */
207    public function setReverbFeedbackLtoL($reverbFeedbackLtoL)
208    {
209        $this->_reverbFeedbackLtoL = $reverbFeedbackLtoL;
210    }
211
212    /**
213     * Returns the left-to-right reverb feedback.
214     *
215     * @return integer
216     */
217    public function getReverbFeedbackLtoR() 
218    {
219        return $this->_reverbFeedbackLtoR; 
220    }
221
222    /**
223     * Sets the left-to-right reverb feedback.
224     *
225     * @param integer $reverbFeedbackLtoR The left-to-right reverb feedback.
226     */
227    public function setReverbFeedbackLtoR($reverbFeedbackLtoR)
228    {
229        $this->_reverbFeedbackLtoR = $reverbFeedbackLtoR;
230    }
231
232    /**
233     * Returns the right-to-right reverb feedback.
234     *
235     * @return integer
236     */
237    public function getReverbFeedbackRtoR() 
238    {
239        return $this->_reverbFeedbackRtoR; 
240    }
241
242    /**
243     * Sets the right-to-right reverb feedback.
244     *
245     * @param integer $reverbFeedbackRtoR The right-to-right reverb feedback.
246     */
247    public function setReverbFeedbackRtoR($reverbFeedbackRtoR)
248    {
249        $this->_reverbFeedbackRtoR = $reverbFeedbackRtoR;
250    }
251
252    /**
253     * Returns the right-to-left reverb feedback.
254     *
255     * @return integer
256     */
257    public function getReverbFeedbackRtoL() 
258    {
259        return $this->_reverbFeedbackRtoL; 
260    }
261
262    /**
263     * Sets the right-to-left reverb feedback.
264     *
265     * @param integer $reverbFeedbackRtoL The right-to-left reverb feedback.
266     */
267    public function setReverbFeedbackRtoL($reverbFeedbackRtoL)
268    {
269        $this->_reverbFeedbackRtoL = $reverbFeedbackRtoL;
270    }
271
272    /**
273     * Returns the left-to-right premix.
274     *
275     * @return integer
276     */
277    public function getPremixLtoR() 
278    {
279        return $this->_premixLtoR; 
280    }
281
282    /**
283     * Sets the left-to-right premix.
284     *
285     * @param integer $premixLtoR The left-to-right premix.
286     */
287    public function setPremixLtoR($premixLtoR)
288    {
289        $this->_premixLtoR = $premixLtoR;
290    }
291
292    /**
293     * Returns the right-to-left premix.
294     *
295     * @return integer
296     */
297    public function getPremixRtoL() 
298    {
299        return $this->_premixRtoL; 
300    }
301
302    /**
303     * Sets the right-to-left premix.
304     *
305     * @param integer $premixRtoL The right-to-left premix.
306     */
307    public function setPremixRtoL($premixRtoL)
308    {
309        $this->_premixRtoL = $premixRtoL;
310    }
311
312    /**
313     * Writes the frame raw data without the header.
314     *
315     * @param Zend_Io_Writer $writer The writer object.
316     * @return void
317     */
318    protected function _writeData($writer)
319    {
320        $writer->writeUInt16BE($this->_reverbLeft)
321               ->writeUInt16BE($this->_reverbRight)
322               ->writeUInt8($this->_reverbBouncesLeft)
323               ->writeUInt8($this->_reverbBouncesRight)
324               ->writeUInt8($this->_reverbFeedbackLtoL)
325               ->writeUInt8($this->_reverbFeedbackLtoR)
326               ->writeUInt8($this->_reverbFeedbackRtoR)
327               ->writeUInt8($this->_reverbFeedbackRtoL)
328               ->writeUInt8($this->_premixLtoR)
329               ->writeUInt8($this->_premixRtoL);
330    }
331}