Home | History | Annotate | Download | only in host_src
      1 /*----------------------------------------------------------------------------
      2  *
      3  * File:
      4  * eas_types.h
      5  *
      6  * Contents and purpose:
      7  * The public interface header for the EAS synthesizer.
      8  *
      9  * This header only contains declarations that are specific
     10  * to this implementation.
     11  *
     12  * DO NOT MODIFY THIS FILE!
     13  *
     14  * Copyright Sonic Network Inc. 2004
     15 
     16  * Licensed under the Apache License, Version 2.0 (the "License");
     17  * you may not use this file except in compliance with the License.
     18  * You may obtain a copy of the License at
     19  *
     20  *      http://www.apache.org/licenses/LICENSE-2.0
     21  *
     22  * Unless required by applicable law or agreed to in writing, software
     23  * distributed under the License is distributed on an "AS IS" BASIS,
     24  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
     25  * See the License for the specific language governing permissions and
     26  * limitations under the License.
     27  *
     28  *----------------------------------------------------------------------------
     29  * Revision Control:
     30  *   $Revision: 726 $
     31  *   $Date: 2007-06-14 23:10:46 -0700 (Thu, 14 Jun 2007) $
     32  *----------------------------------------------------------------------------
     33 */
     34 
     35 #ifndef _EAS_TYPES_H
     36 #define _EAS_TYPES_H
     37 
     38 /* EAS_RESULT return codes */
     39 typedef long EAS_RESULT;
     40 #define EAS_SUCCESS                         0
     41 #define EAS_FAILURE                         -1
     42 #define EAS_ERROR_INVALID_MODULE            -2
     43 #define EAS_ERROR_MALLOC_FAILED             -3
     44 #define EAS_ERROR_FILE_POS                  -4
     45 #define EAS_ERROR_INVALID_FILE_MODE         -5
     46 #define EAS_ERROR_FILE_SEEK                 -6
     47 #define EAS_ERROR_FILE_LENGTH               -7
     48 #define EAS_ERROR_NOT_IMPLEMENTED           -8
     49 #define EAS_ERROR_CLOSE_FAILED              -9
     50 #define EAS_ERROR_FILE_OPEN_FAILED          -10
     51 #define EAS_ERROR_INVALID_HANDLE            -11
     52 #define EAS_ERROR_NO_MIX_BUFFER             -12
     53 #define EAS_ERROR_PARAMETER_RANGE           -13
     54 #define EAS_ERROR_MAX_FILES_OPEN            -14
     55 #define EAS_ERROR_UNRECOGNIZED_FORMAT       -15
     56 #define EAS_BUFFER_SIZE_MISMATCH            -16
     57 #define EAS_ERROR_FILE_FORMAT               -17
     58 #define EAS_ERROR_SMF_NOT_INITIALIZED       -18
     59 #define EAS_ERROR_LOCATE_BEYOND_END         -19
     60 #define EAS_ERROR_INVALID_PCM_TYPE          -20
     61 #define EAS_ERROR_MAX_PCM_STREAMS           -21
     62 #define EAS_ERROR_NO_VOICE_ALLOCATED        -22
     63 #define EAS_ERROR_INVALID_CHANNEL           -23
     64 #define EAS_ERROR_ALREADY_STOPPED           -24
     65 #define EAS_ERROR_FILE_READ_FAILED          -25
     66 #define EAS_ERROR_HANDLE_INTEGRITY          -26
     67 #define EAS_ERROR_MAX_STREAMS_OPEN          -27
     68 #define EAS_ERROR_INVALID_PARAMETER         -28
     69 #define EAS_ERROR_FEATURE_NOT_AVAILABLE     -29
     70 #define EAS_ERROR_SOUND_LIBRARY             -30
     71 #define EAS_ERROR_NOT_VALID_IN_THIS_STATE   -31
     72 #define EAS_ERROR_NO_VIRTUAL_SYNTHESIZER    -32
     73 #define EAS_ERROR_FILE_ALREADY_OPEN         -33
     74 #define EAS_ERROR_FILE_ALREADY_CLOSED       -34
     75 #define EAS_ERROR_INCOMPATIBLE_VERSION      -35
     76 #define EAS_ERROR_QUEUE_IS_FULL             -36
     77 #define EAS_ERROR_QUEUE_IS_EMPTY            -37
     78 #define EAS_ERROR_FEATURE_ALREADY_ACTIVE    -38
     79 
     80 /* special return codes */
     81 #define EAS_EOF                             3
     82 #define EAS_STREAM_BUFFERING                4
     83 #define EAS_BUFFER_FULL                     5
     84 
     85 /* EAS_STATE return codes */
     86 typedef long EAS_STATE;
     87 typedef enum
     88 {
     89     EAS_STATE_READY = 0,
     90     EAS_STATE_PLAY,
     91     EAS_STATE_STOPPING,
     92     EAS_STATE_PAUSING,
     93     EAS_STATE_STOPPED,
     94     EAS_STATE_PAUSED,
     95     EAS_STATE_OPEN,
     96     EAS_STATE_ERROR,
     97     EAS_STATE_EMPTY
     98 } E_EAS_STATE;
     99 
    100 /* constants */
    101 #ifndef EAS_CONST
    102 #define EAS_CONST const
    103 #endif
    104 
    105 /* definition for public interface functions */
    106 #ifndef EAS_PUBLIC
    107 #define EAS_PUBLIC
    108 #endif
    109 
    110 /* boolean values */
    111 typedef unsigned EAS_BOOL;
    112 typedef unsigned char EAS_BOOL8;
    113 
    114 #define EAS_FALSE   0
    115 #define EAS_TRUE    1
    116 
    117 /* scalar variable definitions */
    118 typedef unsigned char EAS_U8;
    119 typedef signed char EAS_I8;
    120 typedef char EAS_CHAR;
    121 
    122 typedef unsigned short EAS_U16;
    123 typedef short EAS_I16;
    124 
    125 typedef unsigned long EAS_U32;
    126 typedef long EAS_I32;
    127 
    128 typedef unsigned EAS_UINT;
    129 typedef int EAS_INT;
    130 typedef long EAS_LONG;
    131 
    132 /* audio output type */
    133 typedef short EAS_PCM;
    134 
    135 /* file open modes */
    136 typedef EAS_I32 EAS_FILE_MODE;
    137 #define EAS_FILE_READ   1
    138 #define EAS_FILE_WRITE  2
    139 
    140 /* file locator e.g. filename or memory pointer */
    141 typedef struct s_eas_file_tag {
    142     void *handle;
    143     int(*readAt)(void *handle, void *buf, int offset, int size);
    144     int(*size)(void *handle);
    145 } EAS_FILE, *EAS_FILE_LOCATOR;
    146 
    147 /* handle to stream */
    148 typedef struct s_eas_stream_tag *EAS_HANDLE;
    149 
    150 /* handle to file */
    151 typedef struct eas_hw_file_tag *EAS_FILE_HANDLE;
    152 
    153 /* handle for synthesizer data */
    154 typedef struct s_eas_data_tag *EAS_DATA_HANDLE;
    155 
    156 /* handle to persistent data for host wrapper interface */
    157 typedef struct eas_hw_inst_data_tag *EAS_HW_DATA_HANDLE;
    158 
    159 /* handle to sound library */
    160 typedef struct s_eas_sndlib_tag *EAS_SNDLIB_HANDLE;
    161 typedef struct s_eas_dls_tag *EAS_DLSLIB_HANDLE;
    162 
    163 /* pointer to frame buffer - used in split architecture only */
    164 typedef struct s_eas_frame_buffer_tag *EAS_FRAME_BUFFER_HANDLE;
    165 
    166 /* untyped pointer for instance data */
    167 typedef void *EAS_VOID_PTR;
    168 
    169 /* inline functions */
    170 #ifndef EAS_INLINE
    171 #if defined (__XCC__)
    172 #define EAS_INLINE __inline__
    173 #elif defined (__GNUC__)
    174 #define EAS_INLINE inline static
    175 #else
    176 #define EAS_INLINE __inline
    177 #endif
    178 #endif
    179 
    180 /* define NULL value */
    181 #ifndef NULL
    182 #define NULL 0
    183 #endif
    184 
    185 /* metadata types for metadata return codes */
    186 typedef enum
    187 {
    188     EAS_METADATA_UNKNOWN = 0,
    189     EAS_METADATA_TITLE,
    190     EAS_METADATA_AUTHOR,
    191     EAS_METADATA_COPYRIGHT,
    192     EAS_METADATA_LYRIC,
    193     EAS_METADATA_TEXT
    194 } E_EAS_METADATA_TYPE;
    195 
    196 /* metadata callback function */
    197 typedef void (*EAS_METADATA_CBFUNC) (E_EAS_METADATA_TYPE metaDataType, char *metaDataBuf, EAS_VOID_PTR pUserData);
    198 
    199 /* file types for metadata return codes */
    200 typedef enum
    201 {
    202     EAS_FILE_UNKNOWN = 0,
    203     EAS_FILE_SMF0,
    204     EAS_FILE_SMF1,
    205     EAS_FILE_SMAF_UNKNOWN,
    206     EAS_FILE_SMAF_MA2,
    207     EAS_FILE_SMAF_MA3,
    208     EAS_FILE_SMAF_MA5,
    209     EAS_FILE_CMX,
    210     EAS_FILE_MFI,
    211     EAS_FILE_OTA,
    212     EAS_FILE_IMELODY,
    213     EAS_FILE_RTTTL,
    214     EAS_FILE_XMF0,
    215     EAS_FILE_XMF1,
    216     EAS_FILE_WAVE_PCM,
    217     EAS_FILE_WAVE_IMA_ADPCM,
    218     EAS_FILE_MMAPI_TONE_CONTROL
    219 } E_EAS_FILE_TYPE;
    220 
    221 /* enumeration for synthesizers */
    222 typedef enum
    223 {
    224     EAS_MCU_SYNTH = 0,
    225     EAS_DSP_SYNTH
    226 } E_SYNTHESIZER;
    227 
    228 /* external audio callback program change */
    229 typedef struct s_ext_audio_prg_chg_tag
    230 {
    231     EAS_U16     bank;
    232     EAS_U8      program;
    233     EAS_U8      channel;
    234 } S_EXT_AUDIO_PRG_CHG;
    235 
    236 /* external audio callback event */
    237 typedef struct s_ext_audio_event_tag
    238 {
    239     EAS_U8      channel;
    240     EAS_U8      note;
    241     EAS_U8      velocity;
    242     EAS_BOOL8   noteOn;
    243 } S_EXT_AUDIO_EVENT;
    244 
    245 typedef struct s_midi_controllers_tag
    246 {
    247     EAS_U8      modWheel;           /* CC1 */
    248     EAS_U8      volume;             /* CC7 */
    249     EAS_U8      pan;                /* CC10 */
    250     EAS_U8      expression;         /* CC11 */
    251     EAS_U8      channelPressure;    /* MIDI channel pressure */
    252 
    253 #ifdef  _REVERB
    254     EAS_U8      reverbSend;         /* CC91 */
    255 #endif
    256 
    257 #ifdef  _CHORUS
    258     EAS_U8      chorusSend;         /* CC93 */
    259 #endif
    260 } S_MIDI_CONTROLLERS;
    261 
    262 /* iMode play modes enumeration for EAS_SetPlayMode */
    263 typedef enum
    264 {
    265     IMODE_PLAY_ALL = 0,
    266     IMODE_PLAY_PARTIAL
    267 } E_I_MODE_PLAY_MODE;
    268 
    269 typedef EAS_BOOL (*EAS_EXT_PRG_CHG_FUNC) (EAS_VOID_PTR pInstData, S_EXT_AUDIO_PRG_CHG *pPrgChg);
    270 typedef EAS_BOOL (*EAS_EXT_EVENT_FUNC) (EAS_VOID_PTR pInstData, S_EXT_AUDIO_EVENT *pEvent);
    271 
    272 #endif /* #ifndef _EAS_TYPES_H */
    273