mirror of
				https://github.com/AquaMorph/Droplets.git
				synced 2025-10-30 16:13:20 +00:00 
			
		
		
		
	Cleaned code
This commit is contained in:
		| @@ -1,12 +1,10 @@ | |||||||
| #include "noise_droplet.h" | #include "noise_droplet.h" | ||||||
|  |  | ||||||
| NoiseDroplet::NoiseDroplet(DaisyPatch* m_patch, | NoiseDroplet::NoiseDroplet(DaisyPatch* m_patch, | ||||||
| 			   float sample_rate, |  | ||||||
| 			   DropletState m_state) : | 			   DropletState m_state) : | ||||||
|   Droplet(m_patch, |   Droplet(m_patch, | ||||||
| 	  m_state) { | 	  m_state) { | ||||||
|   noise.Init(); |   noise.Init(); | ||||||
|   filter.Init(); |  | ||||||
| } | } | ||||||
|  |  | ||||||
| void NoiseDroplet::Control() {} | void NoiseDroplet::Control() {} | ||||||
|   | |||||||
| @@ -12,9 +12,8 @@ | |||||||
| class NoiseDroplet: public Droplet { | class NoiseDroplet: public Droplet { | ||||||
| private: | private: | ||||||
|   daisysp::WhiteNoise noise; |   daisysp::WhiteNoise noise; | ||||||
|   daisysp::NlFilt filter; |  | ||||||
| public: | public: | ||||||
|   NoiseDroplet(DaisyPatch*, float, DropletState); |   NoiseDroplet(DaisyPatch*, DropletState); | ||||||
|   void Control(); |   void Control(); | ||||||
|   void Process(float**, float**, size_t); |   void Process(float**, float**, size_t); | ||||||
|   void Draw(); |   void Draw(); | ||||||
|   | |||||||
| @@ -1,8 +1,8 @@ | |||||||
| #include "vco_droplet.h" | #include "vco_droplet.h" | ||||||
|  |  | ||||||
| VCODroplet::VCODroplet(DaisyPatch* m_patch, | VCODroplet::VCODroplet(DaisyPatch* m_patch, | ||||||
| 		       float sample_rate, | 		       DropletState m_state, | ||||||
| 		       DropletState m_state) : | 		       float sample_rate) : | ||||||
|   Droplet(m_patch, |   Droplet(m_patch, | ||||||
| 	  m_state){ | 	  m_state){ | ||||||
|   int num_waves = Oscillator::WAVE_LAST; |   int num_waves = Oscillator::WAVE_LAST; | ||||||
| @@ -46,7 +46,8 @@ void VCODroplet::Process(float** in, float** out, size_t size) { | |||||||
|  |  | ||||||
| void VCODroplet::Draw() { | void VCODroplet::Draw() { | ||||||
|   DrawName(patch, "VCO"); |   DrawName(patch, "VCO"); | ||||||
|   WriteString(*patch, 0, 54, Font_6x8, WaveToString(wavectrl.Process())); |   WriteString(*patch, 0, 54, Font_6x8, | ||||||
|  | 	      WaveToString(wavectrl.Process())); | ||||||
| } | } | ||||||
|  |  | ||||||
| std::string VCODroplet::WaveToString(uint8_t wf) { | std::string VCODroplet::WaveToString(uint8_t wf) { | ||||||
|   | |||||||
| @@ -18,7 +18,7 @@ class VCODroplet: public Droplet { | |||||||
|   Parameter freqctrl, wavectrl, ampctrl, finectrl; |   Parameter freqctrl, wavectrl, ampctrl, finectrl; | ||||||
|   std::string WaveToString(uint8_t); |   std::string WaveToString(uint8_t); | ||||||
| public: | public: | ||||||
|   VCODroplet(DaisyPatch*, float, DropletState); |   VCODroplet(DaisyPatch*, DropletState, float); | ||||||
|   void Control(); |   void Control(); | ||||||
|   void Process(float**, float**, size_t); |   void Process(float**, float**, size_t); | ||||||
|   void Draw(); |   void Draw(); | ||||||
|   | |||||||
							
								
								
									
										13
									
								
								src/main.cpp
									
									
									
									
									
								
							
							
						
						
									
										13
									
								
								src/main.cpp
									
									
									
									
									
								
							| @@ -2,14 +2,9 @@ | |||||||
|  |  | ||||||
| using namespace daisy; | using namespace daisy; | ||||||
|  |  | ||||||
| DaisyPatch patch; |  | ||||||
| Menu menu(&patch); |  | ||||||
| Droplet* droplet; |  | ||||||
| float samplerate; |  | ||||||
|  |  | ||||||
| int main(void) { | int main(void) { | ||||||
|   patch.Init(); |   patch.Init(); | ||||||
|   samplerate = patch.AudioSampleRate(); |   sample_rate = patch.AudioSampleRate(); | ||||||
|   droplet = GetDroplet(); |   droplet = GetDroplet(); | ||||||
|   patch.StartAdc(); |   patch.StartAdc(); | ||||||
|   patch.StartAudio(AudioThrough); |   patch.StartAudio(AudioThrough); | ||||||
| @@ -56,7 +51,6 @@ void ProcessOled() { | |||||||
| static void AudioThrough(float **in, | static void AudioThrough(float **in, | ||||||
| 			 float **out, | 			 float **out, | ||||||
| 			 size_t size) { | 			 size_t size) { | ||||||
|   patch.UpdateAnalogControls(); |  | ||||||
|   droplet->Process(in, out, size); |   droplet->Process(in, out, size); | ||||||
| } | } | ||||||
|  |  | ||||||
| @@ -64,12 +58,11 @@ Droplet* GetDroplet() { | |||||||
|   switch(menu.GetState()) { |   switch(menu.GetState()) { | ||||||
|   case MenuState::kVCO: |   case MenuState::kVCO: | ||||||
|     return new VCODroplet(&patch, |     return new VCODroplet(&patch, | ||||||
| 			  samplerate, | 			  DropletState::kFull, | ||||||
| 			  DropletState::kFull); | 			  sample_rate); | ||||||
|   case MenuState::kNoise: |   case MenuState::kNoise: | ||||||
|   default: |   default: | ||||||
|     return new NoiseDroplet(&patch, |     return new NoiseDroplet(&patch, | ||||||
| 			    samplerate, |  | ||||||
| 			    DropletState::kFull); | 			    DropletState::kFull); | ||||||
|   }	 |   }	 | ||||||
| } | } | ||||||
|   | |||||||
| @@ -14,6 +14,11 @@ | |||||||
| #include "droplets/noise_droplet.h" | #include "droplets/noise_droplet.h" | ||||||
| #include "droplets/vco_droplet.h" | #include "droplets/vco_droplet.h" | ||||||
|  |  | ||||||
|  | DaisyPatch patch; | ||||||
|  | Menu menu(&patch); | ||||||
|  | Droplet* droplet; | ||||||
|  | float sample_rate; | ||||||
|  |  | ||||||
| void ProcessControls(); | void ProcessControls(); | ||||||
| void ProcessOled(); | void ProcessOled(); | ||||||
| void ProcessOutputs(); | void ProcessOutputs(); | ||||||
|   | |||||||
		Reference in New Issue
	
	Block a user