CLAM-Development  1.4.0
MIDISong.cxx
Go to the documentation of this file.
1 /*
2  * Copyright (c) 2001-2004 MUSIC TECHNOLOGY GROUP (MTG)
3  * UNIVERSITAT POMPEU FABRA
4  *
5  * This program is free software; you can redistribute it and/or modify
6  * it under the terms of the GNU General Public License as published by
7  * the Free Software Foundation; either version 2 of the License, or
8  * (at your option) any later version.
9  *
10  * This program is distributed in the hope that it will be useful,
11  * but WITHOUT ANY WARRANTY; without even the implied warranty of
12  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13  * GNU General Public License for more details.
14  *
15  * You should have received a copy of the GNU General Public License
16  * along with this program; if not, write to the Free Software
17  * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
18  *
19  * MIDIFileReader C++ classes
20  * This code is part of the CLAM library, but also usable stand-alone.
21  * Maarten de Boer <mdeboer@iua.upf.es>
22  *
23  */
24 #include <vector>
25 #include "MIDITrack.hxx"
26 #include "MIDISong.hxx"
27 
28 namespace MIDI
29 {
30 
31  class SongImpl
32  {
33  friend class Song;
34  private:
35  std::vector<Track*> mTrackList;
36  unsigned short mTicksPerQ;
37 
38  int Tracks(void) const
39  {
40  return mTrackList.size();
41  }
42 
43  Track* GetTrack(int i) const
44  {
45  return mTrackList[i];
46  }
47 
48  void AddTrack(Track* t)
49  {
50  mTrackList.push_back(t);
51  }
52 
53  unsigned short GetTicksPerQ(void) const
54  {
55  return mTicksPerQ;
56  }
57 
58  void SetTicksPerQ(unsigned int v)
59  {
60  mTicksPerQ = v;
61  }
62  };
63 
65  {
66  mImpl = new SongImpl;
67  }
68 
70  {
71  delete mImpl;
72  }
73 
74  int Song::Tracks(void) const
75  {
76  return mImpl->Tracks();
77  }
78 
79  Track* Song::GetTrack(int i) const
80  {
81  return mImpl->GetTrack(i);
82  }
83 
85  {
86  mImpl->AddTrack(t);
87  }
88 
89  unsigned short Song::GetTicksPerQ(void) const
90  {
91  return mImpl->GetTicksPerQ();
92  }
93 
94  void Song::SetTicksPerQ(unsigned int v)
95  {
96  mImpl->SetTicksPerQ(v);
97  }
98 
99 }
100