Advertisement
Guest User

Untitled

a guest
May 28th, 2018
101
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.83 KB | None | 0 0
  1. void placeNotesStaff(Note * notes, int nbNotes, int nbStrings)
  2. {
  3. int i;
  4. int stringsIdxCur = 2;
  5. notes[0].stringIdx = stringsIdxCur;
  6. for (i = 1; i < nbNotes; i++)
  7. {
  8. if (notes[i].value == notes[i-1].value)
  9. {
  10. notes[i].stringIdx = stringsIdxCur;
  11. }
  12.  
  13. if (notes[i].value < notes[i-1].value)
  14. {
  15. if (stringsIdxCur == 0)
  16. {
  17. notes[i].stringIdx = stringsIdxCur;
  18. }
  19.  
  20. else
  21. {
  22. notes[i].stringIdx = stringsIdxCur - 1;
  23. stringsIdxCur--;
  24. }
  25. }
  26. if (notes[i].value > notes[i-1].value)
  27. {
  28. if (stringsIdxCur == 4)
  29. {
  30. notes[i].stringIdx = stringsIdxCur;
  31. }
  32.  
  33. else
  34. {
  35. notes[i].stringIdx = stringsIdxCur + 1;
  36. stringsIdxCur++;
  37. }
  38. }
  39. }
  40.  
  41. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement