Ticket #5342: alsa_mixer_fix_5342_v1-trunk18117.patch
File alsa_mixer_fix_5342_v1-trunk18117.patch, 3.8 KB (added by , 16 years ago) |
---|
-
libs/libmyth/audiooutputalsa.h
old new 74 74 75 75 76 76 // Volume related 77 void SetCurrentVolume( QStringcontrol, int channel, int volume);77 void SetCurrentVolume(const char* control, int channel, int volume); 78 78 void OpenMixer(bool setstartingvolume); 79 79 void CloseMixer(void); 80 80 void SetupMixer(void); … … 85 85 int numbadioctls; 86 86 QMutex killAudioLock; 87 87 snd_mixer_t *mixer_handle; 88 Q Stringmixer_control; // e.g. "PCM"88 QByteArray mixer_control; // e.g. "PCM" 89 89 snd_pcm_sframes_t (*pcm_write_func)(snd_pcm_t*, const void*, 90 90 snd_pcm_uframes_t); 91 91 }; -
libs/libmyth/audiooutputalsa.cpp
old new 22 22 AudioOutputBase(settings), 23 23 pcm_handle(NULL), numbadioctls(0), 24 24 killAudioLock(false), mixer_handle(NULL), 25 mixer_control(Q String::null)25 mixer_control(QByteArray()) 26 26 { 27 27 // Set everything up 28 28 Reconfigure(settings); … … 45 45 pcm_handle = NULL; 46 46 numbadioctls = 0; 47 47 48 Q String real_device = (audio_passthru) ?49 audio_passthru_device : audio_main_device;48 QByteArray pcm_device = (audio_passthru) ? audio_passthru_device.toAscii() 49 : audio_main_device.toAscii(); 50 50 51 51 VERBOSE(VB_GENERAL, QString("Opening ALSA audio device '%1'.") 52 .arg( real_device));52 .arg(pcm_device.constData())); 53 53 54 err = snd_pcm_open(&pcm_handle, real_device,54 err = snd_pcm_open(&pcm_handle, pcm_device.constData(), 55 55 SND_PCM_STREAM_PLAYBACK, SND_PCM_NONBLOCK); 56 56 57 57 if (err < 0) 58 58 { 59 59 Error(QString("snd_pcm_open(%1): %2") 60 .arg( real_device).arg(snd_strerror(err)));60 .arg(pcm_device.constData()).arg(snd_strerror(err))); 61 61 62 62 if (pcm_handle) 63 63 CloseDevice(); … … 483 483 if (mixer_handle == NULL) 484 484 return 100; 485 485 486 QByteArray mix_ctl = mixer_control.toAscii();487 486 snd_mixer_selem_id_t *sid; 488 487 snd_mixer_selem_id_alloca(&sid); 489 488 snd_mixer_selem_id_set_index(sid, 0); 490 snd_mixer_selem_id_set_name(sid, mix _ctl.constData());489 snd_mixer_selem_id_set_name(sid, mixer_control.constData()); 491 490 492 491 snd_mixer_elem_t *elem = snd_mixer_find_selem(mixer_handle, sid); 493 492 if (!elem) 494 493 { 495 494 VERBOSE(VB_IMPORTANT, QString("Mixer unable to find control %1") 496 .arg(mixer_control ));495 .arg(mixer_control.constData())); 497 496 return 100; 498 497 } 499 498 … … 504 503 if ((elem = snd_mixer_find_selem(mixer_handle, sid)) == NULL) 505 504 { 506 505 VERBOSE(VB_IMPORTANT, QString("Mixer unable to find control %1 %2") 507 .arg(mixer_control ).arg(channel));506 .arg(mixer_control.constData()).arg(channel)); 508 507 return 100; 509 508 } 510 509 } … … 519 518 520 519 void AudioOutputALSA::SetVolumeChannel(int channel, int volume) 521 520 { 522 SetCurrentVolume(mixer_control , channel, volume);521 SetCurrentVolume(mixer_control.constData(), channel, volume); 523 522 } 524 523 525 void AudioOutputALSA::SetCurrentVolume( QStringcontrol, int channel, int volume)524 void AudioOutputALSA::SetCurrentVolume(const char* control, int channel, int volume) 526 525 { 527 526 VERBOSE(VB_AUDIO, QString("Setting %1 volume to %2") 528 527 .arg(control).arg(volume)); … … 530 529 if (!mixer_handle) 531 530 return; // no mixer, nothing to do 532 531 533 QByteArray ctl = control.toAscii();534 532 snd_mixer_selem_id_t *sid; 535 533 snd_mixer_selem_id_alloca(&sid); 536 534 snd_mixer_selem_id_set_index(sid, 0); 537 snd_mixer_selem_id_set_name(sid, c tl.constData());535 snd_mixer_selem_id_set_name(sid, control); 538 536 539 537 snd_mixer_elem_t *elem = snd_mixer_find_selem(mixer_handle, sid); 540 538 if (!elem)