File: proc_input.C

package info (click to toggle)
gmod 3.1-2
  • links: PTS
  • area: main
  • in suites: hamm, slink
  • size: 1,348 kB
  • ctags: 808
  • sloc: cpp: 7,755; makefile: 82
file content (86 lines) | stat: -rw-r--r-- 1,681 bytes parent folder | download | duplicates (7)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
// -*-C++-*-
// This file is part of the gmod package
// Copyright (C) 1997 by Andrew J. Robinson

#include <sys/types.h>
#include <stdio.h>
#include <unistd.h>

#ifdef USE_LOCAL
#include "soundcard.h"
#else
#include <sys/soundcard.h>
#endif

#include "defines.h"
#include "structs.h"
#include "globals.h"

#ifdef USE_X
#include <stdlib.h>

#include "TrackShell.h"
#include "OptShell.h"
#include "TopShell.h"
#else
#include "CursesScr.h"
#endif

#include "Sequencer.h"

unsigned int
procInput (void)
{
  unsigned int seqInput;
  extern Sequencer *seq;
  extern char played[MAX_POSITION];
#ifdef USE_X
  extern TrackShell *trackShell;
  extern OptShell *optShell;
  extern TopShell *topShell;
#else
  extern CursesScr *cursScreen;
#endif

  if (seq->read ((char *)(&seqInput)) == 4)
    {
      if ((seqInput & 0xff) == SEQ_ECHO)
	{
	  seqInput >>= 8;
	  switch (seqInput & 0xff)
	    {
	    case ECHO_MESSAGE:
	      actualPos = (seqInput >> 16) & 0xff;
	      played[actualPos] = 2;   // played
#ifdef USE_X
	      topShell->setPosition(actualPos);
	      trackShell->updateTracker(tune[actualPos], 
					patternLen[tune[actualPos]],
					voiceTable, patternTable);
#else
	      cursScreen->setPos(actualPos, (seqInput >> 8) & 0xff);
#endif
	      break;
#ifdef USE_X
	    case ECHO_SPEED0:
	      if (optShell->speed0Checked() == FALSE)
		topShell->doNext(1);
	      break;
	    case ECHO_LOOP:
	      if (optShell->loopBreakChecked() == TRUE)
		topShell->doNext(1);
	      break;
	    case ECHO_PATTERN:
	      trackShell->setCurrent(seqInput >> 8);
	      break;
#endif
	    }
	}
      else
	seqInput = ECHO_NONE;
    }
  else
    seqInput = ECHO_NONE;

  return (seqInput);
}