コード例 #1
0
PerlinNoise::PerlinNoise(int _maxFreq, float _persistence, int _range, float xWidth, float yWidth, const vector<vec2>& centers, const vector<float>& radii)
{
	srand(time(0));

	for (int i = 0; i<_maxFreq; i++)
	{
		octaves.push_back(Octave(i, _persistence, _range, xWidth, yWidth, centers, radii));
	}
}
コード例 #2
0
PerlinNoise::PerlinNoise(int _maxFreq, float _persistence, int _range)
{
	srand(time(0));

	for (int i = 0; i<_maxFreq; i++)
	{
		octaves.push_back(Octave(i, _persistence, _range));
	}
}
コード例 #3
0
ファイル: Sound.cpp プロジェクト: AlexeyS/guitartrainer
void Sound::prev()
{
    if (_note != NOTE_FIRST)
        _note = Note(_note - 1);
    else if(_octave != OCTAVE_FIRST)
    {
        _octave = Octave(_octave - 1);
        _note = NOTE_LAST;
    }
}
コード例 #4
0
ファイル: Sound.cpp プロジェクト: AlexeyS/guitartrainer
void Sound::next()
{
    if (_note != NOTE_LAST)
        _note = Note(_note + 1);
    else if(_octave != OCTAVE_LAST)
    {
        _octave = Octave(_octave + 1);
        _note = NOTE_FIRST;
    }
}
コード例 #5
0
void PerlinNoise::generateLandmassNoise(int _maxFreq, float _persistence, int _range, float xWidth, float yWidth, float minY, vector<vector<Edge>>* partitions)
{
	srand(time(0));
	octaves.clear();
	octaves.clear();

	for (int i = 0; i < _maxFreq; i++)
	{
		octaves.push_back(Octave(i, _persistence, _range, xWidth, yWidth, minY, partitions));
	}
}
コード例 #6
0
void AudioProcess()
{
	BYTE i;
	SIGNED_WORD temp16;
	
	if(Phase++&0x01)
	{
		//We are in the Odd Phase.  Do Nothing
		I2S0_TX0 = QueuedI2CSampleOut;
	}
	else
	{
		DAC0_WHOLE = QueuedDACSampleOut;	
		I2S0_TX0 = QueuedI2CSampleOut;
	
		//We need to do an intermediate operation to get the ADC data.
		//The 32-bit ADC0_RA reg is not sign extended to 32-bits.  TO make the compiler happy
		//we need to do a 16-bit signed read and then recast to q31_t
		temp16 = ADC0_RA;
		
		SampleIn = (q31_t)(temp16)<<8;

		if(InhibitAudio == FALSE)
		{
			//See what the current Patch is and do the appropriate processing!
			switch(CurrentPatch)
			{
				default:
					break;
				
				case PATCH_SINE_TEST:
					
					SampleOut = ((q31_t)(Sine_15_0[q++]))<<8;
					
					break;
				
				case PATCH_PASS_THROUGH:
					
					SampleOut = SampleIn;
					
					break;
					
				case PATCH_ALPHA:
				
					SampleIn = SampleIn; 
					arm_biquad_cas_df1_32x64_q31(&MyAlphaIIR,&SampleIn,&SampleOut,1);
					arm_scale_q31(&SampleOut,AlphaIIR_Norm,0,&SampleOut,1);
					SampleIn=SampleOut;
					PickupTranslator(&SampleIn,&SampleOut);
					
			
					break;
					
				case PATCH_BETA:
					
					SampleIn = SampleIn; 
					arm_biquad_cas_df1_32x64_q31(&MyBetaIIR,&SampleIn,&SampleOut,1);
					arm_scale_q31(&SampleOut,BetaIIR_Norm,0,&SampleOut,1);
					SampleIn=SampleOut;
					PickupTranslator(&SampleIn,&SampleOut);
					
					break;
				
				case PATCH_GAMMA:
				
					arm_biquad_cas_df1_32x64_q31(&MyGammaIIR,&SampleIn,&SampleOut,1);
					arm_scale_q31(&SampleOut,GammaIIR_Norm,0,&SampleOut,1);
					overdrive(&SampleOut,&SampleOut);
					arm_scale_q31(&SampleOut,((q31_t)(DriveLevel)<<26),1,&SampleOut,1);
					overdrive(&SampleOut,&SampleOut);
			
					break;
				
				case PATCH_DELTA:
					
					PickupTranslator(&SampleIn,&SampleOut);
					Octave(&SampleOut,&SampleOut);
					arm_biquad_cas_df1_32x64_q31(&MyBetaIIR,&SampleIn,&SampleIn,1);
					arm_scale_q31(&SampleIn,BetaIIR_Norm,0,&SampleIn,1);
				
					 SampleOut += SampleIn>>1;
					
					break;
			}
		}
		else
		{
			SampleOut = SampleIn;
		}
		if(MuteActive == TRUE)
		{
			SampleOut = 0;
		}
		
		QueuedDACSampleOut = TranslateForDAC(SampleOut);
		QueuedI2CSampleOut = TranslateForI2S(SampleOut);
		
		//Start next Sample
		ADC0_SC1A  =  DIFF_DIFFERENTIAL | 1; 
	}