📄 am_hw_primitive_builder_tone.h
字号:
#ifndef AM_HARDWARE_TONE_INCLUDE#define AM_HARDWARE_TONE_INCLUDE#ifdef __cplusplus /* allow #include in a C++ file */extern "C" {#endif/* (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: This file contains definitions used in the generation of a tone.***************************** REVISION HISTORY ****************************** Date Author Reference Number======== ======== ================02-05-15 r58514 CR - LIBbb29284 LCA: Take out 15 alert tones to external flash (in file am_tables.c)00-08-09 mtaraba CR - CSGce55882 Eliminate file gsm.h from audio manager00-05-09 ktang PR - CSGce51877 Update Audio Manager to ITL Sound StyleGuide - Redefined the data types for Synergy sounds99-11-16 ktang PR - CSGce42434 Common Tone Generator MDI messages - Modified the macros99-11-08 ktang PR - CSGce40494 GRiEF AM Music Ringer - Took away the music macros (moved to am_relay_layer_music.h)99-10-25 ktang PR - CSGce40785 GRiEF Audio: DL Audio Tone Types and DL DB Feature IDs - replaced td tone types and ids with DL tone types and ids97-12-30 gswanson PR - CSGce15864 Fix Tone Table - changed the struct defining what gets sent to the DSP. The old struct was set up for smoc, and not for whitecap.97-08-11 gswanson PR - CSGce12130 Unique Ringer Tone - added definitions for the frequencies of the lowest notes (higher notes will be built using these as a base). - added macros to get at the bits of the definition of a sound in a song. */#include <SUAPI/suapi.h>#if (MAKE_NEPTUNE_CHIPSET == TRUE)#ifndef MEMORY_USAGE_H#include <BUILD/memory_usage.h>#endif#endif/********************************************************************************//* This file contains the old and new tone format description, constants / data *//* struct used for defining both formats, and macros to read data out of both *//* formats *//********************************************************************************//********************************************************************************//* DESCRIPTION of the old tone format: *//* 4-byte header: dummy fields. Only the first byte is the identifier of *//* old vs new tone. When it is not identified as old tone *//* format, however, the value of it is considered as tempo *//* in the new tone format *//* *//* AM_HW_TONE_DEF is composed of *//* repeat: The first hex digit of it says how many frequencies in *//* the tone being defined; *//* The second hex digit of it says how many frequencies are *//* concurrent; *//* The last 2 hex digits spell the number of repetition, *//* but 0 means repeat forever *//* freq1/2/3: frequencies, if the first hes digit of repeat is less 3, *//* consider the frequencies in 1 - 2 - 3 order *//* primary_on's: on duration of the coresponding frequencies. The unit of *//* these values is 125 us, i.e. 1/8 ms *//* primary_off's: off duration of the coresponding frequencies. The unit *//* of these values is 125 us, i.e. 1/8 ms *//* secondary_on / off: *//* A secondary on is a period of time that a tone's freqs *//* cycle with their coresponding on / off durations. For *//* example, a traditional ringer could consist of 2 freqs, *//* which start by alternating with each other until the *//* first secondary_on1 is consumed. Then comes *//* secondary_off1, which is silent. Then it could come with *//* secondary_on2, if it is not 0, when the 2 freqs *//* alternate with each other again. And so on. *//********************************************************************************//********************************************************************************//* data structs to define the old tone format */typedef struct{ UINT16 repeat; UINT16 freq1; UINT16 primary_on1; UINT16 primary_off1; UINT16 freq2; UINT16 primary_on2; UINT16 primary_off2; UINT16 freq3; UINT16 primary_on3; UINT16 primary_off3; UINT16 secondary_on1; UINT16 secondary_off1; UINT16 secondary_on2; UINT16 secondary_off2; UINT16 secondary_on3; UINT16 secondary_off3; UINT16 secondary_on4; UINT16 secondary_off4;} AM_HW_TONE_DEF;typedef struct{ UINT8 tempo; UINT8 linelen; UINT8 line_numb; UINT8 repetition; AM_HW_TONE_DEF old_def;} AM_HW_SOUND_OLD_DEF;/********************************************************************************//* macros to get info from the old tone format */#define AM_HW_TONE_DEF_GET_CF(_mask) ((_mask) & 0x0f)#define AM_HW_TONE_DEF_GET_NZF(_mask) ((_mask) >> 4)/********************************************************************************//* DESCRIPTION of the old tone format: *//* X ------ number_of_notes_per_melody_line; *//* Y ------ number_of_melody_line(s) *//* *//* const UINT8 music[] = *//* { *//* tempo, X, Y, repetition, *//* volume_line_1, note_def, duration, note_def, duration ... | *//* ______________________________________ *//* (X * (note_def + note_def)) *//* */ /* volume_line_2, note_def, note_def...... | *//* __________________ *//* (X * note_def) *//* *//* .......................... | Y lines *//* .......................... | *//* .......................... | *//* volume_line_Y, note_def, note_def...... | *//* __________________ *//* (X * note_def) *//* }; *//* *//* The durations specified in line 1 applies to the notes at the same position *//* of all lines, i.e. the xth note of line 1 - line Y are all of the same *//* duration that is specified next to the xth note of line 1. *//* *//* *//* TEMPO: ranges from 0 - 255. Linearly scaled. *//* (6 * AM_MUSIC_UNIT_TEMPO) gets 120 beats per minute. *//* *//* DURATION: ranges from 0 - 255. Linearly scaled from 1/64 - 4 whole note. *//* *//* NOT def: --------------------------------- *//* | | | | | | | | | *//* --------------------------------- *//* | octave | note | *//* *//********************************************************************************/ /********************************************************************************//* constants to get info from the new tone format */#define MAX_LINE_NUMB 4#define NOTE_DEF_PITCH_MASK 0x0F#define NOTE_DEF_PITCH_SHIFT 0#define NOTE_DEF_OCTAVE_MASK 0xF0#define NOTE_DEF_OCTAVE_SHIFT 4#define AM_MUSIC_UNIT_TEMPO (8) /* to scale up tempos for iMeldoy *//********************************************************************************//* data structs to define the new tone format *//* ---------------------------------------------------------------------------- */typedef UINT8 AM_HW_SOUND_NOTE_DEF;typedef UINT8 AM_HW_SOUND_DUR_DEF;/* ---------------------------------------------------------------------------- *//* This defines a line. A line definition contains the volume of the line followed by a sequence of notes defined by AM_HW_SOUND_NOTE_DEF. The reason that note_def is not of type AM_HW_SOUND_NOTE_DEF* is the misalignment of the these data. All data is stored in byte, so some lines of note_def's are lined up at even address, which may cause failure at run time. */typedef struct{ UINT8 volume; UINT8 note_def[1];} AM_HW_SOUND_LINE_DEF;/* ---------------------------------------------------------------------------- *//* ---------------------------------------------------------------------------- *//* This defines a sound. A sound definition encapsulates the tempo of the sound, the length of the sound (in terms of how many notes per line), the number of lines, and all the line definitions (in AM_HW_SOUND_TONE_DEF) */typedef struct{ UINT8 tempo; UINT8 line_len; UINT8 line_numb; UINT8 repetition; AM_HW_SOUND_LINE_DEF line_def[1];} AM_HW_SOUND_TONE_DEF;/* ---------------------------------------------------------------------------- *//* ---------------------------------------------------------------------------- *//* This defines the sound parameters and the volume of the first melody line. *//* Both of line_len and set_len are of the number of AM_HW_SOUND_NOTE_DEF. */typedef volatile struct{ UINT8 tempo; UINT8 line_len; UINT8 line_numb; UINT8 repetition; UINT8 volume; UINT8 set_len;} AM_HW_SOUND_HEADER;/* ---------------------------------------------------------------------------- *//* ---------------------------------------------------------------------------- *//* This is to enable breaking down a sound into multiple messages */typedef volatile struct{ AM_HW_SOUND_HEADER header; UINT8* def_data;} AM_HW_SOUND_DATA;/********************************************************************************//* macros to get info from the new tone format */#define GET_PITCH(a) (((a) & NOTE_DEF_PITCH_MASK) >> NOTE_DEF_PITCH_SHIFT)#define GET_OCTAVE(a) (((a) & NOTE_DEF_OCTAVE_MASK) >> NOTE_DEF_OCTAVE_SHIFT)#define AM_MUSIC_calc_DURATION(tempo, note_length) \ ((tempo) * ((note_length) + 1) * 125 / (3 * AM_MUSIC_UNIT_TEMPO))/* Support for LCA - */#if( MAKE_MEM_CODE_IN_ROM == TRUE) extern const UINT8 *BachInv1; extern const UINT8 *Boogie; extern const UINT8 *CanonInD; extern const UINT8 *ChineseFolk; extern const UINT8 *Sonata_in_C_short; extern const UINT8 *Cumparasita; extern const UINT8 *Fibonacci; extern const UINT8 *Funk; extern const UINT8 *HavaNagila; extern const UINT8 *Snaggle; extern const UINT8 *MapleLeafRag; extern const UINT8 *Overture1812; extern const UINT8 *RondoAlaTurca; extern const UINT8 *ThisOldMan; extern const UINT8 *TocattaFugue;#else extern const UINT8 BachInv1[]; extern const UINT8 Boogie[]; extern const UINT8 CanonInD[]; extern const UINT8 ChineseFolk[]; extern const UINT8 Sonata_in_C_short[]; extern const UINT8 Cumparasita[]; extern const UINT8 Fibonacci[]; extern const UINT8 Funk[]; extern const UINT8 HavaNagila[]; extern const UINT8 Snaggle[]; extern const UINT8 MapleLeafRag[]; extern const UINT8 Overture1812[]; extern const UINT8 RondoAlaTurca[]; extern const UINT8 ThisOldMan[]; extern const UINT8 TocattaFugue[];#endif#ifdef __cplusplus /* allow #include in a C++ file */}#endif#endif
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -