diff --git a/.vscode/settings.json b/.vscode/settings.json index c44c0e6e27aa68990663dbc59fe67c040fbeb559..a16ca39ab43285fce6bc2b73c9e95256982a59f1 100644 --- a/.vscode/settings.json +++ b/.vscode/settings.json @@ -3,6 +3,74 @@ "mylog" ], "files.associations": { - "*.mm": "cpp" + "*.mm": "cpp", + "cctype": "cpp", + "clocale": "cpp", + "cmath": "cpp", + "csignal": "cpp", + "cstdarg": "cpp", + "cstddef": "cpp", + "cstdio": "cpp", + "cstdlib": "cpp", + "cstring": "cpp", + "ctime": "cpp", + "cwchar": "cpp", + "cwctype": "cpp", + "array": "cpp", + "atomic": "cpp", + "hash_map": "cpp", + "hash_set": "cpp", + "bit": "cpp", + "*.tcc": "cpp", + "bitset": "cpp", + "chrono": "cpp", + "cinttypes": "cpp", + "codecvt": "cpp", + "complex": "cpp", + "condition_variable": "cpp", + "cstdint": "cpp", + "deque": "cpp", + "list": "cpp", + "map": "cpp", + "set": "cpp", + "unordered_map": "cpp", + "unordered_set": "cpp", + "vector": "cpp", + "exception": "cpp", + "algorithm": "cpp", + "functional": "cpp", + "iterator": "cpp", + "memory": "cpp", + "memory_resource": "cpp", + "numeric": "cpp", + "optional": "cpp", + "random": "cpp", + "ratio": "cpp", + "regex": "cpp", + "string": "cpp", + "string_view": "cpp", + "system_error": "cpp", + "tuple": "cpp", + "type_traits": "cpp", + "utility": "cpp", + "fstream": "cpp", + "future": "cpp", + "initializer_list": "cpp", + "iomanip": "cpp", + "iosfwd": "cpp", + "iostream": "cpp", + "istream": "cpp", + "limits": "cpp", + "mutex": "cpp", + "new": "cpp", + "ostream": "cpp", + "shared_mutex": "cpp", + "sstream": "cpp", + "stdexcept": "cpp", + "streambuf": "cpp", + "thread": "cpp", + "typeinfo": "cpp", + "valarray": "cpp", + "variant": "cpp" } } \ No newline at end of file diff --git a/Source/PluginEditor.cpp b/Source/PluginEditor.cpp index 4148313a52481f36249ead60a7efd34f05e32ac6..220bce3d09c215ee2ba5f4cc717d7b0f315ac8d8 100644 --- a/Source/PluginEditor.cpp +++ b/Source/PluginEditor.cpp @@ -33,7 +33,8 @@ void Test2AudioProcessorEditor::paint(juce::Graphics &g) g.setColour(juce::Colours::white); g.setFont(15.0f); - g.drawFittedText("Hello Per6!", getLocalBounds(), juce::Justification::centred, 1); + g.drawFittedText("Hello Per 10 !", getLocalBounds(), juce::Justification::centred, 1); + g.drawFittedText("Hello Per 10 !", getLocalBounds(), juce::Justification::centred, 1); if (processor.m_flogger) processor.m_flogger->logMessage("paint called"); } @@ -45,6 +46,6 @@ void Test2AudioProcessorEditor::resized() auto bounds = getLocalBounds(); - //if (m_flogger) - // m_flogger->logMessage(bounds.toString()); + if (processor.m_flogger) + processor.m_flogger->logMessage(bounds.toString()); } diff --git a/Source/PluginProcessor.cpp b/Source/PluginProcessor.cpp index df4da316c0709ae0ec2e0dc762a2202ef96de08f..9612e862d6f2517bc0e6444346b9f8a9ef87a567 100644 --- a/Source/PluginProcessor.cpp +++ b/Source/PluginProcessor.cpp @@ -23,6 +23,9 @@ Test2AudioProcessor::Test2AudioProcessor() #endif { m_flogger = std::unique_ptr<juce::FileLogger>(juce::FileLogger::createDateStampedLogger("foo", "mylog", ".txt", "Welcome to plugin")); + + position = 0; + if (m_flogger) m_flogger->logMessage("PluginProcessor"); } @@ -153,22 +156,35 @@ void Test2AudioProcessor::processBlock(juce::AudioBuffer<float> &buffer, juce::M // ..do something to the data... } - // auto iterator = midiMessages.Iterator; - auto iterator = juce::MidiBuffer::Iterator(midiMessages); - juce::MidiMessage msg; - int sampleNum; - - while (iterator.getNextEvent(msg, sampleNum)) + for (const auto metadata : midiMessages) { + auto msg = metadata.getMessage(); if (msg.isController()) { - //const auto *name = msg.getDescription(); - //::MidiMessage::getControllerName(msg.getControllerNumber()); - //const auto *name = juce::MidiMessage::getControllerName(msg.getControllerNumber()); + if (msg.getRawData()[1] == 30) + { + switch (msg.getRawData()[2]) + { + case 1: + position--; + break; + case 127: + position++; + break; + } + }; if (m_flogger) + { m_flogger->logMessage(msg.getDescription()); - } - } + m_flogger->logMessage("pos " + std::to_string(position)); + //for (int i = 0; i < msg.getRawDataSize(); i++) + //{ + // juce::uint8 val = msg.getRawData()[i]; + // m_flogger->logMessage(std::to_string(val)); + //}; + }; + }; + }; } //============================================================================== diff --git a/Source/PluginProcessor.h b/Source/PluginProcessor.h index baae61be07d8d350ca69ea30c3ea2f472daf4ca4..06e1bb4d02e8c30f46c7cdf05883e1aeeef97e97 100644 --- a/Source/PluginProcessor.h +++ b/Source/PluginProcessor.h @@ -54,6 +54,7 @@ public: void setStateInformation(const void *data, int sizeInBytes) override; std::unique_ptr<juce::FileLogger> m_flogger; + int position; private: //==============================================================================