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

? 歡迎來到蟲蟲下載站! | ?? 資源下載 ?? 資源專輯 ?? 關于我們
? 蟲蟲下載站

?? midinote.cpp

?? realtek562x系列驅動源碼。wince
?? CPP
字號:
//
// Copyright (c) Microsoft Corporation.  All rights reserved.
//
//
// Use of this sample source code is subject to the terms of the Microsoft
// license agreement under which you licensed this sample source code. If
// you did not accept the terms of the license agreement, you are not
// authorized to use this sample source code. For the terms of the license,
// please see the license agreement between you and Microsoft or, if applicable,
// see the LICENSE.RTF on your install media or the root of your tools installation.
// THE SAMPLE SOURCE CODE IS PROVIDED "AS IS", WITH NO WARRANTIES.
//
/*
** Copyright 2000-2003 Intel Corporation All Rights Reserved.
**
** Portions of the source code contained or described herein and all documents
** related to such source code (Material) are owned by Intel Corporation
** or its suppliers or licensors and is licensed by Microsoft Corporation for distribution.
** Title to the Material remains with Intel Corporation or its suppliers and licensors.
** Use of the Materials is subject to the terms of the Microsoft license agreement which accompanied the Materials.
** No other license under any patent, copyright, trade secret or other intellectual
** property right is granted to or conferred upon you by disclosure or
** delivery of the Materials, either expressly, by implication, inducement,
** estoppel or otherwise
** Some portion of the Materials may be copyrighted by Microsoft Corporation.
*/

#include "wavemain.h"

// x is the desired frequency
#define FREQRATIO(x) (double(x)/double(SAMPLERATE))

#define PITCH(x)    ( (UINT32 ) ( FREQRATIO(x) * double(1i64 << 32)) )

#define EQUAL       (1.059463094359)
#ifdef EUROPE
    #define  A      (442.0)
#else
    #define  A      (440.0)
#endif
#define ASHARP      (A * EQUAL)
#define B           (ASHARP * EQUAL)
#define C           (B * EQUAL / 2.0)
#define CSHARP      (C * EQUAL)
#define DNOTE       (CSHARP * EQUAL)
#define DSHARP      (DNOTE * EQUAL)
#define E           (DSHARP * EQUAL)
#define F           (E * EQUAL)
#define FSHARP      (F * EQUAL)
#define G           (FSHARP * EQUAL)
#define GSHARP      (G * EQUAL)

// pitch values, from middle c to octave above
const UINT32 CMidiNote::PitchTable[ 12 ] =
{
    PITCH(C),
    PITCH(CSHARP),
    PITCH(DNOTE),
    PITCH(DSHARP),
    PITCH(E),
    PITCH(F),
    PITCH(FSHARP),
    PITCH(G),
    PITCH(GSHARP),
    PITCH(A),
    PITCH(ASHARP),
    PITCH(B)
};

const INT16 CMidiNote::SineTable[0x101] =
{
0,
804,
1607,
2410,
3211,
4011,
4807,
5601,
6392,
7179,
7961,
8739,
9511,
10278,
11038,
11792,
12539,
13278,
14009,
14732,
15446,
16150,
16845,
17530,
18204,
18867,
19519,
20159,
20787,
21402,
22004,
22594,
23169,
23731,
24278,
24811,
25329,
25831,
26318,
26789,
27244,
27683,
28105,
28510,
28897,
29268,
29621,
29955,
30272,
30571,
30851,
31113,
31356,
31580,
31785,
31970,
32137,
32284,
32412,
32520,
32609,
32678,
32727,
32757,
32767,
32757,
32727,
32678,
32609,
32520,
32412,
32284,
32137,
31970,
31785,
31580,
31356,
31113,
30851,
30571,
30272,
29955,
29621,
29268,
28897,
28510,
28105,
27683,
27244,
26789,
26318,
25831,
25329,
24811,
24278,
23731,
23169,
22594,
22004,
21402,
20787,
20159,
19519,
18867,
18204,
17530,
16845,
16150,
15446,
14732,
14009,
13278,
12539,
11792,
11038,
10278,
9511,
8739,
7961,
7179,
6392,
5601,
4807,
4011,
3211,
2410,
1607,
804,
0,
-804,
-1607,
-2410,
-3211,
-4011,
-4807,
-5601,
-6392,
-7179,
-7961,
-8739,
-9511,
-10278,
-11038,
-11792,
-12539,
-13278,
-14009,
-14732,
-15446,
-16150,
-16845,
-17530,
-18204,
-18867,
-19519,
-20159,
-20787,
-21402,
-22004,
-22594,
-23169,
-23731,
-24278,
-24811,
-25329,
-25831,
-26318,
-26789,
-27244,
-27683,
-28105,
-28510,
-28897,
-29268,
-29621,
-29955,
-30272,
-30571,
-30851,
-31113,
-31356,
-31580,
-31785,
-31970,
-32137,
-32284,
-32412,
-32520,
-32609,
-32678,
-32727,
-32757,
-32767,
-32757,
-32727,
-32678,
-32609,
-32520,
-32412,
-32284,
-32137,
-31970,
-31785,
-31580,
-31356,
-31113,
-30851,
-30571,
-30272,
-29955,
-29621,
-29268,
-28897,
-28510,
-28105,
-27683,
-27244,
-26789,
-26318,
-25831,
-25329,
-24811,
-24278,
-23731,
-23169,
-22594,
-22004,
-21402,
-20787,
-20159,
-19519,
-18867,
-18204,
-17530,
-16845,
-16150,
-15446,
-14732,
-14009,
-13278,
-12539,
-11792,
-11038,
-10278,
-9511,
-8739,
-7961,
-7179,
-6392,
-5601,
-4807,
-4011,
-3211,
-2410,
-1607,
-804,
0   // Extra sample here saves 1 instruction in interpolation case
};

void CMidiNote::GainChange()
{
    m_fxpGain = m_pMidiStream->MapNoteGain(m_dwGain);
}

HRESULT CMidiNote::NoteOn(CMidiStream *pMidiStream, UINT32 Note, UINT32 Velocity, UINT32 Channel)
{
    // Save params
    m_pMidiStream = pMidiStream;
    m_Note     = Note;
    m_Channel  = Channel;
    SetVelocity(Velocity);

    // Init pitch
    m_Index = 0;
    if (Channel==FREQCHANNEL)
    {
        m_IndexDelta = (Note * INVSAMPLERATE);
    }
    else
    {
        m_IndexDelta = PitchTable[ Note % 12 ] ;

        // Adjust octave
        int Octave = ((int)(Note/12)) - 5;
        if (Octave>0)
        {
            m_IndexDelta <<= Octave;
        }
        else if (Octave<0)
        {
            m_IndexDelta >>= -Octave;
        }
    }

    return S_OK;
}

HRESULT CMidiNote::NoteOff(UINT32 Velocity)
{
    // Calculate the number of samples left before we cross a 0 boundary at the middle or end of the table
    DWORD SamplesLeft;
    if (m_IndexDelta)
        {
        SamplesLeft = ( ((0-m_Index)&0x7FFFFFFF) /m_IndexDelta) + 1;
        }
    else
        {
        SamplesLeft=0;
        }

    m_dwBytesLeft = SamplesLeft * sizeof(HWSAMPLE) * OUTCHANNELS;
    DEBUGMSG(1, (TEXT("CMidiNote::NoteOff, m_Index = 0x%x, m_IndexDelta = 0x%x, m_dwBytesLeft = %d\r\n"),m_Index,m_IndexDelta,m_dwBytesLeft));
    // m_pMidiStream->NoteDone(this);
    return S_OK;
}

PBYTE CMidiNote::Render(PBYTE pBuffer, PBYTE pBufferEnd, PBYTE pBufferLast)
{
    DWORD BytesLeft = m_dwBytesLeft;

    // Handle common case first
    if (BytesLeft==(DWORD)-1)
    {
        // Call real inner loop
        return Render2(pBuffer,pBufferEnd,pBufferLast);
    }

    DEBUGMSG(1, (TEXT("CMidiNote::Render, Note in release, m_dwBytesLeft = %d\r\n"),BytesLeft));

    DWORD BytesThisBuf = (pBufferEnd-pBuffer);
    if (BytesLeft > BytesThisBuf)
    {
        // If we can't end during this buffer, just remember where we were
        BytesLeft-=BytesThisBuf;
    }
    else
    {
        // Ok, we end during this buffer. Update pBufferEnd to force the renderer to stop on a 0 crossing.
        pBufferEnd = pBuffer + BytesLeft;
        BytesLeft=0;
    }

    m_dwBytesLeft = BytesLeft;

    // Call real inner loop
    pBufferLast = Render2(pBuffer,pBufferEnd,pBufferLast);

    if (BytesLeft==0)
    {
        // Time to end the note.
        DEBUGMSG(1, (TEXT("CMidiNote::Render, Last index after note done = 0x%x\r\n"),m_Index));
        m_pMidiStream->NoteDone(this);
    }

    return pBufferLast;
}

// Inner loop of the note renderer.
PBYTE CMidiNote::Render2(PBYTE pBuffer, PBYTE pBufferEnd, PBYTE pBufferLast)
{
    // Cache values so compiler won't worry about aliasing
    UINT32 Index            = m_Index;
    UINT32 IndexDelta       = m_IndexDelta;
    const INT16 * pSineTable = SineTable;
    LONG fxpGain = m_fxpGain;

    while (pBuffer < pBufferEnd)
    {
        // Index is in 8.24 format, where the top 8 bits index into the sine table and
        // the lower 24 bits represent the fraction of where we sit between two adjacent
        // samples, which we can use if we're doing linear interpolation
        // I chose 8.24 format so that wrap around at the top of the table happens
        // automatically without the need to do any ANDing.

        // Get an index into the sine table and look up the sample.
        UINT32 TableIndex = Index>>24;
        INT32 OutSamp0 = pSineTable[TableIndex];

#if MIDI_OPTIMIZE_LINEAR_INTERPOLATE
        // If we're doing linear interpolation, get the next sample also. Note that I don't
        // need to worry about wrap around at the top of the table because the sine table has
        // an extra value tacked onto the end to handle this special case.
        INT32 NextSamp = pSineTable[TableIndex+1];

        // Now do the interpolation, adjusting the index to be in 24.8 format and throwing away
        // the integer part (e.g. interpolate 256 points between samples).
        OutSamp0 += ( (NextSamp - OutSamp0) * ((Index>>16)&0x00FF) ) >> 8;
#endif

        // Increment the index to move to the next sample
        // and keep within the valid range
        Index += IndexDelta;

        // Volume!
        OutSamp0 = (OutSamp0 * fxpGain) >> VOLSHIFT;
#if (OUTCHANNELS==2)
        INT32 OutSamp1;
        OutSamp1=OutSamp0;
        if (pBuffer < pBufferLast)
        {
            OutSamp0 += ((HWSAMPLE *)pBuffer)[0];
            OutSamp1 += ((HWSAMPLE *)pBuffer)[1];
#if USE_MIX_SATURATE
            // Handle saturation
            if (OutSamp0>AUDIO_SAMPLE_MAX)
            {
                OutSamp0=AUDIO_SAMPLE_MAX;
            }
            else if (OutSamp0<AUDIO_SAMPLE_MIN)
            {
                OutSamp0=AUDIO_SAMPLE_MIN;
            }
            if (OutSamp1>AUDIO_SAMPLE_MAX)
            {
                OutSamp1=AUDIO_SAMPLE_MAX;
            }
            else if (OutSamp1<AUDIO_SAMPLE_MIN)
            {
                OutSamp1=AUDIO_SAMPLE_MIN;
            }
#endif
        }
        ((HWSAMPLE *)pBuffer)[0] = (HWSAMPLE)OutSamp0;
        ((HWSAMPLE *)pBuffer)[1] = (HWSAMPLE)OutSamp1;
        pBuffer += 2*sizeof(HWSAMPLE);
#else
        if (pBuffer<pBufferLast)
        {
            // Store/sum to the output buffer
            OutSamp0 += *(HWSAMPLE *)pBuffer;

#if USE_MIX_SATURATE
            // Handle saturation
            if (OutSamp0>AUDIO_SAMPLE_MAX)
            {
                OutSamp0=AUDIO_SAMPLE_MAX;
            }
            else if (OutSamp0<AUDIO_SAMPLE_MIN)
            {
                OutSamp0=AUDIO_SAMPLE_MIN;
            }
#endif
        }
        ((HWSAMPLE *)pBuffer)[0] = (HWSAMPLE)OutSamp0;
        pBuffer+=sizeof(HWSAMPLE);
#endif
    }

    // Save cached settings that might have changed in the inner loop
    m_Index = Index;

    return pBuffer;
}


?? 快捷鍵說明

復制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號 Ctrl + =
減小字號 Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
亚洲va国产天堂va久久en| 久久精品国产**网站演员| 国产精品美日韩| 中文一区二区在线观看| 国产欧美精品在线观看| 欧美国产激情一区二区三区蜜月| 国产亚洲自拍一区| 欧美激情综合在线| 国产精品天干天干在线综合| 亚洲欧洲在线观看av| 亚洲人成7777| 亚洲一卡二卡三卡四卡无卡久久| 亚洲国产欧美日韩另类综合 | 色哟哟欧美精品| 国产精品影视网| 国产成人自拍高清视频在线免费播放| 国产宾馆实践打屁股91| 成人激情视频网站| 色综合久久天天| 欧美日高清视频| 日韩欧美一区在线观看| 久久嫩草精品久久久久| 中文字幕欧美激情一区| 亚洲免费观看高清完整版在线| 一区二区三区中文字幕| 香蕉乱码成人久久天堂爱免费| 免费成人美女在线观看.| 国产精品亚洲一区二区三区妖精| www.亚洲人| 欧美日韩亚洲国产综合| 欧美xxxxx裸体时装秀| 欧美激情一区二区| 亚洲一区二区三区中文字幕 | 色播五月激情综合网| 色诱亚洲精品久久久久久| 欧美日韩免费高清一区色橹橹| 91精品国产欧美日韩| 国产欧美久久久精品影院| 一级做a爱片久久| 精品中文字幕一区二区小辣椒| 成人手机在线视频| 欧美男人的天堂一二区| 国产亚洲精品bt天堂精选| 亚洲一区二区欧美| 狠狠色狠狠色综合| 色天天综合色天天久久| 日韩欧美国产精品一区| 亚洲免费在线播放| 韩日精品视频一区| 久久精品欧美日韩| 欧美这里有精品| 91精品欧美综合在线观看最新| 26uuuu精品一区二区| 18涩涩午夜精品.www| 美女视频一区二区| 制服丝袜激情欧洲亚洲| 久久久久97国产精华液好用吗| 亚洲人成精品久久久久久| 激情亚洲综合在线| 欧美日韩免费不卡视频一区二区三区| 一区二区日韩av| 午夜久久久影院| 大陆成人av片| 日韩一区二区高清| 亚洲精品高清在线观看| 国产精品自在在线| 91麻豆精品国产91久久久资源速度| 综合精品久久久| 国产综合色在线| 91精品免费在线观看| 一区二区三区日韩在线观看| 国产福利91精品一区| 欧美一区二区三区的| 亚洲综合成人在线| av一二三不卡影片| 久久久精品综合| 黄色资源网久久资源365| 91麻豆精品国产91久久久| 亚洲综合av网| 99国产精品国产精品久久| 国产午夜精品久久久久久免费视| 免费观看日韩av| 678五月天丁香亚洲综合网| 亚洲女女做受ⅹxx高潮| 国产成人精品一区二区三区网站观看| 欧美一卡在线观看| 日韩不卡免费视频| 欧美军同video69gay| 亚洲bt欧美bt精品| 欧美三片在线视频观看| 日韩国产欧美一区二区三区| 亚洲一区二区视频在线| 91色视频在线| 成人免费一区二区三区视频| 粉嫩久久99精品久久久久久夜| 久久午夜老司机| 久久97超碰色| 精品奇米国产一区二区三区| 久久99精品久久久| 精品国产一区二区三区av性色| 麻豆成人在线观看| 欧美xxxxxxxx| 经典三级视频一区| 久久综合精品国产一区二区三区| 久久国产精品99久久人人澡| 欧美电视剧在线观看完整版| 美腿丝袜亚洲色图| 久久久精品2019中文字幕之3| 国产精品一区二区三区99| 国产日韩欧美精品综合| 国产**成人网毛片九色 | 国产亚洲女人久久久久毛片| 国模套图日韩精品一区二区 | 国内精品免费**视频| 精品少妇一区二区三区在线播放| 精品一区二区在线看| 久久人人超碰精品| 成人久久18免费网站麻豆| 亚洲欧洲av一区二区三区久久| 97精品久久久午夜一区二区三区| 一区二区三区 在线观看视频| 欧美片在线播放| 国产在线精品一区二区三区不卡 | 亚洲伊人伊色伊影伊综合网| 欧美日韩亚洲另类| www.激情成人| 国产精品久久久久影院老司| 成人高清免费在线播放| 亚洲欧美日韩中文播放| 欧美欧美欧美欧美| 国产乱人伦偷精品视频不卡| 日韩一区中文字幕| 欧美日韩精品一区二区三区蜜桃| 美女被吸乳得到大胸91| 亚洲国产精品精华液2区45| 91国偷自产一区二区三区观看 | 91在线视频免费91| 亚洲不卡一区二区三区| xfplay精品久久| 色婷婷综合久久久| 久久99日本精品| 亚洲免费观看在线观看| 日韩欧美黄色影院| av在线播放不卡| 日韩av电影一区| 日本一区二区三区国色天香 | 一区二区日韩电影| 26uuu久久天堂性欧美| 色一情一伦一子一伦一区| 欧美a级理论片| 亚洲女女做受ⅹxx高潮| 2020日本不卡一区二区视频| 色综合久久久久久久| 极品美女销魂一区二区三区免费| 国产精品的网站| 亚洲va天堂va国产va久| 粉嫩在线一区二区三区视频| 亚洲一区二区3| 久久久久久久久久电影| 欧美在线视频日韩| 国产成人福利片| 五月天亚洲精品| 亚洲天堂免费在线观看视频| 精品久久久久久久人人人人传媒| 在线影院国内精品| 国产成a人无v码亚洲福利| 免费成人性网站| 亚洲福中文字幕伊人影院| 国产精品久久毛片av大全日韩| 日韩欧美国产wwwww| 欧洲精品一区二区| 成人黄色国产精品网站大全在线免费观看| 日韩成人伦理电影在线观看| 伊人夜夜躁av伊人久久| 欧美激情综合在线| 精品欧美乱码久久久久久1区2区| 欧美日韩大陆在线| 在线观看国产一区二区| 91影视在线播放| 国产91富婆露脸刺激对白| 激情六月婷婷久久| 另类欧美日韩国产在线| 亚洲高清视频的网址| 亚洲激情欧美激情| 国产精品蜜臀av| 国产精品入口麻豆原神| 久久青草欧美一区二区三区| 日韩精品专区在线| 91麻豆精品国产91久久久使用方法| 欧美亚洲综合色| 色悠悠亚洲一区二区| 91麻豆.com| 91一区二区在线观看| 99v久久综合狠狠综合久久| 成人天堂资源www在线| 成人av在线电影| 91在线看国产| 色综合久久中文综合久久97| 91麻豆视频网站| 色婷婷综合久久久|