diff options
author | Luo Jinghua <sunmoon1997@gmail.com> | 2009-12-11 15:30:15 +0800 |
---|---|---|
committer | Luo Jinghua <sunmoon1997@gmail.com> | 2009-12-11 15:30:15 +0800 |
commit | 08b003df39eda0f3ceb201e87fd6d5fc3d036aa5 (patch) | |
tree | ddfe852b05b4d13e1409d23f71b7a5dd1bc95356 /src | |
parent | 256c3ec34dbdced20e992c89fa6d1e2f2788fdda (diff) |
nexus: supports hdmi audio output
Diffstat (limited to 'src')
-rw-r--r-- | src/device_nexus.cpp | 40 | ||||
-rw-r--r-- | src/device_nexus.h | 3 |
2 files changed, 26 insertions, 17 deletions
diff --git a/src/device_nexus.cpp b/src/device_nexus.cpp index 670a38e..9e89e76 100644 --- a/src/device_nexus.cpp +++ b/src/device_nexus.cpp @@ -29,10 +29,8 @@ namespace audiere { NexusAudioDevice* NexusAudioDevice::create(const ParameterList& parameters) { bool initPlatform = parameters.getBoolean("initPlatform", false); - BKNI_EventHandle event; NEXUS_PlatformConfiguration config; NEXUS_AudioPlaybackHandle playback; - NEXUS_AudioPlaybackStartSettings playbackSettings; NexusAudioDevice *device; if (initPlatform) @@ -49,20 +47,14 @@ namespace audiere { NEXUS_AudioOutput_AddInput(NEXUS_AudioDac_GetConnector(config.outputs.audioDacs[0]), NEXUS_AudioPlayback_GetConnector(playback)); - NEXUS_AudioPlayback_GetDefaultStartSettings(&playbackSettings); - playbackSettings.sampleRate = 44100; - playbackSettings.bitsPerSample = 16; - playbackSettings.signedData = true; - playbackSettings.stereo = true; - playbackSettings.dataCallback.callback = DataCallback; - playbackSettings.dataCallback.param = 0; + device = new NexusAudioDevice(playback, 44100, 4096); - BKNI_CreateEvent(&event); - device = new NexusAudioDevice(playback, event, 44100, 4096); - - playbackSettings.dataCallback.context = device; - NEXUS_AudioPlayback_Start(playback, &playbackSettings); + char buf[64]; + snprintf(buf, sizeof(buf), "%ld", (unsigned long)playback); + setenv ("AUDIERE_NEXUS_PLAYBACK", buf, 1); + snprintf(buf, sizeof(buf), "%ld", (unsigned long)&device->m_playbackSettings); + setenv ("AUDIERE_NEXUS_PLAYBACK_SETTINGS", buf, 1); return device; } @@ -77,13 +69,24 @@ namespace audiere { } NexusAudioDevice::NexusAudioDevice(NEXUS_AudioPlaybackHandle playback, - BKNI_EventHandle event, int rate, int buffer_size) - : MixerDevice(rate), m_event(event), m_playback(playback), m_rate(rate) + : MixerDevice(rate), m_playback(playback), m_rate(rate) { m_buffer_size = buffer_size; m_buffer = new char [buffer_size]; + + NEXUS_AudioPlayback_GetDefaultStartSettings(&m_playbackSettings); + m_playbackSettings.sampleRate = 44100; + m_playbackSettings.bitsPerSample = 16; + m_playbackSettings.signedData = true; + m_playbackSettings.stereo = true; + m_playbackSettings.dataCallback.callback = DataCallback; + m_playbackSettings.dataCallback.param = 0; + m_playbackSettings.dataCallback.context = this; + + BKNI_CreateEvent(&m_event); + NEXUS_AudioPlayback_Start(playback, &m_playbackSettings); } @@ -93,7 +96,12 @@ namespace audiere { NEXUS_PlatformConfiguration config; NEXUS_Platform_GetConfiguration(&config); + unsetenv ("AUDIERE_NEXUS_PLAYBACK"); + 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_AudioDac_GetConnector(config.outputs.audioDacs[0])); NEXUS_AudioPlayback_Close(m_playback); BKNI_DestroyEvent(m_event); diff --git a/src/device_nexus.h b/src/device_nexus.h index feea1b3..2ff3a14 100644 --- a/src/device_nexus.h +++ b/src/device_nexus.h @@ -18,6 +18,7 @@ #include "nexus_stc_channel.h" #include "nexus_pid_channel.h" #include "nexus_parser_band.h" +#include "nexus_hdmi_output.h" namespace audiere { @@ -28,7 +29,6 @@ namespace audiere { private: NexusAudioDevice(NEXUS_AudioPlaybackHandle playback, - BKNI_EventHandle event, int rate, int buffer_size); ~NexusAudioDevice(); @@ -40,6 +40,7 @@ namespace audiere { private: BKNI_EventHandle m_event; NEXUS_AudioPlaybackHandle m_playback; + NEXUS_AudioPlaybackStartSettings m_playbackSettings; int m_buffer_size; char* m_buffer; |