~ubuntu-branches/ubuntu/karmic/muse/karmic-proposed

« back to all changes in this revision

Viewing changes to ssource.cpp

  • Committer: Bazaar Package Importer
  • Author(s): Daniel Kobras
  • Date: 2002-04-23 17:28:23 UTC
  • Revision ID: james.westby@ubuntu.com-20020423172823-w8yplzr81a759xa3
Tags: upstream-0.5.2
ImportĀ upstreamĀ versionĀ 0.5.2

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
//=========================================================
 
2
//  MusE
 
3
//  Linux Music Editor
 
4
//  $Id: ssource.cpp,v 1.1 2002/01/30 14:10:07 muse Exp $
 
5
//
 
6
//  (C) Copyright 2001 Werner Schweer (ws@seh.de)
 
7
//=========================================================
 
8
 
 
9
#include "ssource.h"
 
10
 
 
11
//---------------------------------------------------------
 
12
//   SoundSource
 
13
//---------------------------------------------------------
 
14
 
 
15
SoundSource::SoundSource()
 
16
      {
 
17
      _mute        = false;
 
18
      _soloMute    = false;
 
19
      _curActivity = 0;
 
20
      _channels    = 2;
 
21
 
 
22
      for (int i = 0; i < AUDIO_CHANNELS; ++i) {
 
23
            _activity[i] = 0;
 
24
            _peak[i]     = 0;
 
25
            }
 
26
      }
 
27
 
 
28
SoundSource::SoundSource(const SoundSource& s)
 
29
   : QObject()
 
30
      {
 
31
      _mute        = s._mute;
 
32
      _soloMute    = s._soloMute;
 
33
      _curActivity = s._curActivity;
 
34
      _channels    = s._channels;
 
35
      for (int i = 0; i < AUDIO_CHANNELS; ++i) {
 
36
            _activity[i] = 0;
 
37
            _peak[i]     = 0;
 
38
            }
 
39
      }
 
40
 
 
41
//---------------------------------------------------------
 
42
//   setChannels
 
43
//---------------------------------------------------------
 
44
 
 
45
void SoundSource::setChannels(int val)
 
46
      {
 
47
      _channels = val;
 
48
      }
 
49
 
 
50
//---------------------------------------------------------
 
51
//   resetPeaks
 
52
//---------------------------------------------------------
 
53
 
 
54
void SoundSource::resetPeaks()
 
55
      {
 
56
      for (int i = 0; i < channels(); ++i)
 
57
            _peak[i] = 0;
 
58
      }
 
59
 
 
60
//---------------------------------------------------------
 
61
//   resetMeter
 
62
//---------------------------------------------------------
 
63
 
 
64
void SoundSource::resetMeter()
 
65
      {
 
66
      for (int i = 0; i < channels(); ++i)
 
67
            _activity[i] = 0;
 
68
      }
 
69
 
 
70
 
 
71
bool SoundSource::mute() const                { return _mute; }
 
72
bool SoundSource::soloMute() const            { return _soloMute; }
 
73
 
 
74
void SoundSource::setMute(bool val)           { _mute = val; }
 
75
void SoundSource::setSolo(bool val)           { _soloMute = val; }
 
76
 
 
77
int SoundSource::channels() const             { return _channels; }
 
78
 
 
79
void SoundSource::setActivity(int v, int c=0) { _activity[c] = v; }
 
80
void SoundSource::addActivity(int v, int c=0) { _activity[c] += v; }
 
81
 
 
82
      // for midi (obsolete?):
 
83
int SoundSource::curActivity() const          { return _curActivity; }
 
84
void SoundSource::setCurActivity(int v)       { _curActivity = v; }
 
85
 
 
86
int SoundSource::peak(int channel)            { return _peak[channel]; }
 
87
int SoundSource::activity(int channel=0)      { return _activity[channel]; }
 
88