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

📄 csyn.h

📁 游戏编程精粹2第六章源码
💻 H
📖 第 1 页 / 共 3 页
字号:
#ifndef  _CSYN_H
#define  _CSYN_H
/*
** CSyn - Synthesis Engine
**
** Author: Phil Burk
** Copyright 1996-2001 Phil Burk
** All Rights Reserved.
*/
/*
O- use enum names in prototypes
O- move enums so they don't show up in HTML
*/
#ifdef WIN32
#include <windows.h>
#else
#include <ctype.h>
#endif

/* CSyn uses PortAudio as its audio interface library.
 * For more information, see http://www.portaudio.com
 */
#include "portaudio.h"

#define BEGIN
#define END
/*************************************************************
***********  CSyn.h data types  ****************************
*************************************************************/
#ifndef int8
	typedef char  int8;
	typedef unsigned char  uint8;
#endif
#ifndef int16
	typedef short  int16;
	typedef unsigned short  uint16;
#endif
#ifndef int32
	typedef long   int32;
	typedef unsigned long  uint32;
#endif

typedef int32   CSynErr;
typedef int32   CSynToken;
typedef void   *CSynContext;

// The names of unit generator and their ports are passed as integers
// generated by hashing the name text.
typedef uint32  CSynName;
typedef uint32  CSynUnitType;


// A segmented envelope reads an array of EnvelopeFrame structures.
// This is used with CSyn_WriteEnvelope().
typedef struct EnvelopeFrame
{
// Time it takes to get to the target value from previous value. 
	double      env_Duration; 
// Target value for this segment.
	double      env_Value;
} EnvelopeFrame;

// UNIMPLEMENTED
enum  CSyn_CalculationRate
{
	CSYN_RATE_AUDIO = 0,
	CSYN_RATE_CONTROL /* Do not use yet. FIXME */
};

/********************************************************************/
/* Define hash values for PORT and UNIT names. */
/* Do NOT edit. Generated automatically by gen_hash.c */
#define CSYN_PORT_A0                             (0x000001C1)
#define CSYN_PORT_A1                             (0x000001C9)
#define CSYN_PORT_A2                             (0x000001D1)
#define CSYN_PORT_A3                             (0x000001D9)
#define CSYN_PORT_A4                             (0x000001E1)
#define CSYN_PORT_Amplitude                      (0x02158EC1)
#define CSYN_PORT_B0                             (0x000001C2)
#define CSYN_PORT_B1                             (0x000001CA)
#define CSYN_PORT_B2                             (0x000001D2)
#define CSYN_PORT_B3                             (0x000001DA)
#define CSYN_PORT_B4                             (0x000001E2)
#define CSYN_PORT_BandPass                       (0x020267B0)
#define CSYN_PORT_Bandwidth                      (0x01CCDE32)
#define CSYN_PORT_BusInput                       (0x02139392)
#define CSYN_PORT_BusOutput                      (0x020216D4)
#define CSYN_PORT_Current                        (0x020E546B)
#define CSYN_PORT_Confidence                     (0x01CDB4C7)
#define CSYN_PORT_Damping                        (0x01DA8E8C)
#define CSYN_PORT_Data                           (0x0000E24C)
#define CSYN_PORT_Delay                          (0x0008706C)
#define CSYN_PORT_Fade                           (0x0000E64E)
#define CSYN_PORT_Frequency                      (0x01F2D76C)
#define CSYN_PORT_Gain                           (0x0000F98F)
#define CSYN_PORT_Gate                           (0x0000EA4F)
#define CSYN_PORT_HalfLife                       (0x01D22B1A)
#define CSYN_PORT_HighPass                       (0x02026E36)
#define CSYN_PORT_Input                          (0x000849B9)
#define CSYN_PORT_InputA                         (0x0028C9B9)
#define CSYN_PORT_InputB                         (0x002949B9)
#define CSYN_PORT_InputC                         (0x0029C9B9)
#define CSYN_PORT_LowerLimit                     (0x01D24CEE)
#define CSYN_PORT_LowPass                        (0x020C5184)
#define CSYN_PORT_Output                         (0x004250F7)
#define CSYN_PORT_OutputPulse                    (0x01842621)
#define CSYN_PORT_Pan                            (0x00001ED8)
#define CSYN_PORT_Period                         (0x0039E1F8)
#define CSYN_PORT_Phase                          (0x000751D0)
#define CSYN_PORT_Q                              (0x00000051)
#define CSYN_PORT_Rate                           (0x0000EA5A)
#define CSYN_PORT_ResetLevel                     (0x01C26776)
#define CSYN_PORT_Resonance                      (0x01F06550)
#define CSYN_PORT_Select                         (0x0041187B)
#define CSYN_PORT_SetLevel                       (0x01D60953)
#define CSYN_PORT_Slope                          (0x00074F73)
#define CSYN_PORT_Stiffness                      (0x01D25249)
#define CSYN_PORT_Table                          (0x000743DC)
#define CSYN_PORT_Time                           (0x0000E8DC)
#define CSYN_PORT_TriggerOutput                  (0x02867E12)
#define CSYN_PORT_TriggerPass                    (0x0203E854)
#define CSYN_PORT_UpperLimit                     (0x01D24B3F)
#define CSYN_PORT_Width                          (0x0007849F)
#define CSYN_UNIT_Bus_Read                       (0x01BC7F72)
#define CSYN_UNIT_Bus_Write                      (0x01E355E2)
#define CSYN_UNIT_Circuit                        (0x020CB60B)
#define CSYN_UNIT_Channel_In                     (0x01EA9411)
#define CSYN_UNIT_Channel_Out                    (0x01EC67F1)
#define CSYN_UNIT_Delay_Basic                    (0x0141B8DE)
#define CSYN_UNIT_Delay_Interpolated             (0x053E880C)
#define CSYN_UNIT_Envelope_Linear                (0x057BBDB7)
#define CSYN_UNIT_Envelope_Parabolic             (0x0583AE2B)
#define CSYN_UNIT_Filter_1o1p                    (0x01BE3660)
#define CSYN_UNIT_Filter_1o1p1z                  (0x023E5660)
#define CSYN_UNIT_Filter_1o1z                    (0x01BE5E60)
#define CSYN_UNIT_Filter_2o2p                    (0x01BE36E2)
#define CSYN_UNIT_Filter_2o2p2z                  (0x023E76E2)
#define CSYN_UNIT_Filter_BandPass                (0x05C125EE)
#define CSYN_UNIT_Filter_BandStop                (0x05B485E2)
#define CSYN_UNIT_Filter_LowPass                 (0x05D4F996)
#define CSYN_UNIT_Filter_LowShelf                (0x058FE72E)
#define CSYN_UNIT_Filter_HighPass                (0x05C132FA)
#define CSYN_UNIT_Filter_HighShelf               (0x05589F9E)
#define CSYN_UNIT_Filter_PeakingEQ               (0x05716532)
#define CSYN_UNIT_Filter_StateVariable           (0x06117EDC)
#define CSYN_UNIT_Filter_StateVariableOld        (0x06119B8B)
#define CSYN_UNIT_Lag_Exponential                (0x05829F02)
#define CSYN_UNIT_Lag_Linear                     (0x01F25AEE)
#define CSYN_UNIT_Lag_PeakFollower               (0x05F2D79E)
#define CSYN_UNIT_Line_In                        (0x01E35914)
#define CSYN_UNIT_Line_Out                       (0x020259FC)
#define CSYN_UNIT_Logic_Compare                  (0x01B7A332)
#define CSYN_UNIT_Logic_Latch                    (0x01687906)
#define CSYN_UNIT_Logic_SchmidtTrigger           (0x05A5EF32)
#define CSYN_UNIT_Logic_Select                   (0x0192E58E)
#define CSYN_UNIT_Model_MassSpring               (0x0534C2CF)
#define CSYN_UNIT_Math_Add                       (0x01B7611D)
#define CSYN_UNIT_Math_AddUnsigned               (0x059D9781)
#define CSYN_UNIT_Math_CrossFade                 (0x0589D9E3)
#define CSYN_UNIT_Math_Divide                    (0x01CEADD1)
#define CSYN_UNIT_Math_FourWayFade               (0x0544C60F)
#define CSYN_UNIT_Math_Integrate                 (0x058D830D)
#define CSYN_UNIT_Math_Maximum                   (0x01C11255)
#define CSYN_UNIT_Math_Minimum                   (0x01E11241)
#define CSYN_UNIT_Math_Multiply                  (0x0289DCED)
#define CSYN_UNIT_Math_MultiplyAdd               (0x0491EAFD)
#define CSYN_UNIT_Math_MultiplyAddUnsigned       (0x05855514)
#define CSYN_UNIT_Math_MultiplyUnsigned          (0x061B0E69)
#define CSYN_UNIT_Math_Pan                       (0x01B2E131)
#define CSYN_UNIT_Math_PanControl                (0x05AD5691)
#define CSYN_UNIT_Math_Subtract                  (0x02868559)
#define CSYN_UNIT_Measure_Period                 (0x057371F3)
#define CSYN_UNIT_Noise_Pink                     (0x01771138)
#define CSYN_UNIT_Noise_Red                      (0x017EDB10)
#define CSYN_UNIT_Noise_White                    (0x0194A966)
#define CSYN_UNIT_Osc_Impulse                    (0x01FDBFD1)
#define CSYN_UNIT_Osc_ImpulseBL                  (0x0251FFD1)
#define CSYN_UNIT_Osc_Pulse                      (0x01F061DD)
#define CSYN_UNIT_Osc_PulseBL                    (0x01F1B2DD)
#define CSYN_UNIT_Osc_Sawtooth                   (0x022199FF)
#define CSYN_UNIT_Osc_SawtoothBL                 (0x04C399FF)
#define CSYN_UNIT_Osc_Sine                       (0x01F28B71)
#define CSYN_UNIT_Osc_Square                     (0x0212C509)
#define CSYN_UNIT_Osc_SquareBL                   (0x021D4D09)
#define CSYN_UNIT_Osc_Table                      (0x01BEA1CF)
#define CSYN_UNIT_Osc_Triangle                   (0x01F1A5C9)
#define CSYN_UNIT_Osc_TriangleBL                 (0x0493A5C9)
#define CSYN_UNIT_Sample_Read16F1                (0x042426D3)
#define CSYN_UNIT_Sample_Read16F2                (0x042426D7)
#define CSYN_UNIT_Sample_Read16V1                (0x04A426D3)
#define CSYN_UNIT_Sample_Write16F1               (0x03A5F221)
#define CSYN_UNIT_Sample_Write16F2               (0x03A5F241)
#define CSYN_UNIT_Table_Lookup                   (0x0176D52A)
/* End of automatically generated code. */
/********************************************************************/

// Define Port types so they can be ORed together into a mask for searching.
#define CSYN_PORT_TYPE_INPUT    (1<<0)
#define CSYN_PORT_TYPE_OUTPUT   (1<<1)
#define CSYN_PORT_TYPE_VARIABLE (1<<2)
#define CSYN_PORT_TYPE_CHANNEL  (1<<3)
#define CSYN_PORT_TYPE_TABLE    (1<<4)
#define CSYN_PORT_TYPE_BUSINPUT (1<<5)
#define CSYN_PORT_TYPE_BUSOUTPUT (1<<6)

enum CSyn_StatusLevels
{
	CSYN_STATUS_STOPPED = 0,
	CSYN_STATUS_RELEASED,
	CSYN_STATUS_STARTED
};

enum CSyn_PriorityLevels
{
	CSYN_PRIORITY_LOW = 0,
	CSYN_PRIORITY_MEDIUM,
	CSYN_PRIORITY_HIGH,
	CSYN_PRIORITY_MANY   /* Number of different priority levels. */
};
typedef enum CSyn_PriorityLevels CSyn_PriorityLevel;

enum CSyn_DataTypes
{
	CSYN_DATA_TYPE_INT16 = 0,
	CSYN_DATA_TYPE_INT32,
	CSYN_DATA_TYPE_FLOAT32,
	CSYN_DATA_TYPE_FLOAT64
};
typedef enum CSyn_DataTypes CSyn_DataType;

enum CSyn_SignalTypes
{
	CSYN_SIGNAL_TYPE_RAW_SIGNED = 0,
	CSYN_SIGNAL_TYPE_RAW_UNSIGNED,
	CSYN_SIGNAL_TYPE_OSC_FREQ,
	CSYN_SIGNAL_TYPE_SAMPLE_RATE,
	CSYN_SIGNAL_TYPE_HALF_LIFE,
	CSYN_SIGNAL_TYPE_TIME,
	CSYN_SIGNAL_TYPE_SVF_FREQ,
	CSYN_SIGNAL_TYPE_FULL_RANGE,
	CSYN_SIGNAL_TYPE_MANY  /* Number of different signal types. */
};
typedef enum CSyn_SignalTypes CSyn_SignalType;

#define CSYN_WARN_BASE (100L)
enum CSyn_Warnings  /* NOTE - order must match CSyn_WarningText in cs_errs.c! */
{
	CSYN_WARN_ALREADY_CONNECTED = CSYN_WARN_BASE,

⌨️ 快捷键说明

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