kopia lustrzana https://github.com/jameshball/osci-render
				
				
				
			Polish duplication boundary handling
							rodzic
							
								
									5ff9fde8f9
								
							
						
					
					
						commit
						c698e2a7dd
					
				| 
						 | 
				
			
			@ -9,13 +9,11 @@ public:
 | 
			
		|||
    osci::Point apply(int index, osci::Point input, const std::vector<std::atomic<double>>& values, double sampleRate) override {
 | 
			
		||||
        const double twoPi = juce::MathConstants<double>::twoPi;
 | 
			
		||||
        double copies = juce::jmax(1.0, values[0].load());
 | 
			
		||||
        double ceilCopies = std::ceil(copies - 1e-3);
 | 
			
		||||
        double spread = juce::jlimit(0.0, 1.0, values[1].load());
 | 
			
		||||
        double angleOffset = values[2].load() * juce::MathConstants<double>::twoPi;
 | 
			
		||||
 | 
			
		||||
        // Ensure values extremely close to integer don't get rounded up
 | 
			
		||||
        double fractionalPart = copies - std::floor(copies);
 | 
			
		||||
        double ceilCopies = fractionalPart > 1e-4 ? std::ceil(copies) : std::floor(copies);
 | 
			
		||||
 | 
			
		||||
        // Offset moves each time the input shape is drawn once
 | 
			
		||||
        double theta = std::floor(framePhase * copies) / copies * twoPi + angleOffset;
 | 
			
		||||
        osci::Point offset(std::cos(theta), std::sin(theta), 0.0);
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			@ -37,8 +35,8 @@ public:
 | 
			
		|||
                                          "harmonicDuplicatorSpread", VERSION_HINT, 0.4, 0.0, 1.0),
 | 
			
		||||
                new osci::EffectParameter("Angle Offset",
 | 
			
		||||
                                          "Rotates the offsets between copies without rotating the input shape.",
 | 
			
		||||
                                          "harmonicDuplicatorAngle", VERSION_HINT, 0.0, 0.0, 1.0, 0.0001, osci::LfoType::Sawtooth, 0.2)
 | 
			
		||||
        }
 | 
			
		||||
                                          "harmonicDuplicatorAngle", VERSION_HINT, 0.0, 0.0, 1.0, 0.0001, osci::LfoType::Sawtooth, 0.1)
 | 
			
		||||
            }
 | 
			
		||||
        );
 | 
			
		||||
        eff->setName("Harmonic Duplicator");
 | 
			
		||||
        eff->setIcon(BinaryData::kaleidoscope_svg);
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -22,7 +22,7 @@ public:
 | 
			
		|||
 | 
			
		||||
        int fullSegments = (int)std::floor(segments);
 | 
			
		||||
        double fractionalPart = segments - fullSegments; // in [0,1)
 | 
			
		||||
        fullSegments = fractionalPart > 1e-4 ? fullSegments : fullSegments - 1;
 | 
			
		||||
        fullSegments = fractionalPart > 1e-3 ? fullSegments : fullSegments - 1;
 | 
			
		||||
 | 
			
		||||
        phase = nextPhase(audioProcessor.frequency / (fullSegments + 1), sampleRate) / (2.0 * std::numbers::pi);
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			@ -33,7 +33,7 @@ public:
 | 
			
		|||
 | 
			
		||||
        // Base full wedge angle (all full wedges) and size of partial wedge
 | 
			
		||||
        double baseWedgeAngle = juce::MathConstants<double>::twoPi / segments; // size of a "unit" wedge
 | 
			
		||||
        double partialScale = (currentSegmentIndex == fullSegments && fractionalPart > 1e-4) ? fractionalPart : 1.0;
 | 
			
		||||
        double partialScale = (currentSegmentIndex == fullSegments && fractionalPart > 1e-3) ? fractionalPart : 1.0;
 | 
			
		||||
        double wedgeAngle = baseWedgeAngle * partialScale;
 | 
			
		||||
 | 
			
		||||
        // Normalize theta to [0,1) for compression
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -11,9 +11,9 @@ public:
 | 
			
		|||
    osci::Point apply(int index, osci::Point input, const std::vector<std::atomic<double>>& values, double sampleRate) override {
 | 
			
		||||
        jassert(values.size() == 5);
 | 
			
		||||
 | 
			
		||||
        double gridX = values[0].load() + 0.0001;
 | 
			
		||||
        double gridY = values[1].load() + 0.0001;
 | 
			
		||||
        double gridZ = values[2].load() + 0.0001;
 | 
			
		||||
        double gridX = values[0].load();
 | 
			
		||||
        double gridY = values[1].load();
 | 
			
		||||
        double gridZ = values[2].load();
 | 
			
		||||
        double interpolation = values[3].load();
 | 
			
		||||
        double gridDelay = values[4].load();
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			@ -24,7 +24,9 @@ public:
 | 
			
		|||
        buffer[head] = input;
 | 
			
		||||
 | 
			
		||||
        osci::Point grid = osci::Point(gridX, gridY, gridZ);
 | 
			
		||||
        osci::Point gridFloor = osci::Point(std::floor(gridX), std::floor(gridY), std::floor(gridZ));
 | 
			
		||||
        osci::Point gridFloor = osci::Point(std::floor(gridX + 1e-3),
 | 
			
		||||
                                            std::floor(gridY + 1e-3),
 | 
			
		||||
                                            std::floor(gridZ + 1e-3));
 | 
			
		||||
 | 
			
		||||
        gridFloor.x = std::max(gridFloor.x, 1.0);
 | 
			
		||||
        gridFloor.y = std::max(gridFloor.y, 1.0);
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
		Ładowanie…
	
		Reference in New Issue