Skip to content

Commit

Permalink
cleanup debug info
Browse files Browse the repository at this point in the history
  • Loading branch information
jfrey-xx committed Dec 1, 2017
1 parent b79b402 commit 0a6fe48
Show file tree
Hide file tree
Showing 5 changed files with 3 additions and 30 deletions.
5 changes: 0 additions & 5 deletions mopo/src/arpeggiator.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,6 @@

#include <algorithm>
#include <cstdlib>
#include <iostream>

namespace mopo {

Expand Down Expand Up @@ -117,7 +116,6 @@ namespace mopo {
mopo_float base_note = pattern->at(note_index_);
mopo_float note = base_note + mopo::NOTES_PER_OCTAVE * current_octave_;
mopo_float velocity = active_notes_[base_note];
std::cout << "nextnote. note_index " << note_index_ << ", base note: " << base_note << "\n";
int channel = channel_[base_note];
mopo_float aftertouch = aftertouch_[base_note];

Expand Down Expand Up @@ -169,8 +167,6 @@ namespace mopo {
}

void Arpeggiator::noteOn(mopo_float note, mopo_float velocity, int sample, int channel, mopo_float aftertouch) {

std::cout << "arp noton, velocity: " << velocity << ", channel: " << channel << ", aftertouch: " << aftertouch << "\n";
if (active_notes_.count(note))
return;
if (pressed_notes_.size() == 0) {
Expand Down Expand Up @@ -205,7 +201,6 @@ namespace mopo {
void Arpeggiator::setAftertouch(mopo_float note, mopo_float aftertouch, int sample) {
// TODO: take channel into account
for (const auto &n : pressed_notes_) {
std::cout << "note: " << n << "\n";
if (n == note) {
aftertouch_[n] = aftertouch;
}
Expand Down
13 changes: 1 addition & 12 deletions mopo/src/voice_handler.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,6 @@

#include "utils.h"

#include <iostream>

namespace mopo {

Voice::Voice(Processor* processor) : event_sample_(-1),
Expand Down Expand Up @@ -293,8 +291,6 @@ namespace mopo {
}

void VoiceHandler::noteOn(mopo_float note, mopo_float velocity, int sample, int channel, mopo_float aftertouch) {

std::cout << "noteOn, note: " << note << ", sample: " << sample << ", channel: " << channel << "aftertouch: " << aftertouch << "\n";
MOPO_ASSERT(sample >= 0 && sample < buffer_size_);
MOPO_ASSERT(channel >= 0 && channel < NUM_MIDI_CHANNELS);

Expand Down Expand Up @@ -349,14 +345,7 @@ namespace mopo {

void VoiceHandler::setPressure(mopo_float pressure, int channel, int sample) {
MOPO_ASSERT(channel >= 1 && channel <= mopo::NUM_MIDI_CHANNELS);

std::cout << "helm handler pressure, channel: " << channel << "\n";
for (Voice* voice : active_voices_) {
std::cout << "voice active note:" << voice->state().note << "\n";

std::cout << "voice active channel:" << voice->state().channel << "\n";


for (Voice* voice : active_voices_) {
if (voice->state().channel == channel)
voice->setAftertouch(pressure, sample);
}
Expand Down
12 changes: 2 additions & 10 deletions src/common/midi_manager.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -91,11 +91,7 @@ void MidiManager::removeNextBlockOfMessages(MidiBuffer& buffer, int num_samples)
midi_collector_.removeNextBlockOfMessages(buffer, num_samples);
}

void MidiManager::processMidiMessage(const MidiMessage& midi_message, int sample_position) {

std::cout << "midi message: " << midi_message.getTimeStamp() << " -- " << midi_message.getDescription() << ", sample position: " << sample_position << "\n";


void MidiManager::processMidiMessage(const MidiMessage& midi_message, int sample_position) {
if (midi_message.isProgramChange()) {
current_patch_ = midi_message.getProgramChangeNumber();
File patch = LoadSave::loadPatch(current_bank_, current_folder_, current_patch_,
Expand All @@ -106,7 +102,6 @@ void MidiManager::processMidiMessage(const MidiMessage& midi_message, int sample
}

if (midi_message.isNoteOn()) {
std::cout << "note on velocity: " << (int)midi_message.getVelocity() << "\n";
engine_->noteOn(midi_message.getNoteNumber(),
midi_message.getVelocity() / (mopo::MIDI_SIZE - 1.0),
0, midi_message.getChannel() - 1);
Expand All @@ -121,18 +116,15 @@ void MidiManager::processMidiMessage(const MidiMessage& midi_message, int sample
engine_->sustainOff();
// "aftertouch" is pressure per note
else if (midi_message.isAftertouch()) {
std::cout << "aftertouch\n";
mopo::mopo_float note = midi_message.getNoteNumber();
mopo::mopo_float value = (1.0 * midi_message.getAfterTouchValue()) / mopo::MIDI_SIZE;
engine_->setAftertouch(note, value);
}
// "pressure" is aftertouch for a whole channel (e.g. keyboard send only one value even if several keys are pressed)
// TODO: create a separate modifier
else if (midi_message.isChannelPressure()) {
std::cout << "pressure: " << midi_message.getChannelPressureValue() << "\n";

mopo::mopo_float note = midi_message.getNoteNumber();
mopo::mopo_float value = (1.0 * midi_message.getChannelPressureValue()) / (mopo::MIDI_SIZE - 1.0);
std::cout << "channel: " << midi_message.getChannel() << ", MIDI_SIZE:" << mopo::MIDI_SIZE << ", value: " << value << "\n";
// channel - 1 as with NoteOn above
engine_->setPressure(value, midi_message.getChannel() - 1, sample_position);
}
Expand Down
2 changes: 0 additions & 2 deletions src/synthesis/helm_engine.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -26,8 +26,6 @@
#include <fenv.h>
#endif

#include <iostream>

#define MAX_DELAY_SAMPLES 300000

namespace mopo {
Expand Down
1 change: 0 additions & 1 deletion src/synthesis/helm_engine.h
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,6 @@ namespace mopo {
void setAftertouch(mopo_float note, mopo_float value, int sample = 0);
void setPressure(mopo_float value, int channel = 0, int sample = 0);


// Sustain pedal events.
void sustainOn();
void sustainOff();
Expand Down

0 comments on commit 0a6fe48

Please sign in to comment.