Mercurial > hg > dmlib
annotate jss.h @ 56:8725853609db
Remove the floating point mixing .. it wasn't so good idea after all.
author | Matti Hamalainen <ccr@tnsp.org> |
---|---|
date | Mon, 01 Oct 2012 06:59:00 +0300 |
parents | 064d1d1d5b0f |
children | 3bdc776a4b33 |
rev | line source |
---|---|
0 | 1 /* |
2 * miniJSS - Main header file | |
3 * Programmed and designed by Matti 'ccr' Hamalainen | |
4 * (C) Copyright 2006-2007 Tecnic Software productions (TNSP) | |
5 */ | |
6 #ifndef JSS_H | |
7 #define JSS_H | |
8 | |
9 #include "dmlib.h" | |
10 | |
11 | |
12 /* Locking | |
13 */ | |
14 #ifdef JSS_SUP_THREADS | |
15 # define JSS_LOCK(Q) dmMutexLock((Q)->mutex) | |
16 # define JSS_UNLOCK(Q) dmMutexUnlock((Q)->mutex) | |
17 #else | |
18 # warning DANGER! JSS threads support not included! | |
19 # define JSS_LOCK(Q) | |
20 # define JSS_UNLOCK(Q) | |
21 #endif | |
22 | |
23 | |
24 // Global settings | |
25 #define jsetNChannels (64) // Max number of channels | |
26 #define jsetNotSet (-1) // A global "not set" constant | |
27 #define jsetMinVol (0) | |
28 #define jsetMaxVol (255) | |
29 | |
30 // Sample instrument flags | |
31 #define jsfLooped (0x01) // Is sample looped | |
32 #define jsfBiDi (0x02) // Bi-directional loop? | |
33 #define jsf16bit (0x04) // 16-bit? | |
44
064d1d1d5b0f
Add new functions, jssConvertSampleFromFP() and jssConvertSampleToFP().
Matti Hamalainen <ccr@tnsp.org>
parents:
0
diff
changeset
|
34 |
0 | 35 #define JSFSET(a, b) do { a |= b; } while (0) |
36 #define JSFUNSET(a, b) do { a &= (0xff ^ b); } while (0) | |
37 | |
38 // Panning position | |
39 #define jchPanLeft (0x00) // Leftmost pan | |
40 #define jchPanMiddle (0x80) // Center pan | |
41 #define jchPanRight (0xff) // Rightmost pan | |
42 | |
43 // Audio formats | |
44 enum | |
45 { | |
46 JSS_AUDIO_U8, // 8-bit formats | |
47 JSS_AUDIO_S8, | |
48 JSS_AUDIO_U16, // 16-bit formats | |
49 JSS_AUDIO_S16, | |
50 JSS_AUDIO_U32, // 32-bit (24+padding) | |
51 JSS_AUDIO_S32 | |
52 } JSS_AUDIO_FMT; | |
53 | |
54 | |
55 enum | |
56 { | |
57 JSS_AUDIO_MONO = 1, | |
58 JSS_AUDIO_STEREO = 2 | |
59 } JSS_AUDIO_CHANNELS; | |
60 | |
61 | |
62 /* System initialization and shutdown | |
63 */ | |
64 int jssInit(void); // Initialization. Call before anything else! | |
65 int jssClose(void); // Shutdown. Do not call ANY JSS routines after this! | |
66 | |
67 | |
68 /* Error handling routines and related variables | |
69 */ | |
70 extern BOOL jssWarningIsFatal, // if TRUE, warnings are considered fatal -> function returns | |
71 jssErrorIsFatal; // if FALSE, error is considered non-fatal. this may cause strange problems. | |
72 | |
73 #ifndef JSS_LIGHT | |
74 extern void (*jssError)(int code, char *filename, int linen, char *fmt, ...); | |
75 extern void (*jssWarning)(int code, char *filename, int linen, char *fmt, ...); | |
76 #endif | |
77 | |
78 | |
79 /* If JSS_LIGHT is NOT defined, we add code for verbose error-, warning- | |
80 * and debug-messages. Otherwise use a macro stub. | |
81 */ | |
82 #ifndef JSS_LIGHT | |
83 # define JSSERROR(MEVAL, MRET, ...) do { jssError(MEVAL, __FILE__, (int) __LINE__, __VA_ARGS__); if (jssErrorIsFatal) return MRET; } while (0) | |
84 # define JSSWARNING(MEVAL, MRET, ...) do { jssWarning(MEVAL, __FILE__, (int) __LINE__, __VA_ARGS__); if (jssWarningIsFatal) return MRET; } while (0) | |
85 # ifdef JSS_DEBUG | |
86 # define JSSDEBUG(...) do { fprintf(stderr, "[%s:%d]: ", __FILE__, (int) __LINE__); fprintf(stderr, __VA_ARGS__); } while (0) | |
87 # else | |
88 # define JSSDEBUG(...) do { } while (0) | |
89 # endif // NDEBUG | |
90 #else | |
91 # define JSSERROR(MEVAL, MRET, ...) do { return MRET; } while (0) | |
92 # define JSSWARNING(MEVAL, MRET, ...) do { } while (0) | |
93 # define JSSDEBUG(...) do { } while (0) | |
94 #endif // JSS_LIGHT | |
95 | |
96 | |
97 #endif // JSS_H |