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

📄 aud_api.c

📁 最新MTK手机软件源码
💻 C
📖 第 1 页 / 共 5 页
字号:
 *  media_type      [IN]        
 *  kal_int32 handler(?)
 * RETURNS
 *  kal_int32
 *****************************************************************************/
kal_int32 media_mma_aud_get_pitch(kal_int32 handle, kal_uint8 media_type)
{
    /*----------------------------------------------------------------*/
    /* Local Variables                                                */
    /*----------------------------------------------------------------*/

    /*----------------------------------------------------------------*/
    /* Code Body                                                      */
    /*----------------------------------------------------------------*/
    switch (media_type)
    {
        case MMA_TYPE_MIDI:
            return JMidi_GetPitchTranspose((Media_Handle*) handle);
        case MMA_TYPE_TONE:
            return (kal_int32) JTone_GetPitchShift((Media_Handle*) handle);
        default:
            ASSERT(0);
    }
    return 0;
}


/*****************************************************************************
 * FUNCTION
 *  media_mma_aud_set_pitch
 * DESCRIPTION
 *  This function is to set pitch of midi.
 * PARAMETERS
 *  handle          [IN]        
 *  media_type      [IN]        
 *  pitch           [IN]        
 *  kal_int32 handler(?)
 * RETURNS
 *  void
 *****************************************************************************/
kal_int32 media_mma_aud_set_pitch(kal_int32 handle, kal_uint8 media_type, kal_int32 pitch)
{
    /*----------------------------------------------------------------*/
    /* Local Variables                                                */
    /*----------------------------------------------------------------*/

    /*----------------------------------------------------------------*/
    /* Code Body                                                      */
    /*----------------------------------------------------------------*/
    aud_send_mma_set_pitch_req(stack_int_get_active_module_id(), media_type, handle, pitch);
    MMA_WAIT_EVENT(MMA_EVT_SET_PITCH);
    return mma_status;
}


/*****************************************************************************
 * FUNCTION
 *  media_mma_aud_get_duration_by_data
 * DESCRIPTION
 *  This function is to get duration of midi by given midi data string.
 * PARAMETERS
 *  media_type      [IN]        
 *  data            [IN]        
 *  size            [IN]        
 *  duration        [?]         
 * RETURNS
 *  kal_int32
 *****************************************************************************/
kal_int32 media_mma_aud_get_duration_by_data(
            kal_uint8 media_type,
            const kal_uint8 *data,
            kal_int32 size,
            kal_int32 *duration)
{
    /*----------------------------------------------------------------*/
    /* Local Variables                                                */
    /*----------------------------------------------------------------*/

    /*----------------------------------------------------------------*/
    /* Code Body                                                      */
    /*----------------------------------------------------------------*/
    switch (media_type)
    {
        case MMA_TYPE_MIDI:
            return JSmf_GetMidiDuration(data);
    #ifdef MMA_AMR_SUPPORT
        case MMA_TYPE_AMR:
            return (kal_int32) aud_get_res((kal_uint8)JAmr_GetDuration(data, size, duration));
    #endif /* MMA_AMR_SUPPORT */ 
        default:
            ASSERT(0);
    }
    return 0;
}


/*****************************************************************************
 * FUNCTION
 *  media_mma_aud_get_rate
 * DESCRIPTION
 *  This function is to get rate of midi.
 * PARAMETERS
 *  handle          [IN]        
 *  media_type      [IN]        
 *  kal_int32 handler(?)
 * RETURNS
 *  kal_int32
 *****************************************************************************/
kal_int32 media_mma_aud_get_rate(kal_int32 handle, kal_uint8 media_type)
{
    /*----------------------------------------------------------------*/
    /* Local Variables                                                */
    /*----------------------------------------------------------------*/

    /*----------------------------------------------------------------*/
    /* Code Body                                                      */
    /*----------------------------------------------------------------*/
    switch (media_type)
    {
        case MMA_TYPE_MIDI:
            return JMidi_GetRate((Media_Handle*) handle);
        default:
            ASSERT(0);
    }
    return 0;
}


/*****************************************************************************
 * FUNCTION
 *  media_mma_aud_set_rate
 * DESCRIPTION
 *  This function is to set rate of midi.
 * PARAMETERS
 *  handle          [IN]        
 *  media_type      [IN]        
 *  rate            [IN]        
 *  kal_int32 handler(?)
 * RETURNS
 *  void
 *****************************************************************************/
kal_int32 media_mma_aud_set_rate(kal_int32 handle, kal_uint8 media_type, kal_int32 rate)
{
    /*----------------------------------------------------------------*/
    /* Local Variables                                                */
    /*----------------------------------------------------------------*/

    /*----------------------------------------------------------------*/
    /* Code Body                                                      */
    /*----------------------------------------------------------------*/
    aud_send_mma_set_rate_req(stack_int_get_active_module_id(), media_type, handle, rate);
    MMA_WAIT_EVENT(MMA_EVT_SET_RATE);
    return mma_status;
}


/*****************************************************************************
 * FUNCTION
 *  media_mma_aud_get_tempo
 * DESCRIPTION
 *  This function is to get tempo of midi.
 * PARAMETERS
 *  handle          [IN]        
 *  media_type      [IN]        
 *  kal_int32 handler(?)
 * RETURNS
 *  kal_int32
 *****************************************************************************/
kal_int32 media_mma_aud_get_tempo(kal_int32 handle, kal_uint8 media_type)
{
    /*----------------------------------------------------------------*/
    /* Local Variables                                                */
    /*----------------------------------------------------------------*/

    /*----------------------------------------------------------------*/
    /* Code Body                                                      */
    /*----------------------------------------------------------------*/
    switch (media_type)
    {
        case MMA_TYPE_MIDI:
            return JMidi_GetTempo((Media_Handle*) handle);
        default:
            ASSERT(0);
    }
    return 0;
}


/*****************************************************************************
 * FUNCTION
 *  media_mma_aud_set_tempo
 * DESCRIPTION
 *  This function is to set tempo of midi.
 * PARAMETERS
 *  handle          [IN]        
 *  media_type      [IN]        
 *  tempo           [IN]        
 *  kal_int32 handler(?)
 * RETURNS
 *  void
 *****************************************************************************/
kal_int32 media_mma_aud_set_tempo(kal_int32 handle, kal_uint8 media_type, kal_int32 tempo)
{
    /*----------------------------------------------------------------*/
    /* Local Variables                                                */
    /*----------------------------------------------------------------*/

    /*----------------------------------------------------------------*/
    /* Code Body                                                      */
    /*----------------------------------------------------------------*/
    aud_send_mma_set_tempo_req(stack_int_get_active_module_id(), media_type, handle, tempo);
    MMA_WAIT_EVENT(MMA_EVT_SET_TEMPO);
    return mma_status;
}


/*****************************************************************************
 * FUNCTION
 *  media_mma_aud_open_device
 * DESCRIPTION
 *  This function is to open device of midi.
 * PARAMETERS
 *  media_type      [IN]        
 * RETURNS
 *  void
 *****************************************************************************/
kal_int32 media_mma_aud_open_device(kal_uint8 media_type)
{
    /*----------------------------------------------------------------*/
    /* Local Variables                                                */
    /*----------------------------------------------------------------*/

    /*----------------------------------------------------------------*/
    /* Code Body                                                      */
    /*----------------------------------------------------------------*/
    aud_send_mma_open_device_req(MOD_J2ME, media_type);
    MMA_WAIT_EVENT(MMA_EVT_OPEN_DEVICE);
    return mma_handle;
}


/*****************************************************************************
 * FUNCTION
 *  media_mma_aud_close_device
 * DESCRIPTION
 *  This function is to close device of midi.
 * PARAMETERS
 *  handle          [IN]        
 *  media_type      [IN]        
 * RETURNS
 *  kal_int32
 *****************************************************************************/
kal_int32 media_mma_aud_close_device(kal_int32 handle, kal_uint8 media_type)
{
    /*----------------------------------------------------------------*/
    /* Local Variables                                                */
    /*----------------------------------------------------------------*/

    /*----------------------------------------------------------------*/
    /* Code Body                                                      */
    /*----------------------------------------------------------------*/
    aud_send_mma_close_device_req(stack_int_get_active_module_id(), media_type, handle);
    MMA_WAIT_EVENT(MMA_EVT_CLOSE_DEVICE);
    return mma_status;
}


/*****************************************************************************
 * FUNCTION
 *  media_mma_aud_send_long_msg
 * DESCRIPTION
 *  This function is to send long msg of midi.
 * PARAMETERS
 *  handle          [IN]        
 *  media_type      [IN]        
 *  buf             [?]         kal_uint16 len
 *  len             [IN]        
 *  kal_int32 handler(?)
 * RETURNS
 *  void
 *****************************************************************************/
kal_int32 media_mma_aud_send_long_msg(kal_int32 handle, kal_uint8 media_type, kal_uint8 *buf, kal_uint16 len)
{
    /*----------------------------------------------------------------*/
    /* Local Variables                                                */
    /*----------------------------------------------------------------*/

    /*----------------------------------------------------------------*/
    /* Code Body                                                      */
    /*----------------------------------------------------------------*/
    aud_send_mma_send_long_msg_req(stack_int_get_active_module_id(), media_type, handle, buf, len);
    MMA_WAIT_EVENT(MMA_EVT_SEND_LONG_MSG);
    return mma_status;
}


/*****************************************************************************
 * FUNCTION
 *  media_mma_aud_send_short_msg
 * DESCRIPTION
 *  This function is to send short msg of midi.
 * PARAMETERS
 *  handle          [IN]        
 *  media_type      [IN]        
 *  type            [IN]        kal_uint8 data1, kal_uint8 data2
 *  data1           [IN]        
 *  data2           [IN]        
 *  kal_int32 handler(?)
 * RETURNS
 *  void
 *****************************************************************************/
kal_int32 media_mma_aud_send_short_msg(
            kal_int32 handle,
            kal_uint8 media_type,
            kal_uint8 type,
            kal_uint8 data1,
            kal_uint8 data2)
{
    /*----------------------------------------------------------------*/
    /* Local Variables                                                */
    /*----------------------------------------------------------------*/

    /*----------------------------------------------------------------*/
    /* Code Body                                                      */
    /*----------------------------------------------------------------*/
    aud_send_mma_send_short_msg_req(stack_int_get_active_module_id(), media_type, handle, type, data1, data2);
    MMA_WAIT_EVENT(MMA_EVT_SEND_SHORT_MSG);
    return mma_status;
}


/*****************************************************************************
 * FUNCTION
 *  media_mma_aud_get_channel_volume
 * DESCRIPTION
 *  This function is to get channel volume of midi.
 * PARAMETERS
 *  handle          [IN]        
 *  media_type      [IN]        
 *  channel         [IN]        
 *  kal_int32 handler(?)
 * RETURNS
 *  kal_uint8
 *****************************************************************************/
kal_uint8 media_mma_aud_get_channel_volume(kal_int32 handle,

⌨️ 快捷键说明

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