~ubuntu-branches/ubuntu/quantal/muse/quantal

« back to all changes in this revision

Viewing changes to muse/mpevent.cpp

  • Committer: Bazaar Package Importer
  • Author(s): Eric Hedekar, Eric Hedekar, Fabrice Coutadeur
  • Date: 2010-01-26 02:32:14 UTC
  • mfrom: (1.1.7 upstream)
  • Revision ID: james.westby@ubuntu.com-20100126023214-8ez2g5d26d9p584j
Tags: 1.0.1-0ubuntu1
[ Eric Hedekar ]
* New upstream version (LP: #479688)
* Removed patches that were fixed in upstream source
  -[10_64bit_memcorruption_fix]
  -[10_gcc43_build_fixes]
  -[10_lash_private_api_fix]
  -[10_log2f_aliasing_fix]
  -[10_vamgui_init_fix]
  -[20_fix_const]

[ Fabrice Coutadeur ]
* debian/watch: added watch file
* debian/muse.desktop: deleted deprecated Encoding key, Application category
  and icon extension. This fix several warning with lintian and
  desktop-file-validate

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
1
//=========================================================
2
2
//  MusE
3
3
//  Linux Music Editor
4
 
//  $Id: mpevent.cpp,v 1.6 2004/05/16 16:54:59 wschweer Exp $
 
4
//  $Id: mpevent.cpp,v 1.6.2.2 2009/11/25 09:09:43 terminator356 Exp $
5
5
//
6
6
//  (C) Copyright 2002-2004 Werner Schweer (ws@seh.de)
7
7
//=========================================================
24
24
      _port = port;
25
25
      edata.setData(data, len);
26
26
      _type = tpe;
 
27
      _loopNum = 0;
27
28
      }
28
29
 
29
30
MEvent::MEvent(unsigned tick, int port, int channel, const Event& e)
31
32
      setChannel(channel);
32
33
      setTime(tick);
33
34
      setPort(port);
 
35
      setLoopNum(0);
34
36
      switch(e.type()) {
35
37
            case Note:
36
38
                  setType(ME_NOTEON);
103
105
      return map[channel()] < map[e.channel()];
104
106
      }
105
107
 
 
108
 
 
109
//---------------------------------------------------------
 
110
//   put
 
111
//    return true on fifo overflow
 
112
//---------------------------------------------------------
 
113
 
 
114
bool MidiFifo::put(const MidiPlayEvent& event)
 
115
      {
 
116
      if (size < MIDI_FIFO_SIZE) {
 
117
            fifo[wIndex] = event;
 
118
            wIndex = (wIndex + 1) % MIDI_FIFO_SIZE;
 
119
            // q_atomic_increment(&size);
 
120
            ++size;
 
121
            return false;
 
122
            }
 
123
      return true;
 
124
      }
 
125
 
 
126
//---------------------------------------------------------
 
127
//   get
 
128
//---------------------------------------------------------
 
129
 
 
130
MidiPlayEvent MidiFifo::get()
 
131
      {
 
132
      MidiPlayEvent event(fifo[rIndex]);
 
133
      rIndex = (rIndex + 1) % MIDI_FIFO_SIZE;
 
134
      // q_atomic_decrement(&size);
 
135
      --size;
 
136
      return event;
 
137
      }
 
138
 
 
139
//---------------------------------------------------------
 
140
//   peek
 
141
//---------------------------------------------------------
 
142
 
 
143
const MidiPlayEvent& MidiFifo::peek(int n)
 
144
      {
 
145
      int idx = (rIndex + n) % MIDI_FIFO_SIZE;
 
146
      return fifo[idx];
 
147
      }
 
148
 
 
149
//---------------------------------------------------------
 
150
//   remove
 
151
//---------------------------------------------------------
 
152
 
 
153
void MidiFifo::remove()
 
154
      {
 
155
      rIndex = (rIndex + 1) % MIDI_FIFO_SIZE;
 
156
      // q_atomic_decrement(&size);
 
157
      --size;
 
158
      }
 
159
 
 
160