From 48ba544f37fb476b5b242232dc492e3fdec51409 Mon Sep 17 00:00:00 2001 From: Chris Tallon Date: Sat, 22 Apr 2006 12:33:57 +0000 Subject: [PATCH] New audio structures --- audio.cc | 1 + audio.h | 12 ++++++++++++ audiomvp.cc | 22 ++++++++++++++++------ 3 files changed, 29 insertions(+), 6 deletions(-) diff --git a/audio.cc b/audio.cc index 0066afa..0ce36dc 100644 --- a/audio.cc +++ b/audio.cc @@ -26,6 +26,7 @@ Audio::Audio() { if (instance) return; instance = this; + memset(&Aoffset, 0, sizeof(Aoffset)); } Audio::~Audio() diff --git a/audio.h b/audio.h index 44ee779..8144d97 100644 --- a/audio.h +++ b/audio.h @@ -25,6 +25,16 @@ #include "defines.h" #include "log.h" +typedef struct +{ + unsigned char frontleft; + unsigned char frontright; + unsigned char rearleft; + unsigned char rearright; + unsigned char center; + unsigned char lfe; +} audio_volume; + class Audio { public: @@ -72,6 +82,8 @@ class Audio UCHAR systemMute; UCHAR muted; int volume; + + audio_volume Aoffset; }; #endif diff --git a/audiomvp.cc b/audiomvp.cc index dbd5110..9ab5253 100644 --- a/audiomvp.cc +++ b/audiomvp.cc @@ -200,12 +200,22 @@ int AudioMVP::setVolume(int tvolume) tvolume = 20 - tvolume; - unsigned long vol = (tvolume << 24) | (tvolume << 16); - - Log::getInstance()->log("Audio", Log::DEBUG, "%lx", vol); - Log::getInstance()->log("Audio", Log::DEBUG, "%i", tvolume); - - if (ioctl(fdAudio, AV_SET_AUD_VOLUME, &vol) != 0) return 0; + audio_volume Avolume; + Avolume.frontleft = tvolume + Aoffset.frontleft; + Avolume.frontright = tvolume + Aoffset.frontright; + Avolume.rearleft = tvolume + Aoffset.rearleft; + Avolume.rearright = tvolume + Aoffset.rearright; + Avolume.center = tvolume + Aoffset.center; + Avolume.lfe = tvolume + Aoffset.lfe; + + if (ioctl(fdAudio, AV_SET_AUD_VOLUME, &Avolume) != 0) return 0; + +// unsigned long vol = (tvolume << 24) | (tvolume << 16); +// +// Log::getInstance()->log("Audio", Log::DEBUG, "%lx", vol); +// Log::getInstance()->log("Audio", Log::DEBUG, "%i", tvolume); + +// if (ioctl(fdAudio, AV_SET_AUD_VOLUME, &vol) != 0) return 0; return 1; } -- 2.39.5