Mercurial > hg > dmlib
annotate jss.h @ 44:064d1d1d5b0f
Add new functions, jssConvertSampleFromFP() and jssConvertSampleToFP().
author | Matti Hamalainen <ccr@tnsp.org> |
---|---|
date | Sun, 30 Sep 2012 23:23:08 +0300 |
parents | 32250b436bca |
children | 8725853609db |
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 #define jsfFP (0x08) // Floating point sample |
064d1d1d5b0f
Add new functions, jssConvertSampleFromFP() and jssConvertSampleToFP().
Matti Hamalainen <ccr@tnsp.org>
parents:
0
diff
changeset
|
35 |
0 | 36 #define JSFSET(a, b) do { a |= b; } while (0) |
37 #define JSFUNSET(a, b) do { a &= (0xff ^ b); } while (0) | |
38 | |
39 // Panning position | |
40 #define jchPanLeft (0x00) // Leftmost pan | |
41 #define jchPanMiddle (0x80) // Center pan | |
42 #define jchPanRight (0xff) // Rightmost pan | |
43 | |
44 // Audio formats | |
45 enum | |
46 { | |
47 JSS_AUDIO_U8, // 8-bit formats | |
48 JSS_AUDIO_S8, | |
49 JSS_AUDIO_U16, // 16-bit formats | |
50 JSS_AUDIO_S16, | |
51 JSS_AUDIO_U32, // 32-bit (24+padding) | |
52 JSS_AUDIO_S32 | |
53 } JSS_AUDIO_FMT; | |
54 | |
55 | |
56 enum | |
57 { | |
58 JSS_AUDIO_MONO = 1, | |
59 JSS_AUDIO_STEREO = 2 | |
60 } JSS_AUDIO_CHANNELS; | |
61 | |
62 | |
63 /* System initialization and shutdown | |
64 */ | |
65 int jssInit(void); // Initialization. Call before anything else! | |
66 int jssClose(void); // Shutdown. Do not call ANY JSS routines after this! | |
67 | |
68 | |
69 /* Error handling routines and related variables | |
70 */ | |
71 extern BOOL jssWarningIsFatal, // if TRUE, warnings are considered fatal -> function returns | |
72 jssErrorIsFatal; // if FALSE, error is considered non-fatal. this may cause strange problems. | |
73 | |
74 #ifndef JSS_LIGHT | |
75 extern void (*jssError)(int code, char *filename, int linen, char *fmt, ...); | |
76 extern void (*jssWarning)(int code, char *filename, int linen, char *fmt, ...); | |
77 #endif | |
78 | |
79 | |
80 /* If JSS_LIGHT is NOT defined, we add code for verbose error-, warning- | |
81 * and debug-messages. Otherwise use a macro stub. | |
82 */ | |
83 #ifndef JSS_LIGHT | |
84 # define JSSERROR(MEVAL, MRET, ...) do { jssError(MEVAL, __FILE__, (int) __LINE__, __VA_ARGS__); if (jssErrorIsFatal) return MRET; } while (0) | |
85 # define JSSWARNING(MEVAL, MRET, ...) do { jssWarning(MEVAL, __FILE__, (int) __LINE__, __VA_ARGS__); if (jssWarningIsFatal) return MRET; } while (0) | |
86 # ifdef JSS_DEBUG | |
87 # define JSSDEBUG(...) do { fprintf(stderr, "[%s:%d]: ", __FILE__, (int) __LINE__); fprintf(stderr, __VA_ARGS__); } while (0) | |
88 # else | |
89 # define JSSDEBUG(...) do { } while (0) | |
90 # endif // NDEBUG | |
91 #else | |
92 # define JSSERROR(MEVAL, MRET, ...) do { return MRET; } while (0) | |
93 # define JSSWARNING(MEVAL, MRET, ...) do { } while (0) | |
94 # define JSSDEBUG(...) do { } while (0) | |
95 #endif // JSS_LIGHT | |
96 | |
97 | |
98 #endif // JSS_H |