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

Updated mappings for the Hercules Inpulse 300 #12503

Open
wants to merge 41 commits into
base: 2.4
Choose a base branch
from

Conversation

BoredGuy1
Copy link

@BoredGuy1 BoredGuy1 commented Jan 3, 2024

I made some improvements to Mixxx's included Inpulse 300 mapping. I tried to stay close to the manufacturer mappings listed in this manual.

Full list of changes:

  • Added ability to stop samplers (shift + button)

  • Added toneplay

    • Pressing a pad jumps to the most recently used hotcue and changes the pitch
    • Shift + toneplay changes the pitch without jumping
    • Pads 1-4 increase the pitch by +0 to +3 semitones
    • Pads 5-8 decrease the pitch by -4 to -1 semitones
    • LED reflects total adjustment to current key
  • Added slicer/slicer loop:

    • Press slicer button to activate a slicer section, press again to deactivate it
    • Slicer length is dependent on loop length
    • Exiting slicer mode or pressing LOOP OUT also deactivates the slicer section
    • Creating a slicer section overrides active loops, and creating a 4-beat loop overrides active slicer sections
    • Only works on constant BPM (also true in native software DJUCED)
    • Slicer section does not move backwards when scratching (also true in native software DJUCED)
  • Added actual beatmatch guide functionality to the LEDs

    • This replaces the LEDs' old end-of-track warning functionality. Hopefully no one missed it :P
  • Changed the way scratching works

    • Wheels have inertia rather than instantly stopping when released (this allows backspins and other tricks)
    • Removed scratchPad in XML (not sure what it was doing there)
  • Updated VU meter syntax

    • Replaced vu_meter with VuMeter to comply with new version of Mixxx
    • Replaced connectControl with makeConnection to allow multiple connections (and also to comply with newer versions)
  • Replaced "hotcue_X_enabled" with "hotcue_X_status" in XML file to comply with newer version of Mixxx

Manual is being updated accordingly in another PR: PR#604.

@JoergAtGithub
Copy link
Member

Welcome at Mixxx!
As a first-time contributor we need you to sign the Mixxx Contributor Agreement and comment here when you have done so. It gives us permission to distribute your contribution under the GPL v2 or later license and the Apple Mac App Store. It is also helpful for us to have contact information for contributors in case we may need it in the future.

@JoergAtGithub
Copy link
Member

The pre-commit check is failing. The best way to fix pre-commit issues is to install pre-commit locally on your system, as described here: https://github.com/mixxxdj/mixxx/wiki/Using-Git#set-up-automatic-code-checking
Than it will fix these issues automatically before every commit.
Alternatively, you can download the pre-commit.patch file from the artifacts of this PR
grafik
unzip it, and apply it using:
git apply pre-commit.patch

Please note, that this will not fix the typo, that the codespell check reports - this one must be fixed manually.

@BoredGuy1
Copy link
Author

Alright, I've filled out the agreement, installed pre-commit, and fixed all the typos and style issues. Let me know if there's anything else I need to do.

@JoergAtGithub
Copy link
Member

Target for this PR should be 2.4 not main. Please rebase.

@BoredGuy1 BoredGuy1 changed the base branch from main to 2.4 January 3, 2024 21:27
@JoergAtGithub
Copy link
Member

If you need help with Git, have a look here: https://github.com/mixxxdj/mixxx/wiki/Using-Git#targeting-another-base-branch

@BoredGuy1
Copy link
Author

I'm still figuring my way around git, but assuming I rebased it properly, it should be ready to merge now. I also took the opportunity to add a whole bunch of other stuff, but now the manual PR is no longer up to date. I will be busy in the coming weeks, but hopefully I can get the manual up to speed after that.

In the meantime, it would be nice to have some feedback on this mapping (especially from @DJPhatso ;)

@DJPhatso
Copy link
Contributor

DJPhatso commented Feb 6, 2024

Pretty busy right now, but I'll see what I can do.

@DJPhatso
Copy link
Contributor

DJPhatso commented Feb 13, 2024

Some feedback of what I was able to try:

  • Samplers stop:

Work as expected.

  • Toneplay:

Been a while since I used this functionality in Traktor, so I might not be the best to judge if the flow is correct, but all functions were assigned as described.

  • Beatmatch guide to LEDs

Glad you could make it work as intended :-)

  • Changed the way scratching works

I noticed some unexpected scratching on occasion (i.e. without actually touching the wheels), which did no occur when I switched back to the default mapping (even tried with another unit to rule out some hardware problems), so there might be some adjustments to be done on that side.

Looking at the script, there are a few User Options I might try to modify next time.

  • Updated VU meter syntax

No problems there

@BoredGuy1
Copy link
Author

Never mind, I figured out the QT issue.

This should be ready for review. The manual is also done, sans the broken link checks.

@BoredGuy1
Copy link
Author

Never mind, the random scratching is still there.

@BoredGuy1 BoredGuy1 marked this pull request as draft August 21, 2024 16:58
@daschuer daschuer removed this from the 2.4.2 milestone Sep 15, 2024
@BoredGuy1 BoredGuy1 marked this pull request as ready for review October 5, 2024 06:54
@BoredGuy1
Copy link
Author

Scratching issue has been resolved. Ready for review again.

Copy link
Member

@ywwg ywwg left a comment

Choose a reason for hiding this comment

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

Some initial questions, not a full review. Thank you for doing this!

res/controllers/Hercules-DJControl-Inpulse-300-script.js Outdated Show resolved Hide resolved
res/controllers/Hercules-DJControl-Inpulse-300-script.js Outdated Show resolved Hide resolved
res/controllers/Hercules-DJControl-Inpulse-300-script.js Outdated Show resolved Hide resolved
res/controllers/Hercules-DJControl-Inpulse-300-script.js Outdated Show resolved Hide resolved
Comment on lines +200 to +204
DJCi300.connectSlicerFunctions(1);
DJCi300.connectSlicerFunctions(2);
// Then disconnect them since we're not in slicer mode (yet)
DJCi300.disconnectSlicerFunctions(1);
DJCi300.disconnectSlicerFunctions(2);
Copy link
Member

Choose a reason for hiding this comment

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

I think a better model here would be to have the functions always connected, and then use a bool to decide if they are active. So the handler functions would say "if slicing is not active, return". Then you don't need to be making and disconnecting connections all the time.

Copy link
Member

Choose a reason for hiding this comment

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

That results in lots of function call overhead from C++ into the JS. I think we need to carefully consider how many of these are active vs disabled. (dis-)Connecting is not that expensive IIRC. its just a hashmap lookup with a QObject::connect call.

res/controllers/Hercules-DJControl-Inpulse-300-script.js Outdated Show resolved Hide resolved
res/controllers/Hercules-DJControl-Inpulse-300-script.js Outdated Show resolved Hide resolved
res/controllers/Hercules-DJControl-Inpulse-300-script.js Outdated Show resolved Hide resolved
res/controllers/Hercules-DJControl-Inpulse-300-script.js Outdated Show resolved Hide resolved
Comment on lines +200 to +204
DJCi300.connectSlicerFunctions(1);
DJCi300.connectSlicerFunctions(2);
// Then disconnect them since we're not in slicer mode (yet)
DJCi300.disconnectSlicerFunctions(1);
DJCi300.disconnectSlicerFunctions(2);
Copy link
Member

Choose a reason for hiding this comment

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

That results in lots of function call overhead from C++ into the JS. I think we need to carefully consider how many of these are active vs disabled. (dis-)Connecting is not that expensive IIRC. its just a hashmap lookup with a QObject::connect call.

res/controllers/Hercules-DJControl-Inpulse-300-script.js Outdated Show resolved Hide resolved
Comment on lines +407 to +408
DJCi300.changeMode = function(channel, control, value, _status, _group) {
const deck = channel;
Copy link
Member

Choose a reason for hiding this comment

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

this would be a good opportunity to incorporate ComponentJS. You can probably copy paste large parts of the code there from the Roland DJ-505 mapping (which I personally consider a gold standard componentJS mapping).

Copy link
Member

@ywwg ywwg left a comment

Choose a reason for hiding this comment

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

looking great! approving pending @Swiftb0y 's comments

Comment on lines +381 to +384
const sampleRate = engine.getValue(`[Channel${ deck }]`, "track_samplerate");
const bpm = engine.getValue(`[Channel${ deck }]`, "local_bpm");
// For some reason, multiplying by 60 makes the size 1/2 as large as it's supposed to be
// Hence, we multiply by 120 instead
Copy link
Member

Choose a reason for hiding this comment

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

interesting, this may be a bug (its probably reporting the "true" samplerate so per buffer without taking into account that there are two channels, thus double the samples). The docs don't clarify whether they mean what we internally call samplerate or framerate (which is samples per channel per second) and what you're expecting here.

Copy link
Member

Choose a reason for hiding this comment

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

almost certainly "samplerate" is indeed the audio card sample rate, so that makes sense

Copy link
Member

Choose a reason for hiding this comment

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

I don't quite understand. Are you arguing that returning 2x the audio sampling frequency is correct behavior of the CO or that its a bug?

Comment on lines +390 to +399
// Helper function that calculates current position of play indicator in samples
DJCi300._currentPosition = function(deck) {
const beatClosest = engine.getValue(`[Channel${ deck }]`, "beat_closest");
let beatDistance = engine.getValue(`[Channel${ deck }]`, "beat_distance");

// Map beatDistance so that it scales from 0 to .5, then -.5 to 0
beatDistance = (beatDistance > .5) ? (beatDistance - 1) : beatDistance;
// Adjust beatClosest and return
return (DJCi300._samplesPerBeat(deck) * beatDistance) + beatClosest;
};
Copy link
Member

Choose a reason for hiding this comment

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

this seems convoluted. Doesn't track_samples * playposition suffice?

Copy link
Member

@ywwg ywwg Nov 13, 2024

Choose a reason for hiding this comment

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

we already have beat_active whichj might help here

/* This method sets the control beat_active is set to the following values:

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

Successfully merging this pull request may close these issues.

7 participants