tactilefeedback/tactilefeedbackresolver/plugins/tactiletoneplugin/src/tactiletoneplayer.cpp
branchRCL_3
changeset 21 09b094b73eb8
parent 20 39d4c97df8cb
equal deleted inserted replaced
20:39d4c97df8cb 21:09b094b73eb8
    65 
    65 
    66     // As a fix to EAKH-7LKANT, we're temporarily reading volume level
    66     // As a fix to EAKH-7LKANT, we're temporarily reading volume level
    67     // settings from profiles engine
    67     // settings from profiles engine
    68     InitializeProfilesEngineL();
    68     InitializeProfilesEngineL();
    69                                          
    69                                          
    70     if ( iAudioLevel > EProfileAudioFeedbackLevel5 )
    70     if ( iAudioLevel > EProfileAudioFeedbackLevel3 )
    71         {
    71         {
    72         User::Leave( KErrGeneral );
    72         User::Leave( KErrGeneral );
    73         }
    73         }
    74   
    74   
    75     ReadSettings();
    75     ReadSettings();
   137         
   137         
   138         switch ( aFeedback )
   138         switch ( aFeedback )
   139             {
   139             {
   140             case ETouchFeedbackBasic:               // flow through
   140             case ETouchFeedbackBasic:               // flow through
   141             case ETouchFeedbackBasicButton:         // flow through
   141             case ETouchFeedbackBasicButton:         // flow through
   142             case ETouchFeedbackBasicItem:           // flow through
   142             case ETouchFeedbackList:                // flow through
   143             case ETouchFeedbackBounceEffect:        // flow through
   143             case ETouchFeedbackBoundaryList:        // flow through
   144             case ETouchFeedbackBasicSlider:         // flow through
   144             case ETouchFeedbackSlider:              // flow through
   145             case ETouchFeedbackEditor:              // flow through
   145             case ETouchFeedbackEdit:                // flow through
   146             case ETouchFeedbackLineSelection:       // flow through
   146             case ETouchFeedbackLineSelection:       // flow through
   147             case ETouchFeedbackBlankSelection:      // flow through
   147             case ETouchFeedbackBlankSelection:      // flow through
   148             case ETouchFeedbackTextSelection:       // flow through
   148             case ETouchFeedbackTextSelection:       // flow through
   149             case ETouchFeedbackEmptyLineSelection:  // flow through
   149             case ETouchFeedbackEmptyLineSelection:  // flow through
       
   150             case ETouchFeedbackTab:                 // flow through
   150             case ETouchFeedbackPopUp:               // flow through
   151             case ETouchFeedbackPopUp:               // flow through
   151             case ETouchFeedbackPopupOpen:           // flow through
   152             case ETouchFeedbackIncreasingPopUp:     // flow through
   152             case ETouchFeedbackPopupClose:          // flow through
   153             case ETouchFeedbackDecreasingPopUp:     // flow through
   153             case ETouchFeedbackItemScroll:          // flow through
   154             case ETouchFeedbackFlick:               // flow through
   154             case ETouchFeedbackCheckbox:            // flow through
   155             case ETouchFeedbackCheckbox:            // flow through
   155             case ETouchFeedbackMultitouchActivate:
   156             case ETouchFeedbackCharacterInputButton:
   156             case ETouchFeedbackBasicKeypad:
   157             case ETouchFeedbackOptionsMenuOpened:
   157             case ETouchFeedbackFlick:
   158             case ETouchFeedbackOptionsMenuClosed:
   158             case ETouchFeedbackItemDrop:
   159             case ETouchFeedbackSubMenuOpened:
   159             case ETouchFeedbackItemMoveOver:
   160             case ETouchFeedbackSubMenuClosed:
   160             case ETouchFeedbackItemPick:
   161             case ETouchFeedbackLongTap:
   161             case ETouchFeedbackMultipleCheckbox:
   162             case ETouchFeedbackMultiTouchRecognized:
   162             case ETouchFeedbackRotateStep:
       
   163             case ETouchFeedbackStopFlick:
       
   164             case ETouchFeedbackLongPress:
       
   165                 effectIndex = 0;
   163                 effectIndex = 0;
   166                 break;
   164                 break;
   167             case ETouchFeedbackSensitive:           // flow through
   165             case ETouchFeedbackSensitive:           // flow through
   168             case ETouchFeedbackSensitiveButton:     // flow through
   166             case ETouchFeedbackSensitiveButton:     // flow through
   169             case ETouchFeedbackSensitiveItem:      
   167             case ETouchFeedbackSensitiveList:      
   170             case ETouchFeedbackSensitiveKeypad:
   168             case ETouchFeedbackSensitiveInput:
   171             case ETouchFeedbackSensitiveSlider:
       
   172                 effectIndex = 1;                    
   169                 effectIndex = 1;                    
   173                 break;                              
   170                 break;                              
   174             default:                                
   171             default:                                
   175                 effectIndex = 0;                    
   172                 effectIndex = 0;                    
   176                 break;                              
   173                 break;                              
   218     {
   215     {
   219     TRACE("CTactileTonePlayer::PlayPreviewFeedback - Begin");
   216     TRACE("CTactileTonePlayer::PlayPreviewFeedback - Begin");
   220     TInt ret( KErrArgument );
   217     TInt ret( KErrArgument );
   221     
   218     
   222     if ( aLevel > EProfileAudioFeedbackOff  &&
   219     if ( aLevel > EProfileAudioFeedbackOff  &&
   223          aLevel <= EProfileAudioFeedbackLevel5 )
   220          aLevel <= EProfileAudioFeedbackLevel3 )
   224         {
   221         {
   225         iOriginalLevel = iAudioLevel;
   222         iOriginalLevel = iAudioLevel;
   226         iAudioLevel = aLevel;
   223         iAudioLevel = aLevel;
   227         ReadSettings();    
   224         ReadSettings();    
   228         iCurrentEffectIndex = KErrNotFound;
   225         iCurrentEffectIndex = KErrNotFound;
   363         iRepository.Get( KTactileAudioToneDurationSensitiveLevel3,  
   360         iRepository.Get( KTactileAudioToneDurationSensitiveLevel3,  
   364                          sensitiveDuration );
   361                          sensitiveDuration );
   365         iRepository.Get( KTactileAudioToneVolumeSensitiveLevel3,  
   362         iRepository.Get( KTactileAudioToneVolumeSensitiveLevel3,  
   366                          sensitiveParams.iVolume );        
   363                          sensitiveParams.iVolume );        
   367         }
   364         }
   368     else if ( iAudioLevel == EProfileAudioFeedbackLevel4  )
       
   369         {
       
   370         // Read settings for ETouchFeedbackBasic, level 4
       
   371         iRepository.Get( KTactileAudioToneFreqBasicLevel4,     
       
   372                          basicParams.iFrequency );
       
   373         iRepository.Get( KTactileAudioToneDurationBasicLevel4, 
       
   374                          basicDuration );
       
   375         iRepository.Get( KTactileAudioToneVolumeBasicLevel4,   
       
   376                          basicParams.iVolume );
       
   377         
       
   378         // Read settings for ETouchFeedbackSensitive, level 4
       
   379         iRepository.Get( KTactileAudioToneFreqSensitiveLevel4, 
       
   380                          sensitiveParams.iFrequency );
       
   381         iRepository.Get( KTactileAudioToneDurationSensitiveLevel4,  
       
   382                          sensitiveDuration );
       
   383         iRepository.Get( KTactileAudioToneVolumeSensitiveLevel4,  
       
   384                          sensitiveParams.iVolume );
       
   385         }
       
   386     else if ( iAudioLevel == EProfileAudioFeedbackLevel5  )
       
   387         {
       
   388         // Read settings for ETouchFeedbackBasic, level 5
       
   389         iRepository.Get( KTactileAudioToneFreqBasicLevel5,     
       
   390                          basicParams.iFrequency );
       
   391         iRepository.Get( KTactileAudioToneDurationBasicLevel5, 
       
   392                          basicDuration );
       
   393         iRepository.Get( KTactileAudioToneVolumeBasicLevel5,   
       
   394                          basicParams.iVolume );
       
   395         
       
   396         // Read settings for ETouchFeedbackSensitive, level 5
       
   397         iRepository.Get( KTactileAudioToneFreqSensitiveLevel5, 
       
   398                          sensitiveParams.iFrequency );
       
   399         iRepository.Get( KTactileAudioToneDurationSensitiveLevel5,  
       
   400                          sensitiveDuration );
       
   401         iRepository.Get( KTactileAudioToneVolumeSensitiveLevel5,  
       
   402                          sensitiveParams.iVolume );
       
   403         }
       
   404      
   365      
   405     // Clear old parameters. Only do it at end, so that we still have the
   366     // Clear old parameters. Only do it at end, so that we still have the
   406     // old settings in case something fails when reading these from 
   367     // old settings in case something fails when reading these from 
   407     // Central Repository.
   368     // Central Repository.
   408     iSoundParams.Reset();
   369     iSoundParams.Reset();
   419     // --> Convert to 0-CMdaAudioToneUtility::MaxVolume    
   380     // --> Convert to 0-CMdaAudioToneUtility::MaxVolume    
   420     basicParams.iVolume     = ScaleVolume( basicParams.iVolume );
   381     basicParams.iVolume     = ScaleVolume( basicParams.iVolume );
   421     sensitiveParams.iVolume = ScaleVolume( sensitiveParams.iVolume );
   382     sensitiveParams.iVolume = ScaleVolume( sensitiveParams.iVolume );
   422     
   383     
   423     // Store parameters for different feedback types
   384     // Store parameters for different feedback types
   424     // if append fail just make its action like before
   385     iSoundParams.Append( basicParams );
   425     TRAP_IGNORE( iSoundParams.AppendL( basicParams ) );
   386     iSoundParams.Append( sensitiveParams );
   426     TRAP_IGNORE( iSoundParams.AppendL( sensitiveParams ) );
       
   427     TRACE("CTactileTonePlayer::ReadSettingsL - End");        
   387     TRACE("CTactileTonePlayer::ReadSettingsL - End");        
   428     }
   388     }
   429 
   389 
   430 // ---------------------------------------------------------------------------
   390 // ---------------------------------------------------------------------------
   431 // Scale the volume, and perform sanity check.
   391 // Scale the volume, and perform sanity check.