Fix xfading issues
This commit is contained in:
parent
9437c4e520
commit
32853ce8f7
|
@ -16,7 +16,6 @@
|
|||
|
||||
|0000
|
||||
|
||||
@progress0 $1
|
||||
@progress1 $1
|
||||
@progress2 $1
|
||||
@progress3 $1
|
||||
|
@ -31,6 +30,7 @@
|
|||
( vectors )
|
||||
;on-frame .Screen/vector DEO2
|
||||
;on-button .Controller/vector DEO2
|
||||
#0000 .Audio1/vector DEO2
|
||||
;on-audio1 .Audio1/vector DEO2
|
||||
;on-audio2 .Audio2/vector DEO2
|
||||
;on-audio3 .Audio3/vector DEO2
|
||||
|
@ -44,7 +44,6 @@
|
|||
#f0 .Audio0/decay DEO
|
||||
#ff .Audio0/sustain DEO
|
||||
#1e .Audio0/release DEO
|
||||
#00e8 .Audio0/duration DEO2
|
||||
|
||||
;sine .Audio1/addr DEO2
|
||||
#0054 .Audio1/length DEO2
|
||||
|
@ -71,7 +70,7 @@
|
|||
#f0 .Audio3/decay DEO
|
||||
#00 .Audio3/sustain DEO
|
||||
#1e .Audio3/release DEO
|
||||
#03e0 .Audio3/duration DEO2
|
||||
#00e8 .Audio3/duration DEO2
|
||||
BRK
|
||||
|
||||
@on-button ( -> )
|
||||
|
@ -84,16 +83,6 @@ BRK
|
|||
#3c .Audio0/pitch DEO
|
||||
BRK
|
||||
|
||||
@on-audio0 ( -> )
|
||||
( load next note )
|
||||
.progress0 LDZ
|
||||
( increment note counter )
|
||||
DUP INC #1f AND .progress0 STZ
|
||||
( play note )
|
||||
GET-NOTE
|
||||
.Audio0/pitch DEO
|
||||
BRK
|
||||
|
||||
@on-audio1 ( -> )
|
||||
( load next note )
|
||||
.progress1 LDZ
|
||||
|
|
|
@ -2612,19 +2612,16 @@ audio_handler(void *ctx, Uint8 *out_stream, int len) {
|
|||
Uint8 *addr = &u->dev[device];
|
||||
if (channel[n].duration <= 0 && PEEK2(addr)) {
|
||||
uxn_eval(u, PEEK2(addr));
|
||||
// printf("EVAL: %x\n", device);
|
||||
// printf("ADDR: %x\n", PEEK2(addr));
|
||||
// printf("----\n");
|
||||
}
|
||||
channel[n].duration -= SOUND_TIMER;
|
||||
|
||||
int x = 0;
|
||||
if (channel[n].xfade) {
|
||||
float delta = 1.0f / (XFADE_SAMPLES);
|
||||
while (x < XFADE_SAMPLES * 2 && x < len / 2) {
|
||||
float delta = 1.0f / (XFADE_SAMPLES * 2);
|
||||
while (x < XFADE_SAMPLES * 2) {
|
||||
float alpha = x * delta;
|
||||
float beta = 1.0f - alpha;
|
||||
Sint16 next_a = next_a = next_sample(&channel[n].next_sample);
|
||||
Sint16 next_a = next_sample(&channel[n].next_sample);
|
||||
Sint16 next_b = 0;
|
||||
if (channel[n].sample.data != 0) {
|
||||
next_b = next_sample(&channel[n].sample);
|
||||
|
@ -2637,7 +2634,6 @@ audio_handler(void *ctx, Uint8 *out_stream, int len) {
|
|||
channel[n].xfade = false;
|
||||
}
|
||||
Sample *sample = &channel[n].sample;
|
||||
int direction = 1;
|
||||
while (x < len / 2) {
|
||||
if (sample->data == 0) {
|
||||
break;
|
||||
|
|
Loading…
Reference in New Issue