~ubuntu-branches/ubuntu/raring/muse/raring-proposed

« back to all changes in this revision

Viewing changes to synti/stklib/Controller.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
 
/*
3
 
  Controller Class,
4
 
  by Gary P. Scavone, 2000
5
 
 
6
 
  This object will accept control messages
7
 
  from a variety of sources, such as a MIDI
8
 
  port, scorefile, socket connection, or
9
 
  pipe.  MIDI messages are retrieved with
10
 
  the RtMidi class.  All other input sources
11
 
  (scorefile, socket, or pipe) are assumed
12
 
  to provide SKINI formatted messages.
13
 
 
14
 
  For each call of getNextMessage(), the
15
 
  active input devices are queried to see
16
 
  if a new control message is available.
17
 
  Only one message per call is returned, so
18
 
  a subsequent call begins querying the
19
 
  next available device "after" the previously
20
 
  handled one.
21
 
 
22
 
  This class is primarily for use in STK
23
 
  main() event loops.
24
 
 
25
 
  One of my original goals in creating this class
26
 
  was to simplify the message acquisition process
27
 
  by removing all threads.  If the windoze
28
 
  select() function behaved just like the unix one,
29
 
  that would have been possible.  Since it does not
30
 
  (it can't be used to poll STDIN), I am using a 
31
 
  thread to acquire messages from STDIN, which are
32
 
  then sent via a socket connection to the message
33
 
  socket server.  Perhaps in the future, I will be
34
 
  able to simplify things.
35
 
*/
36
 
/******************************************/
37
 
 
38
 
#if !defined(__Controller_h)
39
 
#define __Controller_h
40
 
 
41
 
#include "Object.h"
42
 
#include "SKINI11.h"
43
 
 
44
 
#if defined(__STK_REALTIME_)
45
 
#include "RtMidi.h"
46
 
#include "StkError.h"
47
 
 
48
 
#if (defined(__OS_IRIX_) || defined(__OS_Linux_))
49
 
#include <sys/types.h>
50
 
#include <unistd.h>
51
 
#include <sys/time.h>
52
 
#include <sys/socket.h>
53
 
#include <arpa/inet.h>
54
 
#include <pthread.h>
55
 
#include <netdb.h>
56
 
#include <fcntl.h>
57
 
#include <errno.h>
58
 
 
59
 
void *stdinHandler(void *);
60
 
 
61
 
#elif defined(__OS_Win_)
62
 
#include <process.h>
63
 
#include <winsock.h>
64
 
 
65
 
void stdinHandler(void *);
66
 
 
67
 
#endif
68
 
 
69
 
#endif // __STK_REALTIME
70
 
 
71
 
#define STK_MIDI        0x0001
72
 
#define STK_PIPE        0x0002
73
 
#define STK_SOCKET      0x0004
74
 
#define STK_SCOREFILE   0x0008
75
 
 
76
 
#define MESSAGE_LENGTH  128
77
 
#define MAX_MESSAGES 25
78
 
#define STK_SOCKET_PORT 2001
79
 
 
80
 
class Controller : public Object
81
 
{
82
 
 protected:
83
 
  int source;
84
 
  long default_ticks;
85
 
  int type;
86
 
  MY_FLOAT channel;
87
 
  MY_FLOAT byte2;
88
 
  MY_FLOAT byte3;
89
 
  char message[MAX_MESSAGES][MESSAGE_LENGTH];
90
 
  int msg_index;
91
 
  int num_messages;
92
 
  SKINI11 *score;
93
 
 
94
 
#if defined(__STK_REALTIME_)
95
 
  fd_set mask;
96
 
  int maxfd;
97
 
  int fd[16];
98
 
  int local_socket;
99
 
  RtMidi *midi_input;
100
 
  int parseSocketData(int fd);
101
 
#if (defined(__OS_IRIX_) || defined(__OS_Linux_))
102
 
  pthread_t stdin_thread;
103
 
#elif defined(__OS_Win_)
104
 
  unsigned long stdin_thread;
105
 
#endif
106
 
#endif // __STK_REALTIME
107
 
 
108
 
 public:
109
 
  Controller(int inputMask);
110
 
  ~Controller();
111
 
  void setDefaultTicks(long nSamples);
112
 
  int getNextMessage();
113
 
  int getType();
114
 
  MY_FLOAT getByte2();
115
 
  MY_FLOAT getByte3();
116
 
  MY_FLOAT getChannel();
117
 
};
118
 
 
119
 
#endif // defined(__Controller_h)