mirror of
				https://github.com/AquaMorph/Droplets.git
				synced 2025-10-31 16:23:19 +00:00 
			
		
		
		
	Created droplet system with noise droplet
This commit is contained in:
		
							
								
								
									
										14
									
								
								src/droplets/droplet.h
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										14
									
								
								src/droplets/droplet.h
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,14 @@ | ||||
| #pragma once | ||||
|  | ||||
| #ifndef CASCADE_DROPLETS_DROPLET_H_ | ||||
| #define CASCADE_DROPLETS_DROPLET_H_ | ||||
|  | ||||
| class Droplet { | ||||
|  public: | ||||
|   virtual ~Droplet() {}; | ||||
|   virtual void Control(float, float, float, float)=0; | ||||
|   virtual void Process(float**, float**, size_t)=0; | ||||
|   virtual void Draw(int*, int, int)=0; | ||||
| }; | ||||
|  | ||||
| #endif // CASCADE_DROPLETS_DROPLET_H_ | ||||
							
								
								
									
										16
									
								
								src/droplets/noise_droplet.cpp
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										16
									
								
								src/droplets/noise_droplet.cpp
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,16 @@ | ||||
| #include "noise_droplet.h" | ||||
|  | ||||
| NoiseDroplet::NoiseDroplet(float sample_rate) { | ||||
|   noise.Init(); | ||||
| } | ||||
|  | ||||
| void NoiseDroplet::Control(float ctr_1, float ctr_2, float ctr_3, float ctr_4) {} | ||||
| void NoiseDroplet::Process(float** in, float** out, size_t size) { | ||||
|   for (size_t i = 0; i < size; i += 2) { | ||||
|     float sig = noise.Process(); | ||||
|     for (size_t chn = 0; chn < 4; chn++) { | ||||
|       out[chn][i] = sig; | ||||
|     } | ||||
|   } | ||||
| } | ||||
| void NoiseDroplet::Draw(int* d, int width, int height) {} | ||||
							
								
								
									
										21
									
								
								src/droplets/noise_droplet.h
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										21
									
								
								src/droplets/noise_droplet.h
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,21 @@ | ||||
| #pragma once | ||||
|  | ||||
| #ifndef CASCADE_DROPLETS_NOISE_DROPLET_H_ | ||||
| #define CASCADE_DROPLETS_NOISE_DROPLET_H_ | ||||
|  | ||||
| #include "daisysp.h" | ||||
| #include "daisy_patch.h" | ||||
|  | ||||
| #include "droplet.h" | ||||
|  | ||||
| class NoiseDroplet: public Droplet { | ||||
|  private: | ||||
|   daisysp::WhiteNoise noise; | ||||
|  public: | ||||
|   NoiseDroplet(float); | ||||
|   void Control(float, float, float, float); | ||||
|   void Process(float**, float**, size_t); | ||||
|   void Draw(int*, int, int); | ||||
| }; | ||||
|  | ||||
| #endif // CASCADE_DROPLETS_NOISE_DROPLET_H_ | ||||
		Reference in New Issue
	
	Block a user