... | ... |
@@ -15,7 +15,6 @@ WITH REGARD TO THIS SOFTWARE. |
15 | 15 |
*/ |
16 | 16 |
|
17 | 17 |
#define SOUND_TIMER (AUDIO_BUFSIZE / SAMPLE_FREQUENCY * 1000.0f) |
18 |
-#define N_CHANNELS 4 |
|
19 | 18 |
#define XFADE_SAMPLES 100 |
20 | 19 |
#define INTERPOL_METHOD 1 |
21 | 20 |
|
... | ... |
@@ -54,7 +53,7 @@ typedef struct AudioChannel { |
54 | 53 |
float vol_r; |
55 | 54 |
} AudioChannel; |
56 | 55 |
|
57 |
-AudioChannel channel[N_CHANNELS]; |
|
56 |
+AudioChannel channel[POLYPHONY]; |
|
58 | 57 |
|
59 | 58 |
const float tuning[109] = { |
60 | 59 |
0.00058853f, 0.00062352f, 0.00066060f, 0.00069988f, 0.00074150f, |
... | ... |
@@ -117,10 +116,10 @@ note_on(AudioChannel *channel, Uint16 duration, Uint8 *data, Uint16 len, Uint8 v |
117 | 116 |
sample.data = data; |
118 | 117 |
sample.len = len; |
119 | 118 |
sample.pos = 0; |
120 |
- sample.env.a = attack * 62.0f; |
|
121 |
- sample.env.d = decay * 62.0f; |
|
119 |
+ sample.env.a = attack * 64.0f; |
|
120 |
+ sample.env.d = decay * 64.0f; |
|
122 | 121 |
sample.env.s = sustain / 16.0f; |
123 |
- sample.env.r = release * 62.0f; |
|
122 |
+ sample.env.r = release * 64.0f; |
|
124 | 123 |
if (loop) { |
125 | 124 |
sample.loop = len; |
126 | 125 |
} else { |
... | ... |
@@ -238,7 +237,7 @@ audio_handler(void *ctx, Uint8 *out_stream, int len) { |
238 | 237 |
memset(stream, 0x00, len); |
239 | 238 |
|
240 | 239 |
int n; |
241 |
- for (n = 0; n < N_CHANNELS; n++) { |
|
240 |
+ for (n = 0; n < POLYPHONY; n++) { |
|
242 | 241 |
Uint8 device = (3 + n) << 4; |
243 | 242 |
Uxn *u = (Uxn *)ctx; |
244 | 243 |
Uint8 *addr = &u->dev[device]; |
... | ... |
@@ -90,6 +90,7 @@ audio_deo(int instance, Uint8 *d, Uint8 port, Uxn *u) |
90 | 90 |
SDL_LockAudioDevice(audio_id); |
91 | 91 |
audio_start(instance, d, u); |
92 | 92 |
SDL_UnlockAudioDevice(audio_id); |
93 |
+ SDL_PauseAudioDevice(audio_id, 0); |
|
93 | 94 |
} |
94 | 95 |
} |
95 | 96 |
|
... | ... |
@@ -266,7 +267,7 @@ emu_init(Uxn *u) |
266 | 267 |
deadline_interval = ms_interval * TIMEOUT_MS; |
267 | 268 |
exec_deadline = SDL_GetPerformanceCounter() + deadline_interval; |
268 | 269 |
screen_resize(WIDTH, HEIGHT); |
269 |
- SDL_PauseAudioDevice(audio_id, 0); |
|
270 |
+ SDL_PauseAudioDevice(audio_id, 1); |
|
270 | 271 |
return 1; |
271 | 272 |
} |
272 | 273 |
|