Allowing 'Bypass Plugin' via PCE - possible feature request?

Started by Christofori, June 19, 2011, 07:24:45

Previous topic - Next topic

Christofori

Quote from: Jojo on June 21, 2011, 16:09:30
I wouldn't say that the code is similar to something that someone who has used BASIC (like me) or Pascal for a long time might be accustomed to or could have written. On the contrary, it's just full to the brim with pointers, macros and old-fashioned code structures, and the latter is what has spawned many redundant pieces of code, or simply code that runs fast but is hard to understand.

Old-fashioned code structures... The structure is exactly what I was talking about.. or moreover, the lack of "readable" structure that existed a while ago, before they wanted to put forth effort to train programmers to make code more readable, anyway.

I'm not thinking I'll be able to come in and clean up the code, now.. lol.. your example was time well spent.  But I might still play with it and customize it somewhat. ;)  Only problem in doing that is if I did come up with a good bit of code I ended up using (dare I say relying upon..?), I'd have to then re-implement it each time a new build came out (or submit it to you for inclusion I suppose, do you ever incorporate user-submitted code bits [FE features]?)
/christofori
'slightly disturbed and wonderfully content'
*Master of the Obvious*

Saga Musix

Quote from: christofori on June 22, 2011, 01:00:25
ers to make code more readable, anyway.
Let me tell you one thing, many parts of the code are unreadable if you don't spend some time figuring out what they do. :D And once you've understood them, you can often easily replace them by something more readble (or maybe just add a comment on what the code does).

Quote from: christofori on June 22, 2011, 01:00:25
do you ever incorporate user-submitted code bits [FE features]?
No, because there aren't any. :D Well, the last patch from outside the development team was from kode54 I think, and I gladly incorporated his fixes - everyone is welcome to make changes to the code and send them to us!
» No support, bug reports, feature requests via private messages - they will not be answered. Use the forums and the issue tracker so that everyone can benefit from your post.

Christofori

/christofori
'slightly disturbed and wonderfully content'
*Master of the Obvious*

Rakib

Are you sure, I know Pelya made a vsti version of modplug and he also did sync with video thingy. I dont think that that has been incorporated in todays build.
^^

Saga Musix

Uhm, so what? The VSTi patch was experimental and a dirty hack - and AFAIK pelya didn't submit it as an official patch (I wouldn't have done that, either). Some of his other patches have made it into codebase, though.
» No support, bug reports, feature requests via private messages - they will not be answered. Use the forums and the issue tracker so that everyone can benefit from your post.

Christofori

An idea that'll probably never be implemented as most don't use this setup (yet... I believe it will become more common than it is today..) -- support for multiple monitors for OMPT content (I know you can move VST(i)'s... I'm talking about sample/instrument/pattern/general tidbits -- being able to see it all, baby!)... but after having read some about the GUI in various snippits from past dev conversations (maybe some from the issue tracker.. hard to remember where I found 'em now..), I know... I know.  I can dream..! :D

But, this all goes to reinforce why I've quit submitting issue tickets without checking around a lot more, first.. and then even posting here for debate first.  Because of course, what I might think of as a 'must-have' most others might care less for..! :P  At any rate, I figured there was no need to add clutter to the IT.
/christofori
'slightly disturbed and wonderfully content'
*Master of the Obvious*

Saga Musix

Try Window -> New Window. I think this is what you want.
» No support, bug reports, feature requests via private messages - they will not be answered. Use the forums and the issue tracker so that everyone can benefit from your post.

Harbinger

Quote from: Jojo on June 21, 2011, 16:09:30
(*) Here's a nice riddle for you: What does the following code do (m is a pattern cell)?

if ((!*((LPDWORD)m)) && (!*(((LPWORD)m)+2)))

Well, i understand the syntax, the vocabulary, but i often have trouble interpreting what it's trying to do...

Let's see...
Take the value of m as a DWORD pointer (in its DWORD-length memory location) and compare the bits (AND) with the value of m's WORD-length pointer plus 2, if they're the same...

Is that close? I forget what the exclamation point is for (if i know at all), and that may have a drastic effect on the interpretation...

That statement is exactly why i didn't what to mess with the code, i barely have a clue what's going on from one line to the next. I started creating a REM-happy version of the code with each line put in plain English, but i kept getting stuck on lines like that one.

I'm secretly hoping that one day before the code gets too obsolete, you'll refactor everything into something so clear i can actually do something with it...

Saga Musix

You've gotten pretty close actually! The && is not a logical AND, though, so the two statements are not compared or anything - the code is only executed if both are true.

Let's take a closer look...
(LPDWORD)m - Reinterpret the mod command pointer as a DWORD (32-bit integer) pointer
*(LPDWORD)m - Dereference the pointer, i.e. look at the DWORD value at the given address
!*((LPDWORD)m - Check if that DWORD value is 0

(LPWORD)m - Reinterpret the mod command pointer as a WORD (16-bit integer) pointer
((LPWORD)m)+2 - Skip two WORDs (i.e. 4 bytes)
*(((LPWORD)m)+2) - Dereference the pointer, i.e. look at the WORD value at the given address
!*(((LPWORD)m)+2) - Check if that WORD value is 0

In other words, this code check if 6 consecutive bytes (that's the size of a pattern cell) at address m are zero. After refactoring, it looks like this:

if(m->Empty())

;D
» No support, bug reports, feature requests via private messages - they will not be answered. Use the forums and the issue tracker so that everyone can benefit from your post.

Harbinger

That's right! The exclamation point is the NOT operator!

Your final code is what is needed throughout. It's so elegant! ;)

BTW: Is/was that snippet really present in the code? Why do you figure it was originally written in longhand like that? Any guesses?

Saga Musix

Quote from: Harbinger on June 23, 2011, 15:03:54
Is/was that snippet really present in the code?
Yes.

And why it was used? I'm sure Olivier wanted to be efficient (this is probably even faster than a memcmp() call), and he was the only person working on the code, so if he understood it, it was fine. Remember that most of the old code was not strictly object-oriented, so object functions like MODCOMMAND::Empty() didn't even exist in the old code.
» No support, bug reports, feature requests via private messages - they will not be answered. Use the forums and the issue tracker so that everyone can benefit from your post.

LPChip

Quote from: Jojo on June 23, 2011, 14:05:12
if(m->Empty())


Now that part I understand. It questions itself and then makes M empty! Yeah, that must be it. :nuts:
"Heh, maybe I should've joined the compo only because it would've meant I wouldn't have had to worry about a damn EQ or compressor for a change. " - Atlantis
"yes.. I think in this case it was wishful thinking: MPT is makng my life hard so it must be wrong" - Rewbs

Christofori

Quote from: Jojo on June 23, 2011, 11:19:20
Try Window -> New Window. I think this is what you want.

Sorta; although you cannot move any of the windows outside of the main OpenMPT application window (which was the goal of the comment, being that multiple monitors were mentioned) and onto another physical screen.  Part of the functionality is there already as you point out, since one is able to split the existing display and arrange the parts as desired; but this assumes one has a rather large monitor (well, someone with a LCDTV as one perhaps would work..) to be able to see portions that were useful... if you can't see but a fraction as your screen is too small however, it doesn't do any good.
/christofori
'slightly disturbed and wonderfully content'
*Master of the Obvious*

Harbinger

Actually, this brings up an interesting question, since you're working with more than one monitor...

Are you able to stretch ModPlug's window over into more than one monitor? This could definitely expand MultiView's functionality (multiple windows of the same track)...and i'd like to mention the possibilities in the OHM...

LPChip

Quote from: Harbinger on June 27, 2011, 20:33:38
Actually, this brings up an interesting question, since you're working with more than one monitor...

Are you able to stretch ModPlug's window over into more than one monitor? This could definitely expand MultiView's functionality (multiple windows of the same track)...and i'd like to mention the possibilities in the OHM...
Its windows. Any window that you can resize, can be moved to several monitors at the same time, so yes.

There are programs and drivers that allow you to create one huge desktop made out of more displays. If you have this kind of setup, maximize will actually put the screen on both windows automatically.
"Heh, maybe I should've joined the compo only because it would've meant I wouldn't have had to worry about a damn EQ or compressor for a change. " - Atlantis
"yes.. I think in this case it was wishful thinking: MPT is makng my life hard so it must be wrong" - Rewbs