All Unit tests
Current file: C:\code\midiparser\src\Midi\Event\EventType.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% 1 / 1
100.00%100.00%
100.00% 4 / 4
 
Midi\EventType
100.00%100.00%
100.00% 1 / 1
100.00%100.00%
100.00% 1 / 1
100.00%100.00%
100.00% 4 / 4
 public static function getEventName($event)
100.00%100.00%
100.00% 1 / 1
100.00%100.00%
100.00% 3 / 3


       1                 : <?php                                                                                                      
       2                 :                                                                                                            
       3                 :     /**                                                                                                    
       4                 :      * \Midi\Event\EventType                                                                               
       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 different MIDI events that can be fired in a track                                   
      16                 :      *                                                                                                     
      17                 :      * @package    Midi                                                                                    
      18                 :      * @subpackage Event                                                                                   
      19                 :      * @copyright  © 2009 Tommy Montgomery <http://phpmidiparser.com/>                                     
      20                 :      * @since      1.0                                                                                     
      21                 :      */                                                                                                    
      22               1 :     final class EventType {                                                                                
      23                 :         /**                                                                                                
      24                 :          * Turns a note off for a particular channel                                                       
      25                 :          *                                                                                                 
      26                 :          * @var int                                                                                        
      27                 :          */                                                                                                
      28                 :         const NOTE_OFF              = 0x80;                                                                
      29                 :         /**                                                                                                
      30                 :          * Turns a note on for a particular channel                                                        
      31                 :          *                                                                                                 
      32                 :          * @var int                                                                                        
      33                 :          */                                                                                                
      34                 :         const NOTE_ON               = 0x90;                                                                
      35                 :         /**                                                                                                
      36                 :          *                                                                                                 
      37                 :          *                                                                                                 
      38                 :          * @var int                                                                                        
      39                 :          */                                                                                                
      40                 :         const NOTE_AFTERTOUCH       = 0xA0;                                                                
      41                 :         /**                                                                                                
      42                 :          * Change to a controller for a particular channel                                                 
      43                 :          *                                                                                                 
      44                 :          * @var int                                                                                        
      45                 :          */                                                                                                
      46                 :         const CONTROLLER            = 0xB0;                                                                
      47                 :         /**                                                                                                
      48                 :          * Changes a program (e.g. instrument for a channel)                                               
      49                 :          *                                                                                                 
      50                 :          * @var int                                                                                        
      51                 :          */                                                                                                
      52                 :         const PROGRAM_CHANGE        = 0xC0;                                                                
      53                 :         /**                                                                                                
      54                 :          *                                                                                                 
      55                 :          *                                                                                                 
      56                 :          * @var int                                                                                        
      57                 :          */                                                                                                
      58                 :         const CHANNEL_AFTERTOUCH    = 0xD0;                                                                
      59                 :         /**                                                                                                
      60                 :          * Bends the pitch for a particular channel                                                        
      61                 :          *                                                                                                 
      62                 :          * @var int                                                                                        
      63                 :          */                                                                                                
      64                 :         const PITCH_BEND            = 0xE0;                                                                
      65                 :         /**                                                                                                
      66                 :          * System exclusive event                                                                          
      67                 :          *                                                                                                 
      68                 :          * @var int                                                                                        
      69                 :          */                                                                                                
      70                 :         const SYSTEM_EXCLUSIVE      = 0xF0;                                                                
      71                 :         /**                                                                                                
      72                 :          * Reserved event                                                                                  
      73                 :          *                                                                                                 
      74                 :          * @var int                                                                                        
      75                 :          */                                                                                                
      76                 :         const UNDEFINED1            = 0xF1;                                                                
      77                 :         /**                                                                                                
      78                 :          *                                                                                                 
      79                 :          *                                                                                                 
      80                 :          * @var int                                                                                        
      81                 :          */                                                                                                
      82                 :         const SONG_POSITION_POINTER = 0xF2;                                                                
      83                 :         /**                                                                                                
      84                 :          * Selects a song                                                                                  
      85                 :          *                                                                                                 
      86                 :          * @var int                                                                                        
      87                 :          */                                                                                                
      88                 :         const SONG_SELECT           = 0xF3;                                                                
      89                 :         /**                                                                                                
      90                 :          * Reserved event                                                                                  
      91                 :          *                                                                                                 
      92                 :          * @var int                                                                                        
      93                 :          */                                                                                                
      94                 :         const UNDEFINED2            = 0xF4;                                                                
      95                 :         /**                                                                                                
      96                 :          * Reserved event                                                                                  
      97                 :          *                                                                                                 
      98                 :          * @var int                                                                                        
      99                 :          */                                                                                                
     100                 :         const UNDEFINED3            = 0xF5;                                                                
     101                 :         /**                                                                                                
     102                 :          *                                                                                                 
     103                 :          *                                                                                                 
     104                 :          * @var int                                                                                        
     105                 :          */                                                                                                
     106                 :         const TUNE_REQUEST          = 0xF6;                                                                
     107                 :         /**                                                                                                
     108                 :          *                                                                                                 
     109                 :          *                                                                                                 
     110                 :          * @var int                                                                                        
     111                 :          */                                                                                                
     112                 :         const AUTHORIZATION         = 0xF7;                                                                
     113                 :         /**                                                                                                
     114                 :          *                                                                                                 
     115                 :          *                                                                                                 
     116                 :          * @var int                                                                                        
     117                 :          */                                                                                                
     118                 :         const TIMING_CLOCK          = 0xF8;                                                                
     119                 :         /**                                                                                                
     120                 :          * Reserved event                                                                                  
     121                 :          *                                                                                                 
     122                 :          * @var int                                                                                        
     123                 :          */                                                                                                
     124                 :         const UNDEFINED4            = 0xF9;                                                                
     125                 :         /**                                                                                                
     126                 :          * Starts a sequence                                                                               
     127                 :          *                                                                                                 
     128                 :          * @var int                                                                                        
     129                 :          */                                                                                                
     130                 :         const SEQUENCE_START        = 0xFA;                                                                
     131                 :         /**                                                                                                
     132                 :          * Continues a previously stopped sequence                                                         
     133                 :          *                                                                                                 
     134                 :          * @var int                                                                                        
     135                 :          */                                                                                                
     136                 :         const SEQUENCE_CONTINUE     = 0xFB;                                                                
     137                 :         /**                                                                                                
     138                 :          * Stops a sequence                                                                                
     139                 :          *                                                                                                 
     140                 :          * @var int                                                                                        
     141                 :          */                                                                                                
     142                 :         const SEQUENCE_STOP         = 0xFC;                                                                
     143                 :         /**                                                                                                
     144                 :          * Reserved event                                                                                  
     145                 :          *                                                                                                 
     146                 :          * @var int                                                                                        
     147                 :          */                                                                                                
     148                 :         const UNDEFINED5            = 0xFD;                                                                
     149                 :         /**                                                                                                
     150                 :          * Describe this variable                                                                          
     151                 :          *                                                                                                 
     152                 :          * @var int                                                                                        
     153                 :          */                                                                                                
     154                 :         const ACTIVE_SENSING        = 0xFE;                                                                
     155                 :         /**                                                                                                
     156                 :          * Represents a meta event                                                                         
     157                 :          *                                                                                                 
     158                 :          * @var int                                                                                        
     159                 :          */                                                                                                
     160                 :         const META                  = 0xFF;                                                                
     161                 :                                                                                                            
     162                 :         private static $eventNameMap = array(                                                              
     163                 :             0x80 => 'Note Off',                                                                            
     164                 :             0x90 => 'Note On',                                                                             
     165                 :             0xA0 => 'Note Aftertouch',                                                                     
     166                 :             0xB0 => 'Controller',                                                                          
     167                 :             0xC0 => 'Program Change',                                                                      
     168                 :             0xD0 => 'Channel Aftertouch',                                                                  
     169                 :             0xE0 => 'Pitch Bend',                                                                          
     170                 :             0xF0 => 'System Exclusive',                                                                    
     171                 :             0xF1 => 'Undefined',                                                                           
     172                 :             0xF2 => 'Song Position Pointer',                                                               
     173                 :             0xF3 => 'Song Select',                                                                         
     174                 :             0xF4 => 'Undefined',                                                                           
     175                 :             0xF5 => 'Undefined',                                                                           
     176                 :             0xF6 => 'Tune Request',                                                                        
     177                 :             0xF7 => 'Authorization',                                                                       
     178                 :             0xF8 => 'Timing Clock',                                                                        
     179                 :             0xF9 => 'Undefined',                                                                           
     180                 :             0xFA => 'Sequence Start',                                                                      
     181                 :             0xFB => 'Sequence Continue',                                                                   
     182                 :             0xFC => 'Sequence Stop',                                                                       
     183                 :             0xFD => 'Undefined',                                                                           
     184                 :             0xFE => 'Active Sensing',                                                                      
     185                 :             0xFF => 'Meta'                                                                                 
     186                 :         );                                                                                                 
     187                 :                                                                                                            
     188                 :         /**                                                                                                
     189                 :          * Gets the name of an event                                                                       
     190                 :          *                                                                                                 
     191                 :          * @since 1.0                                                                                      
     192                 :          *                                                                                                 
     193                 :          * @param  int $event One of the \Midi\EventType constants                                         
     194                 :          * @throws InvalidArgumentException                                                                
     195                 :          * @return string The friendly name of the event                                                   
     196                 :          */                                                                                                
     197                 :         public static function getEventName($event) {                                                      
     198               4 :             if (!isset(self::$eventNameMap[$event])) {                                                     
     199               1 :                 throw new \InvalidArgumentException('1st argument must be one of the EventType constants');
     200                 :             }                                                                                              
     201                 :                                                                                                            
     202               3 :             return self::$eventNameMap[$event];                                                            
     203                 :         }                                                                                                  
     204                 :     }                                                                                                      
     205                 :                                                                                                            
     206                 :                                                                                                            

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.