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

« back to all changes in this revision

Viewing changes to audio.h

  • 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
//=========================================================
 
2
//  MusE
 
3
//  Linux Music Editor
 
4
//  $Id: audio.h,v 1.1.1.1 2003/10/29 10:05:15 wschweer Exp $
 
5
//
 
6
//  (C) Copyright 2001 Werner Schweer (ws@seh.de)
 
7
//=========================================================
 
8
 
 
9
#ifndef __AUDIO_H__
 
10
#define __AUDIO_H__
 
11
 
 
12
#include <pthread.h>
 
13
#include "driver/jackaudio.h"
 
14
 
 
15
class AudioPort;
 
16
class SndFile;
 
17
class AudioNode;
 
18
class PluginI;
 
19
class SynthI;
 
20
class AudioDevice;
 
21
class AudioNode;
 
22
class AudioDevice;
 
23
class WavePart;
 
24
class WaveTrack;
 
25
 
 
26
enum {
 
27
      AUDIO_SET_MIXDOWN, AUDIO_RECORD,
 
28
      AUDIO_ROUTEADD, AUDIO_ROUTESET, AUDIO_ROUTEREMOVE,
 
29
      AUDIO_VOL, AUDIO_PAN,
 
30
      AUDIO_ADDPLUGIN,
 
31
      AUDIO_REMOVE_SYNTHI, AUDIO_ADD_SYNTHI,
 
32
      AUDIO_SET_SEG_SIZE,
 
33
      AUDIO_SET_PREFADER, AUDIO_SET_CHANNELS,
 
34
      AUDIO_SEEK, AUDIO_PLAY,
 
35
      AUDIO_ADD_PART, AUDIO_CHANGE_PART, AUDIO_REMOVE_PART,
 
36
      AUDIO_REMOVE_TRACK,
 
37
      AUDIO_UNDO, AUDIO_REDO,
 
38
      };
 
39
 
 
40
//---------------------------------------------------------
 
41
//   Msg
 
42
//---------------------------------------------------------
 
43
 
 
44
struct AudioMsg {   // this should be an union
 
45
      int serialNo;
 
46
      int id;
 
47
      SndFile* downmix;
 
48
      AudioNode* snode;
 
49
      AudioNode* dnode;
 
50
      AudioPort* port;
 
51
      AudioDevice* device;
 
52
      int ival;
 
53
      int iival;
 
54
      double dval;
 
55
      PluginI* plugin;
 
56
      SynthI* synth;
 
57
      WavePart* spart;
 
58
      WavePart* dpart;
 
59
      WaveTrack* track;
 
60
      };
 
61
 
 
62
//---------------------------------------------------------
 
63
//   Audio
 
64
//---------------------------------------------------------
 
65
 
 
66
class Audio {
 
67
      int curSamplePos;
 
68
 
 
69
      void processMsg(const volatile AudioMsg* msg);
 
70
      volatile bool playState;
 
71
      bool recordState;
 
72
 
 
73
      volatile AudioMsg* msg;
 
74
 
 
75
      int fromThreadFdr;
 
76
      int fromThreadFdw;
 
77
 
 
78
      bool _running;
 
79
 
 
80
      pthread_mutex_t msgMutex;
 
81
 
 
82
      pthread_mutex_t mutex;   // protect sampleTime
 
83
      double sampleTime;
 
84
 
 
85
      int samplePos;
 
86
 
 
87
   public:
 
88
      Audio();
 
89
      ~Audio();
 
90
      void process(unsigned long samples);
 
91
      int pos() { return curSamplePos; }
 
92
 
 
93
      int curPlayPos();
 
94
 
 
95
      void start();
 
96
      void stop(bool);
 
97
 
 
98
      void setRunning(bool val) { _running = val; }
 
99
      bool isPlaying() const    { return playState; }
 
100
      void sendMsg(AudioMsg*);
 
101
      void msgRemoveRoute(AudioNode*, AudioNode*);
 
102
      void msgAddRoute(AudioNode*, AudioNode*);
 
103
      void msgSetRoute(AudioNode*, AudioNode*);
 
104
      void msgAddPlugin(AudioNode*, int idx, PluginI* plugin);
 
105
      void msgSetMute(AudioNode*, bool val);
 
106
      void msgSetVolume(AudioNode*, double val);
 
107
      void msgSetPan(AudioNode*, double val);
 
108
      void msgAddSynthI(SynthI* synth);
 
109
      void msgRemoveSynthI(SynthI* synth);
 
110
      void msgSetSegSize(int, int);
 
111
      void msgSetPrefader(AudioNode*, int);
 
112
      void msgSetChannels(AudioNode*, int);
 
113
 
 
114
//      void msgSetRecFile(AudioNode*, SndFile* sf);
 
115
      void msgSetOff(AudioNode*, bool);
 
116
      void msgSetRecord(AudioNode*, bool);
 
117
 
 
118
      void msgPlay(bool flag);
 
119
      void msgSeek(int);
 
120
      void msgAddPart(WavePart*);
 
121
      void msgRemovePart(WavePart*);
 
122
      void msgChangePart(WavePart* s, WavePart* d);
 
123
      void msgRemoveTrack(WaveTrack*);
 
124
      void msgUndo();
 
125
      void msgRedo();
 
126
 
 
127
      void writeTick();
 
128
 
 
129
      // transport:
 
130
      void startPlay();
 
131
      void stopPlay();
 
132
      void startRecord();
 
133
      void stopRecord();
 
134
      void seek(int tickpos);
 
135
      };
 
136
 
 
137
extern int processAudio(jack_nframes_t, void*);
 
138
extern void processAudio1(void*, void*);
 
139
 
 
140
extern Audio* audio;
 
141
extern AudioDevice* audioDevice;   // current audio device in use
 
142
#endif
 
143