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

Osc in mixxx arm64 2.6 with TrackInfo (Title&Artist) -- Special OSCleton version #14181

Open
wants to merge 21 commits into
base: main
Choose a base branch
from

Conversation

Eve00000
Copy link
Contributor

Osc in mixxx arm64 2.6 with TrackInfo (Title&Artist) -- Special OSCleton version
Extra in this version : GetT# function to request TrackArtist & TrackTitle

@JosepMaJAZ
Copy link
Contributor

This is not a review, I just suggest you to do a small source reorganization.

I see that in /src/osc/ip and /src/osc/osc , there is code from the library. This code should probably be relocated into /lib/osc
Also, /src/osc/oscreceiver.cpp/.h and /src/osc/oscfunctions.h which I assume is your code, should probably go in /src/controllers/osc

you can do that with git (i don't know if you use the commandline or some graphical application) and it will keep the history.

};

// function to convert and carry special characters in TrackArtist & TrackTitle to ASCII
QString escapeStringToJsonUnicode(const QString& input) {
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 it helps to return here directly ASCII as QByteArray.

QString escapeStringToJsonUnicode(const QString& input) {
QString escaped;
for (QChar c : input) {
if (c.isPrint() && c.unicode() < 128) {
Copy link
Member

Choose a reason for hiding this comment

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

This is not fast because it checks all character in the 16 bit range. How about:

Suggested change
if (c.isPrint() && c.unicode() < 128) {
if (c.unicode() >= ' ' && c.unicode() <='~' && c != '\\' && c != '\"' ) {

escaped += c;
} else {
// Escape non-ASCII and special characters
escaped += QString("\\u%1").arg(c.unicode(), 4, 16, QChar('0')).toUpper();
Copy link
Member

Choose a reason for hiding this comment

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

Here memory extra alocation is involved. To be honest, I have no better idea. It would be great to know the final string size forehead and print everything into it in one go. However this requires some not too easy code. Probably not worse the effort.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

This pr is a special one for Arthur concerning his testing with the OSCleton, please keep the review of OSC in pr #13835

I will copy your remarks to #13835 and answer them there

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.

4 participants