Login  Register

Re: Add code for the PianoBooster metronome

Posted by mark-Dutton on Apr 11, 2021; 2:03pm
URL: http://piano-booster.139.s1.nabble.com/Add-code-for-the-PianoBooster-metronome-tp7572964p7572985.html

Hi Loius,

Yes this is true I am not very familiar with git and I apologize if any issues have arisen from this. The only files that
should have been updated are the source files, the cmake config file and the images folder. All of these files are within the src directoy
of the piano booster project if I am not mistaken. But I also had to add metronomedialog.cpp and metronomedialog.h classes to control
the metronome gui as is standard procedure with qt. That is to say no files outside of the src directory should have been modified.

To address the concern you raised with my changes to the boost slider/volume and piano slider/volume:

Firstly I would say if you do not like the changes I have introduced then they can be removed from the pull request but
I would like to give a bit more explanation:

I have a done a diff on the conductor.cpp file for the devlop branch and the wip/metronome
branch and the function: CConductor::calcBoostVolume(int channel, int volume)
follows the same logic minus any added metronome code that was wip. The slider is valid and works
on both branches, however there was a problem when you turned up the volume of the active channel,
the volume of all other channel decreased, so if the active channel volume was at max, all the other
channels were muted. I'm not sure if this is an intended feature but my change allows for each volume
to be changed independantly.

The changes I have introduced are agnostic of the previous method that was in the works.
Instead of adjusting the volume within this function I have simply
done a normalization on the slider value to fit its min/max values (which are -100 to 100) within
that midi main_volume range of 0 to 127. So when the boost slider value is changed, the callback function will
first normalize the slider value and then call the setChannelVolume(int volume) function
which will apply the new volume to the active channel that is selected.
The piano slider and metronome slider follow the same logic of scaling the slider value to the functionali midi range of 0 to 127.

Also in the develop branch, the CConductor::outputPianoVolume() function is identical to that of the
wip/metronome branch and the volume is still hardcoded at 127. All I have really done is change the volume variable within that function
to be set to the m_pianoVolume value.

As for the error you found:
"the second time I started the metronome dialog box the drop down box for the beat had double the number of entries that it should have."
Yes this is an error that I had overlooked but I should be able to fix with relative ease.

But for the preview button not working this is only when the metronome is not activated. This also
is a bug but only for when the metronome is not set to active. When it is active the preview button works.
And if you push the cancel button, the changes you made are rolled back even if you have previewed the
metronome using a different bar or beat sound / volume / velocity.

Part of this pull request was not to introduce an error free merge into the metronome branch but to show you all the functionality
working and get some feedback on it. The most valuable feedback I was looking for and intended to recieve before going
further along with this branch was whether the actual code that I have added to the code base and the features that are now working
are what you had in mind. Feedback such as your worries with the changes to CConductor::calcBoostVolume(int channel, int volume)
is what is most vital to me as I have been very much working on this code with a blindfold on and had to figure out what was/is the original
intention of certain functions/features.

With all of that said, I am eager to get this metronome branch fully functional and work with you and other github contributers to
achieve this. Though for now my input will be at a lot slower rate as I get my head back into the uni books.