making progress. reworking as I go.
This commit is contained in:
parent
fa186adaef
commit
1012c467d8
|
@ -84,14 +84,12 @@ note_out_chop = 0.05000
|
||||||
shim_sinewave = 0
|
shim_sinewave = 0
|
||||||
|
|
||||||
This is a vornoi thing:
|
This is a vornoi thing:
|
||||||
outdrivers = DisplayArray
|
outdrivers = OutputVoronoi, DisplayArray
|
||||||
#lightx = 64
|
lightx = 64
|
||||||
#lighty = 32
|
lighty = 32
|
||||||
#fromsides = 1
|
fromsides = 1
|
||||||
#shape_cutoff = 0.03
|
shape_cutoff = 0.03
|
||||||
#satamp = 5.000
|
satamp = 5.000
|
||||||
#amppow = 2.510
|
amppow = 2.510
|
||||||
#distpow = 1.500
|
distpow = 1.500
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -1,4 +1,6 @@
|
||||||
//NOTE DO NOT EDIT THIS FILE WITHOUT ALSO EDITING DFT12SMALL!!!
|
//NOTE DO NOT EDIT THIS FILE WITHOUT ALSO EDITING DFT12SMALL!!!
|
||||||
|
//WARNING: DFT8Turbo, DFT12Small is currently the only one that's actually working.
|
||||||
|
//THIS FILE DOES NOT CURRENTLY WORK.
|
||||||
|
|
||||||
#include <stdint.h>
|
#include <stdint.h>
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
|
@ -9,6 +11,10 @@
|
||||||
|
|
||||||
#define MAX_FREQS (12)
|
#define MAX_FREQS (12)
|
||||||
#define OCTAVES (4)
|
#define OCTAVES (4)
|
||||||
|
/* Backporting notes:
|
||||||
|
* Change loop to only check if the output table says it's complete.
|
||||||
|
* Pre-multiply octaves in optable.
|
||||||
|
*/
|
||||||
|
|
||||||
/*
|
/*
|
||||||
General procedure - use this code, with uint16_t or uint32_t buffers, and make sure none of the alarms go off.
|
General procedure - use this code, with uint16_t or uint32_t buffers, and make sure none of the alarms go off.
|
||||||
|
@ -40,8 +46,11 @@ uint8_t actiontableplace;
|
||||||
#define NR_OF_OPS (4<<OCTAVES) /*64*/
|
#define NR_OF_OPS (4<<OCTAVES) /*64*/
|
||||||
//Format is:
|
//Format is:
|
||||||
// 255 = DO NOT OPERATE
|
// 255 = DO NOT OPERATE
|
||||||
// bits 0..3 unfolded octave, i.e. sin/cos are offset by one.
|
// bits 0..4 = which octave
|
||||||
// bit 4 = add or subtract.
|
// bit 5 = even or odd (sin or cos) [UNUSED]
|
||||||
|
// bit 6 = reset
|
||||||
|
// bit 7 = add or subtract.
|
||||||
|
// bits 8..15 = octave base offset.
|
||||||
OPTABLETYPE optable[NR_OF_OPS]; //PUT IN FLASH
|
OPTABLETYPE optable[NR_OF_OPS]; //PUT IN FLASH
|
||||||
|
|
||||||
#define ACTIONTABLESIZE 256
|
#define ACTIONTABLESIZE 256
|
||||||
|
@ -114,7 +123,7 @@ static int Setup( float * frequencies, int bins )
|
||||||
if( longestzeroes == 255 )
|
if( longestzeroes == 255 )
|
||||||
{
|
{
|
||||||
//This is a nop. Emit a nop.
|
//This is a nop. Emit a nop.
|
||||||
optable[i] = 255;
|
optable[i] = 65535;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
@ -129,6 +138,7 @@ static int Setup( float * frequencies, int bins )
|
||||||
already_hit_octaveplace[toopmon] = 1;
|
already_hit_octaveplace[toopmon] = 1;
|
||||||
toop |= 1<<5;
|
toop |= 1<<5;
|
||||||
}
|
}
|
||||||
|
|
||||||
if( iop & 1 )
|
if( iop & 1 )
|
||||||
{
|
{
|
||||||
toop |= 1<<6;
|
toop |= 1<<6;
|
||||||
|
@ -137,7 +147,7 @@ static int Setup( float * frequencies, int bins )
|
||||||
//Handle add/subtract bit.
|
//Handle add/subtract bit.
|
||||||
if( iop & 2 ) toop |= 1<<4;
|
if( iop & 2 ) toop |= 1<<4;
|
||||||
|
|
||||||
optable[i] = toop;
|
optable[i] = toop | ((longestzeroes*MAX_FREQS*2+(iop & 1))<<8);
|
||||||
|
|
||||||
//printf( " %d %d %d\n", iop, val, longestzeroes );
|
//printf( " %d %d %d\n", iop, val, longestzeroes );
|
||||||
}
|
}
|
||||||
|
@ -154,6 +164,7 @@ static uint8_t note;
|
||||||
static uint8_t * memptr;
|
static uint8_t * memptr;
|
||||||
static uint16_t * romptr;
|
static uint16_t * romptr;
|
||||||
static uint8_t op;
|
static uint8_t op;
|
||||||
|
static uint8_t note_offset; //Offset of current note.
|
||||||
static uint8_t octave;
|
static uint8_t octave;
|
||||||
static uint8_t intindex;
|
static uint8_t intindex;
|
||||||
static int8_t diff;
|
static int8_t diff;
|
||||||
|
@ -182,68 +193,90 @@ void Padauk8BitRun( int8_t adcval )
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
//Everything inside this loop is executed ~3/4 * MAX_FREQS per audio sample. so.. ~9x.
|
//Everything inside this loop is executed ~3/4 * MAX_FREQS per audio sample. so.. ~9x.
|
||||||
//If op @ 4MHz, we get 44 cycles in here.
|
//If op @ 4MHz, we get 44 cycles in here. I don't think we can do it.
|
||||||
|
|
||||||
//If no operation is scheduled, continue.
|
//If no operation is scheduled, continue.
|
||||||
if( !( action & 1 ) ) continue; //1CYC
|
if( !( action & 1 ) ) continue; //1CYC
|
||||||
|
|
||||||
accM = which_octave_for_op - 1; //1CYC
|
accM = which_octave_for_op - 1; //1CYC
|
||||||
accM = accM + note; //1CYC
|
accM = accM + note; //1CYC
|
||||||
|
//accM now points to the memory address containing which step we're on.
|
||||||
|
//We can use that to figure out which octave we should operate with.
|
||||||
memptr = accM; //1CYC
|
memptr = accM; //1CYC
|
||||||
acc = *memptr; //2CYC (idxm)
|
acc = *memptr; //2CYC (idxm)
|
||||||
acc++; //1CYC
|
acc++; //1CYC
|
||||||
if( acc == NR_OF_OPS ) //2CYC
|
//acc now contains the actual place we are indexing off of.
|
||||||
acc = 0;
|
//If it overflows, be sure to reset it.
|
||||||
|
if( acc == NR_OF_OPS+1 )
|
||||||
|
{
|
||||||
|
acc = 1;
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
//We then update the memory with the new data.
|
||||||
*memptr = acc; //2CYC (idxm)
|
*memptr = acc; //2CYC (idxm)
|
||||||
|
|
||||||
accM = (uint8_t*)optable + acc*2; //1CYC
|
//Now, we look up in optable what we're supposed to do.
|
||||||
|
accM = ((uint8_t*)optable) + acc*2; //1CYC -> ROM dad is stored in word pairs.
|
||||||
romptr = (uint16_t*)accM; //1CYC
|
romptr = (uint16_t*)accM; //1CYC
|
||||||
acc = *romptr; //2CYC (ldtabl)
|
acc = *romptr; //2CYC (ldtabl)
|
||||||
|
|
||||||
//If we are on the one thing we aren't supposed to operate within, cancel.
|
//If we are on the one operation we aren't supposed to operate within, we should cancel and loop around.
|
||||||
if( acc == 255 ) continue; //2CYC
|
//XXX XXX XXX XXX XXX This is wrong. We should probably handle this logic above.
|
||||||
|
//XXX XXX XXX XXX XXX Logic handled above. XXX PICK UP HERE!!!
|
||||||
|
printf( "+ %d %d %d\n", note, acc, *memptr );
|
||||||
|
//if( acc == 255 ) //2CYC
|
||||||
|
//{
|
||||||
|
// //This way, when we loop back around, it will be at index 0, and everything should flow gracefully.
|
||||||
|
// *memptr = 255;
|
||||||
|
// continue;
|
||||||
|
//}
|
||||||
|
if( acc == 255 )
|
||||||
|
{
|
||||||
|
//We dun goofed.
|
||||||
|
fprintf( stderr, "Goofed.\n" );
|
||||||
|
exit( 0 );
|
||||||
|
}
|
||||||
|
|
||||||
op = acc; //1CYC
|
//This actually reads the current octave specifier into "op"
|
||||||
|
//BIT7: add or subtract
|
||||||
|
//BIT6: reset
|
||||||
|
//BIT5: Even or odd?
|
||||||
|
//BITS 0..4 = Which octave.
|
||||||
|
op = acc; //1CYC
|
||||||
|
|
||||||
//21 cycles so far.
|
acc = (*romptr)>>8; //2CYC (ldtabh) -> Contains memory offset of which note to use.
|
||||||
|
note_offset = acc;
|
||||||
acc = MAX_FREQS; //1CYC
|
|
||||||
mul2 = acc; //1CYC
|
|
||||||
acc = op; //1CYC
|
|
||||||
acc = acc & 0xf; //1CYC
|
|
||||||
octave = acc; //1CYC
|
|
||||||
acc = acc * mul2; //2CYC
|
|
||||||
acc = acc + note; //1CYC
|
acc = acc + note; //1CYC
|
||||||
intindex = acc; //1CYC
|
|
||||||
accM = (uint8_t*)integral_at-1 + acc; //1CYC
|
accM = (uint8_t*)integral_at-1 + acc; //1CYC
|
||||||
memptr = accM; //1CYC
|
memptr = accM; //1CYC
|
||||||
|
acc = *memptr; //2CYC idxm
|
||||||
|
|
||||||
if( op & 0x10 ) //ADD //2CYC
|
//acc now contains the running integral of the last time we were on this cell.
|
||||||
|
if( op & (1<<7) ) //ADD //2CYC
|
||||||
{
|
{
|
||||||
acc = *memptr; //2CYC
|
|
||||||
acc = acc - running_integral; //1CYC
|
acc = acc - running_integral; //1CYC
|
||||||
diff = acc; //1CYC
|
|
||||||
}
|
}
|
||||||
else //SUBTRACT
|
else //SUBTRACT
|
||||||
{
|
{
|
||||||
acc = *memptr; //2CYC
|
|
||||||
tmp = acc; //1CYC
|
tmp = acc; //1CYC
|
||||||
acc = running_integral; //1CYC
|
acc = running_integral; //1CYC
|
||||||
acc = acc - tmp; //1CYC
|
acc = acc - tmp; //1CYC
|
||||||
diff = acc; //1CYC
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
diff = acc; //1CYC
|
||||||
|
|
||||||
|
//Assume 2 extra cycles of overhead for if/else. //2 CYC
|
||||||
|
|
||||||
acc = running_integral; //1CYC
|
acc = running_integral; //1CYC
|
||||||
|
//Store the current running integral back into this note's running integral for next time.
|
||||||
*memptr = acc; //2CYC
|
*memptr = acc; //2CYC
|
||||||
|
|
||||||
//42 AVERAGE cycles so far.
|
// op = info about what op we're on. WARNING: Bitfield.
|
||||||
//??? Something below here is wrong??? Or near here??? XXX TODO PICK UP HERE!!!
|
// diff = how much to add to current value.
|
||||||
intindex <<= 1; //1CYC
|
// note_offset = index of current operative note position.
|
||||||
if( op&(1<<6) ) //2CYC
|
octave = op & 0x1f; //XXX TODO
|
||||||
{
|
|
||||||
intindex |= 1; //1CYC
|
|
||||||
}
|
|
||||||
|
|
||||||
|
printf( "%d %d %d %d\n", op, diff, note_offset, octave );
|
||||||
accM = (uint8_t*)(mulmux - 1); //1CYC
|
accM = (uint8_t*)(mulmux - 1); //1CYC
|
||||||
accM = accM + note*2; //1CYC
|
accM = accM + note*2; //1CYC
|
||||||
romptr = accM; //1CYC
|
romptr = accM; //1CYC
|
||||||
|
|
|
@ -32,7 +32,7 @@
|
||||||
|
|
||||||
//We take the raw signal off of the
|
//We take the raw signal off of the
|
||||||
#ifndef FILTER_BLUR_PASSES
|
#ifndef FILTER_BLUR_PASSES
|
||||||
#define FILTER_BLUR_PASSES 2
|
#define FILTER_BLUR_PASSES 1
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
//Determines bit shifts for where notes lie. We represent notes with an
|
//Determines bit shifts for where notes lie. We represent notes with an
|
||||||
|
|
Loading…
Reference in a new issue