📄 am_imelody.h
字号:
#ifndef AM_IMELODY_CLASS#define AM_IMELODY_CLASS/* (c) Copyright Motorola 1996, All rights reserved. Motorola Confidential Proprietary Contains confidential proprietary information of Motorola, Inc. Reverse engineering is prohibited. The copyright notice does not imply publication. DESCRIPTION: The music ringer implementation is done exclusively in the relay layer. Hence, the definitions of types, macros and talbes are moved to "am_relay_layer.h". This the where most of these were defined. ************** REVISION HISTORY ********************************************** Date Author Reference ======== ======== ========================== 02-10-07 stlee CR - LIBbb55179 Melody Required Fields Not Present on Mobile Originiated Ring Tones 02-10-30 bof010 CR - LIBbb65108 Invalid format in stored melody (Port the fix from TALON) 02-19-02 w17860 CR - My Tones: Matching notes contradiction Changed HIGHEST_OCTAVE and LOWEST_OCTAVE values from ASCII to integer values 01-06-08 ktang PR - CSGce90044 iMelody parsor implementation*//************** HEADER FILE INCLUDES ******************************************/#include <SUAPI/suapi.h>#include "am_custom_tune.h"#include "am_hw_primitive_builder_tone.h" /************** CONSTANTS *****************************************************/#define SHARP '#'#define FLAT '&'#define OCTAVE_MARKER '*'#define DEFAULT_OCATVE 4#define DEFAULT_BEAT 120#define DEFAULT_VOLUME 7#define DEFAULT_STYLE S0#define HIGHEST_OCTAVE 8#define LOWEST_OCTAVE 0// This is based on that (6 * AM_MUSIC_UNIT_TEMPO) is the tempo value in the// preset tone definitions, which is of 120 beats speed#define BEAT_TEMPO_PRODUCT (720 * AM_MUSIC_UNIT_TEMPO)/************** FUNCTION PROTOTYPES *******************************************//************** MACROS ********************************************************//************** CLASS DEFINITIONS *********************************************/class AM_iMelody{public: AM_iMelody(void); AM_iMelody(IMELODY_OCTAVE_METHOD method); ~AM_iMelody(void){}; UINT8* TuneTranslation(UINT8* inputStream, UINT8* outputStream, UINT16 outBuffByteSize, AUD_CUSTOM_TYPE action); void GetTuneInfoFromHeader(UINT8* inputStream); void TunePack( UINT8 * imelody_buffer, UINT16 imelody_buffer_size, UINT8 * notes_string, UINT16 beats); void TuneUnpack( UINT8 * imelody_string, UINT8 * notes_buffer, UINT16 notes_buffer_size, UINT16 * beats); inline UINT32 GetTuneCharater(UINT8 field) {return (TuneCharacters[field]);} void Reset(void);private: UINT16 NoteTranslation(); BOOL DiffInsensitive (UINT8 a, UINT8 b); UINT8* SearchField(UINT8* head, const UINT8 field[], UINT8* tail); UINT16 ConvertNoteLength(UINT8* pitch); UINT8 ConvertPitch(UINT8* pitch, UINT8& octave); UINT8 GetOctave(UINT8* pitch); UINT8* GetVerboseOctave(UINT8* pitch); UINT16 GetFieldDecimalValue(UINT8* start, const UINT8 fieldMaker[], UINT8 defaultValue, UINT8* end); UINT8* NextNonLfcrASCII(UINT8* boundary, UINT8* Ptr, INT8 increment); inline void SetInput(UINT8* inPtr) {head = inPtr;} inline void SetOutput(UINT8* outPtr, UINT16 outBuffByteLen) {wrt_ptr = outPtr + outBuffByteLen;} inline BOOL IsAPitch(UINT8 ch) {return ((ch >= 'a' && ch <= 'g') || (ch == 'r'));} UINT8 * num_2_str ( UINT16 num, UINT8 * str_buf, UINT8 str_buf_size); UINT8* head; UINT8* body; UINT8* tail; IMELODY_OCTAVE_METHOD octaveMethod; UINT32 TuneCharacters[NUMBER_OF_FIELDS]; UINT8* octave_ptr; UINT8* wrt_ptr; UINT32 tuneDuration;};#endif /* end of - prevent inadvertently including a header file twice */
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -