~ubuntu-branches/ubuntu/raring/mumble/raring

« back to all changes in this revision

Viewing changes to src/mumble11x/WASAPI.cpp

  • Committer: Bazaar Package Importer
  • Author(s): Thorvald Natvig
  • Date: 2010-01-09 19:28:50 UTC
  • mfrom: (9.1.6 sid)
  • Revision ID: james.westby@ubuntu.com-20100109192850-zs4g5vwrrpd71kob
Tags: 1.2.1-2
Fix upgrade failure when upgrading mumble-server directly from 1.1.x
to 1.2.1

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
/* Copyright (C) 2005-2009, Thorvald Natvig <thorvald@natvig.com>
 
1
/* Copyright (C) 2005-2010, Thorvald Natvig <thorvald@natvig.com>
2
2
 
3
3
   All rights reserved.
4
4
 
259
259
        DWORD dwTaskIndex = 0;
260
260
        HANDLE hMmThread;
261
261
        float *tbuff = NULL;
 
262
        bool doecho = g.s.doEcho();
262
263
 
263
264
        CoInitialize(NULL);
264
265
 
307
308
                CoTaskMemFree(devname);
308
309
        }
309
310
 
310
 
        if (g.s.doEcho()) {
 
311
        if (doecho) {
311
312
                if (! g.s.qsWASAPIOutput.isEmpty()) {
312
313
                        STACKVAR(wchar_t, devname, g.s.qsWASAPIOutput.length());
313
314
                        g.s.qsWASAPIOutput.toWCharArray(devname);
384
385
        iMicChannels = micpwfx->nChannels;
385
386
        iMicFreq = micpwfx->nSamplesPerSec;
386
387
 
387
 
        if (g.s.doEcho()) {
 
388
        if (doecho) {
388
389
                hr = pEchoDevice->Activate(__uuidof(IAudioClient), CLSCTX_ALL, NULL, (void **) &pEchoAudioClient);
389
390
                if (FAILED(hr)) {
390
391
                        qWarning("WASAPIInput: Activate Echo AudioClient failed");
773
774
        iChannels = pwfx->nChannels;
774
775
        initializeMixer(chanmasks);
775
776
 
 
777
        bool mixed = false;
776
778
        while (bRunning && ! FAILED(hr)) {
777
779
                hr = pAudioClient->GetCurrentPadding(&numFramesAvailable);
778
780
                if (FAILED(hr))
780
782
 
781
783
                packetLength = bufferFrameCount - numFramesAvailable;
782
784
 
 
785
                if (lastspoke != (g.bAttenuateOthers || mixed)) {
 
786
                        lastspoke = g.bAttenuateOthers || mixed;
 
787
                        setVolumes(pDevice, lastspoke);
 
788
                }
 
789
 
783
790
                while (packetLength > 0) {
784
791
                        hr = pRenderClient->GetBuffer(packetLength, &pData);
785
792
                        if (FAILED(hr))
786
793
                                goto cleanup;
787
794
 
788
 
                        bool mixed = mix(reinterpret_cast<float *>(pData), packetLength);
 
795
                        mixed = mix(reinterpret_cast<float *>(pData), packetLength);
789
796
                        if (mixed)
790
797
                                hr = pRenderClient->ReleaseBuffer(packetLength, 0);
791
798
                        else
793
800
                        if (FAILED(hr))
794
801
                                goto cleanup;
795
802
 
796
 
                        if (lastspoke != mixed) {
797
 
                                lastspoke = mixed;
798
 
                                setVolumes(pDevice, mixed);
 
803
                        if (!g.s.bAttenuateOthers && !g.bAttenuateOthers) {
 
804
                                mixed = false;
 
805
                        }
 
806
 
 
807
                        if (lastspoke != (g.bAttenuateOthers || mixed)) {
 
808
                                lastspoke = g.bAttenuateOthers || mixed;
 
809
                                setVolumes(pDevice, lastspoke);
799
810
                        }
800
811
 
801
812
                        hr = pAudioClient->GetCurrentPadding(&numFramesAvailable);