Subversion Repositories svn.mios

Rev

Rev 1 | Details | Compare with Previous | Last modification | View Log | RSS feed

Rev Author Line No. Line
44 tk 1
// $Id: eg.h 44 2008-01-30 21:39:30Z tk $
2
/*
3
 * EG program module definitions
4
 *
5
 * ==========================================================================
6
 *
7
 * Copyright (C) 2005  Thorsten Klose (tk@midibox.org)
8
 *
9
 * ==========================================================================
10
 *
11
 * This file is part of a MIOS application
12
 *
13
 * This application is free software; you can redistribute it and/or modify
14
 * it under the terms of the GNU General Public License as published by
15
 * the Free Software Foundation; either version 2 of the License, or
16
 * (at your option) any later version.
17
 *
18
 * This application is distributed in the hope that it will be useful,
19
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
20
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
21
 * GNU General Public License for more details.
22
 *
23
 * You should have received a copy of the GNU General Public License
24
 * along with This application; if not, write to the Free Software
25
 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
26
 *
27
 * ==========================================================================
28
 */
29
 
30
#ifndef _EG_H
31
#define _EG_H
32
 
33
/////////////////////////////////////////////////////////////////////////////
34
// Global definitions
35
/////////////////////////////////////////////////////////////////////////////
36
 
37
 
38
/////////////////////////////////////////////////////////////////////////////
39
// Global Types
40
/////////////////////////////////////////////////////////////////////////////
41
 
42
// EG state definition
43
typedef enum {
44
  IDLE, ATTACK, DECAY, SUSTAIN, RELEASE
45
} eg_state_e;
46
 
47
// EG internal state type
48
typedef union {
49
  struct {
50
    unsigned ALL:8;
51
  };
52
  struct {
53
    eg_state_e STATE:4;
54
    unsigned LAST_GATE:1;
55
  };
56
} eg_int_state_t;
57
 
58
// EG external state type
59
typedef union {
60
  struct {
61
    unsigned ALL:8;
62
  };
63
  struct {
64
    unsigned GATE:1;
65
  };
66
} eg_state_t;
67
 
68
/////////////////////////////////////////////////////////////////////////////
69
// Prototypes
70
/////////////////////////////////////////////////////////////////////////////
71
 
72
void EG_Init(void);
73
void EG_Tick(void);
74
 
75
/////////////////////////////////////////////////////////////////////////////
76
// Export global variables
77
/////////////////////////////////////////////////////////////////////////////
78
 
79
// in order to achive best performance, we are NOT using arrays here!
80
extern eg_state_t    eg0;
81
extern unsigned int  eg0_value;
82
extern unsigned char eg0_attack, eg0_decay, eg0_sustain, eg0_release;
83
 
84
#endif /* _EG_H */