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

Proposed fix 1527 Channel note on indicator doesn't fire when a very high note is played. #1529

Merged
merged 2 commits into from Dec 30, 2014
Merged

Conversation

curlymorphic
Copy link
Contributor

Proposed fix 1527 Channel note on indicator doesn't fire when a very high note is played.

Now the Instrument activity indicator flashed when a note is played.

@diizy
Copy link
Contributor

diizy commented Dec 30, 2014

I'm a bit hesitant about this fix...

The check for the key range is there for a reason, by just bypassing it, we'll be emiting the newNote signal even if the note is invalid, and even if the instrument doesn't get passed a midi event.

I'm not sure if the indicator even should blink in this situation...

@curlymorphic
Copy link
Contributor Author

I also had them concerns, but as master currenly stands the note is already playing before this emit newNote,and notes play that are outside of this range check.

TBH maybe the correct fix for this is to stop the playing of notes outside the range check?

@diizy
Copy link
Contributor

diizy commented Dec 30, 2014

On 12/30/2014 02:52 PM, Dave wrote:

I also had them concerns, but as master currenly stands the note is
already playing before this emit newNote,and notes play that are
outside of this range check.

On some instruments. Try it on eg. Vestige or Opulenz, and you'll see
that those notes won't play. Outgoing MIDI also won't play.

TBH maybe the correct fix for this is to stop the playing of notes
outside the range check?

Well that's not really a good solution either - we shouldn't limit our
instruments to MIDI standards just because some instruments constrain
themselves to MIDI.

Maybe we should first find out all the things the newNote signal is
connected to, then we can maybe figure out when exactly it should be
emitted, or if it should maybe be separated to multiple signals...

@curlymorphic
Copy link
Contributor Author

The only place I can find that uses the newNote signal is InstrumentTrack.cpp ln 913

connect( _it, SIGNAL( newNote() ),
            m_activityIndicator, SLOT( activate() ) );

The only purpose of the newNote signal is for the indicator

@tresf
Copy link
Member

tresf commented Dec 30, 2014

The check for the key range is there for a reason, by just bypassing it, we'll be emiting the newNote signal even if the note is invalid, and even if the instrument doesn't get passed a midi event.

If you don't mind me asking, in what scenarios are the invalid check for? In several instruments, these notes still generate sound output, just no visual indicator on the FadeButton, so what type of scenario are we protecting from?

-Tres

@tresf
Copy link
Member

tresf commented Dec 30, 2014

The only purpose of the newNote signal is for the indicator

Perhaps we give it a more appropriate name then?

@curlymorphic
Copy link
Contributor Author

Perhaps we give it a more appropriate name then?

I agree the name newNote is misleading

activateIndicator would be my suggestion

@diizy
Copy link
Contributor

diizy commented Dec 30, 2014

On 12/30/2014 03:24 PM, Dave wrote:

Perhaps we give it a more appropriate name then?

I agree the name newNote is misleading

activateIndicator would be my suggestion

If it's only used by one recipient, then we shouldn't be using a signal
at all, but instead call the function directly. Signals/Slots always
cause extra overhead compared to direct function calls.

@curlymorphic
Copy link
Contributor Author

I can do that, the queston is where, inside or outside the range check?

@diizy
Copy link
Contributor

diizy commented Dec 30, 2014

On 12/30/2014 03:31 PM, Dave wrote:

I can do that, the queston is where, inside or outside the range check?

Hm, for now it's probably easiest to put it outside the range check,
this can then be handled more elegantly in the future with the API
changes...

@tresf
Copy link
Member

tresf commented Dec 30, 2014

If it's only used by one recipient, then we shouldn't be using a signal at all, but instead call the function directly. Signals/Slots always cause extra overhead compared to direct function calls.

Again, lack of knowledge question... but do emit calls fire non-blocking actions (similar to a new thread)? Probably over-analyzing here, but since my knowledge of slots is very limited, I wanted to make sure that calling the function directly wouldn't cause any unintended issues. 🐮

@diizy
Copy link
Contributor

diizy commented Dec 30, 2014

On 12/30/2014 04:08 PM, Tres Finocchiaro wrote:

If it's only used by one recipient, then we shouldn't be using a
signal at all, but instead call the function directly.
Signals/Slots always cause extra overhead compared to direct
function calls.

Again, lack of knowledge question... but do |emit| calls fire
non-blocking actions (similar to a new thread)?

No. emit calls fire Qt's metaobject system (it's what we need mocfiles
for). It's basically just abstraction that makes it easier to call
arbitrary functions from an arbitrary object. This abstraction of course
comes with overhead, because it has to first figure out what object
we're emitting from, then figure out what slots are connected to the
signal we're emitting, then figure out the function pointers to those
slots and call each of them individually.

The benefit from signals/slots is when we have a situation where we may
not always know all the functions we want to call, or want to modify
these connections in runtime.

If a signal is only ever connected to one slot, then it's a lot of
overhead for no gain - we can get rid of all that overhead by just
calling the function directly.

@curlymorphic
Copy link
Contributor Author

Removed the Signal newNote

@diizy
Copy link
Contributor

diizy commented Dec 30, 2014

Looks good

diizy added a commit that referenced this pull request Dec 30, 2014
Proposed fix 1527 Channel note on indicator doesn't fire when a very high note is played.
@diizy diizy merged commit 22c3100 into LMMS:master Dec 30, 2014
@curlymorphic
Copy link
Contributor Author

If a signal is only ever connected to one slot, then it's a lot of
overhead for no gain - we can get rid of all that overhead by just
calling the function directly.

If performance is the only factor we are measuring. The use of signals and slots removes dependencies for ui and mechanics, with signals and slots, if the ui breaks or changes the engine carries on.

This lack of dependency really shines because it is possible to change the ui with no changes needed to core code. From what i can see LMMS is written using the MVC pattern, putting these dependencies in is eroding that.

This is more of a general observation from me than a comment on performance, that i know is important in audio

@diizy
Copy link
Contributor

diizy commented Jan 4, 2015

This commit may be causing a crash in preset preview now...

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.

None yet

3 participants