summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorLuo Jinghua <sunmoon1997@gmail.com>2010-03-04 15:46:51 +0800
committerLuo Jinghua <sunmoon1997@gmail.com>2010-03-04 15:46:51 +0800
commit3ec62bd4ed38ab31e6b255d772fcb6f71b8488b4 (patch)
treebf5d5158d0d50401d58ec46340c3582cd6412d1b /src
parentb83776fe3d076b9b2a85b478e0f51334e49ecfa0 (diff)
Nexus: output to mixer instead
Diffstat (limited to 'src')
-rw-r--r--src/device_nexus.cpp33
1 files changed, 30 insertions, 3 deletions
diff --git a/src/device_nexus.cpp b/src/device_nexus.cpp
index d8efe9b..7e4838a 100644
--- a/src/device_nexus.cpp
+++ b/src/device_nexus.cpp
@@ -30,6 +30,7 @@ namespace audiere {
NexusAudioDevice::create(const ParameterList& parameters) {
NEXUS_PlatformConfiguration config;
NEXUS_AudioPlaybackHandle playback;
+ NEXUS_AudioMixerHandle mixer;
NexusAudioDevice *device;
NEXUS_Platform_Init(NULL);
@@ -41,10 +42,25 @@ namespace audiere {
return 0;
}
+ mixer = NEXUS_AudioMixer_Open(NULL);
+ if (!mixer) {
+ ADR_LOG("Unable to open audio mixer\n");
+ NEXUS_AudioPlayback_Close(playback);
+ return 0;
+ }
+
+ NEXUS_AudioMixer_AddInput(mixer,
+ NEXUS_AudioPlayback_GetConnector(playback));
+
+ /* Connect DAC to mixer */
NEXUS_AudioOutput_AddInput(NEXUS_AudioDac_GetConnector(config.outputs.audioDacs[0]),
- NEXUS_AudioPlayback_GetConnector(playback));
+ NEXUS_AudioMixer_GetConnector(mixer));
- device = new NexusAudioDevice(playback, 44100, 4096);
+ /* Connect SPDIF to mixer */
+ NEXUS_AudioOutput_AddInput(NEXUS_SpdifOutput_GetConnector(config.outputs.spdif[0]),
+ NEXUS_AudioMixer_GetConnector(mixer));
+
+ device = new NexusAudioDevice(playback, mixer, 44100, 4096);
char buf[64];
@@ -52,6 +68,8 @@ namespace audiere {
setenv ("AUDIERE_NEXUS_PLAYBACK", buf, 1);
snprintf(buf, sizeof(buf), "%ld", (unsigned long)&device->m_playbackSettings);
setenv ("AUDIERE_NEXUS_PLAYBACK_SETTINGS", buf, 1);
+ snprintf(buf, sizeof(buf), "%ld", (unsigned long)mixer);
+ setenv ("AUDIERE_NEXUS_MIXER", buf, 1);
return device;
}
@@ -66,9 +84,10 @@ namespace audiere {
}
NexusAudioDevice::NexusAudioDevice(NEXUS_AudioPlaybackHandle playback,
+ NEXUS_AudioMixerHandle mixer,
int rate,
int buffer_size)
- : MixerDevice(rate), m_playback(playback), m_rate(rate)
+ : MixerDevice(rate), m_playback(playback), m_mixer(mixer), m_rate(rate)
{
m_buffer_size = buffer_size;
m_buffer = new char [buffer_size];
@@ -94,13 +113,21 @@ namespace audiere {
NEXUS_Platform_GetConfiguration(&config);
unsetenv ("AUDIERE_NEXUS_PLAYBACK");
+ unsetenv ("AUDIERE_NEXUS_MIXER");
NEXUS_AudioPlayback_Stop(m_playback);
#if NEXUS_NUM_HDMI_OUTPUTS
NEXUS_AudioOutput_RemoveAllInputs(NEXUS_HdmiOutput_GetAudioConnector(config.outputs.hdmi[0]));
#endif
+ NEXUS_AudioOutput_RemoveAllInputs(NEXUS_SpdifOutput_GetConnector(config.outputs.spdif[0]));
NEXUS_AudioOutput_RemoveAllInputs(NEXUS_AudioDac_GetConnector(config.outputs.audioDacs[0]));
+ NEXUS_AudioMixer_RemoveAllInputs(m_mixer);
+
+ NEXUS_AudioInput_Shutdown(NEXUS_AudioPlayback_GetConnector(m_playback));
+ NEXUS_AudioInput_Shutdown(NEXUS_AudioMixer_GetConnector(m_mixer));
+
NEXUS_AudioPlayback_Close(m_playback);
+ NEXUS_AudioMixer_Close(m_mixer);
BKNI_DestroyEvent(m_event);
delete [] m_buffer;
}