Embodiment
Embodiment 1.Control of a kind of channel volume and the synthetic method for controlling volume of general volume control are as Fig. 1~shown in Figure 2.
It may further comprise the steps:
(1) creates the channel structure, each channel is provided with volume control Channelaudio circuit separately, make each channel volume output balanced;
(2) general volume control Vol circuit is set, to control the volume of all channels simultaneously;
(3) make the scope of channel volume control Channelaudio be general volume control Vol positive and negative half, that is the scope of channel volume control Channelaudio be general volume control Vol negative half to just half, guarantee that channel volume control Channelaudio just is used for the equilibrium of each channel volume output;
(4) adopt the weighted mode synthetic channel volume control Channelaudio and general volume control Vol;
(5) output of the volume after will synthesizing.
In the present embodiment, the initial value of general volume is half of max volume, that is Vmax/2, and the initial value of channel volume is 10% of a max volume.When the user determines the sound accompaniment of certain is Tvol, and then channel volume control Channelaudio is Tvol-Vmax/2.After accomplishing the setting up, after this during switching channels, volume output be Vol+Channelaudio just, and this is the result after synthesizing.Simultaneously, when the value of Channelaudio+Vol was excessive or too small, being provided with in volume had maximum to judge to guarantee that output can not make mistakes in the function.
Quiet control is still realized by general volume control circuit.
Function of automatically cutting off when present embodiment also is provided with weak signal is to eliminate the weak signal noise, as rustle or the like.
The source code of present embodiment is as follows:
/*,、*/#include<stdio.h〉#include<string.h〉#include"stddefs.h"/*c */#include"stevt.h"#include"stlite.h"/*os20 */#include"stwtk.h"#include"appltype.h"#include"pti.h" /*pti */#include"stdenc.h"#include"stvtg.h"#include"stavmem.h"#include".. \ stvid \ videodrv.h"#include"stvid.h"#include"staud.h" /**/#include"ste2p.h"#include"sttbx.h"#include"report.h"#include"symbol.h" /**/#include"aud_reg.h"#include"stclkrv.h"#include"st_nvm.h"#include"vdbase.h"#include"usif.h" /**/#include"stflashd.h"#include"tt_table.h"#ifdef INTEGRATE_TELETEXT#include"ttext.h"#endif#include"app_data.h"#include"keymap.h"#ifdef TESTTOOL#include"testtool.h"#include<ctype.h〉#endif/*#if defined ( tylko11 ) ‖defined ( tylko12 ) #ifdef INTEGRATE_FRONT_PANEL_KEYBOARD#include"segdisp.h"#endif#endif*//*{{{module dependant includes*/#include"usifext.h"#include"osd_cmds.h"#include"drawuif.h"/***************/#include"stcommon.h"#include"stosd.h"#include"stevt.h"#include"stvtg.h"/***************//*#define USIF_DEBUG#define USIF_DEBUG */#define USE_EVENT_ /* *//*}}}*//*}}}*/#ifdef ZOOM_DEMOextern unsigned int SD_Frame ( void ) ; #endif/*LP comment-11/09/00-CVBS exports */#define LIGHT_GREEN#define SOFTWARE_UPDATE_ID " 2.3.0 "/* typedef struct{
U8 SignalStrength;
U32 SignalQuality;
U32 BitErrorRate; SIGNALINFO; SIGNALINFO agcinfo; Gjh add for signal info later use* // * * LP added on 22/10/00 * adopts the STTBX function as output print function */#define ENABLE_STAPI_ENVIRONMENTenum{ INSTALLATION_MENU_ITEM, TRANSPONDER_MENU_ITEM}; Extern STWTK_Button_t TvButton, RadioButton, LanButton, SetupButton; Extern STOSD_Color_t backgroundColor; Extern STOSD_Color_t backcolor; #ifdef VIDEO_PES_BUFFERINGextern boolean DisableVPesInjection (void); Extern boolean EnableVPesInjection (pid_t NewVideopid); #endifextern void OSD_FadeOutRegion (STOSD_RegionHandle_t Handle, U16 Delay); Extern U32 GetDisplayedVideoPictureAddress (void); BOOLEAN GetmpegEnableAudStatus (void); / * MPEG2 audio decoder control */BOOLEAN GetmpegEnableVidStatus (void); Static BOOLEAN bEnableVideo=FALSE; Static BOOLEAN bEnableAudio=FALSE; / * LP-260700-comprises channel conversion information */STVID_PictureParams_t VidParamsU8 TempFR; / * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * mxh6/24/2002*************************************/static semaphore_t stosd_VSync; Enum{ VSYNCSIG_NONE, VSYNCSIG_TOP, VSYNCSIG_BOTTOM, VSYNCSIG_BOTH}; Static unsigned int vsyncSignalMode=VSYNCSIG_BOTH; /***************************************************************************//************************************************************************//**/U8 Audiomode=1 /**/U8 Channelaudio=0 /*-3030*/U8 Vol=40; The general volume control of/* */int TestVideoPid; Int TestAudioPid; Int TestAudioPid0; Int TestPcrPid; Int TestTransponderNo; Int VideoPid; Int AudioPid; Int AudioPid1; Int PcrPid; Int TransponderNo; Int EpgFlag; Int RadioEpgFlag; Int iepgProgNo; U16 RecallNumber, RadioRecallNumber; U16 TestTransfreq; U16 TestSymrate; U16 LasterProgramNo=0; U16 RaidoLasterProgramNo; U16 ATransfreq; U16 ASymrate; U8 DefaultSetupflag=0; Extern U32 PidAddr; Extern U32 RadioPidAddress; Extern U32 RaidoServerAddress; Extern U32 ServerAddress; Extern U16 RealNumberStored; Extern U16 RadioRealNumberStored; Extern U16 FlashPid[TVProgramArray]; Extern U16 RadioFlashPid[RadioProgramArray]; Extern U16 RadioCount; Extern U16 PCount; U16 RadioPmtCount; U16 TVPmtCount; Extern U16 Transfreq_t; Extern U16 Transfreq_tfirst; U16 Programsseacrhsucess; U16 Programsseacrhsingal; Extern U16 RACount; Extern U16 CurrentProgNo; Extern U16 CurrentRadioProgNo; Extern U16 TVFlashPid[TVProgramArray]; Extern U16 RadFlashPid[RadioProgramArray]; Extern U8 RadioServeData[200] [MAX_SERVICE_NAME_LENGTH]; / * */extern U8 ServeData[200] [MAX_SERVICE_NAME_LENGTH]; Extern U8 existed; Extern EPG_NOWNEXTDATA_T Epg_InfoNowNext[EPG_NOW_PROGRAM_NUM]; Extern U8 TotalCount; Extern U8 writingflag; Extern int iItemOff; Extern int tempkeyread; Extern int TVCount; Extern int FirstPlayFlag; Extern int RadioAstROMStoringValidMapping[RADIO_SIZE_NVM_RSVM]; Extern int Epgweaksingal; Extern U8 SignalHD; Extern BYTE astROMStoringValidMapping[SIZE_NVM_RSVM]; Extern BYTE ProgramUpFlag; Extern U8 weak; U8 SignalCA=0; Extern int Temp_To_Play; Extern int Sdttm; Extern int iTypeFlag; / * 1 manual*/extern BOOLEAN GrabtableStatus; Extern BYTE TempStruct[20]; BOOL No_Signal_Flag=FALSE; U8 InfoLoopFlag=0; Typedef U32 STWDG_timer_t; STWDG_timer_t Diaplay_Timer, TimingPlay_Timer; Int Temp_Time[3]; Int Date_Time_Flag; Int Date_Time_destory; U8 bMenuStatus=0; / * menu display on screen, so some clear action should not be done* // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */TRANSPONDER_INFO_STRUCT * pstTransponderInfoTemp; PROG_INFO_STRUCT * pstProgInfoTemp; Int EPGItemSelected; Extern U8 bTV; U8 Modeselect=1; Extern U8 ActivePin; U8 TimingP=0; Task_t * UARTTask; Task_t * GetEitSchedule_CurrentTask; Extern clock_t Time_For_Start_2_Write_Flash; Extern U8 Audmodesel; / * BK-lowpower mode*/U8 lowpower_on=0; U8 freeze_t=0; / * freeze_t=1 for freeze ok*/extern U8 Language; Extern char smessage[] [120]; Extern char smenu[] [40]; Extern int TVNoofCurrTS; Extern void LPM_Init (void); Static slot_t
slotVideo =PTI_INVALID_SLOT,
slotAudio =PTI_INVALID_SLOT,
slotPcr =PTI_INVALID_SLOT;task_t *ptidUsifTask;task_t *ptidNvmSlaveTask;task_t *ptidDbaseTaskId;task_t *ptidTunerTask;task_t *ptidSectionTaskId;static message_queue_t?*pstUsifMsgQueue;static message_queue_t?*pstDbaseMsgQueue;static BOOLEAN?bDisplayStartupBanner=FALSE;static?semaphore_t?stvid_evt;/*TMTM*/#if?defined(USE_STBLAST)extern?BOOLEAN BlastTxOn;#endif#if?defined(tylko11)‖defined(tylko12)#ifdef?INTEGRATE_FRONT_PANEL_KEYBOARDtask_t *ptidSEGDISPTask;extern?void?DVBSegdispProcess(void*pvParam);int?iPrevProgNo=0;#endif#endif#ifdef BUILD_FOR_MICO_BOARD
#define POWER?LED_PIO_ADDRESS PIO_4_BASE_ADDRESS
#define STANDBY_LED_PIO_ADDRESS PIO_1_BASE_ADDRESS
#define STANDBY_LED_PIN 0x80 /*PIO1.7*/
#define POWER_LED_PIN 0x80 /*PIO4.7*/
#define DISABLE_POWER_LED \
*((volatile?BYTE*)(POWER_LED_PIO_ADDRESS+PIO_SET_OFFSET))=POWER_LED_PIN;
#define ENABLE_POWER_LED \
*((volatile?BYTE*)(POWER_LED_PIO_ADDRESS+PIO_CLR_OFFSET))=POWER_LED_PIN;
#define?DISABLE_STANDBY_LED \
*((volatile?BYTE*)(STANDBY_LED_PIO_ADDRESS+PIO_SET_OFFSET))=STANDBY_LED_PIN;
#define?ENABLE_STANDBY_LED \
*((volatile?BYTE*)(STANDBY_LED_PIO_ADDRESS+PIO_CLR_OFFSET))=STANDBY_LED_PIN;#endif/*?====================================================================== Function?to?set?the?audio?volume?of?each?channel?separately.
Takes?a?number?in?the?range?32..63,where
63?is?the?maximum?volume,and?32?is?silent.
In terms of dB the min attenuation is 4dB is provided with the volume function of left and right acoustic channels separately.According to test, register value is between 32-63, can hear sound,=====================================================================*/void mpeg_set_audio_volume_LR (U16 left_volume, U16 right_volume) { STAUD_Attenuation_t Attenuation; If (left_volume〉63)
Left_volume=63; Attenuation.Left=63-left_volume; / * converts attenuation */if (right_volume〉63) to
Right_volume=63; Attenuation.Right=63-right_volume; / * convert to attenuation * // * Eraser bug fix:Call to STAUD fn to set the volume*With 0.9.1 the two channels cannot be set independently*With the use of STSYS_WriteRegDev () the ABS register was corrupted*giving rise to a wrong audio bit buffer filling-up*/STAUD_SetAttenuation (AUDHndl, Attenuation); }/* } } } * // *=========================================================================Function to reset the audio volume of each channel separately.
Takes?a?number?in?the?range?0..16,where
16?is?the?maximum?volume,and?O?is?silent
The default is 16 left and right sides volumes function that resets, reset values be set be 16=========================================================================*/void mpeg_reset_audio_volume_LR (U16 left_volume, U16 right_volume)
STAUD_Attenuation_t?Attenuation;
if(left_volume>63)
left_volume=63;
Attenuation.Left=63-left_volume; /*Convert?to?attenuation */
if(right_volume>63)
right_volume=63;
Attenuation.Right=63-right_volume; / * Convert to attenuation */STAUD_SetAttenuation (AUDHndl, Attenuation); STAUD_Mute (AUDHndl, TRUE, TRUE); }/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * playing programs stop function * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */void TerminateRadioChannel (U16 lasterprongramno)
int?temppid;
if(Epgweaksingal==0)
return;
/*temppid=1+lasterprongramno*ProgramParameterArray;
ALnbFlag=RadioFlashPid[temppid];*/
temppid=1+lasterprongramno*ProgramParameterArray;
VideoPid=RadioFlashPid[temppid];
temppid=2+lasterprongramno*ProgramParameterArray;
AudioPid=RadioFlashPid[temppid];
temppid=3+lasterprongramno*ProgramParameterArray;
PcrPid=RadioFlashPid[temppid];
Temppid=4+lasterprongramno*ProgramParameterArray; / * obtain again volume control value */
Channelaudio=RadioFlashPid[temppid];
if(slotAudio<PTI_INVALID_SLOT&&AudioPid!=DEMUX_INVALID_PID)
{
Pti_audio_dma_state (discard_data); / * audio reset */
pti_audio_dma_reset();/* aud_stop(true); */
if(pti_clear_pid(slotAudio)==true)
{
#ifdef USIF_DEBUG
do_report(severity_error,"couldn′t?clear?AUD?PID[%X]\n",pidCurAudio);
#endif
return;
}
if(pti_deallocate_dynamic_slot(slotAudio)==true)
{
#ifdef USIF_DEBUG
do_report(severity_error,"couldn′t?clear?AUDIO?Slot(%d)[%X]\n",
slotAudio,
pidCurAudio);
#endif
return;
}
}
/*Added?by?LP?on?13/03/01*/
slotAudio=PTI_INVALID_SLOT;
AudioPid=DEMUX_INVALID_PID;
if(PcrPid!=DEMUX_INVALID_PID)
{
/*
*clear?the?PCR?pid?if?any?existing
*/
if(pti_clear_pcr_pid()==true)
{
#ifdef USIF_DEBUG
do_report(severity_error,"couldn't?clear?PCR?PID[%X]\n",pidCurPcr);
#endif
return;
}
PcrPid=DEMUX_INVALID_PID;
SlotPcr=PTI_INVALID_SLOT; }/* * revises video, voice-grade channel change */#ifdef VIDEO_PES_BUFFERING
if(DisableVPesInjection())
{
#ifdef USIF_DEBUG
do_report(severity_error,"Couldn't?disable?Video?Pes?injection\n");
#endif
return;
}#else if(slotVideo<PTI_INVALID_SLOT&&VideoPid!=DEMUX_INVALID_PID) {
pti_video_dma_state(discard_data);
pti_video_dma_reset();
vid_stop(true,true),
if(pti_deallocate_dynamic_slot(slotVideo)==true)
{
#ifdef USIF_DEBUG
do_report(severity_error,"couldn't?clear?VIDEO?Slot(%d)and/or?PID[%X]\n",
slotVideo,
pidCurVideo);
#endif
return;
}
VideoPid=DEMUX_INVALID_PID;
slotVideo=PTI_INVALID_SLOT,
} #endif/*VIDEO_PES_BUFFERED*/#ifdef USIF_DEBUG
do_report(severity_info,"TerminateChannel()done\n");#endif
#ifdef INTEGRATE_TELETEXT
if(pidCurPvt!=DEMUX_INVALID_PID) /*1fff*/
{
ttx_vbi_stop();
ttx_vbi_close();
pidCurPvt=DEMUX_INVALID_PID;
}
#endif}/* user interface initialization process */BOOLEAN DVBUsifInit (void) {/* extern void OSD_SetFilter (STOSD_RegionHandle_t Handle, STOSD_FilterType_tFilter); Extern void OSD_SetMixWeight (STOSD_RegionHandle_t Handle, U8 MixWeight); */BOOLEAN bError=FALSE; / * do_report (severity_info, " USIF Driver version[%s] n ", SOFTWARE_UPDATE_ID); */
if(SEGControlInit()==TRUE)
{
do_report(severity_error,"Failed?to?initialise?segment?display\n");
bError=TRUE;
}#if?0/*to?be?used?when?external?interrupt?is?used?to?wake?up?the?chip
from?power?down?mode*/
ConfigPIOLowPower();#endif
/*
DISABLE_STANDBY_LED;
ENABLE_POWER_LED;*/
/*tuner_module_state = UNLOCKED;*//*see?usifglob.c*/
dbase_module_state = DBASE_WAITING_FOR_START_SIGNAL;
epg_module_state= EPG_NOT_ACTIVE;
/*LP?added?on?13/03/01-Creation?of?the?NEW_FRAME_EVENT
semaphore?for?smooth?channel?switching */#ifdef?USE_EVENT
semaphore_init_fifo_timeout(&stvid_evt,0);#endif
/*---Finally?set?the?device?to?be?in?standby?mode---*/
psemDisplayBufferAccessLock=semaphore_create_fifo(1);
if(psemDisplayBufferAccessLock==NULL)
{
do_report(severity_error,"Unable?to?allocate?semaphore?in?usif_init\n");
return?TRUE;
}
/*choose?the?message?pools?for?mailbox?communications*/
if(symbol_enquire_value("usif_queue",(void**)&pstUsifMsgQueue))
{
do_report(severity_error,"Cant?find?USIF?message?queue\n");
return TRUE;
}
if(symbol_enquire_value("dbase_queue",(void**)&pstDbaseMsgQueue))
{
do_report(severity_error,"Cant?find?DBASE?message?queue\n");
return TRUE;
}
/*
*check?whether?nvm_control?is?registered?or?not.this?is?done
●by?default?when?we?call?nvm_init
*/
bNvmBoxInfoPresent=FALSE;
if(symbol_enquire_value("nvm_control",(void**)&idNvmBoxInfold))
{
do_report(severity_info,"NVM_CONTROL?symbol?not?found.keeping?box_info?inDRAM...\n");
}
else
{
bNvmBoxInfoPresent=TRUE;
if(NVMAccess("nvm_box_inf",sizeof(BOX_INFO_STRUCT),&idNvmBoxInfoId))
{
/*
*Failed?to?allocate?the?BoxInfo?size?of?data?block?in
*NVM
*/
bNvmBoxlnfoPresent=FALSE;
do_report(severity_error,"BOX_INFO?Initialisation?in?NVM...\n");
}
}
if(bNvmBoxInfoPresent==FALSE)
{
if((pstBoxInfo=(BOX_INFO_STRUCT*)malloc(sizeof(BOX_INFO_STRUCT)))==NULL)
{
do_report(severity_error,"Failed?to?allocate?Memory?for?BOX_INFO(Size=%d)\n",sizeof(BOX_INFO_STRUCT));
abort();
}
/*
*initialise?the?box_info
*/
pstBoxInfo->cValidity =FALSE;
}
else
{
/*
*find?the?data_block?start?address?based?on?the?symbol_id
*/
pstBoxInfo=(BOX_INFO_STRUCT*)NVMGetDataAddress(idNvmBoxInfoId);
}
if(pstBoxInfo->cValidity==FALSE)
{
bDisplayStartupBanner=TRUE;
pstBoxInfo->current_box_state =BOX_POWERED_ON;
pstBoxInfo->stLastWatchingProg .uiWord32=0;
pstBoxInfo->bSupplyLnb =FALSE;#ifndef?BUILD_FOR_DVBC
pstBoxInfo->aiLnbFreq[0][0] =DEFAULT_LNB_FREQ;
pstBoxInfo->aiLnbFreq[0][1] =DEFAULT_LNB_FREQ;
pstBoxInfo->aiLnbFreq[1][0] =DEFAULT_LNB_FREQ;
pstBoxInfo->aiLnbFreq[1][1] =DEFAULT_LNB_FREQ;#endif
pstBoxInfo->ChannelaudioLevel =MIN_VOL_LEVEL;
pstBoxInfo->ChannelaudioBalance =VOL_BALANCE_CENTRE;
pstBoxInfo->bMuteState =FALSE;
}
if(pstBoxInfo->ChannelaudioBalance<VOL_BALANCE_LEFT_MAX‖
pstBoxInfo->ChannelaudioBalance>VOL_BALANCE_RIGHT_MAX)
pstBoxlnfo->ChannelaudioBalance=VOL_BALANCE_CENTRE;/* if(pstBoxInfo->ChannelaudioLevel<MIN_VOL_LEVEL‖
pstBoxInfo->ChannelaudioLevel>MAX_VOL_LEVEL)*/
PstBoxInfo-〉ChannelaudioLevel=Channelaudio; / * initialization channel volume */
CCurVolLevel=pstBoxInfo-〉ChannelaudioLevel+Vol; / * channel volume+general volume */
cCurVolBalance =pstBoxInfo->ChannelaudioBalance;
bAudioMuteState=FALSE;
Mpeg_set_audio_volume_LR (cCurVolLevel, cCurVolLevel); / * does quiet processing earlier in that volume when control is set, when preventing that television set from sending " bang bang " sound * // * initialization, be provided with earlier sound channel be in clean sound state */
{
MILLI_DELAY(500);
STAUD_Mute(AUDHndl,FALSE,FALSE);
Unmute_audio();
}
UpdateBoxVolInfo(cCurVolLevel,cCurVolBalance,bAudioMuteState); /*SetupLnbPower();*//*LP-300600-Latest?Lnb?power?setting?is?recovered*/#if!defined(maly)&&defined(tylko11)‖defined(tylko12) STTBX_Print(("VIDEO?Matrix?initialisation\n"));
if(video_matrix_init())
{
STTBX_Print(("video_matrix_init()failed\n"));
} else
{
STTBX_Print(("video_matrix_init()=OK\n"));
}
SetVideoOutputFormat(pstBoxInfo->ucScartInfo);/*gjh?add?for?tvvcr?modulator?channel?set?init2002.12.14*/
if(RFmodulator_init())
{
STTBX_Print(("RFmodulator_init()failed\n"));
}
else
{
STTBX_Print(("RFmodulator_init()=OK\n"));
}#endif
Embodiment 1 had both used the control of channel volume, to guarantee the equilibrium of each channel volume output; Keep the control of general volume again,, need volume with all channels all transfer to when very little as televiewing midnight to solve the problem that the user need control the volume of all channels simultaneously.Its adjusted is very simple.It can be widely used in the various television sets.