⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 mmisounds_v1.c

📁 是一个手机功能的模拟程序
💻 C
📖 第 1 页 / 共 5 页
字号:

 $Description:  Reset the scroll/select menu behavior.

 $Returns:    none

 $Arguments:  none

*******************************************************************************/
void clearScrollSelectMenuItem(void)
{
  scrollSelectMenuItem=FALSE;
  // soundReason = SoundsNone; MZ this flag cleared when user exits the melody/Volume menu.
  stopPlayingMelody();
}

/*******************************************************************************

 $Function:     soundsSetVolume

 $Description:  Function determines if user is in the Melody/SMS/Alarm ringer menu
        and has selected the vloume settings option.

 $Returns:    none

 $Arguments:  none

*******************************************************************************/
void soundsSetVolume(void)
{
  if(soundReason == MelodySelect || soundReason == SettingSMSTone ||
    soundReason == SettingAlarm || soundReason == SettingVolume)
  {
    // Menu items will be selected on scrolling.
    scrollSelectMenuItem = TRUE;
    // store the setting to PCM if volume setting is selected.
    volumeSetting2Pcm=FALSE;
  }
  else
  {
     scrollSelectMenuItem = FALSE;
  }

}
/*******************************************************************************

 $Function:     setSilentModeVolumeOn

 $Description:

 $Returns:    none

 $Arguments:  none

*******************************************************************************/
void setSilentModeVolume(void)
{
  stopPlayingMelody();
  oldVolumeSetting = current.volumeSetting;
  current.volumeSetting =0;
  audio_SetAmplf (AUDIO_BUZZER, current.volumeSetting);
}

/*******************************************************************************

 $Function:     setSilentModeVolumeOn

 $Description:

 $Returns:    none

 $Arguments:  none

*******************************************************************************/
void restoreSilentModeVolume(void)
{
  stopPlayingMelody();
  current.volumeSetting =oldVolumeSetting;
  audio_SetAmplf (AUDIO_BUZZER, current.volumeSetting);

}

/*******************************************************************************

 $Function:     soundReasonRinger

 $Description:  setup the soundReason to be Ringer Melody settings.

 $Returns:    none

 $Arguments:  none

*******************************************************************************/
void soundsVolSilent(void)
{

  FFS_flashData.settings_status |= SettingsSilentMode;
  flash_write();

  stopPlayingMelody();

  if(volumeSetting2Pcm != TRUE)
  {
    current.volumeSetting =0;
    audio_SetAmplf (AUDIO_BUZZER, current.volumeSetting);
    audio_PlaySoundID(AUDIO_BUZZER, current.ringer, 0, AUDIO_PLAY_INFINITE);
  }
  else
  {
    //store setting into PCM
    volumeSetting2Pcm=FALSE;
  }
}
/*******************************************************************************

 $Function:     soundsVolLow

 $Description:  set voulme level to low.

 $Returns:    none

 $Arguments:  none

*******************************************************************************/
void soundsVolLow(void)
{
  FFS_flashData.settings_status &= ~SettingsSilentMode;
  flash_write();
  stopPlayingMelody();
  if(volumeSetting2Pcm != TRUE)
  {
    current.volumeSetting =5;
    audio_SetAmplf (AUDIO_BUZZER, current.volumeSetting);
    audio_PlaySoundID(AUDIO_BUZZER, current.ringer, 0, AUDIO_PLAY_INFINITE);
  }
  else
  {
    //store setting into PCM
    volumeSetting2Pcm=FALSE;
  }
}
/*******************************************************************************

 $Function:     soundsVolMedium

 $Description:  set voulme level to Medium

 $Returns:    none

 $Arguments:  none

*******************************************************************************/
void soundsVolMedium(void)
{
  FFS_flashData.settings_status &= ~SettingsSilentMode;
  flash_write();
  stopPlayingMelody();
  if(volumeSetting2Pcm != TRUE)
  {
    current.volumeSetting =25;
    audio_SetAmplf (AUDIO_BUZZER, current.volumeSetting);
    audio_PlaySoundID(AUDIO_BUZZER, current.ringer, 0, AUDIO_PLAY_INFINITE);
  }
  else
  {
    //store setting into PCM
    volumeSetting2Pcm=FALSE;
  }

}
/*******************************************************************************

 $Function:     soundsVolHigh

 $Description:  set voulme level to High

 $Returns:    none

 $Arguments:  none

*******************************************************************************/
void soundsVolHigh(void)
{
  FFS_flashData.settings_status &= ~SettingsSilentMode;
  flash_write();
  stopPlayingMelody();
  if(volumeSetting2Pcm != TRUE)
  {
    current.volumeSetting =175;
    audio_SetAmplf (AUDIO_BUZZER, current.volumeSetting);
    audio_PlaySoundID(AUDIO_BUZZER, current.ringer, 0, AUDIO_PLAY_INFINITE);
  }
  else
  {
    //store setting into PCM
    volumeSetting2Pcm=FALSE;
  }

}
/*******************************************************************************

 $Function:     soundsVolInc

 $Description:  set voulme level to increasing

 $Returns:    none

 $Arguments:  none

*******************************************************************************/
void soundsVolInc(void)
{
  FFS_flashData.settings_status &= ~SettingsSilentMode;
  flash_write();
  stopPlayingMelody();
  if(volumeSetting2Pcm != TRUE)
  {
    current.volumeSetting = 5;
    audio_SetAmplf (AUDIO_BUZZER, current.volumeSetting);
    audio_PlaySoundID(AUDIO_BUZZER, current.ringer, 0, AUDIO_PLAY_INFINITE);
  }
  else
  {
    //store setting into PCM
    volumeSetting2Pcm=FALSE;

  }


}
/*******************************************************************************

 $Function:     soundReasonRinger

 $Description:  setup the soundReason to be Ringer Melody settings.

 $Returns:    none

 $Arguments:  none

*******************************************************************************/
void soundReasonRinger(void)
{
  soundReason = MelodySelect;
}
/*******************************************************************************

 $Function:     soundReasonSmsTone

 $Description:  Setup the soundReason to be SMS tones settings.

 $Returns:    none

 $Arguments:  none

*******************************************************************************/
void soundReasonSmsTone(void)
{
  soundReason = SettingSMSTone;
}
/*******************************************************************************

 $Function:     soundReasonAlarm

 $Description:  Setup the soundReason to be Alarm settings.

 $Returns:    none

 $Arguments:  none

*******************************************************************************/
void soundReasonAlarm(void)
{
  soundReason = SettingAlarm;
}
/*******************************************************************************

 $Function:     getcurrentSMSTone

 $Description:  Access function for the current SMS Tone.
 $Returns:    Tone Id

 $Arguments:  None

*******************************************************************************/
UBYTE getcurrentSMSTone(void)
{
  return current.SMSTone;
}/*******************************************************************************

 $Function:     getcurrentSMSTone

 $Description:  Access function for the current SMS Tone.
 $Returns:    Tone Id

 $Arguments:  None

*******************************************************************************/
UBYTE getcurrentAlarmTone(void)
{
  return current.AlarmOn;
}
/*******************************************************************************

 $Function:     getCurrentRingerSettings

 $Description:  Access function for the current ringer settings data.
 $Returns:    Ringer Id.

 $Arguments:  None

*******************************************************************************/
UBYTE getCurrentRingerSettings(void)
{
  return current.ringer;
}
/*******************************************************************************

 $Function:     getCurrentVoulmeSettings

 $Description:  Access function for the current ringer volume settings data.
 $Returns:    volume

 $Arguments:  None

*******************************************************************************/
UBYTE getCurrentVoulmeSettings(void)
{
  return current.volumeSetting;
}
/*******************************************************************************

 $Function:     getMelodyListStatus

 $Description:  Status flag indicating if a melody selection menu is active.
 $Returns:    status

 $Arguments:  None

*******************************************************************************/
BOOL getMelodyListStatus(void)
{
  if(soundReason == MelodySelect ||
    soundReason == SettingSMSTone ||
    soundReason == SettingAlarm )
     return TRUE;
  else
    return FALSE;
}


/*******************************************************************************

 $Function:     stopPlayingMelody

 $Description:  stop currently played ringer melody

 $Returns:    None

 $Arguments:  None

*******************************************************************************/

static void stopPlayingMelody( void )
{
  TRACE_FUNCTION( "stopPlayingMelody" );

  /* If a timer event is running we want to stop that as well,
     since we don't really want to turn the tune off and have
     it start again when the timer expires
  */
  if ( hRingerStartTimer != NULL )
    timStop( hRingerStartTimer );

  /* Are we playing a tune
  */
  if ( LastTune )
    audio_StopSoundbyID( AUDIO_BUZZER, LastTune );

  /* Need to wait for the tune to stop before trying to
     set up the next tune, so wait always
  */
  vsi_t_sleep( 0, 5 );
}

/*******************************************************************************

 $Function:     startPlayingMelody

 $Description:  Start played the ringer melody

 $Returns:    None

 $Arguments:  Melody_id

*******************************************************************************/

static void startPlayingMelody(UBYTE melody_id)
{

  if ( hRingerStartTimer != NULL )
    timStop( hRingerStartTimer );

  audio_PlaySoundID(AUDIO_BUZZER, melody_id, (BYTE)current.volumeSetting, AUDIO_PLAY_INFINITE);

}


/*******************************************************************************

 $Function:     soundsPlayRinger

 $Description:  Play the tune selected by melody_id, stopping any currently
        playing tunes if necessary. Remember to take into account the
        volume setting and provide a crescendo if requested

 $Returns:    None

 $Arguments:  melody_id, selects the melody to be played

*******************************************************************************/

static void soundsPlayRinger( int melody_id )
{
  CurrentTune = melody_id;
  if (LastTune)
    audio_StopSoundbyID (AUDIO_BUZZER,LastTune );
  vsi_t_sleep(0, 5);

  if (current.volumeSetting == increasing)
  {
    audio_PlaySoundID ( AUDIO_BUZZER,CurrentTune, 0 , AUDIO_PLAY_CRESCENDO );
  }
  else
  {
    audio_PlaySoundID ( AUDIO_BUZZER,CurrentTune, 0, AUDIO_PLAY_INFINITE );
  }
  LastTune = CurrentTune;
}


/*******************************************************************************

 $Function:     destroyDynaMenu

 $Description:  frees the memory allocated to a dynamenu (Refer to the
        buildMelodyMenu routine below

 $Returns:    None.

 $Arguments:  None.

*******************************************************************************/

static void destroyDynaMenu( void )
{

}


/*******************************************************************************

 $Function:     buildMelodyMenu

 $Description:  Builds the melody menu dynamenu from the melodies supplied
        by the resource manager

 $Returns:    None

 $Arguments:  None

*******************************************************************************/
static T_MFW_HND  buildMelodyMenu( MfwHnd parent_window)
{
  T_MELODY_INFO *  data = (T_MELODY_INFO *)ALLOC_MEMORY (sizeof (T_MELODY_INFO));
  T_MFW_WIN  * win;

    TRACE_FUNCTION (">>>> buildMelodyMenu()");

    /*
     * Create window handler
     */

    data->sounds_win = win_create (parent_window, 0, E_WIN_VISIBLE, (T_MFW_CB)melody_win_cb);
    if (data->sounds_win EQ NULL)
  {
     return NULL;
  }

  TRACE_EVENT(">>>> Melody window created: " );
    /*
     * connect the dialog data to the MFW-window
     */

    data->mmi_control.dialog = (T_DIALOG_FUNC)melody_exec_cb;
    data->mmi_control.data   = data;
    win                      = ((T_MFW_HDR *)data->sounds_win)->data;
    win->user                = (void *)data;
    data->parent             = parent_window;
  winShow(data->sounds_win);
    /*
     * return window handle
     */

     return data->sounds_win;
}

/*******************************************************************************

 $Function:     melody_exec_cb

 $Description:  Exec callback function of the SMS read window (dynamic list of
        all the SMS)

 $Returns:    none

 $Arguments:  win - window handler
        event - mfw event

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -