Permalink
Browse files

Rewrite of CoreAudio driver.

While not everything is fixed yet, it is a step in the right direction.

-You can now select which device to use in the setup and not always have to use the default audio device.
-Fixes #5552.
-Properly set channel layout, under most circumstances, you shouldn't have to use Audio Midi Setup utilities

There are still bugs that I can't explain, probably due to my lack of deep knowledge of CoreAudio, and it certainly ain't behaving as it should. In particular, switching from AC3/DTS bitstream back to PCM will fail except if you have selected the default output device.
Until this is resolved, it is best to keep using the default output device.
  • Loading branch information...
1 parent 4df9b74 commit 267cada976140ef35e24fd8bbac0b65f7155974d @jyavenard jyavenard committed Jun 16, 2011
@@ -317,9 +317,9 @@ AudioOutput::AudioDeviceConfig* AudioOutput::GetAudioDeviceConfig(
return adc;
}
-static void fillSelectionsFromDir(
- const QDir &dir,
- AudioOutput::ADCVect *list)
+#ifdef USING_OSS
+static void fillSelectionsFromDir(const QDir &dir,
+ AudioOutput::ADCVect *list)
{
QFileInfoList il = dir.entryInfoList();
for (QFileInfoList::Iterator it = il.begin();
@@ -329,13 +329,14 @@ static void fillSelectionsFromDir(
QString name = fi.absoluteFilePath();
QString desc = QString("OSS device");
AudioOutput::AudioDeviceConfig *adc =
- AudioOutput::GetAudioDeviceConfig(name, desc);
+ AudioOutput::GetAudioDeviceConfig(name, desc);
if (!adc)
continue;
list->append(*adc);
delete adc;
}
}
+#endif
AudioOutput::ADCVect* AudioOutput::GetOutputList(void)
{
@@ -347,7 +348,7 @@ AudioOutput::ADCVect* AudioOutput::GetOutputList(void)
#endif
#ifdef USE_ALSA
- QMap<QString, QString> *alsadevs = AudioOutputALSA::GetALSADevices("pcm");
+ QMap<QString, QString> *alsadevs = AudioOutputALSA::GetDevices("pcm");
if (!alsadevs->empty())
{
@@ -399,8 +400,26 @@ AudioOutput::ADCVect* AudioOutput::GetOutputList(void)
#if CONFIG_DARWIN
{
- QString name = "CoreAudio:";
- QString desc = "CoreAudio output";
+ QMap<QString, QString> *devs = AudioOutputCA::GetDevices(NULL);
+ if (!devs->empty())
+ {
+ for (QMap<QString, QString>::const_iterator i = devs->begin();
+ i != devs->end(); ++i)
+ {
+ QString key = i.key();
+ QString desc = i.value();
+ QString devname = QString("CoreAudio:%1").arg(key);
+
+ adc = GetAudioDeviceConfig(devname, desc);
+ if (!adc)
+ continue;
+ list->append(*adc);
+ delete adc;
+ }
+ }
+ delete devs;
+ QString name = "CoreAudio:Default Output Device";
+ QString desc = "CoreAudio default output";
adc = GetAudioDeviceConfig(name, desc);
if (adc)
{
@@ -913,7 +913,7 @@ bool AudioOutputALSA::OpenMixer(void)
return true;
}
-QMap<QString, QString> *AudioOutputALSA::GetALSADevices(const char *type)
+QMap<QString, QString> *AudioOutputALSA::GetDevices(const char *type)
{
QMap<QString, QString> *alsadevs = new QMap<QString, QString>();
void **hints, **n;
@@ -20,7 +20,7 @@ class AudioOutputALSA : public AudioOutputBase
// Volume control
virtual int GetVolumeChannel(int channel) const; // Returns 0-100
virtual void SetVolumeChannel(int channel, int volume); // range 0-100 for vol
- static QMap<QString, QString> *GetALSADevices(const char *type);
+ static QMap<QString, QString> *GetDevices(const char *type);
protected:
// You need to implement the following functions
@@ -524,7 +524,7 @@ void AudioOutputBase::Reconfigure(const AudioSettings &orig_settings)
lsource_channels == source_channels &&
lneeds_downmix == needs_downmix;
- if (general_deps)
+ if (general_deps && m_configure_succeeded)
{
VBAUDIO("Reconfigure(): No change -> exiting");
return;
Oops, something went wrong.

0 comments on commit 267cada

Please sign in to comment.