comparison jssmix.h @ 51:36e2f910219c

A non-working implementation of floating point audio mixing.
author Matti Hamalainen <ccr@tnsp.org>
date Mon, 01 Oct 2012 03:48:21 +0300
parents 033c660c25f5
children 8725853609db
comparison
equal deleted inserted replaced
50:4cbdaa3f5d74 51:36e2f910219c
7 #define JSSMIX_H 7 #define JSSMIX_H
8 #include "jss.h" 8 #include "jss.h"
9 9
10 //#define DBG(...) do { fprintf(stderr, __VA_ARGS__); } while (0) 10 //#define DBG(...) do { fprintf(stderr, __VA_ARGS__); } while (0)
11 #define DBG(...) do { /* stub */ } while (0) 11 #define DBG(...) do { /* stub */ } while (0)
12
13
14 #ifdef JSS_MIX_FP
15 #define JMIXER_ADDBUF_TYPE double
16 #else
17 #define JMIXER_ADDBUF_TYPE Sint32
18 #endif
12 19
13 20
14 // Mixing limits 21 // Mixing limits
15 #define JVM_LIMIT_16_POS (32767) 22 #define JVM_LIMIT_16_POS (32767)
16 #define JVM_LIMIT_16_NEG (-32767) 23 #define JVM_LIMIT_16_NEG (-32767)
38 45
39 int chFlags; // Flags 46 int chFlags; // Flags
40 int chVolume, // Volume 47 int chVolume, // Volume
41 chPanning; // Panning 48 chPanning; // Panning
42 49
43 Sint32 chPrevR, chPrevL; 50 JMIXER_ADDBUF_TYPE chPrevR, chPrevL;
44 } JSSChannel; 51 } JSSChannel;
45 52
46 53
47 // Channel table 54 // Channel table
48 typedef int JSSChannelTable[jsetNChannels]; 55 typedef int JSSChannelTable[jsetNChannels];
58 outFreq, 65 outFreq,
59 globalVol; 66 globalVol;
60 JSSChannel channels[jsetNChannels]; 67 JSSChannel channels[jsetNChannels];
61 68
62 int addBufSize; 69 int addBufSize;
63 Sint32 *addBuffer; 70 JMIXER_ADDBUF_TYPE *addBuffer;
64 71
65 // Callback handling 72 // Callback handling
66 int cbFreq, cbCounter; 73 int cbFreq, cbCounter;
67 void *cbData; 74 void *cbData;
68 void (*cbFunction)(void *, void *); 75 void (*cbFunction)(void *, void *);
69 76
70 // Mixing routine pointers 77 // Mixing routine pointers
71 int (*jvmMixChannel_FW)(JSSMixer *, JSSChannel *, Sint32 *, const int, const Sint32); 78 int (*jvmMixChannel_FW)(JSSMixer *, JSSChannel *, JMIXER_ADDBUF_TYPE *, const int, const Sint32);
72 int (*jvmMixChannel_BW)(JSSMixer *, JSSChannel *, Sint32 *, const int, const Sint32); 79 int (*jvmMixChannel_BW)(JSSMixer *, JSSChannel *, JMIXER_ADDBUF_TYPE *, const int, const Sint32);
73 void (*jvmPostProcess)(Sint32 *, void *mixBuffer, int); 80 void (*jvmPostProcess)(JMIXER_ADDBUF_TYPE *, void *, const int);
74 81
75 // Device locking 82 // Device locking
76 #ifdef JSS_SUP_THREADS 83 #ifdef JSS_SUP_THREADS
77 DMMutex *mutex; 84 DMMutex *mutex;
78 #endif 85 #endif