File: syna.h

package info (click to toggle)
synaesthesia 1.4-3
  • links: PTS
  • area: main
  • in suites: slink
  • size: 252 kB
  • ctags: 301
  • sloc: ansic: 2,098; cpp: 1,387; makefile: 92; sh: 1
file content (126 lines) | stat: -rw-r--r-- 3,349 bytes parent folder | download
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
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
/* Synaesthesia - program to display sound graphically
   Copyright (C) 1997  Paul Francis Harrison

  This program is free software; you can redistribute it and/or modify it
  under the terms of the GNU General Public License as published by the
  Free Software Foundation; either version 2 of the License, or (at your
  option) any later version.

  This program is distributed in the hope that it will be useful, but
  WITHOUT ANY WARRANTY; without even the implied warranty of
  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
  General Public License for more details.

  You should have received a copy of the GNU General Public License along
  with this program; if not, write to the Free Software Foundation, Inc.,
  675 Mass Ave, Cambridge, MA 02139, USA.

  The author may be contacted at:
    phar6@student.monash.edu.au
  or
    27 Bond St., Mt. Waverley, 3149, Melbourne, Australia
*/

/***************************************/
/*   For the incurably fiddle prone:   */

/* log2 of sample size */
#define m 8 

/* overlap amount between samples. Set to 1 or 2 if you have a fast computer */
#define overlap 0 

/* Brightness */
#define brightness 150

/* Sample frequency*/
#define frequency 22050

/***************************************/


#define PROGNAME "synaesthesia"

#ifdef __FreeBSD__

typedef unsigned short sampleType;

#else

typedef short sampleType;

#ifndef __linux__

#warning This target has not been tested!

#endif
#endif

void error(char *str);
void inline attempt(int x,char *y) { if (x == -1) error(y); }  
void warning(char *str);
void inline attemptNoDie(int x,char *y) { if (x == -1) warning(y); } 

#define n (1<<m)
#define recSize (1<<m-overlap)

/* core */
extern volatile sampleType *data;
extern unsigned char *output;
extern int outWidth, outHeight;
extern int brightFactor;

void coreInit();
int coreGo();

void screenInit(int xHint,int yHint,int widthHint,int heightHint);
void screenEnd(void);
void screenShow(void);
void sizeRequest(int width,int height);
int sizeUpdate(void);

void inputUpdate(int &mouseX,int &mouseY,int &mouseButtons,char &keyHit);

int processUserInput(void); //True == abort now
void showOutput(void);

/* bitmap */
enum SymbolID {
  Bulb = 0, 
  Speaker = 1, Play = 2, Pause = 3, Stop = 4, SkipFwd = 5, SkipBack = 6,
  Handle = 7, Pointer = 8, Open = 9, NoCD = 10, Exit = 11,
  Zero = 12, One = 13, Two = 14, Three = 15, Four = 16,
  Five = 17, Six = 18, Seven = 19, Eight = 20, Nine = 21, Ten = 22,
  Colon = 22, Slider = 23, Selector = 24,
  SymbolCount = 25
};

enum TransferType {
  HalfBlue, HalfRed, MaxBlue, MaxRed
};

void putSymbol(int x,int y,int id,TransferType typ);

void putString(char *string,int x,int y,int red,int blue);

/* sound */
enum SoundSource { SourceLine, SourceCD, SourcePipe };

void cdOpen(char *cdromName);
void cdClose(void);
void cdGetStatus(int &track, int &frames, SymbolID &state);
void cdPlay(int trackFrame, int endFrame=-1); 
void cdStop(void);
void cdPause(void);
void cdResume(void);
void cdEject(void);
void cdCloseTray(void);
int cdGetTrackCount(void);
int cdGetTrackFrame(int track);
void openSound(SoundSource sound, int downFactor, int windowSize, 
               char *dspName, char *mixerName);
void closeSound();
void setupMixer(double &loudness);
void setVolume(double loudness);
int getNextFragment(void);