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

📄 yss903.h

📁 用于TM1300/PNX1300系列DSP(主要用于视频处理)的设备库的源码
💻 H
字号:
/*
 * Copyright (c) 1995,1996,1997 by TriMedia Technologies. 
 *
 * +------------------------------------------------------------------+
 * | This software is furnished under a license and may only be used  |
 * | and copied in accordance with the terms and conditions of  such  |
 * | a license and with the inclusion of this copyright notice. This  |
 * | software or any other copies of this software may not be provided|
 * | or otherwise made available to any other person.  The ownership  |
 * | and title of this software is not transferred.                   |
 * |                                                                  |
 * | The information in this software is subject  to change without   |
 * | any  prior notice and should not be construed as a commitment by |
 * | TriMedia Technologies.                                           |
 * |                                                                  |
 * | this code and information is provided "as is" without any        |
 * | warranty of any kind, either expressed or implied, including but |
 * | not limited to the implied warranties of merchantability and/or  |
 * | fitness for any particular purpose.                              |
 * +------------------------------------------------------------------+
 *
 *  Module name              : yss903.h  1.2                 
 *
 *  Last update              : 18:43:53  -  00/11/09         
 *
 *  Description              : 
 *
 *     These functions are used to control the audio functions of 
 *     the YSS903 Yamaha Karaoke chip.
 *      
 *      
 */

#ifndef _YSS903_H_
#define _YSS903_H_

#include <tm1/tmLibdevErr.h>

#define YSS903_ERROR_BASE (ERR_LAYER_APP | ERR_TYPE_AUDIO | 0x470000 )
#define ERR_YSS903_YSS_WRITE_FAILED             (YSS903_ERROR_BASE + 1)
#define ERR_YSS903_YSS_READ_FAILED              (YSS903_ERROR_BASE + 2)
#define ERR_YSS903_YSS_STRUCTURE_SIZE_ERROR     (YSS903_ERROR_BASE + 3)
#define ERR_YSS903_YSS_INVALID_SURROUND_MODE    (YSS903_ERROR_BASE + 4)
#define ERR_YSS903_YSS_INVALID_BASE_REGISTER    (YSS903_ERROR_BASE + 5)

/*
YSS903 Karaoke chip control:

WARNING:  The matching C file assumes some hardware in an FPGA to write to the part.
If that changes, you need to change the read and write functions.

When the Yamaha chip works, it will become the only DAC, replacing the Wolfram part.
It provides a number of features:

- Volume
- Treble
- Midrange
- Bass
- Surround mode (at least four selections)
- Karaoke On/Off.

When Karaoke is on, more settings are available:

- Key control:  The remote has three buttons, sharp, flat, and natural.
There are 11 possible settings here.  The center setting is known as "natural," 
meaning no change is applied to the pitch of the microphone input.
The first two steps sharp and flat raise and lower the pitch by 10 and 20 cents.
The next three steps are for special effects.  I don't think we enable them normally.

- Microphone echo on/off
- Microphone reverb on/off
- Microphone surround on/off
- Voice cancel on/off

- Track select:  Karaoke SVCD's probably have multiple audio tracks, with and without 
vocals.  Karaoke VCD's probably have vocals in one channel (left) and music in the other.
The track select control rotates between the available tracks.  In VCD mode, it should 
choose left only, right only, and both.

Furthermore, there are three modes of operation for Karaoke.  

*/

/* low level interface: */
extern tmLibdevErr_t yss903Write(UInt8 addr, UInt8 data);
/* mask is the bits you want to write */
extern tmLibdevErr_t yss903WriteBits(UInt8 addr, UInt8 data, UInt8 mask);
extern tmLibdevErr_t yss903Read(UInt8 addr, UInt8 *data);

/* High level interface: */

/* Init and put it in movie mode */
extern Bool yss903Init( Address dataReg, Address ctrlReg, Address addrReg);

/* choose operational mode (karaoke or Movie) */
extern Bool yss903SelectMovieMode(void);
extern Bool yss903SelectKaraokeMode(void);

/* set the volume of line input.  value in dB. 
 * Volume applies to both Karaoke and Movie mode
 */ 
extern Bool yss903SetLineInputVolume(float leftVol, float rightVol);

/* set the volume of mic input.  value in dB. 
 * Volume applies to both Karaoke and Movie mode
 */ 
extern Bool yss903SetMicInputVolume (float level);

/* set the tone controls of line input.  
 * Values in dB, -10 to +10 in 2dB steps 
 * Tone applies to both Karaoke and Movie mode
 */ 
extern Bool yss903SetLineInputTreble(float level);
extern Bool yss903SetLineInputMidrange(float level);
extern Bool yss903SetLineInputBass(float level);

/* Choose the surround mode of disk audio. 
 * Karaoke and Movie mode have different surround mode settings.
 */
typedef enum {
    yss903SurroundOff,
    yss903SurroundPseudoStereo,
    yss903SurroundLive,
    yss903SurroundMovie,
    yss903SurroundKaraoke,
    yss903SurroundSmallHall,
    yss903SurroundWideSmallHall,
    yss903SurroundLargeHall,
    yss903SurroundWideLargeHall,
    yss903SurroundStadium,
    yss903SurroundWideStadium,
    yss903SurroundRockConcert,
    yss903SurroundWideRockConcert,
} yss903SurroundMode_t;

extern Bool yss903SetSurroundMode(yss903SurroundMode_t mode);

/* Pitch change functions are only available in Karaoke mode.
 * 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
 */
extern Bool yss903SetLineInputPitchChange(Int32 cents);

/* Pitch change functions are only available in Karaoke mode.
 * 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
 */
extern Bool yss903SetMicInputPitchChange (Int32 cents);

/* enable special functions: 
 * available in Karaoke mode.
 */
extern Bool yss903SetMicEcho(Bool on);
extern Bool yss903SetMicReverb(Bool on);
extern Bool yss903SetMicSurround(Bool on);
extern Bool yss903SetVoiceCancel(Bool on);

#endif _YSS903_H_

⌨️ 快捷键说明

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