Skip to content

Commit 47d0946

Browse files
committed
Fixed display width no more varying depending on note names
1 parent 4367918 commit 47d0946

1 file changed

Lines changed: 8 additions & 4 deletions

File tree

main.cpp

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -143,7 +143,7 @@ float timeElapsedSince(std::chrono::steady_clock::time_point tOrigin){
143143
void displayPlayedNotes(int channel, int8_t note){
144144
static int8_t notePerChannel[CHANNEL_COUNT] = {NOTE_STOP, NOTE_STOP};
145145
const char* textPerChannel[CHANNEL_COUNT] = {"LEFT haptic : ",", RIGHT haptic : "};
146-
const char* noteBaseNameArray[12] = {"C","C#","D","D#","E","F","F#","G","G#","A","A#","B"};
146+
const char* noteBaseNameArray[12] = {" C","C#"," D","D#"," E"," F","F#"," G","G#"," A","A#"," B"};
147147

148148
if(channel >= CHANNEL_COUNT)
149149
return;
@@ -155,16 +155,20 @@ void displayPlayedNotes(int channel, int8_t note){
155155

156156
//Write empty string
157157
if(notePerChannel[i] == NOTE_STOP){
158-
cout << "OFF";
158+
cout << "OFF ";
159159
}
160160
else{
161161
//Write note name
162162
cout << noteBaseNameArray[notePerChannel[i]%12];
163-
cout << (notePerChannel[i]/12)-1;
163+
int octave = (notePerChannel[i]/12)-1;
164+
cout << octave;
165+
if(octave >= 0 ){
166+
cout << " ";
167+
}
164168
}
165169
}
166170

167-
cout << " \r" ;
171+
cout << "\r" ;
168172
cout.flush();
169173
}
170174

0 commit comments

Comments
 (0)