1 : <?php
2 :
3 : /**
4 : * \Midi\Event\KeySignatureEvent
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 a set key signature event
16 : *
17 : * This event sets the key signature for the song. It should
18 : * always be in the first track. There can be multiple key
19 : * signature events per song.
20 : *
21 : * @package Midi
22 : * @subpackage Event
23 : * @since 1.0
24 : */
25 1 : class KeySignatureEvent extends MetaEvent {
26 :
27 : /**
28 : * @since 1.0
29 : *
30 : * @param int $accidentals 256 - # of flats, 0 + # of sharps
31 : * @param int $mode 0 for major, 1 for minor
32 : */
33 : public function __construct($accidentals, $mode) {
34 3 : parent::__construct(array($accidentals, $mode));
35 3 : }
36 :
37 : /**
38 : * @since 1.0
39 : * @uses Key::getKeySignature()
40 : *
41 : * @return string
42 : */
43 : public function getParamDescription() {
44 1 : $key = \Midi\Util\Key::getKeySignature($this->data[0], $this->data[1]);
45 1 : return $key;
46 : }
47 :
48 : /**
49 : * @since 1.0
50 : * @uses MetaEventType::KEY_SIGNATURE
51 : *
52 : * @return int
53 : */
54 : public function getSubtype() {
55 1 : return MetaEventType::KEY_SIGNATURE;
56 : }
57 :
58 : }
59 :
|