Fix formatting issues

This commit is contained in:
Sam Ellicott 2021-05-22 14:45:23 -04:00
parent 36ef604baf
commit 08eb40a900
2 changed files with 161 additions and 169 deletions

View file

@ -10,7 +10,8 @@
#ifndef CCEMBEDDED
void DoDFT( float * outbins, float * frequencies, int bins, float * databuffer, int place_in_data_buffer, int size_of_data_buffer, float q )
void DoDFT( float *outbins, float *frequencies, int bins, float *databuffer,
int place_in_data_buffer, int size_of_data_buffer, float q )
{
int i, j;
for ( i = 0; i < bins; i++ )
@ -42,7 +43,8 @@ void DoDFT( float * outbins, float * frequencies, int bins, float * databuffer,
}
}
void DoDFTQuick( float * outbins, float * frequencies, int bins, const float * databuffer, int place_in_data_buffer, int size_of_data_buffer, float q, float speedup )
void DoDFTQuick( float *outbins, float *frequencies, int bins, const float *databuffer,
int place_in_data_buffer, int size_of_data_buffer, float q, float speedup )
{
int i, j;
@ -84,7 +86,6 @@ void DoDFTQuick( float * outbins, float * frequencies, int bins, const float * d
}
////////////////////////////DFT Progressive is for embedded systems, primarily.
@ -121,7 +122,8 @@ void HandleProgressive( float sample )
}
void DoDFTProgressive( float * outbins, float * frequencies, int bins, const float * databuffer, int place_in_data_buffer, int size_of_data_buffer, float q, float speedup )
void DoDFTProgressive( float *outbins, float *frequencies, int bins, const float *databuffer,
int place_in_data_buffer, int size_of_data_buffer, float q, float speedup )
{
int i;
static int last_place;
@ -144,7 +146,6 @@ void DoDFTProgressive( float * outbins, float * frequencies, int bins, const flo
memset( gbinqtyc, 0, sizeof( float ) * bins );
memset( phis, 0, sizeof( float ) * bins );
memset( lastbins, 0, sizeof( float ) * bins );
}
memcpy( outbins, lastbins, sizeof( float ) * bins );
@ -165,31 +166,23 @@ void DoDFTProgressive( float * outbins, float * frequencies, int bins, const flo
int didrun = 0;
for ( i = last_place; i != place_in_data_buffer; i = ( i + 1 ) % size_of_data_buffer )
{
float fin = ((float)((int)(databuffer[i] * 127))) / 127.0; //simulate 8-bit input (it looks FINE!)
float fin = ( (float)( (int)( databuffer[ i ] * 127 ) ) ) /
127.0; // simulate 8-bit input (it looks FINE!)
HandleProgressive( fin );
didrun = 1;
}
last_place = place_in_data_buffer;
if( didrun )
{
memcpy( lastbins, outbins, sizeof(float)*bins );
}
if ( didrun ) { memcpy( lastbins, outbins, sizeof( float ) * bins ); }
/* for( i = 0; i < bins; i++ )
{
printf( "%0.2f ", outbins[i]*100 );
}
printf( "\n" );*/
}
/////////////////////////////INTEGER DFT
@ -231,7 +224,7 @@ void HandleProgressiveInt( int8_t sample1, int8_t sample2 )
//13 cycles MIN
ipl += adv; //Advance, 16bit += 16bit, 1 + 1 cycles 2
localipl = (ipl>>8)<<1; //Select upper 8 bits 1 cycles 1 *** AS/IS: 4
localipl = (ipl>>8)<<1; //Select upper 8 bits, 1 cycle 1 *** AS/IS: 4
st = &sintable[localipl];
s1 = *(st++); //Read s1 component out of table. 2+2 cycles 2
@ -255,7 +248,7 @@ void HandleProgressiveInt( int8_t sample1, int8_t sample2 )
// Add TS and TC to the datspace stuff. (24 instructions)
tmp1 = (*ds); //Read out, sin component. 4 Accurate.
tmp1 = ( *ds ); // Read out, sin component. 4 Accurate
tmp1 -= tmp1 >> 7; // Subtract from the MSB (with carry) 2 -> 6 AS/IS: 7+7 = 14
tmp1 += ts >> 7; // Add MSBs with carry 2 -> 6 AS/IS: 6
@ -273,7 +266,8 @@ void HandleProgressiveInt( int8_t sample1, int8_t sample2 )
}
}
void DoDFTProgressiveInteger( float * outbins, float * frequencies, int bins, const float * databuffer, int place_in_data_buffer, int size_of_data_buffer, float q, float speedup )
void DoDFTProgressiveInteger( float *outbins, float *frequencies, int bins, const float *databuffer,
int place_in_data_buffer, int size_of_data_buffer, float q, float speedup )
{
int i;
static int last_place;
@ -303,7 +297,8 @@ void DoDFTProgressiveInteger( float * outbins, float * frequencies, int bins, co
}
for( i = last_place; i != ( place_in_data_buffer&0xffffe ); i = (i+2)%size_of_data_buffer )
for ( i = last_place; i != ( place_in_data_buffer & 0xffffe );
i = ( i + 2 ) % size_of_data_buffer )
{
int8_t ifr1 = ( int8_t )( ( ( databuffer[ i + 0 ] ) ) * 127 );
int8_t ifr2 = ( int8_t )( ( ( databuffer[ i + 1 ] ) ) * 127 );
@ -326,8 +321,6 @@ void DoDFTProgressiveInteger( float * outbins, float * frequencies, int bins, co
}
#endif

View file

@ -390,8 +390,7 @@ int main( int argc, char **argv )
free( OutDriverNames );
do
{
do {
// Initialize Sound
sd = CNFAInit( sound_source, "colorchord", &SoundCB, GetParameterI( "samplerate", 44100 ),
GetParameterI( "samplerate", 44100 ), GetParameterI( "channels", 2 ),