2
$Id: syna.h,v 1.8 2000/08/11 15:44:48 faure Exp $
4
Synaesthesia - program to display sound graphically
5
Copyright (C) 1997 Paul Francis Harrison
7
This program is free software; you can redistribute it and/or modify it
8
under the terms of the GNU General Public License as published by the
9
Free Software Foundation; either version 2 of the License, or (at your
10
option) any later version.
12
This program is distributed in the hope that it will be useful, but
13
WITHOUT ANY WARRANTY; without even the implied warranty of
14
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
15
General Public License for more details.
17
You should have received a copy of the GNU General Public License along
18
with this program; if not, write to the Free Software Foundation, Inc.,
19
675 Mass Ave, Cambridge, MA 02139, USA.
21
The author may be contacted at:
22
phar6@student.monash.edu.au
24
27 Bond St., Mt. Waverley, 3149, Melbourne, Australia
31
#if defined(__linux__) || defined(__svr4__) || defined(__osf__)
33
void error(const char *str, bool syscall=false); //Display error and exit
34
void warning(const char *str, bool syscall=false); //Display error
36
//void error(char *str,bool syscall=false);
37
inline void attempt(int x, const char *y, bool syscall=false) { if (x == -1) error(y,syscall); }
39
//void warning(char *str,bool syscall=false);
40
inline void attemptNoDie(int x, const char *y, bool syscall=false) { if (x == -1) warning(y,syscall); }
43
#include "magicconf.h"
45
/***************************************/
48
#define PROGNAME "kscdmagic"
54
typedef unsigned short sampleType;
58
typedef short sampleType;
62
#warning This target has not been tested!
68
#include <machine/endian.h>
72
#if BYTE_ORDER == BIG_ENDIAN
80
#define recSize (1<<m-overlap)
83
extern volatile sampleType *data;
84
//extern unsigned char *output, *lastOutput, *lastLastOutput;
85
extern Bitmap<unsigned short> outputBmp, lastOutputBmp, lastLastOutputBmp;
86
#define ucoutput ((unsigned char*)outputBmp.data)
87
#define lastOutput ((unsigned char*)lastOutputBmp.data)
88
#define lastLastOutput ((unsigned char*)lastLastOutputBmp.data)
90
inline unsigned short combiner(unsigned short a,unsigned short b) {
91
//Not that i want to give the compiler a hint or anything...
92
unsigned char ah = a>>8, al = a&255, bh = b>>8, bl = b&255;
93
if (ah < 64) ah *= 4; else ah = 255;
94
if (al < 64) al *= 4; else al = 255;
100
extern PolygonEngine<unsigned short,combiner,2> polygonEngine;
102
extern int outWidth, outHeight;
104
void allocOutput(int w,int h);
107
void setStarSize(double size);
112
void screenInit(int xHint,int yHint,int widthHint,int heightHint);
113
void screenSetPalette(unsigned char *palette);
114
void screenEnd(void);
115
void screenShow(void);
116
int sizeUpdate(void);
118
void inputUpdate(int &mouseX,int &mouseY,int &mouseButtons,char &keyHit);
121
void interfaceInit();
122
void interfaceSyncToState();
128
Play, Pause, Stop, SkipFwd, SkipBack,
129
Handle, Pointer, Open, NoCD, Exit,
130
Zero, One, Two, Three, Four,
131
Five, Six, Seven, Eight, Nine,
132
Slider, Selector, Plug, Loop, Box, Bar,
133
Flame, Wave, Stars, Star, Diamond, Size, FgColor, BgColor,
134
Save, Reset, TrackSelect,
138
/* State information */
140
extern SymbolID state;
141
extern int track, frames;
142
extern double trackProgress;
143
extern char **playList;
144
extern int playListLength, playListPosition;
145
extern SymbolID fadeMode;
146
extern bool pointsAreDiamonds;
147
extern double brightnessTwiddler;
148
extern double starSize;
149
extern double fgRedSlider, fgGreenSlider, bgRedSlider, bgGreenSlider;
151
extern double volume;
153
void setStateToDefaults();
156
void putString(char *string,int x,int y,int red,int blue);
159
enum SoundSource { SourceLine, SourceCD, SourcePipe };
161
void cdOpen(char *cdromName);
163
void cdGetStatus(int &track, int &frames, SymbolID &state);
164
void cdPlay(int trackFrame, int endFrame=-1);
169
void cdCloseTray(void);
170
int cdGetTrackCount(void);
171
int cdGetTrackFrame(int track);
172
void openSound(SoundSource sound, int downFactor, const char *dspName, char *mixerName);
174
void setupMixer(double &loudness);
175
void setVolume(double loudness);
176
int getNextFragment(void);
179
#endif // linux || svr4