Last active
March 10, 2016 21:05
-
-
Save mkrautz/0569e87f74154cdab16c to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
commit a6c441fbff3dc6a6f3084daf65379a0b8c9d903c | |
Author: Mikkel Krautz <[email protected]> | |
Date: Thu Mar 10 21:53:34 2016 +0100 | |
ALSA-debug-v4. | |
diff --git a/src/mumble/ALSAAudio.cpp b/src/mumble/ALSAAudio.cpp | |
index fb5d9e1..524b89d 100644 | |
--- a/src/mumble/ALSAAudio.cpp | |
+++ b/src/mumble/ALSAAudio.cpp | |
@@ -336,15 +336,18 @@ void ALSAAudioInput::run() { | |
snd_pcm_uframes_t wantPeriod = (rrate * iFrameSize) / SAMPLE_RATE; | |
snd_pcm_uframes_t wantBuff = wantPeriod * 8; | |
- ALSA_ERRBAIL(snd_pcm_hw_params_set_period_size_near(capture_handle, hw_params, &wantPeriod, NULL)); | |
+ int dir; | |
+ ALSA_ERRBAIL(snd_pcm_hw_params_set_period_size_near(capture_handle, hw_params, &wantPeriod, &dir)); | |
ALSA_ERRBAIL(snd_pcm_hw_params_set_buffer_size_near(capture_handle, hw_params, &wantBuff)); | |
ALSA_ERRBAIL(snd_pcm_hw_params(capture_handle, hw_params)); | |
- qWarning("ALSAAudioInput: Actual buffer %d hz, %d channel %ld samples [%ld per period]",rrate,iChannels,wantBuff,wantPeriod); | |
- | |
ALSA_ERRBAIL(snd_pcm_hw_params_current(capture_handle, hw_params)); | |
ALSA_ERRBAIL(snd_pcm_hw_params_get_channels(hw_params, &iMicChannels)); | |
ALSA_ERRBAIL(snd_pcm_hw_params_get_rate(hw_params, &iMicFreq, NULL)); | |
+ ALSA_ERRBAIL(snd_pcm_hw_params_get_period_size(hw_params, &wantPeriod, &dir)); | |
+ ALSA_ERRBAIL(snd_pcm_hw_params_get_buffer_size(hw_params, &wantBuff)); | |
+ | |
+ qWarning("ALSAAudioInput: Actual buffer %d hz, %d channel %ld samples [%ld per period]",iMicFreq,iMicChannels,wantBuff,wantPeriod); | |
#ifdef ALSA_VERBOSE | |
snd_output_t *log; | |
@@ -369,7 +372,7 @@ void ALSAAudioInput::run() { | |
eMicFormat = SampleShort; | |
initializeMixer(); | |
- char inbuff[wantPeriod * iChannels * sizeof(short)]; | |
+ char inbuff[wantPeriod * iMicChannels * sizeof(short)]; | |
qml.unlock(); | |
@@ -466,7 +469,14 @@ void ALSAAudioOutput::run() { | |
ALSA_ERRBAIL(snd_pcm_hw_params_get_period_size(hw_params, &period_size, &dir)); | |
ALSA_ERRBAIL(snd_pcm_hw_params_get_buffer_size(hw_params, &buffer_size)); | |
- qWarning("ALSAAudioOutput: Actual buffer %d hz, %d channel %ld samples [%ld per period]",rrate,iChannels,buffer_size,period_size); | |
+ | |
+ ALSA_ERRBAIL(snd_pcm_hw_params_current(pcm_handle, hw_params)); | |
+ ALSA_ERRBAIL(snd_pcm_hw_params_get_channels(hw_params, &iChannels)); | |
+ ALSA_ERRBAIL(snd_pcm_hw_params_get_rate(hw_params, &rrate, NULL)); | |
+ iMixerFreq = rrate; | |
+ eSampleFormat = SampleShort; | |
+ | |
+ qWarning("ALSAAudioOutput: Actual buffer %d hz, %d channel %ld samples [%ld per period]",iMixerFreq,iChannels,buffer_size,period_size); | |
ALSA_ERRBAIL(snd_pcm_sw_params_current(pcm_handle, sw_params)); | |
ALSA_ERRBAIL(snd_pcm_sw_params_set_avail_min(pcm_handle, sw_params, period_size)); | |
@@ -517,12 +527,6 @@ void ALSAAudioOutput::run() { | |
SPEAKER_BACK_CENTER | |
}; | |
- ALSA_ERRBAIL(snd_pcm_hw_params_current(pcm_handle, hw_params)); | |
- ALSA_ERRBAIL(snd_pcm_hw_params_get_channels(hw_params, &iChannels)); | |
- ALSA_ERRBAIL(snd_pcm_hw_params_get_rate(hw_params, &rrate, NULL)); | |
- iMixerFreq = rrate; | |
- eSampleFormat = SampleShort; | |
- | |
qWarning("ALSAAudioOutput: Initializing %d channel, %d hz mixer", iChannels, iMixerFreq); | |
initializeMixer(chanmasks); | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment