亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频

? 歡迎來到蟲蟲下載站! | ?? 資源下載 ?? 資源專輯 ?? 關(guān)于我們
? 蟲蟲下載站

?? sound.c

?? 基于TI公司Cortex-M3的uart超級通信開發(fā)
?? C
?? 第 1 頁 / 共 3 頁
字號:
//! in use in case the requested rate could not be matched exactly.
//!
//! \return The current sample rate in samples/sec.
//
//*****************************************************************************
unsigned long
SoundSampleRateGet(void)
{
    return(g_ulSampleRate);
}

//*****************************************************************************
//
//! Starts playback of a block of PCM audio samples.
//!
//! \param pvData is a pointer to the audio data to play.
//! \param ulLength is the length of the data in bytes.
//! \param pfnCallback is a function to call when this buffer has be played.
//!
//! This function starts the playback of a block of PCM audio samples.  If
//! playback of another buffer is currently ongoing, its playback is canceled
//! and the buffer starts playing immediately.
//!
//! \return 0 if the buffer was accepted, returns non-zero if there was no
//! space available for this buffer.
//
//*****************************************************************************
unsigned long
SoundBufferPlay(const void *pvData, unsigned long ulLength,
                tBufferCallback pfnCallback)
{
    unsigned long ulChannel;

    //
    // Must disable I2S interrupts during this time to prevent state problems.
    //
    IntDisable(INT_I2S0);

    //
    // Save the buffer information.
    //
    g_sOutBuffers[g_ulPlaying].pulData = (unsigned long *)pvData;
    g_sOutBuffers[g_ulPlaying].ulSize = ulLength;
    g_sOutBuffers[g_ulPlaying].pfnBufferCallback = pfnCallback;

    //
    // Handle which half of the ping-pong DMA is in use.
    //
    if(g_ulPlaying)
    {
        ulChannel = UDMA_CHANNEL_I2S0TX | UDMA_ALT_SELECT;
    }
    else
    {
        ulChannel = UDMA_CHANNEL_I2S0TX | UDMA_PRI_SELECT;
    }

    //
    // Set the DMA channel configuration.
    //
    if(g_usChannels == 1)
    {
        //
        // Handle Mono formats.
        //
        if(g_usBitsPerSample == 16)
        {
            //
            // The transfer size is 16 bits from the TX buffer to the TX FIFO.
            // Modify the DMA transfer size at it is units not bytes.
            //
            g_sOutBuffers[g_ulPlaying].ulSize >>= 1;
        }
    }
    else
    {
        //
        // Handle Stereo formats.
        //
        if(g_usBitsPerSample == 8)
        {
            //
            // The transfer size is 16 bits(stereo 8 bits) from the TX buffer
            // to the TX FIFO.  Modify the DMA transfer size at it is units
            // not bytes.
            //
            g_sOutBuffers[g_ulPlaying].ulSize >>= 1;
        }
        else
        {
            //
            // The transfer size is 32 bits(stereo 16 bits) from the TX buffer
            // to the TX FIFO. Modify the DMA transfer size at it is units not
            // bytes.
            //
            g_sOutBuffers[g_ulPlaying].ulSize >>= 2;
        }
    }

    //
    // Set the addresses and the DMA mode to ping-pong.
    //
    uDMAChannelTransferSet(ulChannel,
                           UDMA_MODE_PINGPONG,
                           (unsigned long *)g_sOutBuffers[g_ulPlaying].pulData,
                           (void *)(I2S0_BASE + I2S_O_TXFIFO),
                           g_sOutBuffers[g_ulPlaying].ulSize);

    //
    // Enable the TX channel.  At this point the uDMA controller will
    // start servicing the request from the I2S, and the transmit side
    // should start running.
    //
    uDMAChannelEnable(UDMA_CHANNEL_I2S0TX);

    //
    // Indicate that there is still a pending transfer.
    //
    HWREGBITW(&g_ulDMAFlags, FLAG_TX_PENDING) = 1;

    //
    // Toggle which ping-pong DMA setting is in use.
    //
    g_ulPlaying ^= 1;

    //
    // Enable the I2S controller to start transmitting.
    //
    I2STxEnable(I2S0_BASE);

    //
    // Re-enable I2S interrupts.
    //
    IntEnable(INT_I2S0);

    return(0);
}

//*****************************************************************************
//
//! Starts recording from the audio input.
//!
//! \param pvData is a pointer to store the data as it is received.
//! \param ulSize is the size of the buffer pointed to by pvData in bytes.
//! \param pfnCallback is a function to call when this buffer has been filled.
//!
//! This function initiates a request for the I2S controller to receive data
//! from an I2S codec.
//!
//! \return 0 if the buffer was accepted, returns non-zero if there was no
//! space available for this buffer.
//
//*****************************************************************************
unsigned long
SoundBufferRead(void *pvData, unsigned long ulSize,
                tBufferCallback pfnCallback)
{
    unsigned long ulChannel;
    unsigned long ulDMASetting;

    //
    // Must disable I2S interrupts during this time to prevent state problems.
    //
    IntDisable(INT_I2S0);

    //
    // Save the buffer information.
    //
    g_sInBuffers[g_ulRecording].pulData = (unsigned long *)pvData;
    g_sInBuffers[g_ulRecording].ulSize = ulSize;
    g_sInBuffers[g_ulRecording].pfnBufferCallback = pfnCallback;

    //
    // Configure the I2S TX DMA channel to use high priority burst mode.
    //
    uDMAChannelAttributeEnable(UDMA_CHANNEL_I2S0RX,
                               (UDMA_ATTR_USEBURST |
                                UDMA_ATTR_HIGH_PRIORITY));

    //
    // Handle which half of the ping-pong DMA is in use.
    //
    if(g_ulRecording)
    {
        ulChannel = UDMA_CHANNEL_I2S0RX | UDMA_ALT_SELECT;
    }
    else
    {
        ulChannel = UDMA_CHANNEL_I2S0RX | UDMA_PRI_SELECT;
    }

    //
    // Handle stereo recording.
    //
    if(g_usBitsPerSample == 8)
    {
        //
        // The transfer size is 16 bits(stereo 8 bits) from the RX FIFO to
        // RX buffer.
        //
        ulDMASetting = UDMA_SIZE_16 | UDMA_DST_INC_16 |
                       UDMA_SRC_INC_NONE | UDMA_ARB_2;

        //
        // Modify the DMA transfer size at it is units not bytes.
        //
        g_sInBuffers[g_ulRecording].ulSize >>= 1;
    }
    else
    {
        //
        // The transfer size is 32 bits(stereo 16 bits) from the RX FIFO to
        // RX buffer.
        //
        ulDMASetting = UDMA_SIZE_32 | UDMA_DST_INC_32 |
                       UDMA_SRC_INC_NONE | UDMA_ARB_2;

        //
        // Modify the DMA transfer size at it is units not bytes.
        //
        g_sInBuffers[g_ulRecording].ulSize >>= 2;
    }

    //
    // Configure the DMA settings for this channel.
    //
    uDMAChannelControlSet(ulChannel, ulDMASetting);

    //
    // Set the addresses and the DMA mode to ping-pong.
    //
    uDMAChannelTransferSet(ulChannel,
                           UDMA_MODE_PINGPONG,
                           (void *)(I2S0_BASE + I2S_O_RXFIFO),
                           (unsigned long *)g_sInBuffers[g_ulRecording].pulData,
                           g_sInBuffers[g_ulRecording].ulSize);

    //
    // Enable the RX DMA channel.  At this point the uDMA controller will
    // start servicing the request from the I2S, and the receive side should
    // start receiving data if any is available.
    //
    uDMAChannelEnable(UDMA_CHANNEL_I2S0RX);

    //
    // Indicate that there is still a pending transfer.
    //
    HWREGBITW(&g_ulDMAFlags, FLAG_RX_PENDING) = 1;

    //
    // Toggle which ping-pong DMA setting is in use.
    //
    g_ulRecording ^= 1;

    //
    // Enable the I2S controller to start receiving data.
    //
    I2SRxEnable(I2S0_BASE);

    //
    // Re-enable I2S interrupts.
    //
    IntEnable(INT_I2S0);

    return(0);
}

//*****************************************************************************
//
//! Sets the volume of the music/sound effect playback.
//!
//! \param ulPercent is the volume percentage, which must be between 0%
//! (silence) and 100% (full volume), inclusive.
//!
//! This function sets the volume of the sound output to a value between
//! silence (0%) and full volume (100%).
//!
//! \return None.
//
//*****************************************************************************
void
SoundVolumeSet(unsigned long ulPercent)
{
    TLV320AIC23BHeadPhoneVolumeSet(ulPercent);
}

//*****************************************************************************
//
//! Decreases the volume.
//!
//! \param ulPercent is the amount to decrease the volume, specified as a
//! percentage between 0% (silence) and 100% (full volume), inclusive.
//!
//! This function adjusts the audio output down by the specified percentage.
//! The adjusted volume will not go below 0% (silence).
//!
//! \return None.
//
//*****************************************************************************
void
SoundVolumeDown(unsigned long ulPercent)
{
    //
    // Do not let the volume go below 0%.
    //
    if(g_ucVolume < ulPercent)
    {
        //
        // Set the volume to the minimum.
        //
        g_ucVolume = 0;
    }
    else
    {
        //
        // Decrease the volume by the specified amount.
        //
        g_ucVolume -= ulPercent;
    }

    //
    // Set the new volume.
    //
    SoundVolumeSet(g_ucVolume);
}

//*****************************************************************************
//
//! Returns the current volume level.
//!
//! This function returns the current volume, specified as a percentage between
//! 0% (silence) and 100% (full volume), inclusive.
//!
//! \return Returns the current volume.
//
//*****************************************************************************
unsigned char
SoundVolumeGet(void)
{
    //
    // Return the current Audio Volume.
    //
    return(g_ucVolume);
}

//*****************************************************************************
//
//! Increases the volume.
//!
//! \param ulPercent is the amount to increase the volume, specified as a
//! percentage between 0% (silence) and 100% (full volume), inclusive.
//!
//! This function adjusts the audio output up by the specified percentage.  The
//! adjusted volume will not go above 100% (full volume).
//!
//! \return None.
//
//*****************************************************************************
void
SoundVolumeUp(unsigned long ulPercent)
{
    //
    // Increase the volume by the specified amount.
    //
    g_ucVolume += ulPercent;

    //
    // Do not let the volume go above 100%.
    //
    if(g_ucVolume > 100)
    {
        //
        // Set the volume to the maximum.
        //
        g_ucVolume = 100;
    }

    //
    // Set the new volume.
    //
    SoundVolumeSet(g_ucVolume);
}

//*****************************************************************************
//
// Close the Doxygen group.
//! @}
//
//*****************************************************************************

?? 快捷鍵說明

復(fù)制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號 Ctrl + =
減小字號 Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
日韩va亚洲va欧美va久久| 懂色av一区二区在线播放| 国产在线视频精品一区| 日本高清免费不卡视频| 日韩精品一区国产麻豆| 一区免费观看视频| 国产伦精一区二区三区| 欧美视频一区在线| 中文字幕第一页久久| 国产精品国产精品国产专区不蜜 | 亚洲成人动漫一区| 国产在线国偷精品免费看| 国产电影精品久久禁18| 99精品视频在线播放观看| 2023国产精华国产精品| 天天色 色综合| 激情小说欧美图片| 99精品黄色片免费大全| 久久久久免费观看| 免费av成人在线| 欧美吻胸吃奶大尺度电影 | 亚洲与欧洲av电影| 天天av天天翘天天综合网| 97se亚洲国产综合在线| 国产日韩av一区| 亚洲成人免费视| 91热门视频在线观看| 亚州成人在线电影| 日本亚洲视频在线| 99国产欧美久久久精品| 亚洲欧洲另类国产综合| 五月婷婷综合网| 欧美理论在线播放| 亚洲午夜精品一区二区三区他趣| 99re这里只有精品6| 日韩欧美在线不卡| 亚洲精品v日韩精品| 色婷婷国产精品综合在线观看| 国产精品精品国产色婷婷| 三级不卡在线观看| 91精品啪在线观看国产60岁| 中文幕一区二区三区久久蜜桃| 亚洲第一搞黄网站| 成人国产一区二区三区精品| 国产精品久久久久久久久久久免费看 | 一区二区三区欧美在线观看| 久久se精品一区精品二区| 欧美一区二区视频在线观看 | 久久久久国产免费免费| 国产精品一区二区在线播放| 国产午夜亚洲精品不卡| av电影一区二区| 一区二区三区四区高清精品免费观看| 91精彩视频在线| 国产欧美一区二区精品仙草咪| 国产99一区视频免费| 自拍偷拍亚洲激情| 国产不卡视频一区| 精品国产露脸精彩对白 | 成人网页在线观看| 精品国产乱码久久久久久老虎 | 精东粉嫩av免费一区二区三区| 欧美成人vr18sexvr| 国产成人夜色高潮福利影视| 中文字幕亚洲在| 成人免费观看视频| 亚洲激情六月丁香| 91色在线porny| 日韩久久一区二区| 欧美日韩国产经典色站一区二区三区| 蜜桃精品视频在线| 欧美一区二区三区不卡| 日韩—二三区免费观看av| 欧美三级在线看| 欧美亚洲尤物久久| 捆绑调教美女网站视频一区| 国产精品视频免费看| 91国产福利在线| 久久99精品国产.久久久久久| 欧美一区二区国产| 不卡一区二区在线| 日韩中文字幕一区二区三区| 欧美日韩国产一区二区三区地区| 国产乱子伦视频一区二区三区 | 中文字幕不卡在线播放| 欧美日韩不卡一区二区| 国产九九视频一区二区三区| 久久女同性恋中文字幕| 欧美日韩一区二区在线观看视频| 亚洲永久精品大片| 国产精品午夜久久| 91精品国产综合久久国产大片| 奇米精品一区二区三区在线观看 | 国产精品视频一二三区| www.综合网.com| 久久精品国产99久久6| 亚洲乱码国产乱码精品精可以看| 色丁香久综合在线久综合在线观看| 依依成人综合视频| 717成人午夜免费福利电影| 久久99这里只有精品| 久久精品亚洲精品国产欧美kt∨ | 黄色小说综合网站| 亚洲3atv精品一区二区三区| 91精品国模一区二区三区| 狠狠色狠狠色综合| **性色生活片久久毛片| 久久久久国产精品麻豆ai换脸| 欧美日韩aaa| 国产二区国产一区在线观看| 精品无人码麻豆乱码1区2区| 青青国产91久久久久久 | 欧美一区在线视频| 国产二区国产一区在线观看 | 国产精品一二三| 美女网站色91| 免费观看91视频大全| 视频一区国产视频| 国产欧美日产一区| 国产亚洲精品精华液| 欧美性猛交xxxx黑人交| 国产一区二区三区av电影| 国产曰批免费观看久久久| 亚洲女同一区二区| 亚洲一区在线电影| 国产成人鲁色资源国产91色综 | 国产高清亚洲一区| 亚洲国产成人91porn| 国产日韩av一区二区| 欧美一区二区免费视频| 99久久精品免费观看| 国产综合色视频| 国产精品99久| 国产精品自在在线| 不卡视频免费播放| 激情综合网最新| 亚洲第一在线综合网站| 日韩中文字幕麻豆| 一区二区三区在线观看欧美 | 中文字幕日韩一区| 亚洲激情图片一区| 日韩精品三区四区| 狠狠狠色丁香婷婷综合激情| 国产精品亚洲人在线观看| 日韩国产精品久久久| 久久er99热精品一区二区| 国产一区二区三区在线观看免费 | 精品少妇一区二区三区在线播放 | 精品国产乱码久久久久久老虎| 久久嫩草精品久久久久| 这里只有精品99re| 精品视频在线视频| 亚洲精品一区二区三区在线观看| 国产亚洲精品bt天堂精选| 亚洲欧美区自拍先锋| 午夜精品久久久久久久| 一区二区三区欧美亚洲| 麻豆精品国产91久久久久久| 五月天亚洲精品| 国产剧情在线观看一区二区 | 欧美色大人视频| 久久久精品一品道一区| 亚洲精品成人精品456| 秋霞成人午夜伦在线观看| 国产酒店精品激情| 欧美亚洲国产一区二区三区va | 国产成人午夜精品5599| 色妹子一区二区| 日韩一区二区中文字幕| 日韩精品一区二区三区三区免费 | 亚洲国产成人在线| 中文av字幕一区| 亚洲欧洲成人av每日更新| 日韩精品福利网| 成人动漫一区二区| 99热精品一区二区| 精品少妇一区二区三区视频免付费| 国产精品午夜久久| 免费在线一区观看| 欧美综合亚洲图片综合区| 久久亚洲春色中文字幕久久久| 亚洲精品国产一区二区三区四区在线 | 99视频在线精品| 欧美www视频| 午夜精品久久久久久久蜜桃app| 国产91精品入口| 日韩午夜激情av| 艳妇臀荡乳欲伦亚洲一区| 高清av一区二区| 91老师国产黑色丝袜在线| 欧美色图片你懂的| 日韩欧美中文一区二区| 亚洲综合一区在线| 丁香六月综合激情| 在线看一区二区| 精品成人佐山爱一区二区| 亚洲欧美在线aaa| 首页亚洲欧美制服丝腿| 色婷婷久久综合| 久久久久久久久久久久久夜|