Merge lp://qastaging/~mixxxdevelopers/mixxx/features_external_mixer into lp://qastaging/~mixxxdevelopers/mixxx/trunk

Proposed by RJ Skerry-Ryan
Status: Merged
Merged at revision: 2748
Proposed branch: lp://qastaging/~mixxxdevelopers/mixxx/features_external_mixer
Merge into: lp://qastaging/~mixxxdevelopers/mixxx/trunk
Diff against target: 2253 lines (+1105/-290)
37 files modified
mixxx/build/depends.py (+6/-1)
mixxx/lib/xwax/timecoder.c (+1/-1)
mixxx/lib/xwax/timecoder.h (+1/-1)
mixxx/src/basetrackplayer.cpp (+3/-2)
mixxx/src/circularbuffer.h (+97/-0)
mixxx/src/dlgpreferences.cpp (+3/-3)
mixxx/src/dlgpreferences.h (+4/-1)
mixxx/src/dlgprefsound.cpp (+100/-65)
mixxx/src/dlgprefsound.h (+9/-3)
mixxx/src/dlgprefsounditem.h (+3/-1)
mixxx/src/engine/enginechannel.cpp (+9/-53)
mixxx/src/engine/enginechannel.h (+13/-18)
mixxx/src/engine/enginedeck.cpp (+76/-0)
mixxx/src/engine/enginedeck.h (+59/-0)
mixxx/src/engine/enginemaster.cpp (+46/-12)
mixxx/src/engine/enginemaster.h (+9/-7)
mixxx/src/engine/enginemicrophone.cpp (+125/-0)
mixxx/src/engine/enginemicrophone.h (+53/-0)
mixxx/src/engine/enginepassthrough.cpp (+119/-0)
mixxx/src/engine/enginepassthrough.h (+51/-0)
mixxx/src/mixxx.cpp (+19/-5)
mixxx/src/mixxx.h (+0/-2)
mixxx/src/sounddevice.cpp (+1/-1)
mixxx/src/sounddeviceportaudio.cpp (+1/-1)
mixxx/src/soundmanager.cpp (+70/-38)
mixxx/src/soundmanager.h (+14/-4)
mixxx/src/soundmanagerconfig.cpp (+1/-1)
mixxx/src/soundmanagerconfig.h (+2/-2)
mixxx/src/soundmanagerutil.cpp (+6/-17)
mixxx/src/soundmanagerutil.h (+21/-6)
mixxx/src/test/enginemastertest.cpp (+29/-39)
mixxx/src/test/enginemicrophonetest.cpp (+136/-0)
mixxx/src/vinylcontrol.h (+1/-1)
mixxx/src/vinylcontrolproxy.cpp (+11/-1)
mixxx/src/vinylcontrolproxy.h (+4/-2)
mixxx/src/vinylcontrolxwax.cpp (+1/-1)
mixxx/src/vinylcontrolxwax.h (+1/-1)
To merge this branch: bzr merge lp://qastaging/~mixxxdevelopers/mixxx/features_external_mixer
Reviewer Review Type Date Requested Status
RJ Skerry-Ryan Needs Resubmitting
RAFFI TEA Needs Fixing
Albert Santoni Needs Fixing
William Good Pending
Review via email: mp+53747@code.qastaging.launchpad.net

Description of the change

Based on Bills changes to SoundManager to allow registration of AudioDestination's for AudioInput's and my work on adding an EngineMicrophone EngineChannel, microphone support is now ready for review.

A microphone is a new EngineChannel. It has the group "[Microphone]".

A microphone channel has only 1 mic-specific control:
[Microphone], talkover

Setting talkover to 1 enables the mic input, 0 disables it.

It has controls that are identical to the deck controls for:
- VU meters
- Clipping
- Volume

To post a comment you must log in.
Revision history for this message
RAFFI TEA (raffitea) wrote :

Just tried to test the branch on OS X, but segfault...

Debug: [Main]: Opened PortAudio stream successfully... starting
Assertion failed: (sizeof( UInt32 ) == sizeof( long )), function ringBufferIOProc, file src/hostapi/coreaudio/pa_mac_core.c, line 1713.

Revision history for this message
RJ Skerry-Ryan (rryan) wrote :

seems strange.. was this on bootup? or after you selected a microphone
input?

On Sat, Mar 19, 2011 at 11:43 AM, RAFFI TEA <email address hidden>wrote:

> Just tried to test the branch on OS X, but segfault...
>
> Debug: [Main]: Opened PortAudio stream successfully... starting
> Assertion failed: (sizeof( UInt32 ) == sizeof( long )), function
> ringBufferIOProc, file src/hostapi/coreaudio/pa_mac_core.c, line 1713.
>
> --
>
> https://code.launchpad.net/~mixxxdevelopers/mixxx/features_external_mixer/+merge/53747
> You proposed lp:~mixxxdevelopers/mixxx/features_external_mixer for merging.
>

Revision history for this message
RAFFI TEA (raffitea) wrote :

> seems strange.. was this on bootup? or after you selected a microphone
> input?
>
Yes, it happens on bootup.

Revision history for this message
Albert Santoni (gamegod) wrote :

Hey RJ,

Here's some comments on your code:

• CircularBuffer:
  ∘ Destructor should have: delete [] m_pBuffer;
  ∘ write() comment refers to non-existent numSamples variable
  ∘ skip() - Can the while loop just be replaced with:
     ‣ m_iReadPos = (m_iReadPos + itemsToRead) % m_iLength;
  ∘ If the compiler doesn't make m_iWritePos and m_iReadPos 8-byte aligned, are you sure operations are still atomic? (Do you need a __declspec(align(8)) in there?)
• Preferences:
  ∘ Good, I like that we're passing more of these manager classes into the preferences dialog. This will make tons of sense in the long run.
• EngineMicrophone::receiveBuffer()
  ∘ Assumes the input is stereo. It should check the AudioInput passed to it first maybe?
• Re: SoundManager, your comment that says "// What should channelbase be?"
  ∘ ChannelBase is the channel on the soundcard that we have to open, with the lowest index on the soundcard. For example, if we want to open channels 3-4 and 7-8, channel 3 would be the ChannelBase. (This is relevant because in reality, we're forced to open all channels 3 through 8 contiguously for cases like this.)
• Talkover:
  ∘ Talkover on a physical mixer lowers the music volume some amount (quite a bit). I don't see that in your code anywhere, but maybe I missed that.
• mixxx.cpp
  ∘ This is the best place for EngineMicrophone to live?

I'm surprised that PortAudio lets me open two channels on my mic. It's a mono microphone, though I'm not sure if the magic is going on in CoreAudio or PortAudio to present it as two-channels. (It may be an issue on other platforms if microphones only show up as single-channel devices.)

Anyways, overall very good! Many people will be pleased by the addition of microphone talkover support.

Thanks,
Albert

review: Needs Fixing
Revision history for this message
Albert Santoni (gamegod) wrote :

I tested on Ubuntu 10.10 (32-bit) and Mac OS X 10.6 (64-bit) and I could not reproduce Tobias' ASSERT.

Tobias, how recent is your version of PortAudio?

Revision history for this message
RAFFI TEA (raffitea) wrote :

I use the MacPorts version of PortAudio which I have never updated over the time -- my MacBook Pro (2010) is 3 months old.

I've also deleted the config file but no effects.

If an update to another MacPorts version does not help, I compile for my own. And if it is still not working after, I don't know...

Also I'm interested if Jus experience same problems?

Thanks,

Tobias

Revision history for this message
RAFFI TEA (raffitea) wrote :
Revision history for this message
RAFFI TEA (raffitea) wrote :

Solved the ASSERT myself.

The problem is that Mixxx's default samplerate is 48k. Resetting to 44k resolves the ASSERT on my MacBook Pro (2010 model), iCore 5.

Note that I used the build-in microphone input as well as the build-in soundcard as master out.

Thus, line-out and microphone input may have different maximum samplerates. Don't know if one can determine the max samplerate of the mic-input --> Needs fixing somehow :-)

review: Needs Fixing
Revision history for this message
RAFFI TEA (raffitea) wrote :

Also, tried to speak through the mic while I was recording and playing a track --> The recorded file does not contain my voice. Will voice be only supported if one use shoutcast?

Revision history for this message
RJ Skerry-Ryan (rryan) wrote :

Your voice should end up on the recording since it uses the master output...
hmm. Did you skin-and-hold the talkover button?

On Mon, Mar 28, 2011 at 10:53 AM, RAFFI TEA <email address hidden>wrote:

> Also, tried to speak through the mic while I was recording and playing a
> track --> The recorded file does not contain my voice. Will voice be only
> supported if one use shoutcast?
> --
>
> https://code.launchpad.net/~mixxxdevelopers/mixxx/features_external_mixer/+merge/53747
> You proposed lp:~mixxxdevelopers/mixxx/features_external_mixer for merging.
>

Revision history for this message
RAFFI TEA (raffitea) wrote :

Skin-and-hold the talkover button? No ...

Could you provide some more guidance, please? Thanks :-)

Revision history for this message
RAFFI TEA (raffitea) wrote :

Thanks RJ for your guidance on IRC.

It works fine. Just one thing: I hear myself while speaking through the mic. This is not surprising but is it possible to define an option such that any voice will go to shoutcast and not to the master out? I am not used to hear my self and it holds me off to concentrate on moderating a show :-)

Revision history for this message
RJ Skerry-Ryan (rryan) wrote :

Ahh hm, I think this is technically difficult because both recording and Shoutcast are exact mirrors of the master out, and that isn't configurable. Don't club DJs who use a mic have to get used to hearing themselves?

Revision history for this message
RAFFI TEA (raffitea) wrote :

I think you're right.

2554. By RJ Skerry-Ryan

Use array delete in CircularBuffer.

2555. By RJ Skerry-Ryan

Merging from lp:mixxx

2556. By RJ Skerry-Ryan

Check for channels == 1 and audio-input type is mic in EngineMicrophone. Mark CircularBuffer with warning message about it not being thread safe

Revision history for this message
RJ Skerry-Ryan (rryan) wrote :

 It occurs to me that EngineMicrophone is a specialization of the more general pattern of "Take samples from AudioInput, mix them into the output". I'd like to generalize it, but not now. Maybe once I or somebody else does an input passthrough. The only thing microphone-specific here is the button name "talkover".

 CircularBuffer:

So CircularBuffer isn't thread safe.. it needs memory barriers I believe. I wonder if we should steal this from PortAudio? Given the current SoundManager setup, EngineMicrophone is never touched by different threads, so this isn't a problem right now. I think I'll add a giant warning.

  ∘ Destructor should have: delete [] m_pBuffer;
Done

  ∘ write() comment refers to non-existent numSamples variable
Fixed

  ∘ skip() - Can the while loop just be replaced with:
     ‣ m_iReadPos = (m_iReadPos + itemsToRead) % m_iLength;

Sorta -- except you have to make sure the read pointer doesn't pass the write pointer. I thought there was too much of a chance I'd screw it up, so I just do it as a loop.

  ∘ If the compiler doesn't make m_iWritePos and m_iReadPos 8-byte aligned, are you sure operations are still atomic? (Do you need a __declspec(align(8)) in there?)

Probably -- as I mentioned above I'm going to stop claiming this is thread safe.

• Preferences:

• EngineMicrophone::receiveBuffer()
  ∘ Assumes the input is stereo. It should check the AudioInput passed to it first maybe?

OK, now I verify that the input type is a microphone input and that the input # of channels is 1.

• Re: SoundManager, your comment that says "// What should channelbase be?"
  ∘ ChannelBase is the channel on the soundcard that we have to open, with the lowest index on the soundcard. For example, if we want to open channels 3-4 and 7-8, channel 3 would be the ChannelBase. (This is relevant because in reality, we're forced to open all channels 3 through 8 contiguously for cases like this.)

• Talkover:
  ∘ Talkover on a physical mixer lowers the music volume some amount (quite a bit). I don't see that in your code anywhere, but maybe I missed that.

Nope, it's not there currently. Sean is saying that in general he thinks the DJ should control the microphone levels manually. He said that is how e.g. the DJM-500 works. If I do implement the talkover damping, I think it would need to be a preference option.

• mixxx.cpp
  ∘ This is the best place for EngineMicrophone to live?

It doesn't live here (i.e. isn't a member variable of MixxxApp) since EngineMaster takes ownership of it and deletes it later. It needs to be registered with SoundManager though. Basically, I didn't see a way to do it without introducing a dependency of SoundManager on EngineMicrophone, or EngineMaster on EngineMicrophone.

I could make a MicrophoneManager class which takes both the EngineMaster and SoundManager, and then hooks up the EngineMicrophone, but that seemed overkill to just get those 4 lines out of MixxxApp.

review: Needs Resubmitting
2557. By RJ Skerry-Ryan

Add onInputConnected and onInputDisconnected to AudioDestination. Make a [Microphone],enabled control that turns on and off based on these callbacks.

2558. By William Good

Fix deck outputs, broken because the assumption of
EngineMaster::m_channelBuffers only containing deck buffers (whose
corresponding EngineChannels are named [ChannelX], interestingly) failed.

2559. By RJ Skerry-Ryan

Merging from lp:~mixxxdevelopers/mixxx/features_hydra

2560. By RJ Skerry-Ryan

Add VU meter and clipping processing for EngineMicrophone.

Revision history for this message
Martin Simon (martin-clearsounds.de) wrote :

Wanted to test it. If I enable microphone input at preferences, mixx crashes. What skin I have to use?

Revision history for this message
RAFFI TEA (raffitea) wrote :

> Wanted to test it. If I enable microphone input at preferences, mixx crashes.
> What skin I have to use?

If Mixxx does not start, please delete mixxx.cfg. Start Mixxx again and set samplerate to 44100 Hz.
This has worked for me.

Revision history for this message
RJ Skerry-Ryan (rryan) wrote :

Hi Martin,

What version did you test it with? Can you post the output of "bzr revno"?

Also, could you please post a backtrace? http://www.mixxx.org/wiki/doku.php/creating_backtraces

Thanks,
RJ

Revision history for this message
Martin Simon (martin-clearsounds.de) wrote :

Revision 2560 - Ubuntu 10.10 - Thinkpad internal audio (Intel ALC269)
Output:
Debug: [Main]: Displaying mixxx
Debug: [Main]: Running Mixxx
Fatal: []: ASSERT: "false" in file src/engine/enginemicrophone.cpp, line 103

If I remove the check at lines 98 - 104 all runs fine.

But I still don't know where I can test the microphone input because I have no buttons in the skin!?

Revision history for this message
RJ Skerry-Ryan (rryan) wrote :

Hey Martin,

Thats' right, there's no skin yet. (this branch just adds the features
internally, and our lead artist will make skins that have them). You can
hack it by opening the "skin.xml" file for the skin you are using and
searching for "[Channel1],beatsync" and replacing every occurrence of it
with "[Microphone],talkover". Then the left sync button will act as your
microphone talkover button. You can also replace the "[Channel1],VuMeter"
references to "[Microphone],VuMeter" and "[Channel1],PeakIndicator" with
"[Microphone],PeakIndicator" if you want the left VU and peak indicators to
actually be for the microphone.

Thanks,
RJ

On Fri, Apr 1, 2011 at 11:51 AM, Martin Simon <email address hidden> wrote:

> Revision 2560 - Ubuntu 10.10 - Thinkpad internal audio (Intel ALC269)
> Output:
> Debug: [Main]: Displaying mixxx
> Debug: [Main]: Running Mixxx
> Fatal: []: ASSERT: "false" in file src/engine/enginemicrophone.cpp, line
> 103
>
> If I remove the check at lines 98 - 104 all runs fine.
>
> But I still don't know where I can test the microphone input because I have
> no buttons in the skin!?
> --
>
> https://code.launchpad.net/~mixxxdevelopers/mixxx/features_external_mixer/+merge/53747
> You proposed lp:~mixxxdevelopers/mixxx/features_external_mixer for merging.
>

Revision history for this message
Martin Simon (martin-clearsounds.de) wrote :

Tried another pc now. Made necessary changes to the skin. Ubuntu Maverick x64 build. (could it be a 64bit problem?) Tried different hardware combinations. (M16DX in/out; Aureon 7.1 usb in/out; nvidia internal sound in/out).
I still commented out the check that runs into the assert. Most combinations of in and out fail and mixx crashes when trying to select inputs.

Most comprehensible way: Using only mainboard sound with jack. If I enable input in mixxx, jack shows the portaudio in port an connects the right input channel with it. I also can connect the input directly with the output with jack an it works. Yes, jack can route the sound from the microphone to the output and it works. The input is surely ok. But with pressing my talkover button in mixxx nothing happens. The vumeter displays nothing an no sound is routed through.

2561. By RJ Skerry-Ryan

Update SoundManager to actually call onInputConnected and onInputDisconnected of AudioDestination's registered for AudioInputs.

2562. By RJ Skerry-Ryan

Merging frmo lp:mixxx.

Revision history for this message
RJ Skerry-Ryan (rryan) wrote :

Thanks a lot for the testing Martin. It was definitely broken.

Can you pull the latest changes (and re-enable the asserts, they should only fire if something is wrong) and give it another try?

Thanks,
RJ

Revision history for this message
Martin Simon (martin-clearsounds.de) wrote :

Tested it again and it works as suspected but .... if I release the talkover-button the last samples seem to be delivered again and again ... the sound in the microphone channel "hangs".

Revision history for this message
RJ Skerry-Ryan (rryan) wrote :

Ah yes, another bug -- should be fixed now.

Thanks,
RJ

On Sun, Apr 3, 2011 at 8:33 AM, Martin Simon <email address hidden> wrote:

> Tested it again and it works as suspected but .... if I release the
> talkover-button the last samples seem to be delivered again and again ...
> the sound in the microphone channel "hangs".
> --
>
> https://code.launchpad.net/~mixxxdevelopers/mixxx/features_external_mixer/+merge/53747
> You proposed lp:~mixxxdevelopers/mixxx/features_external_mixer for merging.
>

2563. By RJ Skerry-Ryan

Clear the incoming audio buffer in EngineMicrophone if the talkover button is not enabled.

2564. By William Good

Do getTypeFromInt the easy way

2565. By RJ Skerry-Ryan

Fix volume fader control

2566. By William Good

Update engine to implement AudioSource
Change sound prefs to use soundmanager registration for available inputs/outputs
Update vinylcontrolproxy to implement AudioDestination

2567. By William Good

Added EnginePassthrough class

2568. By RJ Skerry-Ryan

Merging from lp:mixxx

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
The diff is not available at this time. You can reload the page or download it.