On Sat, Jan 8, 2011 at 4:36 AM, Mikael Bouillot <csbhp...@corbac.com> wrote:
> Greetings, Mixxx developers!
>
> I'm using Mixxx 1.7.2.
> I tried 1.8, and promptly reverted back.
>
> In order to do nice mashups, I hacked a nifty little thing into it
> that allows one to navigate synchronously in each track, based on
> the BPM: move by 1/4, 1/2, 1, 2, 4, 8, 16, 32, 64 and 128 beats,
> either forward or backward, for each track.
>
> It's exactly what I needed, I'm having a lot of fun with it.
> I'd submit a patch, but for one small UI problem: it needs a huge
> chunk of the keyboard! I'm using 20 keys for *one* track, with
> a shift modifier for the other track.
>
> But I also got a glimpse of the innards of Mixxx in the process,
> and now I'm wondering: How does this thing even *works*?
>
> OK, to be fair, I'm not used to C++. But the way I see object-
> oriented programming, it's supposed to be modular with small,
> well-defined interfaces. So I guess there must be such an interface
> to the sound engine. When hacking my thingy, it didn't strike me
> as obvious.
> Then again, maybe it's a FAQ.
>
> The reason I'm asking is twofold:
>
> First, I'm moving around the track using slotControlSeekAbs(), and
> it works fine, except when it doesn't. I've got all sort of weird
> bugs where it seeks to the wrong spot, or the audio is suddenly not
> in sync with the wave display for a few seconds. Am I supposed to
> use another method?

The answer to this is tied to why we don't have a clear modular
object-oriented interface for the engine (yet?). Because there's so
much multithreading going on, the original Mixxx developers designed
this "ControlObject" system, which is the main interface for
controlling playback, and is shared by the keyboard, MIDI controllers,
C++ code, etc. Each ControlObject wraps a double value, and they're
nice because they take care of thread safety for you.

The very bottom of this page has a code snippet showing you how to use
ControlObjects:
http://mixxx.org/wiki/doku.php/midi_controller_mapping_file_format?s[]=controlobject
Higher up on the page is the list of controls you can get at.

I'd recommend using the "playposition" ControlObject for doing seeks
rather than touching the internals of the engine. It might fix your
sync problems.

>
> Second, I now need another functionality, and it seems I'm going to
> have a much harder time hacking *that* in: I want to change the
> pitch of a track without changing its tempo.
>
> Right now, I set "Pitch behaviour" to "Vinyl emulation" (because
> "Pitch independent time stretch" sounds like c**p), and thus the
> pitch and tempo change simultaneously when I change the rate of the
> track. In theory, if I combine both modes (VE and PITS) I could
> change the pitch without changing the tempo. In practice, I use
> Sox to manually change the pitch of the tracks in advance when I
> need it. It's 20 minutes of intense brain activity.
> log(rate)/log(2)*12*100, that kind of stuff.
>
> I don't want that: I want a slider in the GUI.
>

As Owen mentioned, the library we're already using for BPM detection
and key-lock/time stretch has this functionality built in. Check out
that src/engine/enginebufferscalest.cpp file Owen mentioned and look
at the SoundTouch.h header to see how it works. (If I remember
correctly, it's fairly straightforward. There's 3 functions in
SoundTouch that you can use for pitch stuff, something like
setPitch(), setRate(), and setTempo(). There's also semi-tone adjust
functions, which might be even more useful.)

To make a slider in the GUI, all you'd need to do is create a
ControlObject in the engine somewhere (try to find out where the
existing "rate" ControlObject is declared, and make a "pitch" one
there too). Then you'd read the value from that CO, and pass it into
EngineBufferScaleST, just like what happens with the pitch. Lastly,
our skin system hooks right into ControlObjects, so you can just edit
the skin.xml for an existing skin and add a new slider that hooks into
"[ChannelN]" and "pitch".

Hopefully this points you in the right direction! Don't be afraid to
hop on IRC (#mixxx on Freenode) if you get stuck, as there's usually a
few of our developers in there. We'd be happy to help you via email
more too.

Thanks,
Albert

------------------------------------------------------------------------------
Gaining the trust of online customers is vital for the success of any company
that requires sensitive data to be transmitted over the Web.   Learn how to 
best implement a security strategy that keeps consumers' information secure 
and instills the confidence they need to proceed with transactions.
http://p.sf.net/sfu/oracle-sfdevnl 
_______________________________________________
Mixxx-devel mailing list
Mixxx-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/mixxx-devel

Reply via email to