kopia lustrzana https://github.com/jameshball/osci-render
Get MIDI working, and MASSIVELY speed up calculating arc length
rodzic
81bea16c91
commit
8c8ccb2a02
|
@ -3,6 +3,8 @@
|
|||
##
|
||||
## Get latest from https://github.com/github/gitignore/blob/master/VisualStudio.gitignore
|
||||
|
||||
.DS_Store
|
||||
|
||||
# ignore JUCE
|
||||
**/Builds
|
||||
**/JuceLibraryCode
|
||||
|
|
|
@ -139,6 +139,8 @@ OscirenderAudioProcessor::OscirenderAudioProcessor()
|
|||
for (int i = 0; i < 4; i++) {
|
||||
synth.addVoice(new ShapeVoice(*this));
|
||||
}
|
||||
|
||||
synth.addSound(defaultSound);
|
||||
}
|
||||
|
||||
OscirenderAudioProcessor::~OscirenderAudioProcessor() {}
|
||||
|
@ -373,13 +375,13 @@ void OscirenderAudioProcessor::openFile(int index) {
|
|||
|
||||
// TODO: This should change whatever the ShapeSound is to the new index
|
||||
void OscirenderAudioProcessor::changeCurrentFile(int index) {
|
||||
synth.clearSounds();
|
||||
if (index == -1) {
|
||||
currentFile = -1;
|
||||
}
|
||||
if (index < 0 || index >= fileBlocks.size()) {
|
||||
return;
|
||||
}
|
||||
synth.clearSounds();
|
||||
synth.addSound(sounds[index]);
|
||||
currentFile = index;
|
||||
updateLuaValues();
|
||||
|
@ -416,14 +418,8 @@ void OscirenderAudioProcessor::processBlock(juce::AudioBuffer<float>& buffer, ju
|
|||
auto totalNumOutputChannels = getTotalNumOutputChannels();
|
||||
|
||||
buffer.clear();
|
||||
midiMessages.clear();
|
||||
// TODO: Make this less hacky and more permanent
|
||||
if (!playedNote) {
|
||||
playedNote = true;
|
||||
midiMessages.addEvent(juce::MidiMessage::noteOn(1, 60, 1.0f), 0);
|
||||
}
|
||||
synth.renderNextBlock(buffer, midiMessages, 0, buffer.getNumSamples());
|
||||
|
||||
midiMessages.clear();
|
||||
|
||||
auto* channelData = buffer.getArrayOfWritePointers();
|
||||
|
||||
|
|
|
@ -218,7 +218,7 @@ private:
|
|||
std::vector<std::shared_ptr<Effect>> allEffects;
|
||||
std::vector<std::shared_ptr<Effect>> permanentEffects;
|
||||
|
||||
bool playedNote = false;
|
||||
ShapeSound::Ptr defaultSound = new ShapeSound(std::make_shared<FileParser>());
|
||||
juce::Synthesiser synth;
|
||||
|
||||
juce::SpinLock consumerLock;
|
||||
|
|
|
@ -56,9 +56,10 @@ void CircleArc::translate(double x, double y) {
|
|||
double CircleArc::length() {
|
||||
if (len < 0) {
|
||||
len = 0;
|
||||
for (int i = 0; i < 500; i++) {
|
||||
Vector2 v1 = nextVector(i / 500.0);
|
||||
Vector2 v2 = nextVector((i + 1) / 500.0);
|
||||
int segments = 5;
|
||||
for (int i = 0; i < segments; i++) {
|
||||
Vector2 v1 = nextVector(i / (double) segments);
|
||||
Vector2 v2 = nextVector((i + 1) / (double) segments);
|
||||
len += Line(v1.x, v1.y, v2.x, v2.y).length();
|
||||
}
|
||||
}
|
||||
|
|
Ładowanie…
Reference in New Issue