Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

playing/recording pianoRoll's chord notes (#4963) #4976

Closed
wants to merge 4 commits into from

Conversation

sharpblade4
Copy link
Contributor

This change makes pianoRoll chord settings to generate notes accordingly, and record them (fixes #4963). It can be triggered by mouse and keyboard, however it does not supported with an external MIDI controller (as current behavior). I'll work on another change that will enable the chord playing (and thus recording) of a base note that was generated by an external MIDI device in future (because it needs different approach, maybe MIDI messages manipulating).

sharpblade4 and others added 3 commits May 6, 2019 11:00
* fix hanging mouse in piano roll (LMMS#4822)

* fix hanging mouse in automation & pianoroll (LMMS#4822);

* fix hanging mouse in automation & pianoroll (LMMS#4822)

removed TODO comment that I forgot in the code
NotePlayHandleManager::acquire uses a read lock unless the pool is empty.
If two threads try to acquire NotePlayHandle simultaneously
when the value of s_availableIndex is 1, one thread will try to read s_available[-1].
If the acquire action and the release action are done at the same time,
NotePlayHandleManager::acquire may try to read data
before NotePlayHandleManager::release actually writes.

This commit prevents them by always using the write lock when acquiring a NotePlayHandle.
@JohannesLorenz
Copy link
Contributor

I'd like to review this. It's ready for review, right?

Do you want this to go into 1.2.0 or 1.2.1?

@sharpblade4
Copy link
Contributor Author

Yes it is ready. It is working for mouse \ keyboard inputs but not for external MIDI controller inputs (for those, the behavior is as it was until now - only base note sounds and recorded).
I don't know for which version it is better, I think 1.2.0?

@JohannesLorenz
Copy link
Contributor

Unfortunatelly, doesn't always work for me. What I do is:

  • Open a new project
  • Add a note section in the 3osc track by clicking somwhere in it (maybe not at the first bar)
  • Open the note section in piano roll
  • Select a chord there, e.g. "moll"
  • Click record
  • Play letters on your PC's keyboard

The notes are often placed at the wrong positions or sometimes missing.

How did you test it?

@JohannesLorenz
Copy link
Contributor

Per the question, 1.2.0 vs 1.2.1, that may also depend on the release date of 1.2.0. I think 1.2.1 is OK, but we'll see.

@sharpblade4
Copy link
Contributor Author

Weird - I tested it with quite the same flow you described. Clicking "record" is not a mandatory step though, since it should play the chord live as well.
The only difference I see is that you choose "moll" chord, which I don't have- and I saw that this is german for "minor".

Anyway, I'll be able to check this only later. I'll update after I do that.

@sharpblade4
Copy link
Contributor Author

sharpblade4 commented May 20, 2019

It works for me. Attaching a screenshot. Do you have any idea on what can I do to find why it doesn't for you?
Screenshot from 2019-05-20 18-32-48

I even tried to change language to see if that's the problem (since the chord is picked by its name) but it also worked.

@sharpblade4 sharpblade4 reopened this May 20, 2019
@JohannesLorenz
Copy link
Contributor

Heh, I just found out it worked on another computer. The reason was that I had "SDL" selected for audio device in the settings on this computer. With other backends, it works.

I'll go on with the review.

@JohannesLorenz
Copy link
Contributor

I had an issue with both jack and pulse: Open triple oscillator piano roll, select minor, press key "C5" for a short duration (maybe 1/8 note) by simply using the left mouse key. When I did that, only the base key did release.

Can you reproduce this?

Copy link
Contributor

@JohannesLorenz JohannesLorenz left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Just an initial review.

src/gui/editors/PianoRoll.cpp Show resolved Hide resolved
src/gui/editors/PianoRoll.cpp Outdated Show resolved Hide resolved
src/gui/editors/PianoRoll.cpp Show resolved Hide resolved
@sharpblade4
Copy link
Contributor Author

I had an issue with both jack and pulse: Open triple oscillator piano roll, select minor, press key "C5" for a short duration (maybe 1/8 note) by simply using the left mouse key. When I did that, only the base key did release.

Can you reproduce this?

Yes. This is a bug (all clicks directly on the pianoKeys graphics will release the base note only). Sorry. I'll fix that in addition to the other comments asap.

@sharpblade4
Copy link
Contributor Author

Thank you for finding the bug, and once again sorry for that.
It is now fixed, along with the other comments in the initial CR.

@JohannesLorenz
Copy link
Contributor

Np for the bug. Good you could fix it.

Btw, this is unrelated to your PR, but: If you take triple oscillator and slide over the keyboard fast (e.g. from C2 to C4), are some notes displayed as still pressed (while they don't sound anymore)?

@JohannesLorenz
Copy link
Contributor

Functional and style review passed. Tests passed. You can squash-merge it, or let me know if I should.

@JohannesLorenz
Copy link
Contributor

Oh, note, I'm not sure about the merge strategy, I'll ask on discord. Sorry, please wait.

@sharpblade4
Copy link
Contributor Author

sharpblade4 commented May 21, 2019

Regarding the notes that keep being displayed when you slide really fast over them - I noticed this as well. Planned to open an issue for it later on.
On the subject of the squash-merge, I actually don't know what do you mean. In general, after a PR is approved, should I be the one to do something? because in my previous PR here I didn't.

@JohannesLorenz
Copy link
Contributor

Usually I leave it to the author to merge. However, I can't see whether an author has the rights to merge. If you don't see the merge button, then I can do it.

I'll first have to ask if we can merge shortly before the 1.2.0 release.

@sharpblade4
Copy link
Contributor Author

sharpblade4 commented May 23, 2019

I don't have the 'merge' button here, so after you'll get a reply I'd appreciate if you can do it

@JohannesLorenz
Copy link
Contributor

It looks like this PR is a feature (as stated in #4989), and stable-1.2 only allows fixes. If you agree, it should be better re-based and re-targetted on/to master, and this PR should be closed instead.

Sorry for the overhead!

@sharpblade4
Copy link
Contributor Author

sharpblade4 commented May 24, 2019

Alright. I hope I understood correctly - I'll fetch the upstream master branch, copy the changes I did into this branch and open a new PR.

@sharpblade4 sharpblade4 changed the base branch from stable-1.2 to master May 24, 2019 13:55
@JohannesLorenz
Copy link
Contributor

Yeah, git cherry-pick can make the copying easier. can...

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants