All Unit tests
Current file: C:\code\midiparser\src\Midi\Event\SetTempoEvent.php
Legend: executed not executed dead code

  Coverage
  Classes Functions / Methods Lines
Total
100.00%100.00%
100.00% 1 / 1
100.00%100.00%
100.00% 4 / 4
100.00%100.00%
100.00% 7 / 7
 
Midi\SetTempoEvent
100.00%100.00%
100.00% 1 / 1
100.00%100.00%
100.00% 4 / 4
100.00%100.00%
100.00% 7 / 7
 public function __construct($mpqn)
100.00%100.00%
100.00% 1 / 1
100.00%100.00%
100.00% 2 / 2
 public function getParamDescription()
100.00%100.00%
100.00% 1 / 1
100.00%100.00%
100.00% 2 / 2
 public static function getBpmFromMpqn($mpqn)
100.00%100.00%
100.00% 1 / 1
100.00%100.00%
100.00% 1 / 1
 public function getSubtype()
100.00%100.00%
100.00% 1 / 1
100.00%100.00%
100.00% 1 / 1


       1                 : <?php                                                                                           
       2                 :                                                                                                 
       3                 :     /**                                                                                         
       4                 :      * \Midi\Event\SetTempoEvent                                                                
       5                 :      *                                                                                          
       6                 :      * @package    Midi                                                                         
       7                 :      * @subpackage Event                                                                        
       8                 :      * @copyright  © 2009 Tommy Montgomery <http://phpmidiparser.com/>                          
       9                 :      * @since      1.0                                                                          
      10                 :      */                                                                                         
      11                 :                                                                                                 
      12                 :     namespace Midi\Event;                                                                       
      13                 :                                                                                                 
      14                 :     /**                                                                                         
      15                 :      * Represents the set tempo meta event                                                      
      16                 :      *                                                                                          
      17                 :      * @package    Midi                                                                         
      18                 :      * @subpackage Event                                                                        
      19                 :      * @since      1.0                                                                          
      20                 :      */                                                                                         
      21               1 :     class SetTempoEvent extends MetaEvent {                                                     
      22                 :                                                                                                 
      23                 :         /**                                                                                     
      24                 :          * Constructor                                                                          
      25                 :          *                                                                                      
      26                 :          * @since 1.0                                                                           
      27                 :          *                                                                                      
      28                 :          * @param  int $mpqn Microseconds per quarter note                                      
      29                 :          */                                                                                     
      30                 :         public function __construct($mpqn) {                                                    
      31               3 :             parent::__construct(array(($mpqn >> 16) & 0xFF, ($mpqn >> 8) & 0xFF, $mpqn & 0xFF));
      32               3 :         }                                                                                       
      33                 :                                                                                                 
      34                 :         /**                                                                                     
      35                 :          * @since 1.0                                                                           
      36                 :          * @uses  getBpmFromMpqn()                                                              
      37                 :          *                                                                                      
      38                 :          * @return string                                                                       
      39                 :          */                                                                                     
      40                 :         public function getParamDescription() {                                                 
      41               1 :             $mpqn = ($this->data[0] << 16) | ($this->data[1] << 8) | $this->data[2];            
      42               1 :             return self::getBpmFromMpqn($mpqn) . ' BPM';                                        
      43                 :         }                                                                                       
      44                 :                                                                                                 
      45                 :         /**                                                                                     
      46                 :          * Calculates the beats per minute give the number                                      
      47                 :          * of microseconds per quarter note                                                     
      48                 :          *                                                                                      
      49                 :          * @since 1.0                                                                           
      50                 :          *                                                                                      
      51                 :          * @param  int $mpqn The number of microseconds per quarter note                        
      52                 :          * @return int                                                                          
      53                 :          */                                                                                     
      54                 :         public static function getBpmFromMpqn($mpqn) {                                          
      55               1 :             return (int)floor(60000000 / $mpqn);                                                
      56                 :         }                                                                                       
      57                 :                                                                                                 
      58                 :         /**                                                                                     
      59                 :          * @since 1.0                                                                           
      60                 :          * @uses  MetaEventType::SET_TEMPO                                                      
      61                 :          *                                                                                      
      62                 :          * @return int                                                                          
      63                 :          */                                                                                     
      64                 :         public function getSubtype() {                                                          
      65               1 :             return MetaEventType::SET_TEMPO;                                                    
      66                 :         }                                                                                       
      67                 :                                                                                                 
      68                 :     }                                                                                           
      69                 :                                                                                                 

Generated by PHPUnit 3.4.1 and Xdebug 2.0.5 using PHP 5.3.0 at Sun Oct 25 23:35:09 PDT 2009.