~ubuntu-branches/ubuntu/breezy/muse/breezy

« back to all changes in this revision

Viewing changes to pos.cpp

  • Committer: Bazaar Package Importer
  • Author(s): Daniel Kobras
  • Date: 2004-02-07 15:18:22 UTC
  • mfrom: (1.1.1 upstream)
  • Revision ID: james.westby@ubuntu.com-20040207151822-es27xxkzbcxkebjm
Tags: 0.6.3-1
* New upstream version.
* Added patches:
  + [10_alsa_init_fix] New, from upstream CVS.
    Initialize direction variable when setting Alsa parameters.
  + [10_canvas_translation_fix] New, from upstream CVS.
    Do not translate tooltips twice in canvas popup.
  + [10_checkbox_fix] New, from upstream CVS.
    Use proper set/test methods on metronome checkboxes.
  + [10_html_doc_cleanup] New.
    Fix links and HTML errors in documentation.
  + [20_allow_system_timer] New.
    The new upstream version fails by default if the real-time clock
    could not be accessed (usually the case when not running suid-root).
    This patch reverts the old behaviour of falling back to the more
    inaccurate system timer.
* Updated patches:
  + [11_PIC_fixes_fixup] Rediffed.
* Removed patches:
  + [20_no_atomic_asm] Merged upstream.
* debian/compat: Splice out debhelper compatibility level from rules file.
* debian/control: Build-depend on latest jack release by default.
  Closes: #228788
* debian/control: Bump standards version.
* debian/control: Use auto-generated debconf dependency via misc:Depends.
* debian/control: Minor tweaks to the long description.
* debian/control: Tighten fluidsynth build dependency to sane version.
* debian/muse.doc-base: New. Register HTML documentation with doc-base.
* debian/templates: Tiny rewording, and typo fix.
* debian/templates, debian/po/*: Switch to po-debconf for translations.

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
1
//=========================================================
2
2
//  MusE
3
3
//  Linux Music Editor
4
 
//  $Id: pos.cpp,v 1.1 2002/01/30 12:08:38 muse Exp $
 
4
//  $Id: pos.cpp,v 1.1.1.1 2003/10/29 10:05:17 wschweer Exp $
5
5
//
6
6
//  (C) Copyright 2000 Werner Schweer (ws@seh.de)
7
7
//=========================================================
29
29
      sn         = -1;
30
30
      }
31
31
 
32
 
//---------------------------------------------------------
33
 
//   Pos
34
 
//---------------------------------------------------------
35
 
 
36
32
Pos::Pos(const Pos& p)
37
33
      {
38
34
      _type      = p._type;
42
38
      sn         = -1;
43
39
      }
44
40
 
 
41
Pos::Pos(int t, bool ticks)
 
42
      {
 
43
      if (ticks) {
 
44
            _type      = TICKS;
 
45
            _posTick   = t;
 
46
            _posSample = 0;
 
47
            }
 
48
      else {
 
49
            _type      = SAMPLES;
 
50
            _posSample = t;
 
51
            _posTick   = 0;
 
52
            }
 
53
      _posTime   = 0.0;
 
54
      sn         = -1;
 
55
      }
 
56
 
 
57
Pos::Pos(const QString& s)
 
58
      {
 
59
      int m, b, t;
 
60
      sscanf(s.latin1(), "%04d.%02d.%03d", &m, &b, &t);
 
61
      int tick = sigmap.bar2tick(m, b, t);
 
62
      _type      = TICKS;
 
63
      _posTick   = tick;
 
64
      _posTime   = 0.0;
 
65
      _posSample = 0;
 
66
      sn         = -1;
 
67
      }
 
68
 
 
69
//---------------------------------------------------------
 
70
//   setType
 
71
//---------------------------------------------------------
 
72
 
 
73
void Pos::setType(TType t)
 
74
      {
 
75
      if (t == _type)
 
76
            return;
 
77
 
 
78
      switch(_type) {
 
79
            case TIME:
 
80
                  if (t == TICKS)
 
81
                        _posTick = tempomap.time2tick(_posTime, _posTick, &sn);
 
82
                  else
 
83
                        _posSample = int(_posTime * sampleRate);
 
84
                  break;
 
85
 
 
86
            case TICKS:
 
87
                  _posTime = tempomap.tick2time(_posTick, _posTime, &sn);
 
88
                  _posSample = int(_posTime * sampleRate);
 
89
                  break;
 
90
 
 
91
            case SAMPLES:
 
92
                  if (t == TICKS)
 
93
                        _posTick = tempomap.time2tick(double(_posSample)/double(sampleRate),
 
94
                           _posTick, &sn);
 
95
                  else
 
96
                        _posTime = double(_posSample)/double(sampleRate);
 
97
                  break;
 
98
            }
 
99
      _type = t;
 
100
      sn    = -1;
 
101
      }
 
102
 
45
103
//---------------------------------------------------------
46
104
//   operator+=
47
105
//---------------------------------------------------------
615
673
      }
616
674
 
617
675
 
618
 
Pos::Pos(int t)
619
 
      {
620
 
      _type      = TICKS;
621
 
      _posTick   = t;
622
 
      _posTime   = 0.0;
623
 
      _posSample = 0;
624
 
      sn         = -1;
625
 
      }
626
 
 
627
 
Pos::Pos(const QString& s)
628
 
      {
629
 
      int m, b, t;
630
 
      sscanf(s.latin1(), "%04d.%02d.%03d", &m, &b, &t);
631
 
      int tick = sigmap.bar2tick(m, b, t);
632
 
      _type      = TICKS;
633
 
      _posTick   = tick;
634
 
      _posTime   = 0.0;
635
 
      _posSample = 0;
636
 
      sn         = -1;
637
 
      }
638
 
 
639
676
void Pos::mbt(int* bar, int* beat, int* tick) const
640
677
      {
641
678
      sigmap.tickValues(posTick(), bar, beat, tick);