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

📄 yss903.c

📁 用于TM1300/PNX1300系列DSP(主要用于视频处理)的设备库的源码
💻 C
📖 第 1 页 / 共 3 页
字号:
                DP(("ERR_YSS903_YSS_INVALID_SURROUND_MODE\n"));
                return False;
            }
            if (yss903WriteBits(0x01, 0, 0x60))
              return False;
            yss903WriteRegisters(surround_on_para_kara, sizeof(surround_on_para_kara));
            break;
        case yss903SurroundLive:
            if (!InKaraokeMode)
            {
                DP(("ERR_YSS903_YSS_INVALID_SURROUND_MODE\n"));
                return False;
            }
            if (yss903WriteBits(0x01, 0x20, 0x60))
              return False;
            yss903WriteRegisters(surround_on_para_kara, sizeof(surround_on_para_kara));
            break;
        case yss903SurroundMovie:
            if (!InKaraokeMode)
            {
                DP(("ERR_YSS903_YSS_INVALID_SURROUND_MODE\n"));
                return False;
            }
            if (yss903WriteBits(0x01, 0x40, 0x60))
              return False;
            yss903WriteRegisters(surround_on_para_kara, sizeof(surround_on_para_kara));
            break;
        case yss903SurroundKaraoke:
            if (!InKaraokeMode)
            {
                DP(("ERR_YSS903_YSS_INVALID_SURROUND_MODE\n"));
                return False;
            }
            if (yss903WriteBits(0x01, 0x60, 0x60))
              return False;
            yss903WriteRegisters(surround_on_para_kara, sizeof(surround_on_para_kara));
            break;
        case yss903SurroundSmallHall:
            if (InKaraokeMode)
            {
                DP(("ERR_YSS903_YSS_INVALID_SURROUND_MODE\n"));
                return False;
            }
            if (yss903WriteBits(0x01, 0x0, 0x60))   /* mode */
              return False;
            if (yss903WriteBits(0x01, 0x0, 0x80))   /*Ymersion off */
              return False;
            yss903WriteRegisters(surround_on_para_movie, sizeof(surround_on_para_movie));
            break;
        case yss903SurroundWideSmallHall:
            if (InKaraokeMode)
            {
                DP(("ERR_YSS903_YSS_INVALID_SURROUND_MODE\n"));
                return False;
            }
            if (yss903WriteBits(0x01, 0x0, 0x60))   /* mode */
              return False;
            if (yss903WriteBits(0x01, 0x80, 0x80))  /*Ymersion on */
              return False;
            yss903WriteRegisters(surround_on_para_movie, sizeof(surround_on_para_movie));
            break;
        case yss903SurroundLargeHall:
            if (InKaraokeMode)
            {
                DP(("ERR_YSS903_YSS_INVALID_SURROUND_MODE\n"));
                return False;
            }
            if (yss903WriteBits(0x01, 0x20, 0x60))  /* mode */
              return False;
            if (yss903WriteBits(0x01, 0x0, 0x80))   /*Ymersion off */
              return False;
            yss903WriteRegisters(surround_on_para_movie, sizeof(surround_on_para_movie));
            break;
        case yss903SurroundWideLargeHall:
            if (InKaraokeMode)
            {
                DP(("ERR_YSS903_YSS_INVALID_SURROUND_MODE\n"));
                return False;
            }
            if (yss903WriteBits(0x01, 0x20, 0x60))  /* mode */
              return False;
            if (yss903WriteBits(0x01, 0x80, 0x80))  /*Ymersion on */
              return False;
            yss903WriteRegisters(surround_on_para_movie, sizeof(surround_on_para_movie));
            break;
        case yss903SurroundStadium:
            if (InKaraokeMode)
            {
                DP(("ERR_YSS903_YSS_INVALID_SURROUND_MODE\n"));
                return False;
            }
            if (yss903WriteBits(0x01, 0x40, 0x60))  /* mode */
              return False;
            if (yss903WriteBits(0x01, 0x0, 0x80))   /*Ymersion off */
              return False;
            yss903WriteRegisters(surround_on_para_movie, sizeof(surround_on_para_movie));
            break;
        case yss903SurroundWideStadium:
            if (InKaraokeMode)
            {
                DP(("ERR_YSS903_YSS_INVALID_SURROUND_MODE\n"));
                return False;
            }
            if (yss903WriteBits(0x01, 0x40, 0x60))  /* mode */
              return False;
            if (yss903WriteBits(0x01, 0x80, 0x80))  /*Ymersion on */
              return False;
            yss903WriteRegisters(surround_on_para_movie, sizeof(surround_on_para_movie));
            break;
        case yss903SurroundRockConcert:
            if (InKaraokeMode)
            {
                DP(("ERR_YSS903_YSS_INVALID_SURROUND_MODE\n"));
                return False;
            }
            if (yss903WriteBits(0x01, 0x60, 0x60))  /* mode */
              return False;
            if (yss903WriteBits(0x01, 0x0, 0x80))   /*Ymersion off */
              return False;
            yss903WriteRegisters(surround_on_para_movie, sizeof(surround_on_para_movie));
            break;
        case yss903SurroundWideRockConcert:
            if (InKaraokeMode)
            {
                DP(("ERR_YSS903_YSS_INVALID_SURROUND_MODE\n"));
                return False;
            }
            if (yss903WriteBits(0x01, 0x60, 0x60))  /* mode */
              return False;
            if (yss903WriteBits(0x01, 0x80, 0x80))  /*Ymersion on */
              return False;
            yss903WriteRegisters(surround_on_para_movie, sizeof(surround_on_para_movie));
            break;
        default:
            if (InKaraokeMode)
                yss903WriteRegisters(surround_off_para_kara, sizeof(surround_off_para_kara));
            else 
                yss903WriteRegisters(surround_off_para_movie, sizeof(surround_off_para_movie));
            DP(("ERR_YSS903_YSS_INVALID_SURROUND_MODE\n"));
            return False;
    }
    return True;
}
                                                                                        
/***************************************************************/
extern Bool yss903SetMicEcho(Bool on)
{
    UInt8 micecho_on_para[]=
    { 0x25,0x7f,
      0x28,0x7f,
      0x2b,0x7f,
      0x2c,0x7f,
      0x36,0x7f,
      0x37,0x7f,
      0x20,0x7f,
      0x23,0x7f
    };

    UInt8 micecho_off_para[]=
    { 0x25,0x00,
      0x28,0x00,
      0x2b,0x00,
      0x2c,0x00,
      0x36,0x00,
      0x37,0x00,
      0x20,0x00,
      0x23,0x00
    };

    DP_L2(("yss903SetMicEcho()\n"));
    if (!InKaraokeMode)
        return False;
    if(on)
       yss903WriteRegisters(micecho_on_para, sizeof(micecho_on_para));
    else
       yss903WriteRegisters(micecho_off_para, sizeof(micecho_off_para));
    return True;
}

/***************************************************************/
extern Bool yss903SetMicReverb(Bool on)
{
  UInt8 micreverb_on_para[]=
    { 0x25,0x7f,
      0x28,0x7f,
      0x2b,0x7f,
      0x2c,0x7f,
      0x3a,0x7f,
      0x3b,0x7f,
      0x20,0x7f,
      0x23,0x7f
    };
  UInt8 micreverb_off_para[]=
    { 0x25,0x00,
      0x28,0x00,
      0x2b,0x00,
      0x2c,0x00,
      0x3a,0x00,
      0x3b,0x00,
      0x20,0x00,
      0x23,0x00
    };

    DP_L2(("yss903SetMicReverb()\n"));
    if (!InKaraokeMode)
        return False;
    if(on)
    {
        if (yss903WriteBits(0x06, 0x10, 0x10)) 
            return False;
        yss903WriteRegisters(micreverb_on_para, sizeof(micreverb_on_para));
        return True;
    }
    else
    {
        if (yss903WriteBits(0x06, 0x00, 0x10)) 
            return False;
        yss903WriteRegisters(micreverb_off_para, sizeof(micreverb_off_para));
        return True;
    }
}

/***************************************************************/
extern Bool yss903SetMicSurround(Bool on)
{
   UInt8 micsurround_on_para[]=
    { 0x3c,0x7f,
      0x3d,0x7f
    };
    UInt8 micsurround_off_para[]=
    { 0x3c,0x00,
      0x3d,0x00
    };

    DP_L2(("yss903SetMicSurround()\n"));
    if (!InKaraokeMode)
        return False;
    if(on)
        yss903WriteRegisters(micsurround_on_para, sizeof(micsurround_on_para));
    else 
        yss903WriteRegisters(micsurround_off_para, sizeof(micsurround_off_para));
    return True;
}


/***************************************************************/
extern Bool yss903SetVoiceCancel(Bool on)
{
    DP_L2(("yss903SetVoiceCancel()\n"));
    if (!InKaraokeMode)
        return False;
    if(on)
    {
        if (yss903WriteBits(0x02, 0x10, 0x10)) 
            return False;
    }
    else
    {
        if (yss903WriteBits(0x02, 0x0, 0x10)) 
            return False;
    }
    return True;
}


/***************************************************************/
/* control the pitch change functions */
extern Bool yss903SetLineInputPitchChange(Int32 cents)
{
    Int8 ival;
/* there are 100 cents in a half step, and a whole step is a "key" 
 * in Yamaha terminology.  There are 1200 cents in an octave.
 * The ratio of 100 cents is the twelfth root of 2.
 * For the line input, valid pitch shifts are:
 * 0, +/-50, +/-150, +/-200, +/-250, +/-300, +/-350, +/-400, +/-450, 
 *   +/-500, +/-550, +/-600, +-700, +/-1200, -1400, +/-1900
 */
    DP_L2(("yss903SetLineInputPitchChange()\n"));
    if (!InKaraokeMode)
        return False;

    if (cents>1875)
        ival = 0x0F;    /*  +1800, or an octave plus a fifth    */
    else if (cents > 1100)
        ival = 0x0E;    /*  one octave  */
    else if (cents > -12)   /* marks the bottom of the range */
    {   /* +3.5 down to zero key shift */
        ival = (Int32)((float)cents * 0.02);
        if (ival > 0xD) 
            ival = 0xD;
    }
    else if (cents > -375)
    {
        ival = (Int32)((float)cents * 0.02);
        if (ival > 0xD) 
            ival = 0xD;
        ival = 0x1F + ival;
    }
    else if (cents > -1250)
        ival = 0x12;    /* octave down */
    else if (cents > -1350)
        ival = 0x11;    /* octave plus a whole step (ninth) down */
    else ival = 0x10;   /* octave plus a fifth down */

    DP(("Setting line key shift to %x from %g cents\n", ival, cents));
    if (yss903WriteBits(0x01, ival, 0x1F)) 
          return False;
    return True;
 }


/***************************************************************/
extern Bool yss903SetMicInputPitchChange (Int32 cents)
{
    Int8 ival;
/* there are 100 cents in a half step, and a whole step is a "key" 
 * in Yamaha terminology.  There are 1200 cents in an octave.
 * The ratio of 100 cents is the twelfth root of 2.
 * For the line input, valid pitch shifts are:
 * 0, +/-10, +/-20, +/-400, +/-700, +/-1200
 */
    DP_L2(("yss903SetMicInputPitchChange()\n"));
    if (!InKaraokeMode)
        return False;

    if (cents == 1200)       ival = 0x5;
    else if (cents == +700)  ival = 0x4;
    else if (cents == +400)  ival = 0x3;
    else if (cents == +20 )  ival = 0x2;
    else if (cents == +10 )  ival = 0x1;
    else if (cents == -10 )  ival = 0xF;
    else if (cents == -20 )  ival = 0xE;
    else if (cents == -400)  ival = 0xD;
    else if (cents == -700)  ival = 0xC;
    else if (cents == -1200) ival = 0xB;
    else ival = 0x0;

    DP(("Setting mic key shift to %x from %g cents\n", ival, cents));
    return (yss903WriteBits(0x07, ival | (ival<<4), 0xFF));
 }

#endif USE_KARAOKE

⌨️ 快捷键说明

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