uxn

Varvara Ordinator, written in ANSI C(SDL2)
git clone https://git.eamoncaddigan.net/uxn.git
Log | Files | Refs | README | LICENSE

commit d343865471d5bf0b55e592f2a7fb8a4e12f5b624
parent 67dfbc1a63368d8f0926122492d0bd98ffe36bfd
Author: Andrew Alderwick <andrew@alderwick.co.uk>
Date:   Tue, 27 Apr 2021 21:03:38 +0100

Added position readout to audio devices

Diffstat:
Mprojects/demos/musictracker.usm | 8++++----
Mprojects/demos/piano.usm | 10+++++-----
Mprojects/examples/blank.usm | 12++++++------
Mprojects/software/enfer.usm | 10+++++-----
Msrc/emulator.c | 9++++++---
5 files changed, 26 insertions(+), 23 deletions(-)

diff --git a/projects/demos/musictracker.usm b/projects/demos/musictracker.usm @@ -25,10 +25,10 @@ |00 @System [ &vector $2 &pad $6 &r $2 &g $2 &b $2 ] |10 @Console [ &vector $2 &pad $6 &char $1 &byte $1 &short $2 &string $2 ] |20 @Screen [ &vector $2 &width $2 &height $2 &pad $2 &x $2 &y $2 &addr $2 &color $1 ] -|30 @Audio0 [ &vector $2 &output $1 &pad $5 &adsr $2 &len $2 &addr $2 &volume $1 &pitch $1 ] -|40 @Audio1 [ &vector $2 &output $1 &pad $5 &adsr $2 &len $2 &addr $2 &volume $1 &pitch $1 ] -|50 @Audio2 [ &vector $2 &output $1 &pad $5 &adsr $2 &len $2 &addr $2 &volume $1 &pitch $1 ] -|60 @Audio3 [ &vector $2 &output $1 &pad $5 &adsr $2 &len $2 &addr $2 &volume $1 &pitch $1 ] +|30 @Audio0 [ &vector $2 &position $2 &output $1 &pad $3 &adsr $2 &len $2 &addr $2 &volume $1 &pitch $1 ] +|40 @Audio1 [ &vector $2 &position $2 &output $1 &pad $3 &adsr $2 &len $2 &addr $2 &volume $1 &pitch $1 ] +|50 @Audio2 [ &vector $2 &position $2 &output $1 &pad $3 &adsr $2 &len $2 &addr $2 &volume $1 &pitch $1 ] +|60 @Audio3 [ &vector $2 &position $2 &output $1 &pad $3 &adsr $2 &len $2 &addr $2 &volume $1 &pitch $1 ] |80 @Controller [ &vector $2 &button $1 &key $1 ] |90 @Mouse [ &vector $2 &x $2 &y $2 &state $1 &chord $1 ] |a0 @File [ &vector $2 &success $2 &offset $2 &pad $2 &name $2 &length $2 &load $2 &save $2 ] diff --git a/projects/demos/piano.usm b/projects/demos/piano.usm @@ -12,11 +12,11 @@ |00 @System [ &vector $2 &pad $6 &r $2 &g $2 &b $2 ] |10 @Console [ &pad $8 &char $1 &byte $1 &short $2 &string $2 ] -|20 @Screen [ &vector $2 &width $2 &height $2 &pad $2 &x $2 &y $2 &addr $2 &color $1 ] -|30 @Audio0 [ &vector $2 &output $1 &pad $5 &adsr $2 &length $2 &addr $2 &volume $1 &pitch $1 ] -|40 @Audio1 [ &vector $2 &output $1 &pad $5 &adsr $2 &length $2 &addr $2 &volume $1 &pitch $1 ] -|50 @Audio2 [ &vector $2 &output $1 &pad $5 &adsr $2 &length $2 &addr $2 &volume $1 &pitch $1 ] -|60 @Audio3 [ &vector $2 &output $1 &pad $5 &adsr $2 &length $2 &addr $2 &volume $1 &pitch $1 ] +|20 @Screen [ &vector $2 &width $2 &height $2 &pad $2 &x $2 &y $2 &addr $2 &color $1 ] +|30 @Audio0 [ &vector $2 &position $2 &output $1 &pad $3 &adsr $2 &length $2 &addr $2 &volume $1 &pitch $1 ] +|40 @Audio1 [ &vector $2 &position $2 &output $1 &pad $3 &adsr $2 &length $2 &addr $2 &volume $1 &pitch $1 ] +|50 @Audio2 [ &vector $2 &position $2 &output $1 &pad $3 &adsr $2 &length $2 &addr $2 &volume $1 &pitch $1 ] +|60 @Audio3 [ &vector $2 &position $2 &output $1 &pad $3 &adsr $2 &length $2 &addr $2 &volume $1 &pitch $1 ] |70 @Midi [ &vector $2 &channel $1 &note $1 &velocity $1 ] |80 @Controller [ &vector $2 &button $1 &key $1 ] |90 @Mouse [ &vector $2 &x $2 &y $2 &state $1 &chord $1 ] diff --git a/projects/examples/blank.usm b/projects/examples/blank.usm @@ -2,13 +2,13 @@ ( devices ) -|00 @System [ &vector $2 &pad $6 &r $2 &g $2 &b $2 ] +|00 @System [ &vector $2 &wst $1 &rst $1 &pad $4 &r $2 &g $2 &b $2 ] |10 @Console [ &pad $8 &char $1 &byte $1 &short $2 &string $2 ] -|20 @Screen [ &vector $2 &width $2 &height $2 &pad $2 &x $2 &y $2 &addr $2 &color $1 ] -|30 @Audio0 [ &vector $2 &output $1 &pad $5 &adsr $2 &length $2 &addr $2 &volume $1 &pitch $1 ] -|40 @Audio1 [ &vector $2 &output $1 &pad $5 &adsr $2 &length $2 &addr $2 &volume $1 &pitch $1 ] -|50 @Audio2 [ &vector $2 &output $1 &pad $5 &adsr $2 &length $2 &addr $2 &volume $1 &pitch $1 ] -|60 @Audio3 [ &vector $2 &output $1 &pad $5 &adsr $2 &length $2 &addr $2 &volume $1 &pitch $1 ] +|20 @Screen [ &vector $2 &width $2 &height $2 &pad $2 &x $2 &y $2 &addr $2 &color $1 ] +|30 @Audio0 [ &vector $2 &position $2 &output $1 &pad $3 &adsr $2 &length $2 &addr $2 &volume $1 &pitch $1 ] +|40 @Audio1 [ &vector $2 &position $2 &output $1 &pad $3 &adsr $2 &length $2 &addr $2 &volume $1 &pitch $1 ] +|50 @Audio2 [ &vector $2 &position $2 &output $1 &pad $3 &adsr $2 &length $2 &addr $2 &volume $1 &pitch $1 ] +|60 @Audio3 [ &vector $2 &position $2 &output $1 &pad $3 &adsr $2 &length $2 &addr $2 &volume $1 &pitch $1 ] |70 @Midi [ &vector $2 &channel $1 &note $1 &velocity $1 ] |80 @Controller [ &vector $2 &button $1 &key $1 ] |90 @Mouse [ &vector $2 &x $2 &y $2 &state $1 &chord $1 ] diff --git a/projects/software/enfer.usm b/projects/software/enfer.usm @@ -18,11 +18,11 @@ |00 @System [ &vector $2 &pad $6 &r $2 &g $2 &b $2 ] |10 @Console [ &pad $8 &char $1 &byte $1 &short $2 &string $2 ] -|20 @Screen [ &vector $2 &width $2 &height $2 &pad $2 &x $2 &y $2 &addr $2 &color $1 ] -|30 @Audio0 [ &vector $2 &output $1 &pad $5 &adsr $2 &length $2 &addr $2 &volume $1 &pitch $1 ] -|40 @Audio1 [ &vector $2 &output $1 &pad $5 &adsr $2 &length $2 &addr $2 &volume $1 &pitch $1 ] -|50 @Audio2 [ &vector $2 &output $1 &pad $5 &adsr $2 &length $2 &addr $2 &volume $1 &pitch $1 ] -|60 @Audio3 [ &vector $2 &output $1 &pad $5 &adsr $2 &length $2 &addr $2 &volume $1 &pitch $1 ] +|20 @Screen [ &vector $2 &width $2 &height $2 &pad $2 &x $2 &y $2 &addr $2 &color $1 ] +|30 @Audio0 [ &vector $2 &position $2 &output $1 &pad $3 &adsr $2 &length $2 &addr $2 &volume $1 &pitch $1 ] +|40 @Audio1 [ &vector $2 &position $2 &output $1 &pad $3 &adsr $2 &length $2 &addr $2 &volume $1 &pitch $1 ] +|50 @Audio2 [ &vector $2 &position $2 &output $1 &pad $3 &adsr $2 &length $2 &addr $2 &volume $1 &pitch $1 ] +|60 @Audio3 [ &vector $2 &position $2 &output $1 &pad $3 &adsr $2 &length $2 &addr $2 &volume $1 &pitch $1 ] |70 @Midi [ &vector $2 &channel $1 &note $1 &velocity $1 ] |80 @Controller [ &vector $2 &button $1 &key $1 ] |90 @Mouse [ &vector $2 &x $2 &y $2 &state $1 &chord $1 ] diff --git a/src/emulator.c b/src/emulator.c @@ -252,9 +252,12 @@ static void audio_talk(Device *d, Uint8 b0, Uint8 w) { Apu *c = &apu[d - devaudio0]; - if(!w && b0 == 0x2) { - d->dat[0x2] = apu_get_vu(c); - } else if(w && b0 == 0xf) { + if(!w) { + if(b0 == 0x2) + mempoke16(d->dat, 0x2, c->i); + else if(b0 == 0x4) + d->dat[0x4] = apu_get_vu(c); + } else if(b0 == 0xf) { SDL_LockAudioDevice(audio_id); c->len = mempeek16(d->dat, 0xa); c->addr = &d->mem[mempeek16(d->dat, 0xc)];