SoundEffect.c
资源名称:mmi.rar [点击查看]
上传用户:lqx1163
上传日期:2014-08-13
资源大小:9183k
文件大小:64k
源码类别:
MTK
开发平台:
C/C++
- /*****************************************************************************
- * Copyright Statement:
- * --------------------
- * This software is protected by Copyright and the information contained
- * herein is confidential. The software may not be copied and the information
- * contained herein may not be used or disclosed except with the written
- * permission of MediaTek Inc. (C) 2005
- *
- * BY OPENING THIS FILE, BUYER HEREBY UNEQUIVOCALLY ACKNOWLEDGES AND AGREES
- * THAT THE SOFTWARE/FIRMWARE AND ITS DOCUMENTATIONS ("MEDIATEK SOFTWARE")
- * RECEIVED FROM MEDIATEK AND/OR ITS REPRESENTATIVES ARE PROVIDED TO BUYER ON
- * AN "AS-IS" BASIS ONLY. MEDIATEK EXPRESSLY DISCLAIMS ANY AND ALL WARRANTIES,
- * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE IMPLIED WARRANTIES OF
- * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE OR NONINFRINGEMENT.
- * NEITHER DOES MEDIATEK PROVIDE ANY WARRANTY WHATSOEVER WITH RESPECT TO THE
- * SOFTWARE OF ANY THIRD PARTY WHICH MAY BE USED BY, INCORPORATED IN, OR
- * SUPPLIED WITH THE MEDIATEK SOFTWARE, AND BUYER AGREES TO LOOK ONLY TO SUCH
- * THIRD PARTY FOR ANY WARRANTY CLAIM RELATING THERETO. MEDIATEK SHALL ALSO
- * NOT BE RESPONSIBLE FOR ANY MEDIATEK SOFTWARE RELEASES MADE TO BUYER'S
- * SPECIFICATION OR TO CONFORM TO A PARTICULAR STANDARD OR OPEN FORUM.
- *
- * BUYER'S SOLE AND EXCLUSIVE REMEDY AND MEDIATEK'S ENTIRE AND CUMULATIVE
- * LIABILITY WITH RESPECT TO THE MEDIATEK SOFTWARE RELEASED HEREUNDER WILL BE,
- * AT MEDIATEK'S OPTION, TO REVISE OR REPLACE THE MEDIATEK SOFTWARE AT ISSUE,
- * OR REFUND ANY SOFTWARE LICENSE FEES OR SERVICE CHARGE PAID BY BUYER TO
- * MEDIATEK FOR SUCH MEDIATEK SOFTWARE AT ISSUE.
- *
- * THE TRANSACTION CONTEMPLATED HEREUNDER SHALL BE CONSTRUED IN ACCORDANCE
- * WITH THE LAWS OF THE STATE OF CALIFORNIA, USA, EXCLUDING ITS CONFLICT OF
- * LAWS PRINCIPLES. ANY DISPUTES, CONTROVERSIES OR CLAIMS ARISING THEREOF AND
- * RELATED THERETO SHALL BE SETTLED BY ARBITRATION IN SAN FRANCISCO, CA, UNDER
- * THE RULES OF THE INTERNATIONAL CHAMBER OF COMMERCE (ICC).
- *
- *****************************************************************************/
- /*****************************************************************************
- *
- * Filename:
- * ---------
- * SoundEffect.c
- *
- * Project:
- * --------
- * MAUI
- *
- * Description:
- * ------------
- * This file is intends to setup sound effect.
- *
- * Author:
- * -------
- * Tim Chen
- *
- *============================================================================
- * HISTORY
- * Below this line, this part is controlled by PVCS VM. DO NOT MODIFY!!
- *------------------------------------------------------------------------------
- * $Log$
- *
- * removed!
- * removed!
- *
- *
- * removed!
- * removed!
- *
- *
- * removed!
- * removed!
- *
- *
- * removed!
- * removed!
- *
- *
- * removed!
- * removed!
- *
- *
- * removed!
- * removed!
- *
- *
- * removed!
- * removed!
- *
- *
- * removed!
- * removed!
- *
- *
- * removed!
- * removed!
- *
- *
- * removed!
- * removed!
- *
- *
- * removed!
- * removed!
- *
- *
- * removed!
- * removed!
- *
- *
- * removed!
- * removed!
- *
- *
- * removed!
- * removed!
- *
- *
- * removed!
- * removed!
- *
- *
- * removed!
- * removed!
- *
- *
- * removed!
- * removed!
- *
- *
- * removed!
- * removed!
- *
- *
- *------------------------------------------------------------------------------
- * Upper this line, this part is controlled by PVCS VM. DO NOT MODIFY!!
- *============================================================================
- ****************************************************************************/
- #include "MMI_features.h"
- #include "StdC.h"
- #include "L4Dr1.h"
- #include "L4Dr.h"
- #include "wgui_categories.h"
- #include "wgui_categories_inputs.h"
- #include "SettingDefs.h"
- #include "SettingsGdcl.h"
- #include "settingstructs.h"
- #include "settinggprots.h"
- #include "ProtocolEvents.h"
- #include "NVRAMType.h"
- #include "NVRAMProt.h"
- #include "NVRAMEnum.h"
- #include "CommonScreens.h"
- #include "SettingProt.h"
- #include "SettingProfile.h"
- #include "SoundEffect.h"
- #include "Audio3DEffect.h"
- #include "mdi_datatype.h"
- #include "mdi_audio.h"
- #include "DebugInitDef.h"
- #if defined(__MMI_AUDIO_EQUALIZER__)
- #include "ProfilesEnum.h"
- #endif
- #ifdef __MMI_SOUND_EFFECT__
- #if defined(__MMI_AUDIO_EQUALIZER__)
- audio_equalizer_struct g_settings_audio_equalizer;
- static U16 selected_audio_equalizer_index = 0;
- #endif /* defined(__MMI_AUDIO_EQUALIZER__) */
- #ifdef __MMI_EDITABLE_AUDIO_EQUALIZER__
- #ifdef MMI_ON_HARDWARE_P
- #include "nvram_default_audio.h"
- #endif
- extern equalizer_setting_info g_audio_equalizer_current_setting_info;
- extern float one_pixel_represents;
- void mmi_settings_audio_equalizer_adjust_values_for_editor(audio_equalizer_struct *);
- static UI_character_type name_text_editor_buffer[SETTING_NAME_MAX_LEN];
- U16 setting_name_edit_option_highlighted_item_text;
- BOOL g_audio_equalizer_setting_modified = FALSE;
- extern U16 g_audio_equalizer_scrollable_ht, g_audio_equalizer_unit_scroll;
- extern void mmi_aud_eq_init_image_specific_vals(void);
- #endif /* __MMI_EDITABLE_AUDIO_EQUALIZER__ */
- #endif /* __MMI_SOUND_EFFECT__ */
- audio_mic_volume_struct g_settings_audio_mic_volume;
- /*****************************************************************************
- * FUNCTION
- * InitSoundEffect
- * DESCRIPTION
- * This function is for initializing the Sound efeects application.
- * PARAMETERS
- * void
- * RETURNS
- * void
- *****************************************************************************/
- void InitSoundEffect(void)
- {
- #ifdef __MMI_SOUND_EFFECT__
- /*----------------------------------------------------------------*/
- /* Local Variables */
- /*----------------------------------------------------------------*/
- /*----------------------------------------------------------------*/
- /* Code Body */
- /*----------------------------------------------------------------*/
- SetHiliteHandler(MENU_SETTING_SOUND_EFFECT, mmi_settings_sound_effect_highlight_hdlr);
- #if defined(__MMI_AUDIO_EQUALIZER__)
- SetHiliteHandler(MENU_SETTING_AUDIO_EQUALIZIER, mmi_settings_audio_equalizer_highlight_hdlr);
- SetHintHandler(MENU_SETTING_AUDIO_EQUALIZIER, mmi_settings_audio_equalizer_hint_hdlr);
- #endif /* defined(__MMI_AUDIO_EQUALIZER__) */
- #ifdef __MMI_EDITABLE_AUDIO_EQUALIZER__
- SetHiliteHandler(
- MENU_SETTING_AUDIO_EQUALIZER_SET_OPT_SELECT,
- mmi_settings_audio_equalizer_opt_select_highlight_hdlr);
- SetHiliteHandler(MENU_SETTING_AUDIO_EQUALIZER_SET_OPT_EDIT, mmi_settings_audio_equalizer_opt_edit_highlight_hdlr);
- SetHiliteHandler(
- MENU_SETTING_AUDIO_EQUALIZER_SET_OPT_RENAME,
- mmi_settings_audio_equalizer_opt_rename_highlight_hdlr);
- #endif /* __MMI_EDITABLE_AUDIO_EQUALIZER__ */
- #if defined(__MMI_AUDIO_EQUALIZER__)
- mmi_aud_eq_init_image_specific_vals();
- mmi_settings_read_audio_equalizer_from_nvram(&g_settings_audio_equalizer);
- mdi_audio_set_equalizer(g_settings_audio_equalizer.magnitude[g_settings_audio_equalizer.index]);
- #endif /* defined(__MMI_AUDIO_EQUALIZER__) */
- #endif /* __MMI_SOUND_EFFECT__ */
- mmi_settings_read_audio_mic_volume_from_nvram(&g_settings_audio_mic_volume);
- /* Init Audio 3D Effect */
- #ifdef __MMI_AUDIO_3D_EFFECT__
- mmi_aud_3d_effect_init();
- #endif
- }
- #ifdef __MMI_SOUND_EFFECT__
- #if defined(__MMI_AUDIO_EQUALIZER__)
- /*****************************************************************************
- * FUNCTION
- * mmi_settings_audio_equalizer_hint_hdlr
- * DESCRIPTION
- * This function is hint handler for equalizer menu item..
- * PARAMETERS
- * index [IN]
- * RETURNS
- * void
- *****************************************************************************/
- void mmi_settings_audio_equalizer_hint_hdlr(U16 index)
- {
- /*----------------------------------------------------------------*/
- /* Local Variables */
- /*----------------------------------------------------------------*/
- /*----------------------------------------------------------------*/
- /* Code Body */
- /*----------------------------------------------------------------*/
- memset((S8*) hintData[(index)], 0, MAX_SUB_MENU_SIZE);
- #ifdef __MMI_EDITABLE_AUDIO_EQUALIZER__
- pfnUnicodeStrcpy(
- (S8*) hintData[index],
- (S8*) g_settings_audio_equalizer.setting_name[g_settings_audio_equalizer.index]);
- #else /* __MMI_EDITABLE_AUDIO_EQUALIZER__ */
- pfnUnicodeStrcpy(
- (S8*) hintData[(index)],
- GetString((U16) (STR_ID_SETTING_AUDIO_EQUALIZER_SET_1 + g_settings_audio_equalizer.index)));
- #endif /* __MMI_EDITABLE_AUDIO_EQUALIZER__ */
- }
- /*****************************************************************************
- * FUNCTION
- * mmi_settings_audio_equalizer_highlight_hdlr
- * DESCRIPTION
- * This function is highlight handler for the Equalizer menu item.
- * PARAMETERS
- * void
- * RETURNS
- * void
- *****************************************************************************/
- void mmi_settings_audio_equalizer_highlight_hdlr(void)
- {
- /*----------------------------------------------------------------*/
- /* Local Variables */
- /*----------------------------------------------------------------*/
- /*----------------------------------------------------------------*/
- /* Code Body */
- /*----------------------------------------------------------------*/
- ChangeLeftSoftkey(STR_GLOBAL_OK, 0);
- ChangeRightSoftkey(STR_GLOBAL_BACK, 0);
- SetLeftSoftkeyFunction(mmi_settings_entry_audio_equalizer_list, KEY_EVENT_UP);
- SetRightSoftkeyFunction(GoBackHistory, KEY_EVENT_UP);
- SetKeyHandler(mmi_settings_entry_audio_equalizer_list, KEY_RIGHT_ARROW, KEY_EVENT_DOWN);
- SetKeyHandler(GoBackHistory, KEY_LEFT_ARROW, KEY_EVENT_DOWN);
- }
- /*****************************************************************************
- * FUNCTION
- * mmi_settings_entry_audio_equalizer_list
- * DESCRIPTION
- * This function is for entering the audio equalizer setting list screen.
- * PARAMETERS
- * void
- * RETURNS
- * void
- *****************************************************************************/
- void mmi_settings_entry_audio_equalizer_list(void)
- {
- #ifdef __MMI_EDITABLE_AUDIO_EQUALIZER__
- /*----------------------------------------------------------------*/
- /* Local Variables */
- /*----------------------------------------------------------------*/
- U8 *guiBuffer; /* Buffer holding history data */
- U16 gimagearray2[MAX_SUB_MENUS];
- U8 i;
- U16 nNumofItem; /* Stores no of children in the submenu */
- U16 ItemIcons[MAX_SUB_MENUS];
- /*----------------------------------------------------------------*/
- /* Code Body */
- /*----------------------------------------------------------------*/
- /* 1 Call Exit Handler */
- EntryNewScreen(SCR_ID_SETTING_AUDIO_EQUALIZER, NULL, mmi_settings_entry_audio_equalizer_list, NULL);
- /* 2 Get current screen to gui buffer for history purposes */
- guiBuffer = GetCurrGuiBuffer(SCR_ID_SETTING_AUDIO_EQUALIZER);
- /* 3. Retrieve no of child of menu item to be displayed */
- nNumofItem = g_settings_audio_equalizer.count + 1;
- SetParentHandler(MENU_SETTING_AUDIO_EQUALIZIER);
- for (i = 0; i < g_settings_audio_equalizer.count; i++)
- {
- memset((S8*) subMenuDataPtrs[i], 0, MAX_SUB_MENU_SIZE);
- pfnUnicodeStrncpy(
- (S8*) subMenuDataPtrs[i],
- (S8*) g_settings_audio_equalizer.setting_name[i],
- MAX_SUBMENU_CHARACTERS);
- }
- /* set the last menu item as "Restore Factory Defaults" */
- pfnUnicodeStrncpy(
- (S8*) subMenuDataPtrs[i],
- GetString(STR_ID_SETTING_AUDIO_EQUALIZER_REST_FACT_DEFAULT),
- MAX_SUBMENU_CHARACTERS);
- for (i = 0; i < nNumofItem; i++)
- {
- if (i == g_settings_audio_equalizer.index)
- {
- gimagearray2[i] = IMG_VICON;
- }
- else
- {
- gimagearray2[i] = IMG_PROFILES_NO_IMAGE;
- }
- ItemIcons[i] = IMG_PROFILES_NO_IMAGE;
- }
- RegisterHighlightHandler(mmi_settings_audio_equalizer_list_highlight_hdlr);
- ShowCategory73Screen(
- STR_ID_SETTING_AUDIO_EQUALIZER_CAPTION,
- GetRootTitleIcon(MENU_SETTING_SOUND_EFFECT),
- STR_GLOBAL_OPTIONS,
- 0,
- STR_GLOBAL_BACK,
- 0,
- nNumofItem,
- (U8 **) subMenuDataPtrs,
- (U16*) gimagearray2,
- ItemIcons,
- g_settings_audio_equalizer.index,
- guiBuffer,
- 0);
- SetRightSoftkeyFunction(GoBackHistory, KEY_EVENT_UP);
- SetKeyHandler(GoBackHistory, KEY_LEFT_ARROW, KEY_EVENT_DOWN);
- #else /* __MMI_EDITABLE_AUDIO_EQUALIZER__ */ /* if the editing of audio equalizer settings is not to be there */
- U8 *guiBuffer;
- U16 audio_equalizer_list_strings[] =
- {
- STR_ID_SETTING_AUDIO_EQUALIZER_SET_1,
- STR_ID_SETTING_AUDIO_EQUALIZER_SET_2,
- STR_ID_SETTING_AUDIO_EQUALIZER_SET_3,
- STR_ID_SETTING_AUDIO_EQUALIZER_SET_4,
- STR_ID_SETTING_AUDIO_EQUALIZER_SET_5,
- STR_ID_SETTING_AUDIO_EQUALIZER_SET_6,
- STR_ID_SETTING_AUDIO_EQUALIZER_SET_7,
- STR_ID_SETTING_AUDIO_EQUALIZER_SET_8
- };
- EntryNewScreen(SCR_ID_SETTING_AUDIO_EQUALIZER, NULL, mmi_settings_entry_audio_equalizer_list, NULL);
- guiBuffer = GetCurrGuiBuffer(SCR_ID_SETTING_AUDIO_EQUALIZER);
- SetParentHandler(MENU_SETTING_AUDIO_EQUALIZIER);
- RegisterHighlightHandler(mmi_settings_audio_equalizer_list_highlight_hdlr);
- ShowCategory11Screen(
- STR_ID_SETTING_AUDIO_EQUALIZER,
- GetRootTitleIcon(MENU_SETTING_SOUND_EFFECT),
- STR_GLOBAL_OK,
- IMG_GLOBAL_OK,
- STR_GLOBAL_BACK,
- IMG_GLOBAL_BACK,
- g_settings_audio_equalizer.count,
- audio_equalizer_list_strings,
- (U16) g_settings_audio_equalizer.index,
- guiBuffer);
- SetLeftSoftkeyFunction(mmi_settings_audio_equalizer_list_LSK_hdlr, KEY_EVENT_UP);
- SetRightSoftkeyFunction(GoBackHistory, KEY_EVENT_UP);
- SetKeyHandler(GoBackHistory, KEY_LEFT_ARROW, KEY_EVENT_DOWN);
- #endif /* __MMI_EDITABLE_AUDIO_EQUALIZER__ */
- }
- /*****************************************************************************
- * FUNCTION
- * mmi_settings_audio_equalizer_list_highlight_hdlr
- * DESCRIPTION
- * This function is highlight handler for the setting list screen.
- * PARAMETERS
- * index [IN]
- * RETURNS
- * void
- *****************************************************************************/
- void mmi_settings_audio_equalizer_list_highlight_hdlr(S32 index)
- {
- /*----------------------------------------------------------------*/
- /* Local Variables */
- /*----------------------------------------------------------------*/
- /*----------------------------------------------------------------*/
- /* Code Body */
- /*----------------------------------------------------------------*/
- selected_audio_equalizer_index = (U16) index;
- #ifdef __MMI_EDITABLE_AUDIO_EQUALIZER__
- if (index == g_settings_audio_equalizer.count) /* the case when the highlighted item is restore factory default */
- {
- ChangeLeftSoftkey(STR_GLOBAL_OK, IMG_GLOBAL_OK);
- SetLeftSoftkeyFunction(mmi_settings_audio_equalizer_restore_factory_default, KEY_EVENT_UP);
- SetKeyHandler(mmi_settings_audio_equalizer_restore_factory_default, KEY_RIGHT_ARROW, KEY_EVENT_DOWN);
- }
- else
- {
- ChangeLeftSoftkey(STR_GLOBAL_OPTIONS, IMG_GLOBAL_OPTIONS);
- SetLeftSoftkeyFunction(mmi_settings_entry_audio_equalizer_setting_options, KEY_EVENT_UP);
- SetKeyHandler(mmi_settings_entry_audio_equalizer_setting_options, KEY_RIGHT_ARROW, KEY_EVENT_DOWN);
- }
- #endif /* __MMI_EDITABLE_AUDIO_EQUALIZER__ */
- }
- /*****************************************************************************
- * FUNCTION
- * mmi_settings_audio_equalizer_list_LSK_hdlr
- * DESCRIPTION
- * This function is the LSK handler for the setting list screen.
- * PARAMETERS
- * void
- * RETURNS
- * void
- *****************************************************************************/
- void mmi_settings_audio_equalizer_list_LSK_hdlr(void)
- {
- /*----------------------------------------------------------------*/
- /* Local Variables */
- /*----------------------------------------------------------------*/
- /*----------------------------------------------------------------*/
- /* Code Body */
- /*----------------------------------------------------------------*/
- mmi_settings_select_audio_equalizer((S16) selected_audio_equalizer_index);
- DisplayPopup((PU8) GetString(STR_GLOBAL_DONE), IMG_GLOBAL_ACTIVATED, 1, UI_POPUP_NOTIFYDURATION_TIME, SUCCESS_TONE);
- DeleteScreenIfPresent(SCR_ID_SETTING_AUDIO_EQUALIZER);
- }
- /*****************************************************************************
- * FUNCTION
- * mmi_settings_read_audio_equalizer_from_nvram
- * DESCRIPTION
- * This function is for reading the NVRAM data for audio equalizer
- * PARAMETERS
- * audio_equalizer_p [?]
- * RETURNS
- * void
- *****************************************************************************/
- void mmi_settings_read_audio_equalizer_from_nvram(audio_equalizer_struct *audio_equalizer_p)
- {
- #ifdef MMI_ON_HARDWARE_P
- /*----------------------------------------------------------------*/
- /* Local Variables */
- /*----------------------------------------------------------------*/
- S16 error;
- /*----------------------------------------------------------------*/
- /* Code Body */
- /*----------------------------------------------------------------*/
- ReadRecord(NVRAM_EF_AUDIO_EQUALIZER_LID, 1, (void*)audio_equalizer_p, NVRAM_EF_AUDIO_EQUALIZER_SIZE, &error);
- #else /* MMI_ON_HARDWARE_P */
- audio_equalizer_p->count = MAX_EQUALIZER_NUM;
- audio_equalizer_p->index = 0;
- memset(audio_equalizer_p->magnitude, -100, MAX_EQUALIZER_NUM * 8);
- /* for testing purpose */
- audio_equalizer_p->magnitude[1][0] = 100;
- audio_equalizer_p->magnitude[1][1] = 60;
- audio_equalizer_p->magnitude[1][2] = 20;
- audio_equalizer_p->magnitude[1][3] = -20;
- audio_equalizer_p->magnitude[1][4] = -60;
- audio_equalizer_p->magnitude[1][5] = -100;
- audio_equalizer_p->magnitude[1][6] = -100;
- audio_equalizer_p->magnitude[1][7] = -100;
- /* copy the names */
- pfnUnicodeStrcpy((S8*) audio_equalizer_p->setting_name[0], (S8*) L"Normal");
- pfnUnicodeStrcpy((S8*) audio_equalizer_p->setting_name[1], (S8*) L"Bass");
- pfnUnicodeStrcpy((S8*) audio_equalizer_p->setting_name[2], (S8*) L"Dance");
- pfnUnicodeStrcpy((S8*) audio_equalizer_p->setting_name[3], (S8*) L"Classical");
- pfnUnicodeStrcpy((S8*) audio_equalizer_p->setting_name[4], (S8*) L"Treble");
- pfnUnicodeStrcpy((S8*) audio_equalizer_p->setting_name[5], (S8*) L"Party");
- pfnUnicodeStrcpy((S8*) audio_equalizer_p->setting_name[6], (S8*) L"Pop");
- pfnUnicodeStrcpy((S8*) audio_equalizer_p->setting_name[7], (S8*) L"Rock");
- pfnUnicodeStrcpy((S8*) audio_equalizer_p->setting_name[8], (S8*) L"Restore Factory Default");
- #endif /* MMI_ON_HARDWARE_P */
- #ifdef __MMI_EDITABLE_AUDIO_EQUALIZER__
- mmi_settings_audio_equalizer_adjust_values_for_editor(audio_equalizer_p);
- #endif
- }
- /*****************************************************************************
- * FUNCTION
- * mmi_settings_write_audio_equalizer_to_nvram
- * DESCRIPTION
- * This function is for writing to NVRAM the audio equalizer values.
- * PARAMETERS
- * audio_equalizer_p [?]
- * RETURNS
- * void
- *****************************************************************************/
- void mmi_settings_write_audio_equalizer_to_nvram(audio_equalizer_struct *audio_equalizer_p)
- {
- #ifdef MMI_ON_HARDWARE_P
- /*----------------------------------------------------------------*/
- /* Local Variables */
- /*----------------------------------------------------------------*/
- S16 error;
- /*----------------------------------------------------------------*/
- /* Code Body */
- /*----------------------------------------------------------------*/
- WriteRecord(NVRAM_EF_AUDIO_EQUALIZER_LID, 1, (void*)audio_equalizer_p, NVRAM_EF_AUDIO_EQUALIZER_SIZE, &error);
- #endif /* MMI_ON_HARDWARE_P */
- }
- /*****************************************************************************
- * FUNCTION
- * mmi_settings_select_audio_equalizer
- * DESCRIPTION
- * This function is for selecting a particular setting.
- * PARAMETERS
- * index [IN]
- * RETURNS
- * void
- *****************************************************************************/
- void mmi_settings_select_audio_equalizer(S16 index)
- {
- /*----------------------------------------------------------------*/
- /* Local Variables */
- /*----------------------------------------------------------------*/
- /*----------------------------------------------------------------*/
- /* Code Body */
- /*----------------------------------------------------------------*/
- if (g_settings_audio_equalizer.index != index)
- {
- g_settings_audio_equalizer.index = index;
- mdi_audio_set_equalizer(g_settings_audio_equalizer.magnitude[index]);
- mmi_settings_write_audio_equalizer_to_nvram(&g_settings_audio_equalizer);
- }
- }
- #endif /* defined(__MMI_AUDIO_EQUALIZER__) */ /* __MMI_AUDIO_EQUALIZER */
- /*****************************************************************************
- * FUNCTION
- * mmi_settings_sound_effect_highlight_hdlr
- * DESCRIPTION
- * This function is highlight handler for the sound effect menu item.
- * PARAMETERS
- * void
- * RETURNS
- * void
- *****************************************************************************/
- void mmi_settings_sound_effect_highlight_hdlr(void)
- {
- /*----------------------------------------------------------------*/
- /* Local Variables */
- /*----------------------------------------------------------------*/
- /*----------------------------------------------------------------*/
- /* Code Body */
- /*----------------------------------------------------------------*/
- ChangeLeftSoftkey(STR_GLOBAL_OK, 0);
- ChangeRightSoftkey(STR_GLOBAL_BACK, 0);
- SetLeftSoftkeyFunction(mmi_settings_entry_sound_effect_list, KEY_EVENT_UP);
- SetRightSoftkeyFunction(GoBackHistory, KEY_EVENT_UP);
- SetKeyHandler(mmi_settings_entry_sound_effect_list, KEY_RIGHT_ARROW, KEY_EVENT_DOWN);
- SetKeyHandler(GoBackHistory, KEY_LEFT_ARROW, KEY_EVENT_DOWN);
- }
- /*****************************************************************************
- * FUNCTION
- * mmi_settings_entry_sound_effect_list
- * DESCRIPTION
- * This function is entry function for the sound effect list screen
- * PARAMETERS
- * void
- * RETURNS
- * void
- *****************************************************************************/
- void mmi_settings_entry_sound_effect_list(void)
- {
- /*----------------------------------------------------------------*/
- /* Local Variables */
- /*----------------------------------------------------------------*/
- U16 n_items;
- U8 *guiBuffer;
- U16 item_strs[10];
- U16 item_icons[10];
- U8 *item_hints[10];
- /*----------------------------------------------------------------*/
- /* Code Body */
- /*----------------------------------------------------------------*/
- EntryNewScreen(SCR_ID_SETTING_SOUND_EFFECT, NULL, mmi_settings_entry_sound_effect_list, NULL);
- guiBuffer = GetCurrGuiBuffer(SCR_ID_SETTING_SOUND_EFFECT);
- n_items = GetNumOfChild(MENU_SETTING_SOUND_EFFECT);
- GetSequenceStringIds(MENU_SETTING_SOUND_EFFECT, item_strs);
- GetSequenceImageIds(MENU_SETTING_SOUND_EFFECT, item_icons);
- SetParentHandler(MENU_SETTING_SOUND_EFFECT);
- RegisterHighlightHandler(ExecuteCurrHiliteHandler);
- ConstructHintsList(MENU_SETTING_SOUND_EFFECT, (U8 **) item_hints);
- ShowCategory52Screen(
- STR_ID_SETTING_SOUND_EFFECT,
- IMG_SCR_SETTING_CAPTION,
- STR_GLOBAL_OK,
- IMG_GLOBAL_OK,
- STR_GLOBAL_BACK,
- IMG_GLOBAL_BACK,
- n_items,
- item_strs,
- item_icons,
- (U8 **) item_hints,
- LIST_MENU,
- 0,
- guiBuffer);
- SetRightSoftkeyFunction(GoBackHistory, KEY_EVENT_UP);
- }
- #ifdef __MMI_EDITABLE_AUDIO_EQUALIZER__
- /*****************************************************************************
- * FUNCTION
- * mmi_settings_audio_equalizer_adjust_values_for_editor
- * DESCRIPTION
- *
- * PARAMETERS
- * audio_equalizer_p [?]
- * RETURNS
- * void
- *****************************************************************************/
- void mmi_settings_audio_equalizer_adjust_values_for_editor(audio_equalizer_struct *audio_equalizer_p)
- {
- /*----------------------------------------------------------------*/
- /* Local Variables */
- /*----------------------------------------------------------------*/
- U8 index, index1;
- signed char temp[100];
- S16 number_of_steps_in_bar;
- /*----------------------------------------------------------------*/
- /* Code Body */
- /*----------------------------------------------------------------*/
- MMI_ASSERT(g_audio_equalizer_scrollable_ht / g_audio_equalizer_unit_scroll <= 100);
- MMI_ASSERT(audio_equalizer_p->count <= MAX_EQUALIZER_NUM);
- MMI_ASSERT(audio_equalizer_p->index >= 0 && audio_equalizer_p->index < MAX_EQUALIZER_NUM);
- //modifcation of values to make the equalizer user friendly and more meaningful.
- //calculation of intervals for each bar:
- number_of_steps_in_bar = g_audio_equalizer_scrollable_ht / g_audio_equalizer_unit_scroll;
- for (index = 0; index < number_of_steps_in_bar; index++)
- {
- temp[index] = LOWER_LIMIT_SOUND_LEVEL / 10 + (index * (256 / number_of_steps_in_bar));
- }
- /* applying binary search algorithm for manipulation of values: */
- for (index = 0; index < audio_equalizer_p->count; index++)
- {
- for (index1 = 0; index1 < NUM_OF_BARS_IN_A_SETTING; index1++)
- {
- signed char num_to_be_modified = audio_equalizer_p->magnitude[index][index1];
- /* find the number closest to it in the temp array: */
- int mid, left, right;
- BOOL found = FALSE;
- left = 0;
- right = number_of_steps_in_bar - 1;
- while (left < right)
- {
- mid = (left + right) / 2;
- if (num_to_be_modified == temp[mid])
- {
- found = TRUE;
- break;
- }
- else if (num_to_be_modified < temp[mid])
- {
- right = mid - 1;
- }
- else
- {
- left = mid + 1;
- }
- }
- if (!found)
- {
- if (left == right) /* in this case the num_to_be_modified lies between left and left - 1 */
- {
- if (num_to_be_modified < temp[left])
- {
- /* her left will always be more than zero ....assuming that the value from NVRAM is with in range */
- if (num_to_be_modified - temp[left - 1] > temp[left] - num_to_be_modified)
- {
- audio_equalizer_p->magnitude[index][index1] = temp[left];
- }
- else
- {
- audio_equalizer_p->magnitude[index][index1] = temp[left - 1];
- }
- }
- else
- {
- if (left == number_of_steps_in_bar - 1)
- {
- if (num_to_be_modified - temp[left] > 127 - num_to_be_modified)
- {
- audio_equalizer_p->magnitude[index][index1] = 127;
- }
- else
- {
- audio_equalizer_p->magnitude[index][index1] = temp[left];
- }
- }
- else
- {
- if (num_to_be_modified - temp[left] > temp[left + 1] - num_to_be_modified)
- {
- audio_equalizer_p->magnitude[index][index1] = temp[left + 1];
- }
- else
- {
- audio_equalizer_p->magnitude[index][index1] = temp[left];
- }
- }
- }
- }
- else if (right < left) /* in this case the num_to_be_modified lies between right and left */
- {
- if (num_to_be_modified - temp[right] > temp[left] - num_to_be_modified)
- {
- audio_equalizer_p->magnitude[index][index1] = temp[left];
- }
- else
- {
- audio_equalizer_p->magnitude[index][index1] = temp[right];
- }
- }
- }
- }
- }
- }
- /*****************************************************************************
- * FUNCTION
- * mmi_settings_audio_equalizer_restore_factory_default
- * DESCRIPTION
- * This function is for restoring the settings to default values.
- * PARAMETERS
- * void
- * RETURNS
- * void
- *****************************************************************************/
- void mmi_settings_audio_equalizer_restore_factory_default(void)
- {
- #ifdef MMI_ON_HARDWARE_P
- /*----------------------------------------------------------------*/
- /* Local Variables */
- /*----------------------------------------------------------------*/
- /*----------------------------------------------------------------*/
- /* Code Body */
- /*----------------------------------------------------------------*/
- memcpy(
- (void*)&g_settings_audio_equalizer,
- (void*)&NVRAM_EF_AUDIO_EQUALIZER_DEFAULT,
- NVRAM_EF_AUDIO_EQUALIZER_SIZE);
- #else /* MMI_ON_HARDWARE_P */
- g_settings_audio_equalizer.count = MAX_EQUALIZER_NUM;
- g_settings_audio_equalizer.index = 0;
- memset(g_settings_audio_equalizer.magnitude, 0, MAX_EQUALIZER_NUM * 8);
- /* copy the names */
- pfnUnicodeStrcpy((S8*) g_settings_audio_equalizer.setting_name[0], (S8*) L"Normal");
- pfnUnicodeStrcpy((S8*) g_settings_audio_equalizer.setting_name[1], (S8*) L"Bass");
- pfnUnicodeStrcpy((S8*) g_settings_audio_equalizer.setting_name[2], (S8*) L"Dance");
- pfnUnicodeStrcpy((S8*) g_settings_audio_equalizer.setting_name[3], (S8*) L"Classical");
- pfnUnicodeStrcpy((S8*) g_settings_audio_equalizer.setting_name[4], (S8*) L"Treble");
- pfnUnicodeStrcpy((S8*) g_settings_audio_equalizer.setting_name[5], (S8*) L"Party");
- pfnUnicodeStrcpy((S8*) g_settings_audio_equalizer.setting_name[6], (S8*) L"Pop");
- pfnUnicodeStrcpy((S8*) g_settings_audio_equalizer.setting_name[7], (S8*) L"Rock");
- pfnUnicodeStrcpy((S8*) g_settings_audio_equalizer.setting_name[8], (S8*) L"Restore Factory Default");
- #endif /* MMI_ON_HARDWARE_P */
- mmi_settings_audio_equalizer_adjust_values_for_editor(&g_settings_audio_equalizer);
- mdi_audio_set_equalizer(g_settings_audio_equalizer.magnitude[g_settings_audio_equalizer.index]);
- mmi_settings_write_audio_equalizer_to_nvram(&g_settings_audio_equalizer);
- DisplayPopup((PU8) GetString(STR_GLOBAL_DONE), IMG_GLOBAL_ACTIVATED, 1, UI_POPUP_NOTIFYDURATION_TIME, SUCCESS_TONE);
- }
- /*****************************************************************************
- * FUNCTION
- * mmi_settings_entry_audio_equalizer_setting_options
- * DESCRIPTION
- * This function is for entering the audio equalizer settings options screen
- * PARAMETERS
- * void
- * RETURNS
- * void
- *****************************************************************************/
- void mmi_settings_entry_audio_equalizer_setting_options(void)
- {
- /*----------------------------------------------------------------*/
- /* Local Variables */
- /*----------------------------------------------------------------*/
- U8 *guiBuffer;
- U16 nStrItemList[3]; /* Stores the strings id of submenus returned */
- U16 nNumofItem; /* Stores no of children in the submenu */
- U16 item_icons[] = {IMG_GLOBAL_L1, IMG_GLOBAL_L2, IMG_GLOBAL_L3};
- U8 *item_popups[] = {NULL, NULL, NULL};
- /*----------------------------------------------------------------*/
- /* Code Body */
- /*----------------------------------------------------------------*/
- EntryNewScreen(
- SCR_ID_SETTING_AUDIO_EQUALIZER_OPTIONS,
- NULL,
- mmi_settings_entry_audio_equalizer_setting_options,
- NULL);
- guiBuffer = GetCurrGuiBuffer(SCR_ID_SETTING_AUDIO_EQUALIZER_OPTIONS);
- /* Retrieve no of child of menu item to be displayed */
- nNumofItem = GetNumOfChild(MENU_SETTING_AUDIO_EQUALIZER_SET_OPT);
- /* Retrieve string ids in sequence of given menu item to be displayed */
- GetSequenceStringIds(MENU_SETTING_AUDIO_EQUALIZER_SET_OPT, nStrItemList);
- /* Set current parent id */
- SetParentHandler(MENU_SETTING_AUDIO_EQUALIZER_SET_OPT);
- RegisterHighlightHandler(ExecuteCurrHiliteHandler);
- ShowCategory52Screen(
- STR_GLOBAL_OPTIONS,
- 0,
- STR_GLOBAL_OK,
- IMG_GLOBAL_OK,
- STR_GLOBAL_BACK,
- IMG_GLOBAL_OK,
- nNumofItem,
- nStrItemList,
- item_icons,
- item_popups,
- 0,
- 0,
- guiBuffer);
- }
- /*****************************************************************************
- * FUNCTION
- * mmi_settings_audio_equalizer_opt_select_highlight_hdlr
- * DESCRIPTION
- * This function is highlight handler for the select menu item.
- * PARAMETERS
- * void
- * RETURNS
- * void
- *****************************************************************************/
- void mmi_settings_audio_equalizer_opt_select_highlight_hdlr(void)
- {
- /*----------------------------------------------------------------*/
- /* Local Variables */
- /*----------------------------------------------------------------*/
- /*----------------------------------------------------------------*/
- /* Code Body */
- /*----------------------------------------------------------------*/
- SetLeftSoftkeyFunction(mmi_settings_audio_equalizer_setting_select, KEY_EVENT_UP);
- SetRightSoftkeyFunction(GoBackHistory, KEY_EVENT_UP);
- SetKeyHandler(GoBackHistory, KEY_LEFT_ARROW, KEY_EVENT_DOWN);
- }
- /*****************************************************************************
- * FUNCTION
- * mmi_settings_audio_equalizer_opt_edit_highlight_hdlr
- * DESCRIPTION
- * This function is highlight handler for the edit menu item.
- * PARAMETERS
- * void
- * RETURNS
- * void
- *****************************************************************************/
- void mmi_settings_audio_equalizer_opt_edit_highlight_hdlr(void)
- {
- /*----------------------------------------------------------------*/
- /* Local Variables */
- /*----------------------------------------------------------------*/
- /*----------------------------------------------------------------*/
- /* Code Body */
- /*----------------------------------------------------------------*/
- SetLeftSoftkeyFunction(mmi_settings_entry_audio_equalizer_setting_edit, KEY_EVENT_UP);
- SetRightSoftkeyFunction(GoBackHistory, KEY_EVENT_UP);
- SetKeyHandler(GoBackHistory, KEY_LEFT_ARROW, KEY_EVENT_DOWN);
- SetKeyHandler(mmi_settings_entry_audio_equalizer_setting_edit, KEY_RIGHT_ARROW, KEY_EVENT_DOWN);
- }
- /*****************************************************************************
- * FUNCTION
- * mmi_settings_audio_equalizer_opt_rename_highlight_hdlr
- * DESCRIPTION
- * This function is highlight handler for the rename option
- * PARAMETERS
- * void
- * RETURNS
- * void
- *****************************************************************************/
- void mmi_settings_audio_equalizer_opt_rename_highlight_hdlr(void)
- {
- /*----------------------------------------------------------------*/
- /* Local Variables */
- /*----------------------------------------------------------------*/
- /*----------------------------------------------------------------*/
- /* Code Body */
- /*----------------------------------------------------------------*/
- SetLeftSoftkeyFunction(mmi_settings_entry_audio_equalizer_setting_rename, KEY_EVENT_UP);
- SetRightSoftkeyFunction(GoBackHistory, KEY_EVENT_UP);
- SetKeyHandler(GoBackHistory, KEY_LEFT_ARROW, KEY_EVENT_DOWN);
- SetKeyHandler(mmi_settings_entry_audio_equalizer_setting_rename, KEY_RIGHT_ARROW, KEY_EVENT_DOWN);
- }
- /*****************************************************************************
- * FUNCTION
- * mmi_settings_audio_equalizer_setting_select
- * DESCRIPTION
- * This function is for selecting a particular setting.
- * PARAMETERS
- * void
- * RETURNS
- * void
- *****************************************************************************/
- void mmi_settings_audio_equalizer_setting_select(void)
- {
- /*----------------------------------------------------------------*/
- /* Local Variables */
- /*----------------------------------------------------------------*/
- /*----------------------------------------------------------------*/
- /* Code Body */
- /*----------------------------------------------------------------*/
- mmi_settings_select_audio_equalizer((S16) selected_audio_equalizer_index);
- DisplayPopup((PU8) GetString(STR_GLOBAL_DONE), IMG_GLOBAL_ACTIVATED, 1, UI_POPUP_NOTIFYDURATION_TIME, SUCCESS_TONE);
- DeleteScreenIfPresent(SCR_ID_SETTING_AUDIO_EQUALIZER_OPTIONS);
- }
- /*****************************************************************************
- * FUNCTION
- * mmi_settings_entry_audio_equalizer_setting_edit
- * DESCRIPTION
- * This function is for entering the editing screen.
- * PARAMETERS
- * void
- * RETURNS
- * void
- *****************************************************************************/
- void mmi_settings_entry_audio_equalizer_setting_edit(void)
- {
- /*----------------------------------------------------------------*/
- /* Local Variables */
- /*----------------------------------------------------------------*/
- U8 *guiBuffer;
- /*----------------------------------------------------------------*/
- /* Code Body */
- /*----------------------------------------------------------------*/
- EntryNewScreen(
- SCR_ID_SETTING_AUDIO_EQUALIZER_OPTIONS_EDIT,
- NULL,
- mmi_settings_entry_audio_equalizer_setting_edit,
- NULL);
- guiBuffer = GetCurrGuiBuffer(SCR_ID_SETTING_AUDIO_EQUALIZER_OPTIONS_EDIT);
- if (!guiBuffer)
- {
- g_audio_equalizer_current_setting_info.active_bar = 0; /* initially the first bar is to be activated. */
- ShowCategory334Screen(
- STR_ID_SETTING_AUDIO_EQUALIZER_CAPTION,
- 0,
- 0,
- 0,
- STR_GLOBAL_BACK,
- IMG_GLOBAL_BACK,
- g_settings_audio_equalizer.magnitude[selected_audio_equalizer_index],
- guiBuffer);
- }
- else
- {
- if (g_audio_equalizer_setting_modified)
- {
- U8 index;
- signed char changed_magnitude[NUM_OF_BARS_IN_A_SETTING];
- for (index = 0; index < NUM_OF_BARS_IN_A_SETTING; index++)
- {
- changed_magnitude[index] = g_audio_equalizer_current_setting_info.sound_level[index] / 10;
- }
- ShowCategory334Screen(
- STR_ID_SETTING_AUDIO_EQUALIZER_CAPTION,
- 0,
- STR_GLOBAL_SAVE,
- 0,
- STR_GLOBAL_BACK,
- IMG_GLOBAL_BACK,
- changed_magnitude,
- guiBuffer);
- SetLeftSoftkeyFunction(mmi_settings_audio_equalizer_save_values, KEY_EVENT_UP);
- }
- else
- {
- ShowCategory334Screen(
- STR_ID_SETTING_AUDIO_EQUALIZER_CAPTION,
- 0,
- 0,
- 0,
- STR_GLOBAL_BACK,
- IMG_GLOBAL_BACK,
- g_settings_audio_equalizer.magnitude[selected_audio_equalizer_index],
- guiBuffer);
- }
- }
- SetKeyHandler(mmi_settings_audio_equalizer_activate_previous_bar, KEY_LEFT_ARROW, KEY_EVENT_DOWN);
- SetKeyHandler(mmi_settings_audio_equalizer_activate_next_bar, KEY_RIGHT_ARROW, KEY_EVENT_DOWN);
- SetKeyHandler(mmi_settings_audio_equalizer_increment_sound_level, KEY_UP_ARROW, KEY_EVENT_DOWN);
- SetKeyHandler(mmi_settings_audio_equalizer_decrement_sound_level, KEY_DOWN_ARROW, KEY_EVENT_DOWN);
- SetKeyHandler(mmi_settings_audio_equalizer_increment_sound_level, KEY_VOL_UP, KEY_EVENT_DOWN);
- SetKeyHandler(mmi_settings_audio_equalizer_decrement_sound_level, KEY_VOL_DOWN, KEY_EVENT_DOWN);
- SetRightSoftkeyFunction(mmi_settings_audio_equalizer_setting_edit_RSK_hdlr, KEY_EVENT_UP);
- SetDelScrnIDCallbackHandler(SCR_ID_SETTING_AUDIO_EQUALIZER_OPTIONS_EDIT, (HistoryDelCBPtr) mmi_settings_audio_equalizer_delete_history_hdlr);
- }
- /*****************************************************************************
- * FUNCTION
- * mmi_settings_audio_equalizer_delete_history_hdlr
- * DESCRIPTION
- *
- * PARAMETERS
- * in_param
- * RETURNS
- * U8
- *****************************************************************************/
- U8 mmi_settings_audio_equalizer_delete_history_hdlr(void *in_param)
- {
- /*----------------------------------------------------------------*/
- /* Local Variables */
- /*----------------------------------------------------------------*/
- /*----------------------------------------------------------------*/
- /* Code Body */
- /*----------------------------------------------------------------*/
- g_audio_equalizer_setting_modified = FALSE;
- return FALSE;
- }
- /*****************************************************************************
- * FUNCTION
- * mmi_settings_audio_equalizer_setting_edit_RSK_hdlr
- * DESCRIPTION
- *
- * PARAMETERS
- * void
- * RETURNS
- * void
- *****************************************************************************/
- void mmi_settings_audio_equalizer_setting_edit_RSK_hdlr(void)
- {
- /*----------------------------------------------------------------*/
- /* Local Variables */
- /*----------------------------------------------------------------*/
- /*----------------------------------------------------------------*/
- /* Code Body */
- /*----------------------------------------------------------------*/
- /* reset the modification flag */
- g_audio_equalizer_setting_modified = FALSE;
- GoBackHistory();
- }
- /*****************************************************************************
- * FUNCTION
- * mmi_settings_audio_equalizer_activate_previous_bar
- * DESCRIPTION
- * This function is for activating the previous bar.
- * PARAMETERS
- * void
- * RETURNS
- * void
- *****************************************************************************/
- void mmi_settings_audio_equalizer_activate_previous_bar(void)
- {
- /*----------------------------------------------------------------*/
- /* Local Variables */
- /*----------------------------------------------------------------*/
- /*----------------------------------------------------------------*/
- /* Code Body */
- /*----------------------------------------------------------------*/
- wgui_audio_equalizer_activate_bar((U8) ((NUM_OF_BARS_IN_A_SETTING +
- (g_audio_equalizer_current_setting_info.active_bar -
- 1)) % NUM_OF_BARS_IN_A_SETTING));
- }
- /*****************************************************************************
- * FUNCTION
- * mmi_settings_audio_equalizer_activate_next_bar
- * DESCRIPTION
- * This function is for activating the next bar in the editing screen
- * PARAMETERS
- * void
- * RETURNS
- * void
- *****************************************************************************/
- void mmi_settings_audio_equalizer_activate_next_bar(void)
- {
- /*----------------------------------------------------------------*/
- /* Local Variables */
- /*----------------------------------------------------------------*/
- /*----------------------------------------------------------------*/
- /* Code Body */
- /*----------------------------------------------------------------*/
- wgui_audio_equalizer_activate_bar((U8) ((g_audio_equalizer_current_setting_info.active_bar
- + 1) % NUM_OF_BARS_IN_A_SETTING));
- }
- /*****************************************************************************
- * FUNCTION
- * mmi_settings_audio_equalizer_increment_sound_level
- * DESCRIPTION
- * This function is to increase the sound level.
- * PARAMETERS
- * void
- * RETURNS
- * void
- *****************************************************************************/
- void mmi_settings_audio_equalizer_increment_sound_level(void)
- {
- /*----------------------------------------------------------------*/
- /* Local Variables */
- /*----------------------------------------------------------------*/
- S16 sound_level = g_audio_equalizer_current_setting_info.sound_level[
- g_audio_equalizer_current_setting_info.active_bar];
- S16 delta = (S16) (g_audio_equalizer_unit_scroll * one_pixel_represents);
- S16 magnitude = (S16) g_settings_audio_equalizer.magnitude[
- selected_audio_equalizer_index][
- g_audio_equalizer_current_setting_info.active_bar];
- /*----------------------------------------------------------------*/
- /* Code Body */
- /*----------------------------------------------------------------*/
- sound_level += delta;
- if (sound_level > UPPER_LIMIT_SOUND_LEVEL)
- {
- sound_level = UPPER_LIMIT_SOUND_LEVEL;
- }
- g_audio_equalizer_current_setting_info.sound_level[
- g_audio_equalizer_current_setting_info.active_bar] = sound_level;
- if (!g_audio_equalizer_setting_modified && sound_level/10 != magnitude)
- {
- g_audio_equalizer_setting_modified = TRUE;
- ChangeLeftSoftkey(STR_GLOBAL_SAVE, 0);
- SetLeftSoftkeyFunction(mmi_settings_audio_equalizer_save_values, KEY_EVENT_UP);
- }
- wgui_audio_equalizer_change_sound_level();
- }
- /*****************************************************************************
- * FUNCTION
- * mmi_settings_audio_equalizer_decrement_sound_level
- * DESCRIPTION
- * This function is for decreasing the sound level.
- * PARAMETERS
- * void
- * RETURNS
- * void
- *****************************************************************************/
- void mmi_settings_audio_equalizer_decrement_sound_level(void)
- {
- /*----------------------------------------------------------------*/
- /* Local Variables */
- /*----------------------------------------------------------------*/
- S16 sound_level = g_audio_equalizer_current_setting_info.sound_level[
- g_audio_equalizer_current_setting_info.active_bar];
- S16 delta = (S16) (g_audio_equalizer_unit_scroll * one_pixel_represents);
- S16 magnitude = (S16) g_settings_audio_equalizer.magnitude[
- selected_audio_equalizer_index][
- g_audio_equalizer_current_setting_info.active_bar];
- /*----------------------------------------------------------------*/
- /* Code Body */
- /*----------------------------------------------------------------*/
- sound_level -= delta;
- if ( sound_level < LOWER_LIMIT_SOUND_LEVEL)
- {
- sound_level = LOWER_LIMIT_SOUND_LEVEL;
- }
- g_audio_equalizer_current_setting_info.sound_level[
- g_audio_equalizer_current_setting_info.active_bar] = sound_level;
- if (!g_audio_equalizer_setting_modified && sound_level/10 != magnitude)
- {
- g_audio_equalizer_setting_modified = TRUE;
- ChangeLeftSoftkey(STR_GLOBAL_SAVE, 0);
- SetLeftSoftkeyFunction(mmi_settings_audio_equalizer_save_values, KEY_EVENT_UP);
- }
- wgui_audio_equalizer_change_sound_level();
- }
- #ifdef __MMI_TOUCH_SCREEN__
- /*****************************************************************************
- * FUNCTION
- * mmi_settings_audio_equalizer_change_sound_level
- * DESCRIPTION
- *
- * PARAMETERS
- * change [IN]
- * RETURNS
- * void
- *****************************************************************************/
- void mmi_settings_audio_equalizer_change_sound_level(S16 change)
- {
- /*----------------------------------------------------------------*/
- /* Local Variables */
- /*----------------------------------------------------------------*/
- S16 sound_level = g_audio_equalizer_current_setting_info.sound_level[
- g_audio_equalizer_current_setting_info.active_bar];
- S16 magnitude = (S16) g_settings_audio_equalizer.magnitude[
- selected_audio_equalizer_index][
- g_audio_equalizer_current_setting_info.active_bar];
- /*----------------------------------------------------------------*/
- /* Code Body */
- /*----------------------------------------------------------------*/
- sound_level += change;
- /* since the scrollable height for the +ve side and -ve side is same and the absolute val of the max and min
- limits (1270 and -1280)is different so we need to modify the +ve value when it to becomes 1280. */
- if (sound_level > UPPER_LIMIT_SOUND_LEVEL)
- {
- sound_level = UPPER_LIMIT_SOUND_LEVEL;
- }
- else if(sound_level < LOWER_LIMIT_SOUND_LEVEL)
- {
- sound_level = LOWER_LIMIT_SOUND_LEVEL;
- }
- g_audio_equalizer_current_setting_info.sound_level[
- g_audio_equalizer_current_setting_info.active_bar] = sound_level;
- if (!g_audio_equalizer_setting_modified && sound_level/10 != magnitude)
- {
- g_audio_equalizer_setting_modified = TRUE;
- ChangeLeftSoftkey(STR_GLOBAL_SAVE, 0);
- SetLeftSoftkeyFunction(mmi_settings_audio_equalizer_save_values, KEY_EVENT_UP);
- }
- wgui_audio_equalizer_change_sound_level();
- }
- #endif /* __MMI_TOUCH_SCREEN__ */
- /*****************************************************************************
- * FUNCTION
- * mmi_settings_audio_equalizer_save_values
- * DESCRIPTION
- * This function is for saving the values of the edited setting.
- * PARAMETERS
- * void
- * RETURNS
- * void
- *****************************************************************************/
- void mmi_settings_audio_equalizer_save_values(void)
- {
- /*----------------------------------------------------------------*/
- /* Local Variables */
- /*----------------------------------------------------------------*/
- U8 index;
- /*----------------------------------------------------------------*/
- /* Code Body */
- /*----------------------------------------------------------------*/
- /* 1. copy the values to the global audio equalizer setting structure */
- for (index = 0; index < NUM_OF_BARS_IN_A_SETTING; index++)
- {
- g_settings_audio_equalizer.magnitude[selected_audio_equalizer_index][index] =
- g_audio_equalizer_current_setting_info.sound_level[index] / 10;
- }
- /* reset the modification flag */
- g_audio_equalizer_setting_modified = FALSE;
- if (g_settings_audio_equalizer.index == selected_audio_equalizer_index)
- {
- mdi_audio_set_equalizer(g_settings_audio_equalizer.magnitude[selected_audio_equalizer_index]);
- }
- mmi_settings_write_audio_equalizer_to_nvram(&g_settings_audio_equalizer);
- DisplayPopup((PU8) GetString(STR_GLOBAL_DONE), IMG_GLOBAL_ACTIVATED, 1, UI_POPUP_NOTIFYDURATION_TIME, SUCCESS_TONE);
- }
- /* renaming related functions */
- /*****************************************************************************
- * FUNCTION
- * mmi_settings_entry_audio_equalizer_setting_rename
- * DESCRIPTION
- *
- * PARAMETERS
- * void
- * RETURNS
- * void
- *****************************************************************************/
- void mmi_settings_entry_audio_equalizer_setting_rename(void)
- {
- /*----------------------------------------------------------------*/
- /* Local Variables */
- /*----------------------------------------------------------------*/
- U8 *gui_buffer;
- /*----------------------------------------------------------------*/
- /* Code Body */
- /*----------------------------------------------------------------*/
- EntryNewScreen(
- SCR_ID_AUDIO_EQUALIZER_SETTING_NAME_EDIT,
- NULL,
- mmi_settings_entry_audio_equalizer_setting_rename,
- NULL);
- if ((gui_buffer = GetCurrGuiBuffer(SCR_ID_AUDIO_EQUALIZER_SETTING_NAME_EDIT)) == NULL)
- {
- pfnUnicodeStrcpy(
- (S8*) name_text_editor_buffer,
- (S8*) g_settings_audio_equalizer.setting_name[selected_audio_equalizer_index]);
- }
- ShowCategory5Screen(
- STR_ID_SETTING_AUDIO_EQUALIZER_SETTIN_NAME_EDIT_TITLE,
- 0,
- STR_GLOBAL_OPTIONS,
- 0,
- STR_GLOBAL_BACK,
- 0,
- INPUT_TYPE_ALPHANUMERIC_SENTENCECASE | INPUT_TYPE_USE_ENCODING_BASED_LENGTH,
- (U8*) name_text_editor_buffer,
- SETTING_NAME_MAX_LEN,
- gui_buffer);
- SetLeftSoftkeyFunction(mmi_settings_entry_audio_equalizer_setting_name_edit_option, KEY_EVENT_UP);
- SetCategory5RightSoftkeyFunction(GoBackHistory, KEY_EVENT_UP);
- RegisterInputMethodScreenCloseFunction(GoBackHistory);
- }
- /*****************************************************************************
- * FUNCTION
- * mmi_settings_entry_audio_equalizer_setting_name_edit_option
- * DESCRIPTION
- *
- * PARAMETERS
- * void
- * RETURNS
- * void
- *****************************************************************************/
- void mmi_settings_entry_audio_equalizer_setting_name_edit_option(void)
- {
- /*----------------------------------------------------------------*/
- /* Local Variables */
- /*----------------------------------------------------------------*/
- U16 item_texts[] = {STR_GLOBAL_DONE, STR_GLOBAL_INPUT_METHOD};
- U16 item_icons[] = {IMG_GLOBAL_L1, IMG_GLOBAL_L2};
- /*----------------------------------------------------------------*/
- /* Code Body */
- /*----------------------------------------------------------------*/
- EntryNewScreen(
- SCR_ID_AUDIO_EQUALIZER_SETTING_NAME_EDIT_OPTION,
- NULL,
- mmi_settings_entry_audio_equalizer_setting_name_edit_option,
- NULL);
- RegisterHighlightHandler(mmi_settings_audio_equalizer_setting_name_edit_option_highlight_hdlr);
- ShowCategory52Screen(
- STR_GLOBAL_OPTIONS,
- 0,
- STR_GLOBAL_OK,
- 0,
- STR_GLOBAL_BACK,
- 0,
- 2,
- item_texts,
- item_icons,
- NULL,
- 0,
- 0,
- NULL);
- /* register left, right arrow key handlers */
- SetKeyHandler(GoBackHistory, KEY_LEFT_ARROW, KEY_EVENT_DOWN);
- SetKeyHandler(mmi_settings_audio_equalizer_setting_name_edit_option_LSK, KEY_RIGHT_ARROW, KEY_EVENT_DOWN);
- /* register LSK, RSK handlers */
- SetLeftSoftkeyFunction(mmi_settings_audio_equalizer_setting_name_edit_option_LSK, KEY_EVENT_UP);
- SetRightSoftkeyFunction(GoBackHistory, KEY_EVENT_UP);
- }
- /*****************************************************************************
- * FUNCTION
- * mmi_settings_audio_equalizer_setting_name_edit_option_highlight_hdlr
- * DESCRIPTION
- *
- * PARAMETERS
- * index [IN]
- * RETURNS
- * void
- *****************************************************************************/
- void mmi_settings_audio_equalizer_setting_name_edit_option_highlight_hdlr(S32 index)
- {
- /*----------------------------------------------------------------*/
- /* Local Variables */
- /*----------------------------------------------------------------*/
- U16 item_texts[] = {STR_GLOBAL_DONE, STR_GLOBAL_INPUT_METHOD};
- /*----------------------------------------------------------------*/
- /* Code Body */
- /*----------------------------------------------------------------*/
- setting_name_edit_option_highlighted_item_text = item_texts[index];
- }
- /*****************************************************************************
- * FUNCTION
- * mmi_settings_audio_equalizer_setting_name_edit_option_LSK
- * DESCRIPTION
- *
- * PARAMETERS
- * void
- * RETURNS
- * void
- *****************************************************************************/
- void mmi_settings_audio_equalizer_setting_name_edit_option_LSK(void)
- {
- /*----------------------------------------------------------------*/
- /* Local Variables */
- /*----------------------------------------------------------------*/
- /*----------------------------------------------------------------*/
- /* Code Body */
- /*----------------------------------------------------------------*/
- switch (setting_name_edit_option_highlighted_item_text)
- {
- case STR_GLOBAL_DONE:
- if (pfnUnicodeStrlen((S8*) name_text_editor_buffer) != 0)
- {
- pfnUnicodeStrcpy(
- (S8*) g_settings_audio_equalizer.setting_name[selected_audio_equalizer_index],
- (S8*) name_text_editor_buffer);
- mmi_settings_write_audio_equalizer_to_nvram(&g_settings_audio_equalizer);
- DisplayPopup(
- (PU8) GetString(STR_GLOBAL_DONE),
- IMG_GLOBAL_ACTIVATED,
- 1,
- UI_POPUP_NOTIFYDURATION_TIME,
- SUCCESS_TONE);
- DeleteScreenIfPresent(SCR_ID_AUDIO_EQUALIZER_SETTING_NAME_EDIT_OPTION);
- DeleteScreenIfPresent(SCR_ID_AUDIO_EQUALIZER_SETTING_NAME_EDIT);
- }
- else
- {
- DisplayPopup(
- (PU8) GetString(STR_ID_SETTING_AUDIO_EQUALIZER_SETTING_INVALID_NAME),
- 0,
- 1,
- UI_POPUP_NOTIFYDURATION_TIME,
- SUCCESS_TONE);
- }
- break;
- case STR_GLOBAL_INPUT_METHOD:
- EntryInputMethodScreen();
- DeleteScreenIfPresent(SCR_ID_AUDIO_EQUALIZER_SETTING_NAME_EDIT_OPTION);
- break;
- }
- }
- #endif /* __MMI_EDITABLE_AUDIO_EQUALIZER__ */
- #endif /* __MMI_SOUND_EFFECT__ */
- /*****************************************************************************
- * FUNCTION
- * mmi_settings_read_audio_mic_volume_from_nvram
- * DESCRIPTION
- *
- * PARAMETERS
- * audio_mic_volume_p [?]
- * RETURNS
- * void
- *****************************************************************************/
- void mmi_settings_read_audio_mic_volume_from_nvram(audio_mic_volume_struct *audio_mic_volume_p)
- {
- #ifdef MMI_ON_HARDWARE_P
- /*----------------------------------------------------------------*/
- /* Local Variables */
- /*----------------------------------------------------------------*/
- S16 error;
- U16 mic_volume_set;
- U8 set_index;
- unsigned char *ptr = (unsigned char*)&mic_volume_set;
- /*----------------------------------------------------------------*/
- /* Code Body */
- /*----------------------------------------------------------------*/
- ReadValue(NVRAM_AUDIO_MIC_VOLUME_SET, &mic_volume_set, DS_SHORT, &error);
- for (set_index = 0; set_index < AUDIO_MIC_SET_NUM; set_index++)
- {
- /* check if the value from NVRAM an invalid data */
- if (*ptr == 0xFF)
- {
- ptr = (unsigned char*)&mic_volume_set;
- /* reset in call mic volume level to 3 */
- audio_mic_volume_p->levels[AUDIO_MIC_IN_CALL] = *ptr++ = 3;
- /* reset app mic volume level to 4 */
- audio_mic_volume_p->levels[AUDIO_MIC_APP] = *ptr++ = 4;
- WriteValue(NVRAM_AUDIO_MIC_VOLUME_SET, &mic_volume_set, DS_SHORT, &error);
- break;
- }
- else
- {
- audio_mic_volume_p->levels[set_index] = *ptr++;
- }
- }
- #endif /* MMI_ON_HARDWARE_P */
- }
- /*****************************************************************************
- * FUNCTION
- * mmi_settings_write_audio_mic_volume_to_nvram
- * DESCRIPTION
- *
- * PARAMETERS
- * audio_mic_volume_p [?]
- * RETURNS
- * void
- *****************************************************************************/
- void mmi_settings_write_audio_mic_volume_to_nvram(audio_mic_volume_struct *audio_mic_volume_p)
- {
- #ifdef MMI_ON_HARDWARE_P
- /*----------------------------------------------------------------*/
- /* Local Variables */
- /*----------------------------------------------------------------*/
- S16 error;
- U16 mic_volume_set;
- U8 set_index;
- unsigned char *ptr = (unsigned char*)&mic_volume_set;
- /*----------------------------------------------------------------*/
- /* Code Body */
- /*----------------------------------------------------------------*/
- for (set_index = 0; set_index < AUDIO_MIC_SET_NUM; set_index++)
- {
- *ptr++ = audio_mic_volume_p->levels[set_index];
- }
- WriteValue(NVRAM_AUDIO_MIC_VOLUME_SET, &mic_volume_set, DS_SHORT, &error);
- #endif /* MMI_ON_HARDWARE_P */
- }