summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDave Sparks <davidsparks@android.com>2009-08-25 00:35:45 (GMT)
committerDave Sparks <davidsparks@android.com>2009-08-25 00:35:45 (GMT)
commit56c99cd2c2c1e6ab038dac5fced5b92ccf11ff6c (patch)
tree42d3ac8ff2731bda88f4e060f40400de456542c6
parent618669a0423554a0af43cd0aa42101fc80b7d948 (diff)
downloadandroid_external_sonivox-56c99cd2c2c1e6ab038dac5fced5b92ccf11ff6c.zip
android_external_sonivox-56c99cd2c2c1e6ab038dac5fced5b92ccf11ff6c.tar.gz
android_external_sonivox-56c99cd2c2c1e6ab038dac5fced5b92ccf11ff6c.tar.bz2
Sonivox whitespace cleanup
-rw-r--r--arm-fm-22k/host_src/eas.h2100
-rw-r--r--arm-fm-22k/host_src/eas_build.h48
-rw-r--r--arm-fm-22k/host_src/eas_chorus.h80
-rw-r--r--arm-fm-22k/host_src/eas_config.c1214
-rw-r--r--arm-fm-22k/host_src/eas_config.h358
-rw-r--r--arm-fm-22k/host_src/eas_debugmsgs.h86
-rw-r--r--arm-fm-22k/host_src/eas_host.h142
-rw-r--r--arm-fm-22k/host_src/eas_hostmm.c1296
-rw-r--r--arm-fm-22k/host_src/eas_main.c898
-rw-r--r--arm-fm-22k/host_src/eas_report.c504
-rw-r--r--arm-fm-22k/host_src/eas_report.h130
-rw-r--r--arm-fm-22k/host_src/eas_reverb.h84
-rw-r--r--arm-fm-22k/host_src/eas_types.h512
-rw-r--r--arm-fm-22k/host_src/eas_wave.c822
-rw-r--r--arm-fm-22k/host_src/eas_wave.h124
-rw-r--r--arm-fm-22k/lib_src/eas_audioconst.h170
-rw-r--r--arm-fm-22k/lib_src/eas_chorus.c1184
-rw-r--r--arm-fm-22k/lib_src/eas_chorusdata.c44
-rw-r--r--arm-fm-22k/lib_src/eas_chorusdata.h296
-rw-r--r--arm-fm-22k/lib_src/eas_ctype.h58
-rw-r--r--arm-fm-22k/lib_src/eas_data.c50
-rw-r--r--arm-fm-22k/lib_src/eas_data.h238
-rw-r--r--arm-fm-22k/lib_src/eas_effects.h98
-rw-r--r--arm-fm-22k/lib_src/eas_fmengine.c1546
-rw-r--r--arm-fm-22k/lib_src/eas_fmengine.h218
-rw-r--r--arm-fm-22k/lib_src/eas_fmsndlib.c3324
-rw-r--r--arm-fm-22k/lib_src/eas_fmsynth.c1796
-rw-r--r--arm-fm-22k/lib_src/eas_fmsynth.h138
-rw-r--r--arm-fm-22k/lib_src/eas_fmtables.c712
-rw-r--r--arm-fm-22k/lib_src/eas_ima_tables.c84
-rw-r--r--arm-fm-22k/lib_src/eas_imaadpcm.c712
-rw-r--r--arm-fm-22k/lib_src/eas_imelody.c3452
-rw-r--r--arm-fm-22k/lib_src/eas_imelodydata.c62
-rw-r--r--arm-fm-22k/lib_src/eas_imelodydata.h122
-rw-r--r--arm-fm-22k/lib_src/eas_math.c312
-rw-r--r--arm-fm-22k/lib_src/eas_math.h800
-rw-r--r--arm-fm-22k/lib_src/eas_midi.c1114
-rw-r--r--arm-fm-22k/lib_src/eas_midi.h118
-rw-r--r--arm-fm-22k/lib_src/eas_midictrl.h104
-rw-r--r--arm-fm-22k/lib_src/eas_mididata.c44
-rw-r--r--arm-fm-22k/lib_src/eas_miditypes.h252
-rw-r--r--arm-fm-22k/lib_src/eas_mixbuf.c48
-rw-r--r--arm-fm-22k/lib_src/eas_mixer.c904
-rw-r--r--arm-fm-22k/lib_src/eas_mixer.h250
-rw-r--r--arm-fm-22k/lib_src/eas_ota.c2130
-rw-r--r--arm-fm-22k/lib_src/eas_otadata.c58
-rw-r--r--arm-fm-22k/lib_src/eas_otadata.h138
-rw-r--r--arm-fm-22k/lib_src/eas_pan.c172
-rw-r--r--arm-fm-22k/lib_src/eas_pan.h108
-rw-r--r--arm-fm-22k/lib_src/eas_parser.h172
-rw-r--r--arm-fm-22k/lib_src/eas_pcm.c2940
-rw-r--r--arm-fm-22k/lib_src/eas_pcm.h694
-rw-r--r--arm-fm-22k/lib_src/eas_pcmdata.c46
-rw-r--r--arm-fm-22k/lib_src/eas_pcmdata.h290
-rw-r--r--arm-fm-22k/lib_src/eas_public.c5170
-rw-r--r--arm-fm-22k/lib_src/eas_reverb.c2284
-rw-r--r--arm-fm-22k/lib_src/eas_reverbdata.c44
-rw-r--r--arm-fm-22k/lib_src/eas_reverbdata.h948
-rw-r--r--arm-fm-22k/lib_src/eas_rtttl.c2370
-rw-r--r--arm-fm-22k/lib_src/eas_rtttldata.c58
-rw-r--r--arm-fm-22k/lib_src/eas_rtttldata.h116
-rw-r--r--arm-fm-22k/lib_src/eas_smf.c2382
-rw-r--r--arm-fm-22k/lib_src/eas_smf.h74
-rw-r--r--arm-fm-22k/lib_src/eas_smfdata.c108
-rw-r--r--arm-fm-22k/lib_src/eas_smfdata.h108
-rw-r--r--arm-fm-22k/lib_src/eas_sndlib.h788
-rw-r--r--arm-fm-22k/lib_src/eas_synth.h766
-rw-r--r--arm-fm-22k/lib_src/eas_synth_protos.h96
-rw-r--r--arm-fm-22k/lib_src/eas_synthcfg.h116
-rw-r--r--arm-fm-22k/lib_src/eas_vm_protos.h2148
-rw-r--r--arm-fm-22k/lib_src/eas_voicemgt.c7918
-rw-r--r--arm-fm-22k/lib_src/eas_wavefile.c1710
-rw-r--r--arm-fm-22k/lib_src/eas_wavefile.h102
-rw-r--r--arm-fm-22k/lib_src/eas_wavefiledata.c42
-rw-r--r--arm-hybrid-22k/host_src/eas.h2100
-rw-r--r--arm-hybrid-22k/host_src/eas_build.h48
-rw-r--r--arm-hybrid-22k/host_src/eas_chorus.h80
-rw-r--r--arm-hybrid-22k/host_src/eas_config.c1214
-rw-r--r--arm-hybrid-22k/host_src/eas_config.h358
-rw-r--r--arm-hybrid-22k/host_src/eas_debugmsgs.h88
-rw-r--r--arm-hybrid-22k/host_src/eas_host.h142
-rw-r--r--arm-hybrid-22k/host_src/eas_hostmm.c1296
-rw-r--r--arm-hybrid-22k/host_src/eas_main.c898
-rw-r--r--arm-hybrid-22k/host_src/eas_report.c504
-rw-r--r--arm-hybrid-22k/host_src/eas_report.h130
-rw-r--r--arm-hybrid-22k/host_src/eas_reverb.h84
-rw-r--r--arm-hybrid-22k/host_src/eas_types.h512
-rw-r--r--arm-hybrid-22k/host_src/eas_wave.c822
-rw-r--r--arm-hybrid-22k/host_src/eas_wave.h124
-rw-r--r--arm-hybrid-22k/lib_src/ARM_synth_constants_gnu.inc306
-rw-r--r--arm-hybrid-22k/lib_src/eas_audioconst.h170
-rw-r--r--arm-hybrid-22k/lib_src/eas_chorus.c1184
-rw-r--r--arm-hybrid-22k/lib_src/eas_chorusdata.c44
-rw-r--r--arm-hybrid-22k/lib_src/eas_chorusdata.h296
-rw-r--r--arm-hybrid-22k/lib_src/eas_ctype.h58
-rw-r--r--arm-hybrid-22k/lib_src/eas_data.c50
-rw-r--r--arm-hybrid-22k/lib_src/eas_data.h238
-rw-r--r--arm-hybrid-22k/lib_src/eas_effects.h98
-rw-r--r--arm-hybrid-22k/lib_src/eas_fmengine.c1546
-rw-r--r--arm-hybrid-22k/lib_src/eas_fmengine.h218
-rw-r--r--arm-hybrid-22k/lib_src/eas_fmsynth.c1796
-rw-r--r--arm-hybrid-22k/lib_src/eas_fmsynth.h138
-rw-r--r--arm-hybrid-22k/lib_src/eas_fmtables.c712
-rw-r--r--arm-hybrid-22k/lib_src/eas_ima_tables.c84
-rw-r--r--arm-hybrid-22k/lib_src/eas_imaadpcm.c712
-rw-r--r--arm-hybrid-22k/lib_src/eas_imelody.c3452
-rw-r--r--arm-hybrid-22k/lib_src/eas_imelodydata.c62
-rw-r--r--arm-hybrid-22k/lib_src/eas_imelodydata.h122
-rw-r--r--arm-hybrid-22k/lib_src/eas_math.c312
-rw-r--r--arm-hybrid-22k/lib_src/eas_math.h800
-rw-r--r--arm-hybrid-22k/lib_src/eas_midi.c1114
-rw-r--r--arm-hybrid-22k/lib_src/eas_midi.h118
-rw-r--r--arm-hybrid-22k/lib_src/eas_midictrl.h104
-rw-r--r--arm-hybrid-22k/lib_src/eas_mididata.c44
-rw-r--r--arm-hybrid-22k/lib_src/eas_miditypes.h252
-rw-r--r--arm-hybrid-22k/lib_src/eas_mixbuf.c48
-rw-r--r--arm-hybrid-22k/lib_src/eas_mixer.c904
-rw-r--r--arm-hybrid-22k/lib_src/eas_mixer.h250
-rw-r--r--arm-hybrid-22k/lib_src/eas_ota.c2130
-rw-r--r--arm-hybrid-22k/lib_src/eas_otadata.c58
-rw-r--r--arm-hybrid-22k/lib_src/eas_otadata.h138
-rw-r--r--arm-hybrid-22k/lib_src/eas_pan.c172
-rw-r--r--arm-hybrid-22k/lib_src/eas_pan.h108
-rw-r--r--arm-hybrid-22k/lib_src/eas_parser.h172
-rw-r--r--arm-hybrid-22k/lib_src/eas_pcm.c2940
-rw-r--r--arm-hybrid-22k/lib_src/eas_pcm.h694
-rw-r--r--arm-hybrid-22k/lib_src/eas_pcmdata.c46
-rw-r--r--arm-hybrid-22k/lib_src/eas_pcmdata.h290
-rw-r--r--arm-hybrid-22k/lib_src/eas_public.c5170
-rw-r--r--arm-hybrid-22k/lib_src/eas_reverb.c2284
-rw-r--r--arm-hybrid-22k/lib_src/eas_reverbdata.c44
-rw-r--r--arm-hybrid-22k/lib_src/eas_reverbdata.h948
-rw-r--r--arm-hybrid-22k/lib_src/eas_rtttl.c2370
-rw-r--r--arm-hybrid-22k/lib_src/eas_rtttldata.c58
-rw-r--r--arm-hybrid-22k/lib_src/eas_rtttldata.h116
-rw-r--r--arm-hybrid-22k/lib_src/eas_smf.c2382
-rw-r--r--arm-hybrid-22k/lib_src/eas_smf.h74
-rw-r--r--arm-hybrid-22k/lib_src/eas_smfdata.c108
-rw-r--r--arm-hybrid-22k/lib_src/eas_smfdata.h108
-rw-r--r--arm-hybrid-22k/lib_src/eas_sndlib.h788
-rw-r--r--arm-hybrid-22k/lib_src/eas_synth.h766
-rw-r--r--arm-hybrid-22k/lib_src/eas_synth_protos.h96
-rw-r--r--arm-hybrid-22k/lib_src/eas_synthcfg.h116
-rw-r--r--arm-hybrid-22k/lib_src/eas_vm_protos.h2148
-rw-r--r--arm-hybrid-22k/lib_src/eas_voicemgt.c7918
-rw-r--r--arm-hybrid-22k/lib_src/eas_wavefile.c1710
-rw-r--r--arm-hybrid-22k/lib_src/eas_wavefile.h102
-rw-r--r--arm-hybrid-22k/lib_src/eas_wavefiledata.c42
-rw-r--r--arm-hybrid-22k/lib_src/eas_wt_IPC_frame.h140
-rw-r--r--arm-hybrid-22k/lib_src/eas_wtengine.c1298
-rw-r--r--arm-hybrid-22k/lib_src/eas_wtengine.h318
-rw-r--r--arm-hybrid-22k/lib_src/eas_wtsynth.c2478
-rw-r--r--arm-hybrid-22k/lib_src/eas_wtsynth.h108
-rw-r--r--arm-hybrid-22k/lib_src/hybrid_22khz_mcu.c10274
-rw-r--r--arm-wt-22k/host_src/eas.h570
-rw-r--r--arm-wt-22k/host_src/eas_build.h48
-rw-r--r--arm-wt-22k/host_src/eas_chorus.h80
-rw-r--r--arm-wt-22k/host_src/eas_config.c1214
-rw-r--r--arm-wt-22k/host_src/eas_config.h358
-rw-r--r--arm-wt-22k/host_src/eas_host.h150
-rw-r--r--arm-wt-22k/host_src/eas_hostmm.c24
-rw-r--r--arm-wt-22k/host_src/eas_main.c674
-rw-r--r--arm-wt-22k/host_src/eas_report.c504
-rw-r--r--arm-wt-22k/host_src/eas_report.h130
-rw-r--r--arm-wt-22k/host_src/eas_reverb.h84
-rw-r--r--arm-wt-22k/host_src/eas_types.h522
-rw-r--r--arm-wt-22k/host_src/eas_wave.c822
-rw-r--r--arm-wt-22k/host_src/eas_wave.h124
-rw-r--r--arm-wt-22k/host_src/jet.h398
-rw-r--r--[-rwxr-xr-x]arm-wt-22k/jetcreator_lib_src/darwin-x86/EASLib.c3618
-rw-r--r--[-rwxr-xr-x]arm-wt-22k/jetcreator_lib_src/darwin-x86/EASLib.h62
-rw-r--r--[-rwxr-xr-x]arm-wt-22k/jetcreator_lib_src/darwin-x86/EASLibVst.c3008
-rw-r--r--[-rwxr-xr-x]arm-wt-22k/jetcreator_lib_src/darwin-x86/eas_host_debug.h94
-rw-r--r--[-rwxr-xr-x]arm-wt-22k/jetcreator_lib_src/darwin-x86/eastestv37.c1998
-rw-r--r--arm-wt-22k/jetcreator_lib_src/darwin-x86/wt_44khz.c29446
-rw-r--r--arm-wt-22k/lib_src/ARM_synth_constants_gnu.inc306
-rw-r--r--arm-wt-22k/lib_src/dls.h536
-rw-r--r--arm-wt-22k/lib_src/dls2.h244
-rw-r--r--arm-wt-22k/lib_src/eas_audioconst.h170
-rw-r--r--arm-wt-22k/lib_src/eas_chorus.c1184
-rw-r--r--arm-wt-22k/lib_src/eas_chorusdata.c44
-rw-r--r--arm-wt-22k/lib_src/eas_chorusdata.h296
-rw-r--r--arm-wt-22k/lib_src/eas_ctype.h58
-rw-r--r--arm-wt-22k/lib_src/eas_data.c50
-rw-r--r--arm-wt-22k/lib_src/eas_data.h242
-rw-r--r--arm-wt-22k/lib_src/eas_dlssynth.c754
-rw-r--r--arm-wt-22k/lib_src/eas_dlssynth.h58
-rw-r--r--arm-wt-22k/lib_src/eas_effects.h98
-rw-r--r--arm-wt-22k/lib_src/eas_flog.c168
-rw-r--r--arm-wt-22k/lib_src/eas_ima_tables.c84
-rw-r--r--arm-wt-22k/lib_src/eas_imaadpcm.c712
-rw-r--r--arm-wt-22k/lib_src/eas_imelody.c3460
-rw-r--r--arm-wt-22k/lib_src/eas_imelodydata.c62
-rw-r--r--arm-wt-22k/lib_src/eas_imelodydata.h122
-rw-r--r--arm-wt-22k/lib_src/eas_math.c312
-rw-r--r--arm-wt-22k/lib_src/eas_math.h800
-rw-r--r--arm-wt-22k/lib_src/eas_mdls.c3928
-rw-r--r--arm-wt-22k/lib_src/eas_mdls.h566
-rw-r--r--arm-wt-22k/lib_src/eas_midi.c1114
-rw-r--r--arm-wt-22k/lib_src/eas_midi.h118
-rw-r--r--arm-wt-22k/lib_src/eas_midictrl.h104
-rw-r--r--arm-wt-22k/lib_src/eas_mididata.c44
-rw-r--r--arm-wt-22k/lib_src/eas_miditypes.h252
-rw-r--r--arm-wt-22k/lib_src/eas_mixbuf.c48
-rw-r--r--arm-wt-22k/lib_src/eas_mixer.c904
-rw-r--r--arm-wt-22k/lib_src/eas_mixer.h250
-rw-r--r--arm-wt-22k/lib_src/eas_ota.c2130
-rw-r--r--arm-wt-22k/lib_src/eas_otadata.c58
-rw-r--r--arm-wt-22k/lib_src/eas_otadata.h138
-rw-r--r--arm-wt-22k/lib_src/eas_pan.c172
-rw-r--r--arm-wt-22k/lib_src/eas_pan.h108
-rw-r--r--arm-wt-22k/lib_src/eas_parser.h172
-rw-r--r--arm-wt-22k/lib_src/eas_pcm.c2940
-rw-r--r--arm-wt-22k/lib_src/eas_pcm.h694
-rw-r--r--arm-wt-22k/lib_src/eas_pcmdata.c46
-rw-r--r--arm-wt-22k/lib_src/eas_pcmdata.h290
-rw-r--r--arm-wt-22k/lib_src/eas_public.c3092
-rw-r--r--arm-wt-22k/lib_src/eas_reverb.c2284
-rw-r--r--arm-wt-22k/lib_src/eas_reverbdata.c44
-rw-r--r--arm-wt-22k/lib_src/eas_reverbdata.h948
-rw-r--r--arm-wt-22k/lib_src/eas_rtttl.c2370
-rw-r--r--arm-wt-22k/lib_src/eas_rtttldata.c58
-rw-r--r--arm-wt-22k/lib_src/eas_rtttldata.h116
-rw-r--r--arm-wt-22k/lib_src/eas_smf.c1636
-rw-r--r--arm-wt-22k/lib_src/eas_smf.h74
-rw-r--r--arm-wt-22k/lib_src/eas_smfdata.c108
-rw-r--r--arm-wt-22k/lib_src/eas_smfdata.h108
-rw-r--r--arm-wt-22k/lib_src/eas_sndlib.h788
-rw-r--r--arm-wt-22k/lib_src/eas_synth.h766
-rw-r--r--arm-wt-22k/lib_src/eas_synth_protos.h96
-rw-r--r--arm-wt-22k/lib_src/eas_synthcfg.h116
-rw-r--r--arm-wt-22k/lib_src/eas_tcdata.c62
-rw-r--r--arm-wt-22k/lib_src/eas_tcdata.h106
-rw-r--r--arm-wt-22k/lib_src/eas_tonecontrol.c1858
-rw-r--r--arm-wt-22k/lib_src/eas_vm_protos.h2148
-rw-r--r--arm-wt-22k/lib_src/eas_voicemgt.c7918
-rw-r--r--arm-wt-22k/lib_src/eas_wavefile.c1710
-rw-r--r--arm-wt-22k/lib_src/eas_wavefile.h102
-rw-r--r--arm-wt-22k/lib_src/eas_wavefiledata.c42
-rw-r--r--arm-wt-22k/lib_src/eas_wt_IPC_frame.h140
-rw-r--r--arm-wt-22k/lib_src/eas_wtengine.c898
-rw-r--r--arm-wt-22k/lib_src/eas_wtengine.h318
-rw-r--r--arm-wt-22k/lib_src/eas_wtsynth.c1428
-rw-r--r--arm-wt-22k/lib_src/eas_wtsynth.h108
-rw-r--r--arm-wt-22k/lib_src/eas_xmf.c1676
-rw-r--r--arm-wt-22k/lib_src/eas_xmf.h96
-rw-r--r--arm-wt-22k/lib_src/eas_xmfdata.c64
-rw-r--r--arm-wt-22k/lib_src/eas_xmfdata.h86
-rw-r--r--arm-wt-22k/lib_src/jet.c2258
-rw-r--r--arm-wt-22k/lib_src/jet_data.h342
-rw-r--r--arm-wt-22k/lib_src/wt_22khz.c29280
-rw-r--r--arm-wt-22k/misc/eas_host.c1550
252 files changed, 132823 insertions, 132823 deletions
diff --git a/arm-fm-22k/host_src/eas.h b/arm-fm-22k/host_src/eas.h
index 0bb04fe..c64af49 100644
--- a/arm-fm-22k/host_src/eas.h
+++ b/arm-fm-22k/host_src/eas.h
@@ -1,17 +1,17 @@
-/*----------------------------------------------------------------------------
- *
- * File:
- * eas.h
- *
- * Contents and purpose:
- * The public interface header for the EAS synthesizer.
- *
- * This header only contains declarations that are specific
- * to this implementation.
- *
- * DO NOT MODIFY THIS FILE!
- *
- * Copyright Sonic Network Inc. 2005, 2006
+/*----------------------------------------------------------------------------
+ *
+ * File:
+ * eas.h
+ *
+ * Contents and purpose:
+ * The public interface header for the EAS synthesizer.
+ *
+ * This header only contains declarations that are specific
+ * to this implementation.
+ *
+ * DO NOT MODIFY THIS FILE!
+ *
+ * Copyright Sonic Network Inc. 2005, 2006
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -24,1039 +24,1039 @@
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
- *
- *----------------------------------------------------------------------------
- * Revision Control:
- * $Revision: 852 $
- * $Date: 2007-09-04 11:43:49 -0700 (Tue, 04 Sep 2007) $
- *----------------------------------------------------------------------------
-*/
-
-#ifndef _EAS_H
-#define _EAS_H
-
-#include "eas_types.h"
-
-/* for C++ linkage */
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-/* library version macro */
-#define MAKE_LIB_VERSION(a,b,c,d) (((((((EAS_U32) a <<8) | (EAS_U32) b) << 8) | (EAS_U32) c) << 8) | (EAS_U32) d)
-#define LIB_VERSION MAKE_LIB_VERSION(3, 6, 10, 14)
-
-typedef struct
-{
- EAS_U32 libVersion;
- EAS_BOOL checkedVersion;
- EAS_I32 maxVoices;
- EAS_I32 numChannels;
- EAS_I32 sampleRate;
- EAS_I32 mixBufferSize;
- EAS_BOOL filterEnabled;
- EAS_U32 buildTimeStamp;
- EAS_CHAR *buildGUID;
-} S_EAS_LIB_CONFIG;
-
-/* enumerated effects module numbers for configuration */
-typedef enum
-{
- EAS_MODULE_ENHANCER = 0,
- EAS_MODULE_COMPRESSOR,
- EAS_MODULE_REVERB,
- EAS_MODULE_CHORUS,
- EAS_MODULE_WIDENER,
- EAS_MODULE_GRAPHIC_EQ,
- EAS_MODULE_WOW,
- EAS_MODULE_MAXIMIZER,
- EAS_MODULE_TONECONTROLEQ,
- NUM_EFFECTS_MODULES
-} E_FX_MODULES;
-
-/* enumerated optional module numbers for configuration */
-typedef enum
-{
- EAS_MODULE_MMAPI_TONE_CONTROL = 0,
- EAS_MODULE_METRICS
-} E_OPT_MODULES;
-#define NUM_OPTIONAL_MODULES 2
-
-/* enumerated audio decoders for configuration */
-typedef enum
-{
- EAS_DECODER_PCM = 0,
- EAS_DECODER_SMAF_ADPCM,
- EAS_DECODER_IMA_ADPCM,
- EAS_DECODER_7BIT_SMAF_ADPCM,
- EAS_DECODER_NOT_SUPPORTED
-} E_DECODER_MODULES;
-#define NUM_DECODER_MODULES 4
-
-/* defines for EAS_PEOpenStream flags parameter */
-#define PCM_FLAGS_STEREO 0x00000100 /* stream is stereo */
-#define PCM_FLAGS_8_BIT 0x00000001 /* 8-bit format */
-#define PCM_FLAGS_UNSIGNED 0x00000010 /* unsigned format */
-#define PCM_FLAGS_STREAMING 0x80000000 /* streaming mode */
-
-/* maximum volume setting */
-#define EAS_MAX_VOLUME 100
-
-/*----------------------------------------------------------------------------
- * EAS_Init()
- *----------------------------------------------------------------------------
- * Purpose:
- * Initialize the synthesizer library
- *
- * Inputs:
- * polyphony - number of voices to play (dynamic memory model only)
- * ppLibData - pointer to data handle variable for this instance
- *
- * Outputs:
- *
- *----------------------------------------------------------------------------
-*/
-EAS_PUBLIC EAS_RESULT EAS_Init (EAS_DATA_HANDLE *ppEASData);
-
-/*----------------------------------------------------------------------------
- * EAS_Config()
- *----------------------------------------------------------------------------
- * Purpose:
- * Returns a pointer to a structure containing the configuration options
- * in this library build.
- *
- * Inputs:
- *
- * Outputs:
- *
- *----------------------------------------------------------------------------
-*/
-EAS_PUBLIC const S_EAS_LIB_CONFIG *EAS_Config (void);
-
-/*----------------------------------------------------------------------------
- * EAS_Shutdown()
- *----------------------------------------------------------------------------
- * Purpose:
- * Shuts down the library. Deallocates any memory associated with the
- * synthesizer (dynamic memory model only)
- *
- * Inputs:
- * pEASData - handle to data for this instance
- *
- * Outputs:
- *
- *----------------------------------------------------------------------------
-*/
-EAS_PUBLIC EAS_RESULT EAS_Shutdown (EAS_DATA_HANDLE pEASData);
-
-/*----------------------------------------------------------------------------
- * EAS_Render()
- *----------------------------------------------------------------------------
- * Purpose:
- * Parse the Midi data and render PCM audio data.
- *
- * Inputs:
- * pEASData - buffer for internal EAS data
- * pOut - output buffer pointer
- * nNumRequested - requested num samples to generate
- * pnNumGenerated - actual number of samples generated
- *
- * Outputs:
- * EAS_SUCCESS if PCM data was successfully rendered
- *
- *----------------------------------------------------------------------------
-*/
-EAS_PUBLIC EAS_RESULT EAS_Render (EAS_DATA_HANDLE pEASData, EAS_PCM *pOut, EAS_I32 numRequested, EAS_I32 *pNumGenerated);
-
-/*----------------------------------------------------------------------------
- * EAS_SetRepeat()
- *----------------------------------------------------------------------------
- * Purpose:
- * Set the selected stream to repeat.
- *
- * Inputs:
- * pEASData - handle to data for this instance
- * streamHandle - handle to stream
- * repeatCount - repeat count (0 = no repeat, -1 = repeat forever)
- *
- * Outputs:
- *
- * Side Effects:
- *
- * Notes:
- * 0 = no repeat
- * 1 = repeat once, i.e. play through twice
- * -1 = repeat forever
- *----------------------------------------------------------------------------
-*/
-EAS_PUBLIC EAS_RESULT EAS_SetRepeat (EAS_DATA_HANDLE pEASData, EAS_HANDLE streamHandle, EAS_I32 repeatCount);
-
-/*----------------------------------------------------------------------------
- * EAS_GetRepeat()
- *----------------------------------------------------------------------------
- * Purpose:
- * Gets the current repeat count for the selected stream.
- *
- * Inputs:
- * pEASData - handle to data for this instance
- * streamHandle - handle to stream
- * pRrepeatCount - pointer to variable to hold repeat count
- *
- * Outputs:
- *
- * Side Effects:
- *
- * Notes:
- * 0 = no repeat
- * 1 = repeat once, i.e. play through twice
- * -1 = repeat forever
- *----------------------------------------------------------------------------
-*/
-EAS_PUBLIC EAS_RESULT EAS_GetRepeat (EAS_DATA_HANDLE pEASData, EAS_HANDLE streamHandle, EAS_I32 *pRepeatCount);
-
-/*----------------------------------------------------------------------------
- * EAS_SetPlaybackRate()
- *----------------------------------------------------------------------------
- * Purpose:
- * Set the playback rate.
- *
- * Inputs:
- * pEASData - handle to data for this instance
- * streamHandle - handle to stream
- * rate - rate (28-bit fractional amount)
- *
- * Outputs:
- *
- * Side Effects:
- *
- *----------------------------------------------------------------------------
-*/
-EAS_PUBLIC EAS_RESULT EAS_SetPlaybackRate (EAS_DATA_HANDLE pEASData, EAS_HANDLE streamHandle, EAS_U32 rate);
-#define MAX_PLAYBACK_RATE (EAS_U32)(1L << 29)
-#define MIN_PLAYBACK_RATE (EAS_U32)(1L << 27)
-
-/*----------------------------------------------------------------------------
- * EAS_SetTransposition)
- *----------------------------------------------------------------------------
- * Purpose:
- * Sets the key tranposition for the synthesizer. Transposes all
- * melodic instruments by the specified amount. Range is limited
- * to +/-12 semitones.
- *
- * Inputs:
- * pEASData - handle to data for this instance
- * streamHandle - handle to stream
- * transposition - +/-12 semitones
- *
- * Outputs:
- *
- * Side Effects:
- *
- *----------------------------------------------------------------------------
-*/
-EAS_PUBLIC EAS_RESULT EAS_SetTransposition (EAS_DATA_HANDLE pEASData, EAS_HANDLE streamHandle, EAS_I32 transposition);
-#define MAX_TRANSPOSE 12
-
-/*----------------------------------------------------------------------------
- * EAS_SetSynthPolyphony()
- *----------------------------------------------------------------------------
- * Purpose:
- * Set the polyphony of the synthesizer. Value must be >= 1 and <= the
- * maximum number of voices. This function will pin the polyphony
- * at those limits
- *
- * Inputs:
- * pEASData - pointer to overall EAS data structure
- * synthNum - synthesizer number (0 = onboard, 1 = DSP)
- * polyphonyCount - the desired polyphony count
- *
- * Outputs:
- *
- * Side Effects:
- *
- *----------------------------------------------------------------------------
-*/
-EAS_PUBLIC EAS_RESULT EAS_SetSynthPolyphony (EAS_DATA_HANDLE pEASData, EAS_I32 synthNum, EAS_I32 polyphonyCount);
-
-/*----------------------------------------------------------------------------
- * EAS_GetSynthPolyphony()
- *----------------------------------------------------------------------------
- * Purpose:
- * Returns the current polyphony setting of the synthesizer
- *
- * Inputs:
- * pEASData - pointer to overall EAS data structure
- * synthNum - synthesizer number (0 = onboard, 1 = DSP)
- * pPolyphonyCount - pointer to variable to receive polyphony count
- *
- * Outputs:
- *
- * Side Effects:
- *
- *----------------------------------------------------------------------------
-*/
-EAS_PUBLIC EAS_RESULT EAS_GetSynthPolyphony (EAS_DATA_HANDLE pEASData, EAS_I32 synthNum, EAS_I32 *pPolyphonyCount);
-
-/*----------------------------------------------------------------------------
- * EAS_SetPolyphony()
- *----------------------------------------------------------------------------
- * Purpose:
- * Set the polyphony of the stream. Value must be >= 1 and <= the
- * maximum number of voices. This function will pin the polyphony
- * at those limits
- *
- * Inputs:
- * pEASData - pointer to overall EAS data structure
- * streamHandle - handle returned by EAS_OpenFile
- * polyphonyCount - the desired polyphony count
- *
- * Outputs:
- *
- * Side Effects:
- *
- *----------------------------------------------------------------------------
-*/
-EAS_PUBLIC EAS_RESULT EAS_SetPolyphony (EAS_DATA_HANDLE pEASData, EAS_HANDLE streamHandle, EAS_I32 polyphonyCount);
-
-/*----------------------------------------------------------------------------
- * EAS_GetPolyphony()
- *----------------------------------------------------------------------------
- * Purpose:
- * Returns the current polyphony setting of the stream
- *
- * Inputs:
- * pEASData - pointer to overall EAS data structure
- * streamHandle - handle returned by EAS_OpenFile
- * pPolyphonyCount - pointer to variable to receive polyphony count
- *
- * Outputs:
- *
- * Side Effects:
- *
- *----------------------------------------------------------------------------
-*/
-EAS_PUBLIC EAS_RESULT EAS_GetPolyphony (EAS_DATA_HANDLE pEASData, EAS_HANDLE streamHandle, EAS_I32 *pPolyphonyCount);
-
-/*----------------------------------------------------------------------------
- * EAS_SetPriority()
- *----------------------------------------------------------------------------
- * Purpose:
- * Set the priority of the stream. Determines which stream's voices
- * are stolen when there are insufficient voices for all notes.
- * Value must be in the range of 1-255, lower values are higher
- * priority. The default priority is 50.
- *
- * Inputs:
- * pEASData - pointer to overall EAS data structure
- * streamHandle - handle returned by EAS_OpenFile
- * polyphonyCount - the desired polyphony count
- *
- * Outputs:
- *
- * Side Effects:
- *
- *----------------------------------------------------------------------------
-*/
-EAS_PUBLIC EAS_RESULT EAS_SetPriority (EAS_DATA_HANDLE pEASData, EAS_HANDLE streamHandle, EAS_I32 priority);
-
-/*----------------------------------------------------------------------------
- * EAS_GetPriority()
- *----------------------------------------------------------------------------
- * Purpose:
- * Returns the current priority setting of the stream
- *
- * Inputs:
- * pEASData - pointer to overall EAS data structure
- * streamHandle - handle returned by EAS_OpenFile
- * pPriority - pointer to variable to receive priority
- *
- * Outputs:
- *
- * Side Effects:
- *
- *----------------------------------------------------------------------------
-*/
-EAS_PUBLIC EAS_RESULT EAS_GetPriority (EAS_DATA_HANDLE pEASData, EAS_HANDLE streamHandle, EAS_I32 *pPriority);
-
-/*----------------------------------------------------------------------------
- * EAS_SetVolume()
- *----------------------------------------------------------------------------
- * Purpose:
- * Set the master volume for the mixer. The default volume setting is
- * 90 (-10 dB). The volume range is 0 to 100 in 1dB increments.
- *
- * Inputs:
- * pEASData - pointer to overall EAS data structure
- * volume - the desired master volume
- *
- * Outputs:
- *
- *
- * Side Effects:
- * overrides any previously set master volume from sysex
- *
- *----------------------------------------------------------------------------
-*/
-EAS_PUBLIC EAS_RESULT EAS_SetVolume (EAS_DATA_HANDLE pEASData, EAS_HANDLE streamHandle, EAS_I32 volume);
-
-/*----------------------------------------------------------------------------
- * EAS_GetVolume()
- *----------------------------------------------------------------------------
- * Purpose:
- * Returns the master volume for the mixer in 1dB increments.
- *
- * Inputs:
- * pEASData - pointer to overall EAS data structure
- * volume - the desired master volume
- *
- * Outputs:
- *
- *
- * Side Effects:
- * overrides any previously set master volume from sysex
- *
- *----------------------------------------------------------------------------
-*/
-EAS_PUBLIC EAS_I32 EAS_GetVolume (EAS_DATA_HANDLE pEASData, EAS_HANDLE streamHandle);
-
-/*----------------------------------------------------------------------------
- * EAS_SetMaxLoad()
- *----------------------------------------------------------------------------
- * Purpose:
- * Sets the maximum workload the parsers will do in a single call to
- * EAS_Render. The units are currently arbitrary, but should correlate
- * well to the actual CPU cycles consumed. The primary effect is to
- * reduce the occasional peaks in CPU cycles consumed when parsing
- * dense parts of a MIDI score. Setting maxWorkLoad to zero disables
- * the workload limiting function.
- *
- * Inputs:
- * pEASData - handle to data for this instance
- * maxLoad - the desired maximum workload
- *
- * Outputs:
- *
- * Side Effects:
- *
- *----------------------------------------------------------------------------
-*/
-EAS_PUBLIC EAS_RESULT EAS_SetMaxLoad (EAS_DATA_HANDLE pEASData, EAS_I32 maxLoad);
-
-/*----------------------------------------------------------------------------
- * EAS_SetMaxPCMStreams()
- *----------------------------------------------------------------------------
- * Sets the maximum number of PCM streams allowed in parsers that
- * use PCM streaming.
- *
- * Inputs:
- * pEASData - pointer to overall EAS data structure
- * streamHandle - handle returned by EAS_OpenFile
- * maxNumStreams - maximum number of PCM streams
- *----------------------------------------------------------------------------
-*/
-EAS_PUBLIC EAS_RESULT EAS_SetMaxPCMStreams (EAS_DATA_HANDLE pEASData, EAS_HANDLE pStream, EAS_I32 maxNumStreams);
-
-/*----------------------------------------------------------------------------
- * EAS_OpenFile()
- *----------------------------------------------------------------------------
- * Purpose:
- * Opens a file for audio playback.
- *
- * Inputs:
- * pEASData - pointer to overall EAS data structure
- * locator - pointer to filename or other locating information
- * pStreamHandle - pointer to stream handle variable
- *
- * Outputs:
- *
- *
- * Side Effects:
- *
- *----------------------------------------------------------------------------
-*/
-EAS_PUBLIC EAS_RESULT EAS_OpenFile (EAS_DATA_HANDLE pEASData, EAS_FILE_LOCATOR locator, EAS_HANDLE *pStreamHandle);
-
-#ifdef MMAPI_SUPPORT
-/*----------------------------------------------------------------------------
- * EAS_MMAPIToneControl()
- *----------------------------------------------------------------------------
- * Purpose:
- * Opens a ToneControl file for audio playback.
- *
- * Inputs:
- * pEASData - pointer to overall EAS data structure
- * locator - pointer to filename or other locating information
- * pStreamHandle - pointer to stream handle variable
- *
- * Outputs:
- *
- *
- * Side Effects:
- *
- *----------------------------------------------------------------------------
-*/
-EAS_PUBLIC EAS_RESULT EAS_MMAPIToneControl (EAS_DATA_HANDLE pEASData, EAS_FILE_LOCATOR locator, EAS_HANDLE *pStreamHandle);
-
-/*----------------------------------------------------------------------------
- * EAS_GetWaveFmtChunk
- *----------------------------------------------------------------------------
- * Helper function to retrieve WAVE file fmt chunk for MMAPI
- *----------------------------------------------------------------------------
- * pEASData - pointer to EAS persistent data object
- * streamHandle - stream handle
- * pFmtChunk - pointer to pointer to FMT chunk data
- *----------------------------------------------------------------------------
-*/
-EAS_PUBLIC EAS_RESULT EAS_GetWaveFmtChunk (EAS_DATA_HANDLE pEASData, EAS_HANDLE streamHandle, EAS_VOID_PTR *ppFmtChunk);
-#endif
-
-/*----------------------------------------------------------------------------
- * EAS_GetFileType
- *----------------------------------------------------------------------------
- * Returns the file type (see eas_types.h for enumerations)
- *----------------------------------------------------------------------------
- * pEASData - pointer to EAS persistent data object
- * streamHandle - stream handle
- * pFileType - pointer to variable to receive file type
- *----------------------------------------------------------------------------
-*/
-EAS_PUBLIC EAS_RESULT EAS_GetFileType (EAS_DATA_HANDLE pEASData, EAS_HANDLE streamHandle, EAS_I32 *pFileType);
-
-/*----------------------------------------------------------------------------
- * EAS_ParseMetaData()
- *----------------------------------------------------------------------------
- * Purpose:
- *
- *
- * Inputs:
- * pEASData - pointer to overall EAS data structure
- * streamHandle - file or stream handle
- * playLength - pointer to variable to store the play length (in msecs)
- *
- * Outputs:
- *
- *
- * Side Effects:
- * - resets the parser to the start of the file
- *----------------------------------------------------------------------------
-*/
-EAS_PUBLIC EAS_RESULT EAS_ParseMetaData (EAS_DATA_HANDLE pEASData, EAS_HANDLE streamHandle, EAS_I32 *pPlayLength);
-
-/*----------------------------------------------------------------------------
- * EAS_Prepare()
- *----------------------------------------------------------------------------
- * Purpose:
- * Prepares the synthesizer to play the file or stream. Parses the first
- * frame of data from the file and arms the synthesizer.
- *
- * Inputs:
- * pEASData - pointer to overall EAS data structure
- * streamHandle - file or stream handle
- *
- * Outputs:
- *
- *
- * Side Effects:
- *
- *----------------------------------------------------------------------------
-*/
-EAS_PUBLIC EAS_RESULT EAS_Prepare (EAS_DATA_HANDLE pEASData, EAS_HANDLE streamHandle);
-
-/*----------------------------------------------------------------------------
- * EAS_State()
- *----------------------------------------------------------------------------
- * Purpose:
- * Returns the state of an audio file or stream.
- *
- * Inputs:
- * pEASData - pointer to overall EAS data structure
- * streamHandle - file or stream handle
- *
- * Outputs:
- *
- *
- * Side Effects:
- *
- *----------------------------------------------------------------------------
-*/
-EAS_PUBLIC EAS_RESULT EAS_State (EAS_DATA_HANDLE pEASData, EAS_HANDLE streamHandle, EAS_STATE *pState);
-
-/*----------------------------------------------------------------------------
- * EAS_RegisterMetaDataCallback()
- *----------------------------------------------------------------------------
- * Purpose:
- * Registers a metadata callback function for parsed metadata. To
- * de-register the callback, call this function again with parameter
- * cbFunc set to NULL.
- *
- * Inputs:
- * pEASData - pointer to overall EAS data structure
- * streamHandle - file or stream handle
- * cbFunc - pointer to host callback function
- * metaDataBuffer - pointer to metadata buffer
- * metaDataBufSize - maximum size of the metadata buffer
- *
- * Outputs:
- *
- *
- * Side Effects:
- *
- *----------------------------------------------------------------------------
-*/
-EAS_PUBLIC EAS_RESULT EAS_RegisterMetaDataCallback (
- EAS_DATA_HANDLE pEASData,
- EAS_HANDLE streamHandle,
- EAS_METADATA_CBFUNC cbFunc,
- char *metaDataBuffer,
- EAS_I32 metaDataBufSize,
- EAS_VOID_PTR pUserData);
-
-/*----------------------------------------------------------------------------
- * EAS_GetNoteCount ()
- *----------------------------------------------------------------------------
- * Returns the total number of notes played in this stream
- *
- * Inputs:
- * pEASData - pointer to overall EAS data structure
- * streamHandle - file or stream handle
- * pNoteCount - pointer to variable to receive note count
- *----------------------------------------------------------------------------
-*/
-EAS_PUBLIC EAS_RESULT EAS_GetNoteCount (EAS_DATA_HANDLE pEASData, EAS_HANDLE pStream, EAS_I32 *pNoteCount);
-
-/*----------------------------------------------------------------------------
- * EAS_CloseFile()
- *----------------------------------------------------------------------------
- * Purpose:
- * Closes an audio file or stream. Playback should have either paused or
- * completed (EAS_State returns EAS_PAUSED or EAS_STOPPED).
- *
- * Inputs:
- * pEASData - pointer to overall EAS data structure
- * streamHandle - file or stream handle
- *
- * Outputs:
- *
- *
- * Side Effects:
- *
- *----------------------------------------------------------------------------
-*/
-EAS_PUBLIC EAS_RESULT EAS_CloseFile (EAS_DATA_HANDLE pEASData, EAS_HANDLE streamHandle);
-
-/*----------------------------------------------------------------------------
- * EAS_OpenMIDIStream()
- *----------------------------------------------------------------------------
- * Purpose:
- * Opens a raw MIDI stream allowing the host to route MIDI cable data directly to the synthesizer
- *
- * Inputs:
- * pEASData - pointer to overall EAS data structure
- * pStreamHandle - pointer to variable to hold file or stream handle
- * streamHandle - open stream or NULL for new synthesizer instance
- *
- * Outputs:
- *
- *
- * Side Effects:
- *
- *----------------------------------------------------------------------------
-*/
-EAS_PUBLIC EAS_RESULT EAS_OpenMIDIStream (EAS_DATA_HANDLE pEASData, EAS_HANDLE *pStreamHandle, EAS_HANDLE streamHandle);
-
-/*----------------------------------------------------------------------------
- * EAS_WriteMIDIStream()
- *----------------------------------------------------------------------------
- * Purpose:
- * Send data to the MIDI stream device
- *
- * Inputs:
- * pEASData - pointer to overall EAS data structure
- * streamHandle - stream handle
- * pBuffer - pointer to buffer
- * count - number of bytes to write
- *
- * Outputs:
- *
- *
- * Side Effects:
- *
- *----------------------------------------------------------------------------
-*/
-EAS_PUBLIC EAS_RESULT EAS_WriteMIDIStream(EAS_DATA_HANDLE pEASData, EAS_HANDLE streamHandle, EAS_U8 *pBuffer, EAS_I32 count);
-
-/*----------------------------------------------------------------------------
- * EAS_CloseMIDIStream()
- *----------------------------------------------------------------------------
- * Purpose:
- * Closes a raw MIDI stream
- *
- * Inputs:
- * pEASData - pointer to overall EAS data structure
- * streamHandle - stream handle
- *
- * Outputs:
- *
- *
- * Side Effects:
- *
- *----------------------------------------------------------------------------
-*/
-EAS_PUBLIC EAS_RESULT EAS_CloseMIDIStream (EAS_DATA_HANDLE pEASData, EAS_HANDLE streamHandle);
-
-/*----------------------------------------------------------------------------
- * EAS_Locate()
- *----------------------------------------------------------------------------
- * Purpose:
- * Locate into the file associated with the handle.
- *
- * Inputs:
- * pEASData - pointer to overall EAS data structure
- * streamHandle - file handle
- * milliseconds - playback offset from start of file in milliseconds
- *
- * Outputs:
- *
- *
- * Side Effects:
- * the actual offset will be quantized to the closest update period, typically
- * a resolution of 5.9ms. Notes that are started prior to this time will not
- * sound. Any notes currently playing will be shut off.
- *
- *----------------------------------------------------------------------------
-*/
-EAS_PUBLIC EAS_RESULT EAS_Locate (EAS_DATA_HANDLE pEASData, EAS_HANDLE streamHandle, EAS_I32 milliseconds, EAS_BOOL offset);
-
-/*----------------------------------------------------------------------------
- * EAS_GetRenderTime()
- *----------------------------------------------------------------------------
- * Purpose:
- * Returns the current playback offset
- *
- * Inputs:
- * pEASData - pointer to overall EAS data structure
- *
- * Outputs:
- * Gets the render time clock in msecs.
- *
- * Side Effects:
- *
- *----------------------------------------------------------------------------
-*/
-EAS_PUBLIC EAS_RESULT EAS_GetRenderTime (EAS_DATA_HANDLE pEASData, EAS_I32 *pTime);
-
-/*----------------------------------------------------------------------------
- * EAS_GetLocation()
- *----------------------------------------------------------------------------
- * Purpose:
- * Returns the current playback offset
- *
- * Inputs:
- * pEASData - pointer to overall EAS data structure
- * streamHandle - file handle
- *
- * Outputs:
- * The offset in milliseconds from the start of the current sequence, quantized
- * to the nearest update period. Actual resolution is typically 5.9 ms.
- *
- * Side Effects:
- *
- *----------------------------------------------------------------------------
-*/
-EAS_PUBLIC EAS_RESULT EAS_GetLocation (EAS_DATA_HANDLE pEASData, EAS_HANDLE streamHandle, EAS_I32 *pTime);
-
-/*----------------------------------------------------------------------------
- * EAS_Pause()
- *----------------------------------------------------------------------------
- * Purpose:
- * Pauses the playback of the data associated with this handle. The audio
- * is gracefully ramped down to prevent clicks and pops. It may take several
- * buffers of audio before the audio is muted.
- *
- * Inputs:
- * psEASData - pointer to overall EAS data structure
- * streamHandle - file or stream handle
- *
- * Outputs:
- *
- *
- * Side Effects:
- *
- *
- *----------------------------------------------------------------------------
-*/
-EAS_PUBLIC EAS_RESULT EAS_Pause (EAS_DATA_HANDLE pEASData, EAS_HANDLE streamHandle);
-
-/*----------------------------------------------------------------------------
- * EAS_Resume()
- *----------------------------------------------------------------------------
- * Purpose:
- * Resumes the playback of the data associated with this handle. The audio
- * is gracefully ramped up to prevent clicks and pops.
- *
- * Inputs:
- * psEASData - pointer to overall EAS data structure
- * streamHandle - file or stream handle
- *
- * Outputs:
- *
- *
- * Side Effects:
- *
- *
- *----------------------------------------------------------------------------
-*/
-EAS_PUBLIC EAS_RESULT EAS_Resume (EAS_DATA_HANDLE pEASData, EAS_HANDLE streamHandle);
-
-/*----------------------------------------------------------------------------
- * EAS_GetParameter()
- *----------------------------------------------------------------------------
- * Purpose:
- * Set the parameter of a module. See E_MODULES for a list of modules
- * and the header files of the modules for a list of parameters.
- *
- * Inputs:
- * psEASData - pointer to overall EAS data structure
- * module - enumerated module number
- * param - enumerated parameter number
- * pValue - pointer to variable to receive parameter value
- *
- * Outputs:
- *
- *
- * Side Effects:
- *
- *
- *----------------------------------------------------------------------------
-*/
-EAS_PUBLIC EAS_RESULT EAS_GetParameter (EAS_DATA_HANDLE pEASData, EAS_I32 module, EAS_I32 param, EAS_I32 *pValue);
-
-/*----------------------------------------------------------------------------
- * EAS_SetParameter()
- *----------------------------------------------------------------------------
- * Purpose:
- * Set the parameter of a module. See E_MODULES for a list of modules
- * and the header files of the modules for a list of parameters.
- *
- * Inputs:
- * psEASData - pointer to overall EAS data structure
- * handle - file or stream handle
- * module - enumerated module number
- * param - enumerated parameter number
- * value - new parameter value
- *
- * Outputs:
- *
- *
- * Side Effects:
- *
- *
- *----------------------------------------------------------------------------
-*/
-EAS_PUBLIC EAS_RESULT EAS_SetParameter (EAS_DATA_HANDLE pEASData, EAS_I32 module, EAS_I32 param, EAS_I32 value);
-
-#ifdef _METRICS_ENABLED
-/*----------------------------------------------------------------------------
- * EAS_MetricsReport()
- *----------------------------------------------------------------------------
- * Purpose:
- * Displays the current metrics through the EAS_Report interface.
- *
- * Inputs:
- * pEASData - instance data handle
- *
- * Outputs:
- *
- *
- * Side Effects:
- *
- *----------------------------------------------------------------------------
-*/
-EAS_PUBLIC EAS_RESULT EAS_MetricsReport (EAS_DATA_HANDLE pEASData);
-
-/*----------------------------------------------------------------------------
- * EAS_MetricsReset()
- *----------------------------------------------------------------------------
- * Purpose:
- * Displays the current metrics through the EAS_Report interface.
- *
- * Inputs:
- * pEASData - instance data handle
- *
- * Outputs:
- *
- *
- * Side Effects:
- *
- *----------------------------------------------------------------------------
-*/
-EAS_PUBLIC EAS_RESULT EAS_MetricsReset (EAS_DATA_HANDLE pEASData);
-#endif
-
-/*----------------------------------------------------------------------------
- * EAS_SetSoundLibrary()
- *----------------------------------------------------------------------------
- * Purpose:
- * Sets the location of the sound library.
- *
- * Inputs:
- * pEASData - instance data handle
- * streamHandle - file or stream handle
- * pSoundLib - pointer to sound library
- *
- * Outputs:
- *
- *
- * Side Effects:
- *
- *----------------------------------------------------------------------------
-*/
-EAS_PUBLIC EAS_RESULT EAS_SetSoundLibrary (EAS_DATA_HANDLE pEASData, EAS_HANDLE streamHandle, EAS_SNDLIB_HANDLE pSndLib);
-
-/*----------------------------------------------------------------------------
- * EAS_SetHeaderSearchFlag()
- *----------------------------------------------------------------------------
- * By default, when EAS_OpenFile is called, the parsers check the
- * first few bytes of the file looking for a specific header. Some
- * mobile devices may add a header to the start of a file, which
- * will prevent the parser from recognizing the file. If the
- * searchFlag is set to EAS_TRUE, the parser will search the entire
- * file looking for the header. This may enable EAS to recognize
- * some files that it would ordinarily reject. The negative is that
- * it make take slightly longer to process the EAS_OpenFile request.
- *
- * Inputs:
- * pEASData - instance data handle
- * searchFlag - search flag (EAS_TRUE or EAS_FALSE)
- *----------------------------------------------------------------------------
-*/
-EAS_PUBLIC EAS_RESULT EAS_SetHeaderSearchFlag (EAS_DATA_HANDLE pEASData, EAS_BOOL searchFlag);
-
-/*----------------------------------------------------------------------------
- * EAS_SetPlayMode()
- *----------------------------------------------------------------------------
- * Some file formats support special play modes, such as iMode partial
- * play mode. This call can be used to change the play mode. The
- * default play mode (usually straight playback) is always zero.
- *
- * Inputs:
- * pEASData - instance data handle
- * handle - file or stream handle
- * playMode - play mode (see eas_types.h for enumerations)
- *----------------------------------------------------------------------------
-*/
-EAS_PUBLIC EAS_RESULT EAS_SetPlayMode (EAS_DATA_HANDLE pEASData, EAS_HANDLE pStream, EAS_I32 playMode);
-
-#ifdef DLS_SYNTHESIZER
-/*----------------------------------------------------------------------------
- * EAS_LoadDLSCollection()
- *----------------------------------------------------------------------------
- * Purpose:
- * Downloads a DLS collection
- *
- * Inputs:
- * pEASData - instance data handle
- * streamHandle - file or stream handle
- * locator - file locator
- *
- * Outputs:
- *
- *
- * Side Effects:
- * May overlay instruments in the GM sound set
- *
- *----------------------------------------------------------------------------
-*/
-EAS_PUBLIC EAS_RESULT EAS_LoadDLSCollection (EAS_DATA_HANDLE pEASData, EAS_HANDLE streamHandle, EAS_FILE_LOCATOR locator);
-#endif
-
-/*----------------------------------------------------------------------------
- * EAS_SetFrameBuffer()
- *----------------------------------------------------------------------------
- * Purpose:
- * Sets the frame buffer pointer passed to the IPC communications functions
- *
- * Inputs:
- * pEASData - instance data handle
- * locator - file locator
- *
- * Outputs:
- *
- *
- * Side Effects:
- * May overlay instruments in the GM sound set
- *
- *----------------------------------------------------------------------------
-*/
-EAS_PUBLIC EAS_RESULT EAS_SetFrameBuffer (EAS_DATA_HANDLE pEASData, EAS_FRAME_BUFFER_HANDLE pFrameBuffer);
-
-#ifdef EXTERNAL_AUDIO
-/*----------------------------------------------------------------------------
- * EAS_RegExtAudioCallback()
- *----------------------------------------------------------------------------
- * Purpose:
- * Registers callback functions for audio events.
- *
- * Inputs:
- * pEASData - pointer to overall EAS data structure
- * streamHandle - file or stream handle
- * cbProgChgFunc - pointer to host callback function for program change
- * cbEventFunc - pointer to host callback functio for note events
- *
- * Outputs:
- *
- *
- * Side Effects:
- *
- *----------------------------------------------------------------------------
-*/
-EAS_PUBLIC EAS_RESULT EAS_RegExtAudioCallback (EAS_DATA_HANDLE pEASData,
- EAS_HANDLE streamHandle,
- EAS_VOID_PTR pInstData,
- EAS_EXT_PRG_CHG_FUNC cbProgChgFunc,
- EAS_EXT_EVENT_FUNC cbEventFunc);
-
-/*----------------------------------------------------------------------------
- * EAS_GetMIDIControllers()
- *----------------------------------------------------------------------------
- * Purpose:
- * Returns the current state of MIDI controllers on the requested channel.
- *
- * Inputs:
- * pEASData - pointer to overall EAS data structure
- * streamHandle - file or stream handle
- * pControl - pointer to structure to receive data
- *
- * Outputs:
- *
- *
- * Side Effects:
- *
- *----------------------------------------------------------------------------
-*/
-EAS_PUBLIC EAS_RESULT EAS_GetMIDIControllers (EAS_DATA_HANDLE pEASData, EAS_HANDLE streamHandle, EAS_U8 channel, S_MIDI_CONTROLLERS *pControl);
-#endif
-
-/*----------------------------------------------------------------------------
- * EAS_SearchFile
- *----------------------------------------------------------------------------
- * Search file for specific sequence starting at current file
- * position. Returns offset to start of sequence.
- *
- * Inputs:
- * pEASData - pointer to EAS persistent data object
- * fileHandle - file handle
- * searchString - pointer to search sequence
- * len - length of search sequence
- * pOffset - pointer to variable to store offset to sequence
- *
- * Returns EAS_EOF if end-of-file is reached
- *----------------------------------------------------------------------------
-*/
-EAS_RESULT EAS_SearchFile (EAS_DATA_HANDLE pEASData, EAS_FILE_HANDLE fileHandle, const EAS_U8 *searchString, EAS_I32 len, EAS_I32 *pOffset);
-
-#ifdef __cplusplus
-} /* end extern "C" */
-#endif
-
-#endif /* #ifndef _EAS_H */
+ *
+ *----------------------------------------------------------------------------
+ * Revision Control:
+ * $Revision: 852 $
+ * $Date: 2007-09-04 11:43:49 -0700 (Tue, 04 Sep 2007) $
+ *----------------------------------------------------------------------------
+*/
+
+#ifndef _EAS_H
+#define _EAS_H
+
+#include "eas_types.h"
+
+/* for C++ linkage */
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+/* library version macro */
+#define MAKE_LIB_VERSION(a,b,c,d) (((((((EAS_U32) a <<8) | (EAS_U32) b) << 8) | (EAS_U32) c) << 8) | (EAS_U32) d)
+#define LIB_VERSION MAKE_LIB_VERSION(3, 6, 10, 14)
+
+typedef struct
+{
+ EAS_U32 libVersion;
+ EAS_BOOL checkedVersion;
+ EAS_I32 maxVoices;
+ EAS_I32 numChannels;
+ EAS_I32 sampleRate;
+ EAS_I32 mixBufferSize;
+ EAS_BOOL filterEnabled;
+ EAS_U32 buildTimeStamp;
+ EAS_CHAR *buildGUID;
+} S_EAS_LIB_CONFIG;
+
+/* enumerated effects module numbers for configuration */
+typedef enum
+{
+ EAS_MODULE_ENHANCER = 0,
+ EAS_MODULE_COMPRESSOR,
+ EAS_MODULE_REVERB,
+ EAS_MODULE_CHORUS,
+ EAS_MODULE_WIDENER,
+ EAS_MODULE_GRAPHIC_EQ,
+ EAS_MODULE_WOW,
+ EAS_MODULE_MAXIMIZER,
+ EAS_MODULE_TONECONTROLEQ,
+ NUM_EFFECTS_MODULES
+} E_FX_MODULES;
+
+/* enumerated optional module numbers for configuration */
+typedef enum
+{
+ EAS_MODULE_MMAPI_TONE_CONTROL = 0,
+ EAS_MODULE_METRICS
+} E_OPT_MODULES;
+#define NUM_OPTIONAL_MODULES 2
+
+/* enumerated audio decoders for configuration */
+typedef enum
+{
+ EAS_DECODER_PCM = 0,
+ EAS_DECODER_SMAF_ADPCM,
+ EAS_DECODER_IMA_ADPCM,
+ EAS_DECODER_7BIT_SMAF_ADPCM,
+ EAS_DECODER_NOT_SUPPORTED
+} E_DECODER_MODULES;
+#define NUM_DECODER_MODULES 4
+
+/* defines for EAS_PEOpenStream flags parameter */
+#define PCM_FLAGS_STEREO 0x00000100 /* stream is stereo */
+#define PCM_FLAGS_8_BIT 0x00000001 /* 8-bit format */
+#define PCM_FLAGS_UNSIGNED 0x00000010 /* unsigned format */
+#define PCM_FLAGS_STREAMING 0x80000000 /* streaming mode */
+
+/* maximum volume setting */
+#define EAS_MAX_VOLUME 100
+
+/*----------------------------------------------------------------------------
+ * EAS_Init()
+ *----------------------------------------------------------------------------
+ * Purpose:
+ * Initialize the synthesizer library
+ *
+ * Inputs:
+ * polyphony - number of voices to play (dynamic memory model only)
+ * ppLibData - pointer to data handle variable for this instance
+ *
+ * Outputs:
+ *
+ *----------------------------------------------------------------------------
+*/
+EAS_PUBLIC EAS_RESULT EAS_Init (EAS_DATA_HANDLE *ppEASData);
+
+/*----------------------------------------------------------------------------
+ * EAS_Config()
+ *----------------------------------------------------------------------------
+ * Purpose:
+ * Returns a pointer to a structure containing the configuration options
+ * in this library build.
+ *
+ * Inputs:
+ *
+ * Outputs:
+ *
+ *----------------------------------------------------------------------------
+*/
+EAS_PUBLIC const S_EAS_LIB_CONFIG *EAS_Config (void);
+
+/*----------------------------------------------------------------------------
+ * EAS_Shutdown()
+ *----------------------------------------------------------------------------
+ * Purpose:
+ * Shuts down the library. Deallocates any memory associated with the
+ * synthesizer (dynamic memory model only)
+ *
+ * Inputs:
+ * pEASData - handle to data for this instance
+ *
+ * Outputs:
+ *
+ *----------------------------------------------------------------------------
+*/
+EAS_PUBLIC EAS_RESULT EAS_Shutdown (EAS_DATA_HANDLE pEASData);
+
+/*----------------------------------------------------------------------------
+ * EAS_Render()
+ *----------------------------------------------------------------------------
+ * Purpose:
+ * Parse the Midi data and render PCM audio data.
+ *
+ * Inputs:
+ * pEASData - buffer for internal EAS data
+ * pOut - output buffer pointer
+ * nNumRequested - requested num samples to generate
+ * pnNumGenerated - actual number of samples generated
+ *
+ * Outputs:
+ * EAS_SUCCESS if PCM data was successfully rendered
+ *
+ *----------------------------------------------------------------------------
+*/
+EAS_PUBLIC EAS_RESULT EAS_Render (EAS_DATA_HANDLE pEASData, EAS_PCM *pOut, EAS_I32 numRequested, EAS_I32 *pNumGenerated);
+
+/*----------------------------------------------------------------------------
+ * EAS_SetRepeat()
+ *----------------------------------------------------------------------------
+ * Purpose:
+ * Set the selected stream to repeat.
+ *
+ * Inputs:
+ * pEASData - handle to data for this instance
+ * streamHandle - handle to stream
+ * repeatCount - repeat count (0 = no repeat, -1 = repeat forever)
+ *
+ * Outputs:
+ *
+ * Side Effects:
+ *
+ * Notes:
+ * 0 = no repeat
+ * 1 = repeat once, i.e. play through twice
+ * -1 = repeat forever
+ *----------------------------------------------------------------------------
+*/
+EAS_PUBLIC EAS_RESULT EAS_SetRepeat (EAS_DATA_HANDLE pEASData, EAS_HANDLE streamHandle, EAS_I32 repeatCount);
+
+/*----------------------------------------------------------------------------
+ * EAS_GetRepeat()
+ *----------------------------------------------------------------------------
+ * Purpose:
+ * Gets the current repeat count for the selected stream.
+ *
+ * Inputs:
+ * pEASData - handle to data for this instance
+ * streamHandle - handle to stream
+ * pRrepeatCount - pointer to variable to hold repeat count
+ *
+ * Outputs:
+ *
+ * Side Effects:
+ *
+ * Notes:
+ * 0 = no repeat
+ * 1 = repeat once, i.e. play through twice
+ * -1 = repeat forever
+ *----------------------------------------------------------------------------
+*/
+EAS_PUBLIC EAS_RESULT EAS_GetRepeat (EAS_DATA_HANDLE pEASData, EAS_HANDLE streamHandle, EAS_I32 *pRepeatCount);
+
+/*----------------------------------------------------------------------------
+ * EAS_SetPlaybackRate()
+ *----------------------------------------------------------------------------
+ * Purpose:
+ * Set the playback rate.
+ *
+ * Inputs:
+ * pEASData - handle to data for this instance
+ * streamHandle - handle to stream
+ * rate - rate (28-bit fractional amount)
+ *
+ * Outputs:
+ *
+ * Side Effects:
+ *
+ *----------------------------------------------------------------------------
+*/
+EAS_PUBLIC EAS_RESULT EAS_SetPlaybackRate (EAS_DATA_HANDLE pEASData, EAS_HANDLE streamHandle, EAS_U32 rate);
+#define MAX_PLAYBACK_RATE (EAS_U32)(1L << 29)
+#define MIN_PLAYBACK_RATE (EAS_U32)(1L << 27)
+
+/*----------------------------------------------------------------------------
+ * EAS_SetTransposition)
+ *----------------------------------------------------------------------------
+ * Purpose:
+ * Sets the key tranposition for the synthesizer. Transposes all
+ * melodic instruments by the specified amount. Range is limited
+ * to +/-12 semitones.
+ *
+ * Inputs:
+ * pEASData - handle to data for this instance
+ * streamHandle - handle to stream
+ * transposition - +/-12 semitones
+ *
+ * Outputs:
+ *
+ * Side Effects:
+ *
+ *----------------------------------------------------------------------------
+*/
+EAS_PUBLIC EAS_RESULT EAS_SetTransposition (EAS_DATA_HANDLE pEASData, EAS_HANDLE streamHandle, EAS_I32 transposition);
+#define MAX_TRANSPOSE 12
+
+/*----------------------------------------------------------------------------
+ * EAS_SetSynthPolyphony()
+ *----------------------------------------------------------------------------
+ * Purpose:
+ * Set the polyphony of the synthesizer. Value must be >= 1 and <= the
+ * maximum number of voices. This function will pin the polyphony
+ * at those limits
+ *
+ * Inputs:
+ * pEASData - pointer to overall EAS data structure
+ * synthNum - synthesizer number (0 = onboard, 1 = DSP)
+ * polyphonyCount - the desired polyphony count
+ *
+ * Outputs:
+ *
+ * Side Effects:
+ *
+ *----------------------------------------------------------------------------
+*/
+EAS_PUBLIC EAS_RESULT EAS_SetSynthPolyphony (EAS_DATA_HANDLE pEASData, EAS_I32 synthNum, EAS_I32 polyphonyCount);
+
+/*----------------------------------------------------------------------------
+ * EAS_GetSynthPolyphony()
+ *----------------------------------------------------------------------------
+ * Purpose:
+ * Returns the current polyphony setting of the synthesizer
+ *
+ * Inputs:
+ * pEASData - pointer to overall EAS data structure
+ * synthNum - synthesizer number (0 = onboard, 1 = DSP)
+ * pPolyphonyCount - pointer to variable to receive polyphony count
+ *
+ * Outputs:
+ *
+ * Side Effects:
+ *
+ *----------------------------------------------------------------------------
+*/
+EAS_PUBLIC EAS_RESULT EAS_GetSynthPolyphony (EAS_DATA_HANDLE pEASData, EAS_I32 synthNum, EAS_I32 *pPolyphonyCount);
+
+/*----------------------------------------------------------------------------
+ * EAS_SetPolyphony()
+ *----------------------------------------------------------------------------
+ * Purpose:
+ * Set the polyphony of the stream. Value must be >= 1 and <= the
+ * maximum number of voices. This function will pin the polyphony
+ * at those limits
+ *
+ * Inputs:
+ * pEASData - pointer to overall EAS data structure
+ * streamHandle - handle returned by EAS_OpenFile
+ * polyphonyCount - the desired polyphony count
+ *
+ * Outputs:
+ *
+ * Side Effects:
+ *
+ *----------------------------------------------------------------------------
+*/
+EAS_PUBLIC EAS_RESULT EAS_SetPolyphony (EAS_DATA_HANDLE pEASData, EAS_HANDLE streamHandle, EAS_I32 polyphonyCount);
+
+/*----------------------------------------------------------------------------
+ * EAS_GetPolyphony()
+ *----------------------------------------------------------------------------
+ * Purpose:
+ * Returns the current polyphony setting of the stream
+ *
+ * Inputs:
+ * pEASData - pointer to overall EAS data structure
+ * streamHandle - handle returned by EAS_OpenFile
+ * pPolyphonyCount - pointer to variable to receive polyphony count
+ *
+ * Outputs:
+ *
+ * Side Effects:
+ *
+ *----------------------------------------------------------------------------
+*/
+EAS_PUBLIC EAS_RESULT EAS_GetPolyphony (EAS_DATA_HANDLE pEASData, EAS_HANDLE streamHandle, EAS_I32 *pPolyphonyCount);
+
+/*----------------------------------------------------------------------------
+ * EAS_SetPriority()
+ *----------------------------------------------------------------------------
+ * Purpose:
+ * Set the priority of the stream. Determines which stream's voices
+ * are stolen when there are insufficient voices for all notes.
+ * Value must be in the range of 1-255, lower values are higher
+ * priority. The default priority is 50.
+ *
+ * Inputs:
+ * pEASData - pointer to overall EAS data structure
+ * streamHandle - handle returned by EAS_OpenFile
+ * polyphonyCount - the desired polyphony count
+ *
+ * Outputs:
+ *
+ * Side Effects:
+ *
+ *----------------------------------------------------------------------------
+*/
+EAS_PUBLIC EAS_RESULT EAS_SetPriority (EAS_DATA_HANDLE pEASData, EAS_HANDLE streamHandle, EAS_I32 priority);
+
+/*----------------------------------------------------------------------------
+ * EAS_GetPriority()
+ *----------------------------------------------------------------------------
+ * Purpose:
+ * Returns the current priority setting of the stream
+ *
+ * Inputs:
+ * pEASData - pointer to overall EAS data structure
+ * streamHandle - handle returned by EAS_OpenFile
+ * pPriority - pointer to variable to receive priority
+ *
+ * Outputs:
+ *
+ * Side Effects:
+ *
+ *----------------------------------------------------------------------------
+*/
+EAS_PUBLIC EAS_RESULT EAS_GetPriority (EAS_DATA_HANDLE pEASData, EAS_HANDLE streamHandle, EAS_I32 *pPriority);
+
+/*----------------------------------------------------------------------------
+ * EAS_SetVolume()
+ *----------------------------------------------------------------------------
+ * Purpose:
+ * Set the master volume for the mixer. The default volume setting is
+ * 90 (-10 dB). The volume range is 0 to 100 in 1dB increments.
+ *
+ * Inputs:
+ * pEASData - pointer to overall EAS data structure
+ * volume - the desired master volume
+ *
+ * Outputs:
+ *
+ *
+ * Side Effects:
+ * overrides any previously set master volume from sysex
+ *
+ *----------------------------------------------------------------------------
+*/
+EAS_PUBLIC EAS_RESULT EAS_SetVolume (EAS_DATA_HANDLE pEASData, EAS_HANDLE streamHandle, EAS_I32 volume);
+
+/*----------------------------------------------------------------------------
+ * EAS_GetVolume()
+ *----------------------------------------------------------------------------
+ * Purpose:
+ * Returns the master volume for the mixer in 1dB increments.
+ *
+ * Inputs:
+ * pEASData - pointer to overall EAS data structure
+ * volume - the desired master volume
+ *
+ * Outputs:
+ *
+ *
+ * Side Effects:
+ * overrides any previously set master volume from sysex
+ *
+ *----------------------------------------------------------------------------
+*/
+EAS_PUBLIC EAS_I32 EAS_GetVolume (EAS_DATA_HANDLE pEASData, EAS_HANDLE streamHandle);
+
+/*----------------------------------------------------------------------------
+ * EAS_SetMaxLoad()
+ *----------------------------------------------------------------------------
+ * Purpose:
+ * Sets the maximum workload the parsers will do in a single call to
+ * EAS_Render. The units are currently arbitrary, but should correlate
+ * well to the actual CPU cycles consumed. The primary effect is to
+ * reduce the occasional peaks in CPU cycles consumed when parsing
+ * dense parts of a MIDI score. Setting maxWorkLoad to zero disables
+ * the workload limiting function.
+ *
+ * Inputs:
+ * pEASData - handle to data for this instance
+ * maxLoad - the desired maximum workload
+ *
+ * Outputs:
+ *
+ * Side Effects:
+ *
+ *----------------------------------------------------------------------------
+*/
+EAS_PUBLIC EAS_RESULT EAS_SetMaxLoad (EAS_DATA_HANDLE pEASData, EAS_I32 maxLoad);
+
+/*----------------------------------------------------------------------------
+ * EAS_SetMaxPCMStreams()
+ *----------------------------------------------------------------------------
+ * Sets the maximum number of PCM streams allowed in parsers that
+ * use PCM streaming.
+ *
+ * Inputs:
+ * pEASData - pointer to overall EAS data structure
+ * streamHandle - handle returned by EAS_OpenFile
+ * maxNumStreams - maximum number of PCM streams
+ *----------------------------------------------------------------------------
+*/
+EAS_PUBLIC EAS_RESULT EAS_SetMaxPCMStreams (EAS_DATA_HANDLE pEASData, EAS_HANDLE pStream, EAS_I32 maxNumStreams);
+
+/*----------------------------------------------------------------------------
+ * EAS_OpenFile()
+ *----------------------------------------------------------------------------
+ * Purpose:
+ * Opens a file for audio playback.
+ *
+ * Inputs:
+ * pEASData - pointer to overall EAS data structure
+ * locator - pointer to filename or other locating information
+ * pStreamHandle - pointer to stream handle variable
+ *
+ * Outputs:
+ *
+ *
+ * Side Effects:
+ *
+ *----------------------------------------------------------------------------
+*/
+EAS_PUBLIC EAS_RESULT EAS_OpenFile (EAS_DATA_HANDLE pEASData, EAS_FILE_LOCATOR locator, EAS_HANDLE *pStreamHandle);
+
+#ifdef MMAPI_SUPPORT
+/*----------------------------------------------------------------------------
+ * EAS_MMAPIToneControl()
+ *----------------------------------------------------------------------------
+ * Purpose:
+ * Opens a ToneControl file for audio playback.
+ *
+ * Inputs:
+ * pEASData - pointer to overall EAS data structure
+ * locator - pointer to filename or other locating information
+ * pStreamHandle - pointer to stream handle variable
+ *
+ * Outputs:
+ *
+ *
+ * Side Effects:
+ *
+ *----------------------------------------------------------------------------
+*/
+EAS_PUBLIC EAS_RESULT EAS_MMAPIToneControl (EAS_DATA_HANDLE pEASData, EAS_FILE_LOCATOR locator, EAS_HANDLE *pStreamHandle);
+
+/*----------------------------------------------------------------------------
+ * EAS_GetWaveFmtChunk
+ *----------------------------------------------------------------------------
+ * Helper function to retrieve WAVE file fmt chunk for MMAPI
+ *----------------------------------------------------------------------------
+ * pEASData - pointer to EAS persistent data object
+ * streamHandle - stream handle
+ * pFmtChunk - pointer to pointer to FMT chunk data
+ *----------------------------------------------------------------------------
+*/
+EAS_PUBLIC EAS_RESULT EAS_GetWaveFmtChunk (EAS_DATA_HANDLE pEASData, EAS_HANDLE streamHandle, EAS_VOID_PTR *ppFmtChunk);
+#endif
+
+/*----------------------------------------------------------------------------
+ * EAS_GetFileType
+ *----------------------------------------------------------------------------
+ * Returns the file type (see eas_types.h for enumerations)
+ *----------------------------------------------------------------------------
+ * pEASData - pointer to EAS persistent data object
+ * streamHandle - stream handle
+ * pFileType - pointer to variable to receive file type
+ *----------------------------------------------------------------------------
+*/
+EAS_PUBLIC EAS_RESULT EAS_GetFileType (EAS_DATA_HANDLE pEASData, EAS_HANDLE streamHandle, EAS_I32 *pFileType);
+
+/*----------------------------------------------------------------------------
+ * EAS_ParseMetaData()
+ *----------------------------------------------------------------------------
+ * Purpose:
+ *
+ *
+ * Inputs:
+ * pEASData - pointer to overall EAS data structure
+ * streamHandle - file or stream handle
+ * playLength - pointer to variable to store the play length (in msecs)
+ *
+ * Outputs:
+ *
+ *
+ * Side Effects:
+ * - resets the parser to the start of the file
+ *----------------------------------------------------------------------------
+*/
+EAS_PUBLIC EAS_RESULT EAS_ParseMetaData (EAS_DATA_HANDLE pEASData, EAS_HANDLE streamHandle, EAS_I32 *pPlayLength);
+
+/*----------------------------------------------------------------------------
+ * EAS_Prepare()
+ *----------------------------------------------------------------------------
+ * Purpose:
+ * Prepares the synthesizer to play the file or stream. Parses the first
+ * frame of data from the file and arms the synthesizer.
+ *
+ * Inputs:
+ * pEASData - pointer to overall EAS data structure
+ * streamHandle - file or stream handle
+ *
+ * Outputs:
+ *
+ *
+ * Side Effects:
+ *
+ *----------------------------------------------------------------------------
+*/
+EAS_PUBLIC EAS_RESULT EAS_Prepare (EAS_DATA_HANDLE pEASData, EAS_HANDLE streamHandle);
+
+/*----------------------------------------------------------------------------
+ * EAS_State()
+ *----------------------------------------------------------------------------
+ * Purpose:
+ * Returns the state of an audio file or stream.
+ *
+ * Inputs:
+ * pEASData - pointer to overall EAS data structure
+ * streamHandle - file or stream handle
+ *
+ * Outputs:
+ *
+ *
+ * Side Effects:
+ *
+ *----------------------------------------------------------------------------
+*/
+EAS_PUBLIC EAS_RESULT EAS_State (EAS_DATA_HANDLE pEASData, EAS_HANDLE streamHandle, EAS_STATE *pState);
+
+/*----------------------------------------------------------------------------
+ * EAS_RegisterMetaDataCallback()
+ *----------------------------------------------------------------------------
+ * Purpose:
+ * Registers a metadata callback function for parsed metadata. To
+ * de-register the callback, call this function again with parameter
+ * cbFunc set to NULL.
+ *
+ * Inputs:
+ * pEASData - pointer to overall EAS data structure
+ * streamHandle - file or stream handle
+ * cbFunc - pointer to host callback function
+ * metaDataBuffer - pointer to metadata buffer
+ * metaDataBufSize - maximum size of the metadata buffer
+ *
+ * Outputs:
+ *
+ *
+ * Side Effects:
+ *
+ *----------------------------------------------------------------------------
+*/
+EAS_PUBLIC EAS_RESULT EAS_RegisterMetaDataCallback (
+ EAS_DATA_HANDLE pEASData,
+ EAS_HANDLE streamHandle,
+ EAS_METADATA_CBFUNC cbFunc,
+ char *metaDataBuffer,
+ EAS_I32 metaDataBufSize,
+ EAS_VOID_PTR pUserData);
+
+/*----------------------------------------------------------------------------
+ * EAS_GetNoteCount ()
+ *----------------------------------------------------------------------------
+ * Returns the total number of notes played in this stream
+ *
+ * Inputs:
+ * pEASData - pointer to overall EAS data structure
+ * streamHandle - file or stream handle
+ * pNoteCount - pointer to variable to receive note count
+ *----------------------------------------------------------------------------
+*/
+EAS_PUBLIC EAS_RESULT EAS_GetNoteCount (EAS_DATA_HANDLE pEASData, EAS_HANDLE pStream, EAS_I32 *pNoteCount);
+
+/*----------------------------------------------------------------------------
+ * EAS_CloseFile()
+ *----------------------------------------------------------------------------
+ * Purpose:
+ * Closes an audio file or stream. Playback should have either paused or
+ * completed (EAS_State returns EAS_PAUSED or EAS_STOPPED).
+ *
+ * Inputs:
+ * pEASData - pointer to overall EAS data structure
+ * streamHandle - file or stream handle
+ *
+ * Outputs:
+ *
+ *
+ * Side Effects:
+ *
+ *----------------------------------------------------------------------------
+*/
+EAS_PUBLIC EAS_RESULT EAS_CloseFile (EAS_DATA_HANDLE pEASData, EAS_HANDLE streamHandle);
+
+/*----------------------------------------------------------------------------
+ * EAS_OpenMIDIStream()
+ *----------------------------------------------------------------------------
+ * Purpose:
+ * Opens a raw MIDI stream allowing the host to route MIDI cable data directly to the synthesizer
+ *
+ * Inputs:
+ * pEASData - pointer to overall EAS data structure
+ * pStreamHandle - pointer to variable to hold file or stream handle
+ * streamHandle - open stream or NULL for new synthesizer instance
+ *
+ * Outputs:
+ *
+ *
+ * Side Effects:
+ *
+ *----------------------------------------------------------------------------
+*/
+EAS_PUBLIC EAS_RESULT EAS_OpenMIDIStream (EAS_DATA_HANDLE pEASData, EAS_HANDLE *pStreamHandle, EAS_HANDLE streamHandle);
+
+/*----------------------------------------------------------------------------
+ * EAS_WriteMIDIStream()
+ *----------------------------------------------------------------------------
+ * Purpose:
+ * Send data to the MIDI stream device
+ *
+ * Inputs:
+ * pEASData - pointer to overall EAS data structure
+ * streamHandle - stream handle
+ * pBuffer - pointer to buffer
+ * count - number of bytes to write
+ *
+ * Outputs:
+ *
+ *
+ * Side Effects:
+ *
+ *----------------------------------------------------------------------------
+*/
+EAS_PUBLIC EAS_RESULT EAS_WriteMIDIStream(EAS_DATA_HANDLE pEASData, EAS_HANDLE streamHandle, EAS_U8 *pBuffer, EAS_I32 count);
+
+/*----------------------------------------------------------------------------
+ * EAS_CloseMIDIStream()
+ *----------------------------------------------------------------------------
+ * Purpose:
+ * Closes a raw MIDI stream
+ *
+ * Inputs:
+ * pEASData - pointer to overall EAS data structure
+ * streamHandle - stream handle
+ *
+ * Outputs:
+ *
+ *
+ * Side Effects:
+ *
+ *----------------------------------------------------------------------------
+*/
+EAS_PUBLIC EAS_RESULT EAS_CloseMIDIStream (EAS_DATA_HANDLE pEASData, EAS_HANDLE streamHandle);
+
+/*----------------------------------------------------------------------------
+ * EAS_Locate()
+ *----------------------------------------------------------------------------
+ * Purpose:
+ * Locate into the file associated with the handle.
+ *
+ * Inputs:
+ * pEASData - pointer to overall EAS data structure
+ * streamHandle - file handle
+ * milliseconds - playback offset from start of file in milliseconds
+ *
+ * Outputs:
+ *
+ *
+ * Side Effects:
+ * the actual offset will be quantized to the closest update period, typically
+ * a resolution of 5.9ms. Notes that are started prior to this time will not
+ * sound. Any notes currently playing will be shut off.
+ *
+ *----------------------------------------------------------------------------
+*/
+EAS_PUBLIC EAS_RESULT EAS_Locate (EAS_DATA_HANDLE pEASData, EAS_HANDLE streamHandle, EAS_I32 milliseconds, EAS_BOOL offset);
+
+/*----------------------------------------------------------------------------
+ * EAS_GetRenderTime()
+ *----------------------------------------------------------------------------
+ * Purpose:
+ * Returns the current playback offset
+ *
+ * Inputs:
+ * pEASData - pointer to overall EAS data structure
+ *
+ * Outputs:
+ * Gets the render time clock in msecs.
+ *
+ * Side Effects:
+ *
+ *----------------------------------------------------------------------------
+*/
+EAS_PUBLIC EAS_RESULT EAS_GetRenderTime (EAS_DATA_HANDLE pEASData, EAS_I32 *pTime);
+
+/*----------------------------------------------------------------------------
+ * EAS_GetLocation()
+ *----------------------------------------------------------------------------
+ * Purpose:
+ * Returns the current playback offset
+ *
+ * Inputs:
+ * pEASData - pointer to overall EAS data structure
+ * streamHandle - file handle
+ *
+ * Outputs:
+ * The offset in milliseconds from the start of the current sequence, quantized
+ * to the nearest update period. Actual resolution is typically 5.9 ms.
+ *
+ * Side Effects:
+ *
+ *----------------------------------------------------------------------------
+*/
+EAS_PUBLIC EAS_RESULT EAS_GetLocation (EAS_DATA_HANDLE pEASData, EAS_HANDLE streamHandle, EAS_I32 *pTime);
+
+/*----------------------------------------------------------------------------
+ * EAS_Pause()
+ *----------------------------------------------------------------------------
+ * Purpose:
+ * Pauses the playback of the data associated with this handle. The audio
+ * is gracefully ramped down to prevent clicks and pops. It may take several
+ * buffers of audio before the audio is muted.
+ *
+ * Inputs:
+ * psEASData - pointer to overall EAS data structure
+ * streamHandle - file or stream handle
+ *
+ * Outputs:
+ *
+ *
+ * Side Effects:
+ *
+ *
+ *----------------------------------------------------------------------------
+*/
+EAS_PUBLIC EAS_RESULT EAS_Pause (EAS_DATA_HANDLE pEASData, EAS_HANDLE streamHandle);
+
+/*----------------------------------------------------------------------------
+ * EAS_Resume()
+ *----------------------------------------------------------------------------
+ * Purpose:
+ * Resumes the playback of the data associated with this handle. The audio
+ * is gracefully ramped up to prevent clicks and pops.
+ *
+ * Inputs:
+ * psEASData - pointer to overall EAS data structure
+ * streamHandle - file or stream handle
+ *
+ * Outputs:
+ *
+ *
+ * Side Effects:
+ *
+ *
+ *----------------------------------------------------------------------------
+*/
+EAS_PUBLIC EAS_RESULT EAS_Resume (EAS_DATA_HANDLE pEASData, EAS_HANDLE streamHandle);
+
+/*----------------------------------------------------------------------------
+ * EAS_GetParameter()
+ *----------------------------------------------------------------------------
+ * Purpose:
+ * Set the parameter of a module. See E_MODULES for a list of modules
+ * and the header files of the modules for a list of parameters.
+ *
+ * Inputs:
+ * psEASData - pointer to overall EAS data structure
+ * module - enumerated module number
+ * param - enumerated parameter number
+ * pValue - pointer to variable to receive parameter value
+ *
+ * Outputs:
+ *
+ *
+ * Side Effects:
+ *
+ *
+ *----------------------------------------------------------------------------
+*/
+EAS_PUBLIC EAS_RESULT EAS_GetParameter (EAS_DATA_HANDLE pEASData, EAS_I32 module, EAS_I32 param, EAS_I32 *pValue);
+
+/*----------------------------------------------------------------------------
+ * EAS_SetParameter()
+ *----------------------------------------------------------------------------
+ * Purpose:
+ * Set the parameter of a module. See E_MODULES for a list of modules
+ * and the header files of the modules for a list of parameters.
+ *
+ * Inputs:
+ * psEASData - pointer to overall EAS data structure
+ * handle - file or stream handle
+ * module - enumerated module number
+ * param - enumerated parameter number
+ * value - new parameter value
+ *
+ * Outputs:
+ *
+ *
+ * Side Effects:
+ *
+ *
+ *----------------------------------------------------------------------------
+*/
+EAS_PUBLIC EAS_RESULT EAS_SetParameter (EAS_DATA_HANDLE pEASData, EAS_I32 module, EAS_I32 param, EAS_I32 value);
+
+#ifdef _METRICS_ENABLED
+/*----------------------------------------------------------------------------
+ * EAS_MetricsReport()
+ *----------------------------------------------------------------------------
+ * Purpose:
+ * Displays the current metrics through the EAS_Report interface.
+ *
+ * Inputs:
+ * pEASData - instance data handle
+ *
+ * Outputs:
+ *
+ *
+ * Side Effects:
+ *
+ *----------------------------------------------------------------------------
+*/
+EAS_PUBLIC EAS_RESULT EAS_MetricsReport (EAS_DATA_HANDLE pEASData);
+
+/*----------------------------------------------------------------------------
+ * EAS_MetricsReset()
+ *----------------------------------------------------------------------------
+ * Purpose:
+ * Displays the current metrics through the EAS_Report interface.
+ *
+ * Inputs:
+ * pEASData - instance data handle
+ *
+ * Outputs:
+ *
+ *
+ * Side Effects:
+ *
+ *----------------------------------------------------------------------------
+*/
+EAS_PUBLIC EAS_RESULT EAS_MetricsReset (EAS_DATA_HANDLE pEASData);
+#endif
+
+/*----------------------------------------------------------------------------
+ * EAS_SetSoundLibrary()
+ *----------------------------------------------------------------------------
+ * Purpose:
+ * Sets the location of the sound library.
+ *
+ * Inputs:
+ * pEASData - instance data handle
+ * streamHandle - file or stream handle
+ * pSoundLib - pointer to sound library
+ *
+ * Outputs:
+ *
+ *
+ * Side Effects:
+ *
+ *----------------------------------------------------------------------------
+*/
+EAS_PUBLIC EAS_RESULT EAS_SetSoundLibrary (EAS_DATA_HANDLE pEASData, EAS_HANDLE streamHandle, EAS_SNDLIB_HANDLE pSndLib);
+
+/*----------------------------------------------------------------------------
+ * EAS_SetHeaderSearchFlag()
+ *----------------------------------------------------------------------------
+ * By default, when EAS_OpenFile is called, the parsers check the
+ * first few bytes of the file looking for a specific header. Some
+ * mobile devices may add a header to the start of a file, which
+ * will prevent the parser from recognizing the file. If the
+ * searchFlag is set to EAS_TRUE, the parser will search the entire
+ * file looking for the header. This may enable EAS to recognize
+ * some files that it would ordinarily reject. The negative is that
+ * it make take slightly longer to process the EAS_OpenFile request.
+ *
+ * Inputs:
+ * pEASData - instance data handle
+ * searchFlag - search flag (EAS_TRUE or EAS_FALSE)
+ *----------------------------------------------------------------------------
+*/
+EAS_PUBLIC EAS_RESULT EAS_SetHeaderSearchFlag (EAS_DATA_HANDLE pEASData, EAS_BOOL searchFlag);
+
+/*----------------------------------------------------------------------------
+ * EAS_SetPlayMode()
+ *----------------------------------------------------------------------------
+ * Some file formats support special play modes, such as iMode partial
+ * play mode. This call can be used to change the play mode. The
+ * default play mode (usually straight playback) is always zero.
+ *
+ * Inputs:
+ * pEASData - instance data handle
+ * handle - file or stream handle
+ * playMode - play mode (see eas_types.h for enumerations)
+ *----------------------------------------------------------------------------
+*/
+EAS_PUBLIC EAS_RESULT EAS_SetPlayMode (EAS_DATA_HANDLE pEASData, EAS_HANDLE pStream, EAS_I32 playMode);
+
+#ifdef DLS_SYNTHESIZER
+/*----------------------------------------------------------------------------
+ * EAS_LoadDLSCollection()
+ *----------------------------------------------------------------------------
+ * Purpose:
+ * Downloads a DLS collection
+ *
+ * Inputs:
+ * pEASData - instance data handle
+ * streamHandle - file or stream handle
+ * locator - file locator
+ *
+ * Outputs:
+ *
+ *
+ * Side Effects:
+ * May overlay instruments in the GM sound set
+ *
+ *----------------------------------------------------------------------------
+*/
+EAS_PUBLIC EAS_RESULT EAS_LoadDLSCollection (EAS_DATA_HANDLE pEASData, EAS_HANDLE streamHandle, EAS_FILE_LOCATOR locator);
+#endif
+
+/*----------------------------------------------------------------------------
+ * EAS_SetFrameBuffer()
+ *----------------------------------------------------------------------------
+ * Purpose:
+ * Sets the frame buffer pointer passed to the IPC communications functions
+ *
+ * Inputs:
+ * pEASData - instance data handle
+ * locator - file locator
+ *
+ * Outputs:
+ *
+ *
+ * Side Effects:
+ * May overlay instruments in the GM sound set
+ *
+ *----------------------------------------------------------------------------
+*/
+EAS_PUBLIC EAS_RESULT EAS_SetFrameBuffer (EAS_DATA_HANDLE pEASData, EAS_FRAME_BUFFER_HANDLE pFrameBuffer);
+
+#ifdef EXTERNAL_AUDIO
+/*----------------------------------------------------------------------------
+ * EAS_RegExtAudioCallback()
+ *----------------------------------------------------------------------------
+ * Purpose:
+ * Registers callback functions for audio events.
+ *
+ * Inputs:
+ * pEASData - pointer to overall EAS data structure
+ * streamHandle - file or stream handle
+ * cbProgChgFunc - pointer to host callback function for program change
+ * cbEventFunc - pointer to host callback functio for note events
+ *
+ * Outputs:
+ *
+ *
+ * Side Effects:
+ *
+ *----------------------------------------------------------------------------
+*/
+EAS_PUBLIC EAS_RESULT EAS_RegExtAudioCallback (EAS_DATA_HANDLE pEASData,
+ EAS_HANDLE streamHandle,
+ EAS_VOID_PTR pInstData,
+ EAS_EXT_PRG_CHG_FUNC cbProgChgFunc,
+ EAS_EXT_EVENT_FUNC cbEventFunc);
+
+/*----------------------------------------------------------------------------
+ * EAS_GetMIDIControllers()
+ *----------------------------------------------------------------------------
+ * Purpose:
+ * Returns the current state of MIDI controllers on the requested channel.
+ *
+ * Inputs:
+ * pEASData - pointer to overall EAS data structure
+ * streamHandle - file or stream handle
+ * pControl - pointer to structure to receive data
+ *
+ * Outputs:
+ *
+ *
+ * Side Effects:
+ *
+ *----------------------------------------------------------------------------
+*/
+EAS_PUBLIC EAS_RESULT EAS_GetMIDIControllers (EAS_DATA_HANDLE pEASData, EAS_HANDLE streamHandle, EAS_U8 channel, S_MIDI_CONTROLLERS *pControl);
+#endif
+
+/*----------------------------------------------------------------------------
+ * EAS_SearchFile
+ *----------------------------------------------------------------------------
+ * Search file for specific sequence starting at current file
+ * position. Returns offset to start of sequence.
+ *
+ * Inputs:
+ * pEASData - pointer to EAS persistent data object
+ * fileHandle - file handle
+ * searchString - pointer to search sequence
+ * len - length of search sequence
+ * pOffset - pointer to variable to store offset to sequence
+ *
+ * Returns EAS_EOF if end-of-file is reached
+ *----------------------------------------------------------------------------
+*/
+EAS_RESULT EAS_SearchFile (EAS_DATA_HANDLE pEASData, EAS_FILE_HANDLE fileHandle, const EAS_U8 *searchString, EAS_I32 len, EAS_I32 *pOffset);
+
+#ifdef __cplusplus
+} /* end extern "C" */
+#endif
+
+#endif /* #ifndef _EAS_H */
diff --git a/arm-fm-22k/host_src/eas_build.h b/arm-fm-22k/host_src/eas_build.h
index 64ccf5a..5b058e7 100644
--- a/arm-fm-22k/host_src/eas_build.h
+++ b/arm-fm-22k/host_src/eas_build.h
@@ -1,15 +1,15 @@
-/*----------------------------------------------------------------------------
- *
- * File:
- * host_src\eas_build.h
- *
- * Contents and purpose:
- * This file contains the build configuration for this
- * build. The buildGUIDStr is a GUID created during
- * the build process and is guaranteed to be unique
- * for each build.
- *
- * Copyright Sonic Network Inc. 2006
+/*----------------------------------------------------------------------------
+ *
+ * File:
+ * host_src\eas_build.h
+ *
+ * Contents and purpose:
+ * This file contains the build configuration for this
+ * build. The buildGUIDStr is a GUID created during
+ * the build process and is guaranteed to be unique
+ * for each build.
+ *
+ * Copyright Sonic Network Inc. 2006
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -22,15 +22,15 @@
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
- *
- * This file was autogenerated by buildid.exe
- *----------------------------------------------------------------------------
-*/
-
-#ifndef _GUID_53c2509edf8f42e3975a054126c0cc1b_
-#define _GUID_53c2509edf8f42e3975a054126c0cc1b_
-
-#define _BUILD_VERSION_ "53c2509e-df8f-42e3-975a-054126c0cc1b"
-#define _BUILD_TIME_ 0x4743b8c9
-
-#endif /* _GUID_53c2509edf8f42e3975a054126c0cc1b_ */
+ *
+ * This file was autogenerated by buildid.exe
+ *----------------------------------------------------------------------------
+*/
+
+#ifndef _GUID_53c2509edf8f42e3975a054126c0cc1b_
+#define _GUID_53c2509edf8f42e3975a054126c0cc1b_
+
+#define _BUILD_VERSION_ "53c2509e-df8f-42e3-975a-054126c0cc1b"
+#define _BUILD_TIME_ 0x4743b8c9
+
+#endif /* _GUID_53c2509edf8f42e3975a054126c0cc1b_ */
diff --git a/arm-fm-22k/host_src/eas_chorus.h b/arm-fm-22k/host_src/eas_chorus.h
index 0e9057f..998a828 100644
--- a/arm-fm-22k/host_src/eas_chorus.h
+++ b/arm-fm-22k/host_src/eas_chorus.h
@@ -1,13 +1,13 @@
-/*----------------------------------------------------------------------------
- *
- * File:
- * eas_chorus.h
- *
- * Contents and purpose:
- * Contains parameter enumerations for the Chorus effect
- *
- *
- * Copyright Sonic Network Inc. 2006
+/*----------------------------------------------------------------------------
+ *
+ * File:
+ * eas_chorus.h
+ *
+ * Contents and purpose:
+ * Contains parameter enumerations for the Chorus effect
+ *
+ *
+ * Copyright Sonic Network Inc. 2006
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -20,34 +20,34 @@
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
- *
- *----------------------------------------------------------------------------
- * Revision Control:
- * $Revision: 309 $
- * $Date: 2006-09-12 18:52:45 -0700 (Tue, 12 Sep 2006) $
- *----------------------------------------------------------------------------
-*/
-
-#ifndef EAS_CHORUS_H
-#define EAS_CHORUS_H
-
-/* enumerated parameter settings for Chorus effect */
-typedef enum
-{
- EAS_PARAM_CHORUS_BYPASS,
- EAS_PARAM_CHORUS_PRESET,
- EAS_PARAM_CHORUS_RATE,
- EAS_PARAM_CHORUS_DEPTH,
- EAS_PARAM_CHORUS_LEVEL
-} E_CHORUS_PARAMS;
-
-typedef enum
-{
- EAS_PARAM_CHORUS_PRESET1,
- EAS_PARAM_CHORUS_PRESET2,
- EAS_PARAM_CHORUS_PRESET3,
- EAS_PARAM_CHORUS_PRESET4
-} E_CHORUS_PRESETS;
-
-
+ *
+ *----------------------------------------------------------------------------
+ * Revision Control:
+ * $Revision: 309 $
+ * $Date: 2006-09-12 18:52:45 -0700 (Tue, 12 Sep 2006) $
+ *----------------------------------------------------------------------------
+*/
+
+#ifndef EAS_CHORUS_H
+#define EAS_CHORUS_H
+
+/* enumerated parameter settings for Chorus effect */
+typedef enum
+{
+ EAS_PARAM_CHORUS_BYPASS,
+ EAS_PARAM_CHORUS_PRESET,
+ EAS_PARAM_CHORUS_RATE,
+ EAS_PARAM_CHORUS_DEPTH,
+ EAS_PARAM_CHORUS_LEVEL
+} E_CHORUS_PARAMS;
+
+typedef enum
+{
+ EAS_PARAM_CHORUS_PRESET1,
+ EAS_PARAM_CHORUS_PRESET2,
+ EAS_PARAM_CHORUS_PRESET3,
+ EAS_PARAM_CHORUS_PRESET4
+} E_CHORUS_PRESETS;
+
+
#endif \ No newline at end of file
diff --git a/arm-fm-22k/host_src/eas_config.c b/arm-fm-22k/host_src/eas_config.c
index c45fbb7..0b92357 100644
--- a/arm-fm-22k/host_src/eas_config.c
+++ b/arm-fm-22k/host_src/eas_config.c
@@ -1,22 +1,22 @@
-/*----------------------------------------------------------------------------
- *
- * File:
- * eas_config.c
- *
- * Contents and purpose:
- * This file contains the Configuration Module interface (CM). The CM
- * is a module compiled external to the library that sets the configuration
- * for this build. It allows the library to find optional components and
- * links to static memory allocations (when used in a static configuration).
- *
- * DO NOT MODIFY THIS FILE!
- *
- * NOTE: This module is not intended to be modified by the customer. It
- * needs to be included in the build process with the correct configuration
- * defines (see the library documentation for information on how to configure
- * the library).
- *
- * Copyright Sonic Network Inc. 2004-2006
+/*----------------------------------------------------------------------------
+ *
+ * File:
+ * eas_config.c
+ *
+ * Contents and purpose:
+ * This file contains the Configuration Module interface (CM). The CM
+ * is a module compiled external to the library that sets the configuration
+ * for this build. It allows the library to find optional components and
+ * links to static memory allocations (when used in a static configuration).
+ *
+ * DO NOT MODIFY THIS FILE!
+ *
+ * NOTE: This module is not intended to be modified by the customer. It
+ * needs to be included in the build process with the correct configuration
+ * defines (see the library documentation for information on how to configure
+ * the library).
+ *
+ * Copyright Sonic Network Inc. 2004-2006
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -29,591 +29,591 @@
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
- *
- *----------------------------------------------------------------------------
- * Revision Control:
- * $Revision: 796 $
- * $Date: 2007-08-01 00:15:25 -0700 (Wed, 01 Aug 2007) $
- *----------------------------------------------------------------------------
-*/
-
-#include "eas.h"
-#include "eas_config.h"
-
-
-#ifdef _MFI_PARSER
-/*----------------------------------------------------------------------------
- * Vendor/Device ID for MFi Extensions
- *
- * Define the preprocessor symbols to establish the vendor ID and
- * device ID for the MFi PCM/ADPCM extensions.
- *----------------------------------------------------------------------------
-*/
-const EAS_U8 eas_MFIVendorIDMSB = (MFI_VENDOR_ID >> 8) & 0xff;
-const EAS_U8 eas_MFIVendorIDLSB = MFI_VENDOR_ID & 0xff;
-const EAS_U8 eas_MFIDeviceID = MFI_DEVICE_ID;
-#endif
-
-/*----------------------------------------------------------------------------
- *
- * parserModules
- *
- * This structure is used by the EAS library to locate file parsing
- * modules.
- *----------------------------------------------------------------------------
-*/
-
-/* define the external file parsers */
-extern EAS_VOID_PTR EAS_SMF_Parser;
-
-#ifdef _XMF_PARSER
-extern EAS_VOID_PTR EAS_XMF_Parser;
-#endif
-
-#ifdef _SMAF_PARSER
-extern EAS_VOID_PTR EAS_SMAF_Parser;
-#endif
-
-#ifdef _WAVE_PARSER
-extern EAS_VOID_PTR EAS_Wave_Parser;
-#endif
-
-#ifdef _OTA_PARSER
-extern EAS_VOID_PTR EAS_OTA_Parser;
-#endif
-
-#ifdef _IMELODY_PARSER
-extern EAS_VOID_PTR EAS_iMelody_Parser;
-#endif
-
-#ifdef _RTTTL_PARSER
-extern EAS_VOID_PTR EAS_RTTTL_Parser;
-#endif
-
-#if defined (_CMX_PARSER) || defined(_MFI_PARSER)
-extern EAS_VOID_PTR EAS_CMF_Parser;
-#endif
-
-/* initalize pointers to parser interfaces */
-/*lint -e{605} not pretty, but it works */
-EAS_VOID_PTR const parserModules[] =
-{
- &EAS_SMF_Parser,
-
-#ifdef _XMF_PARSER
- &EAS_XMF_Parser,
-#endif
-
-#ifdef _WAVE_PARSER
- &EAS_Wave_Parser,
-#endif
-
-#ifdef _SMAF_PARSER
- &EAS_SMAF_Parser,
-#endif
-
-#ifdef _OTA_PARSER
- &EAS_OTA_Parser,
-#endif
-
-#ifdef _IMELODY_PARSER
- &EAS_iMelody_Parser,
-#endif
-
-#ifdef _RTTTL_PARSER
- &EAS_RTTTL_Parser,
-#endif
-
-#if defined (_CMX_PARSER) || defined(_MFI_PARSER)
- &EAS_CMF_Parser
-#endif
-};
-#define NUM_PARSER_MODULES (sizeof(parserModules) / sizeof(EAS_VOID_PTR))
-
-/*----------------------------------------------------------------------------
- * Data Modules
- *----------------------------------------------------------------------------
-*/
-
-#ifdef _STATIC_MEMORY
-extern EAS_VOID_PTR eas_SMFData;
-extern EAS_VOID_PTR eas_Data;
-extern EAS_VOID_PTR eas_MixBuffer;
-extern EAS_VOID_PTR eas_Synth;
-extern EAS_VOID_PTR eas_MIDI;
-extern EAS_VOID_PTR eas_PCMData;
-extern EAS_VOID_PTR eas_MIDIData;
-
-#ifdef _XMF_PARSER
-extern EAS_VOID_PTR eas_XMFData;
-#endif
-
-#ifdef _SMAF_PARSER
-extern EAS_VOID_PTR eas_SMAFData;
-#endif
-
-#ifdef _OTA_PARSER
-extern EAS_VOID_PTR eas_OTAData;
-#endif
-
-#ifdef _IMELODY_PARSER
-extern EAS_VOID_PTR eas_iMelodyData;
-#endif
-
-#ifdef _RTTTL_PARSER
-extern EAS_VOID_PTR eas_RTTTLData;
-#endif
-
-#ifdef _WAVE_PARSER
-extern EAS_VOID_PTR eas_WaveData;
-#endif
-
-#if defined (_CMX_PARSER) || defined(_MFI_PARSER)
-extern EAS_VOID_PTR eas_CMFData;
-#endif
-#endif
-
-/*----------------------------------------------------------------------------
- *
- * Effects Modules
- *
- * These declarations are used by the EAS library to locate
- * effects modules.
- *----------------------------------------------------------------------------
-*/
-
-#ifdef _ENHANCER_ENABLED
-extern EAS_VOID_PTR EAS_Enhancer;
-#define EAS_ENHANCER_INTERFACE &EAS_Enhancer
-#ifdef _STATIC_MEMORY
-extern EAS_VOID_PTR eas_EnhancerData;
-#define EAS_ENHANCER_DATA &eas_EnhancerData
-#else
-#define EAS_ENHANCER_DATA NULL
-#endif
-#else
-#define EAS_ENHANCER_INTERFACE NULL
-#define EAS_ENHANCER_DATA NULL
-#endif
-
-#ifdef _COMPRESSOR_ENABLED
-extern EAS_VOID_PTR EAS_Compressor;
-#define EAS_COMPRESSOR_INTERFACE &EAS_Compressor
-#ifdef _STATIC_MEMORY
-extern EAS_VOID_PTR eas_CompressorData;
-#define EAS_COMPRESSOR_DATA &eas_CompressorData
-#else
-#define EAS_COMPRESSOR_DATA NULL
-#endif
-#else
-#define EAS_COMPRESSOR_INTERFACE NULL
-#define EAS_COMPRESSOR_DATA NULL
-#endif
-
-#ifdef _MAXIMIZER_ENABLED
-extern EAS_VOID_PTR EAS_Maximizer;
-#define EAS_MAXIMIZER_INTERFACE &EAS_Maximizer
-#ifdef _STATIC_MEMORY
-extern EAS_VOID_PTR eas_MaximizerData;
-#define EAS_MAXIMIZER_DATA &eas_MaximizerData
-#else
-#define EAS_MAXIMIZER_DATA NULL
-#endif
-#else
-#define EAS_MAXIMIZER_INTERFACE NULL
-#define EAS_MAXIMIZER_DATA NULL
-#endif
-
-
-#ifdef _REVERB_ENABLED
-extern EAS_VOID_PTR EAS_Reverb;
-#define EAS_REVERB_INTERFACE &EAS_Reverb
-#ifdef _STATIC_MEMORY
-extern EAS_VOID_PTR eas_ReverbData;
-#define EAS_REVERB_DATA &eas_ReverbData
-#else
-#define EAS_REVERB_DATA NULL
-#endif
-#else
-#define EAS_REVERB_INTERFACE NULL
-#define EAS_REVERB_DATA NULL
-#endif
-
-#ifdef _CHORUS_ENABLED
-extern EAS_VOID_PTR EAS_Chorus;
-#define EAS_CHORUS_INTERFACE &EAS_Chorus
-#ifdef _STATIC_MEMORY
-extern EAS_VOID_PTR eas_ChorusData;
-#define EAS_CHORUS_DATA &eas_ChorusData
-#else
-#define EAS_CHORUS_DATA NULL
-#endif
-#else
-#define EAS_CHORUS_INTERFACE NULL
-#define EAS_CHORUS_DATA NULL
-#endif
-
-#ifdef _WIDENER_ENABLED
-extern EAS_VOID_PTR EAS_Widener;
-#define EAS_WIDENER_INTERFACE &EAS_Widener
-#ifdef _STATIC_MEMORY
-extern EAS_VOID_PTR eas_WidenerData;
-#define EAS_WIDENER_DATA &eas_WidenerData
-#else
-#define EAS_WIDENER_DATA NULL
-#endif
-#else
-#define EAS_WIDENER_INTERFACE NULL
-#define EAS_WIDENER_DATA NULL
-#endif
-
-#ifdef _GRAPHIC_EQ_ENABLED
-extern EAS_VOID_PTR EAS_GraphicEQ;
-#define EAS_GRAPHIC_EQ_INTERFACE &EAS_GraphicEQ
-#ifdef _STATIC_MEMORY
-extern EAS_VOID_PTR eas_GraphicEQData;
-#define EAS_GRAPHIC_EQ_DATA &eas_GraphicEQData
-#else
-#define EAS_GRAPHIC_EQ_DATA NULL
-#endif
-#else
-#define EAS_GRAPHIC_EQ_INTERFACE NULL
-#define EAS_GRAPHIC_EQ_DATA NULL
-#endif
-
-#ifdef _WOW_ENABLED
-extern EAS_VOID_PTR EAS_Wow;
-#define EAS_WOW_INTERFACE &EAS_Wow
-#ifdef _STATIC_MEMORY
-#error "WOW module requires dynamic memory model"
-#else
-#define EAS_WOW_DATA NULL
-#endif
-#else
-#define EAS_WOW_INTERFACE NULL
-#define EAS_WOW_DATA NULL
-#endif
-
-#ifdef _TONECONTROLEQ_ENABLED
-extern EAS_VOID_PTR EAS_ToneControlEQ;
-#define EAS_TONECONTROLEQ_INTERFACE &EAS_ToneControlEQ
-#ifdef _STATIC_MEMORY
-extern EAS_VOID_PTR eas_ToneControlEQData;
-#define EAS_TONECONTROLEQ_DATA &eas_ToneControlEQData
-#else
-#define EAS_TONECONTROLEQ_DATA NULL
-#endif
-#else
-#define EAS_TONECONTROLEQ_INTERFACE NULL
-#define EAS_TONECONTROLEQ_DATA NULL
-#endif
-
-/*lint -e{605} not pretty, but it works */
-EAS_VOID_PTR const effectsModules[] =
-{
- EAS_ENHANCER_INTERFACE,
- EAS_COMPRESSOR_INTERFACE,
- EAS_REVERB_INTERFACE,
- EAS_CHORUS_INTERFACE,
- EAS_WIDENER_INTERFACE,
- EAS_GRAPHIC_EQ_INTERFACE,
- EAS_WOW_INTERFACE,
- EAS_MAXIMIZER_INTERFACE,
- EAS_TONECONTROLEQ_INTERFACE
-};
-
-EAS_VOID_PTR const effectsData[] =
-{
- EAS_ENHANCER_DATA,
- EAS_COMPRESSOR_DATA,
- EAS_REVERB_DATA,
- EAS_CHORUS_DATA,
- EAS_WIDENER_DATA,
- EAS_GRAPHIC_EQ_DATA,
- EAS_WOW_DATA,
- EAS_MAXIMIZER_DATA,
- EAS_TONECONTROLEQ_DATA
-};
-
-/*----------------------------------------------------------------------------
- *
- * Optional Modules
- *
- * These declarations are used by the EAS library to locate
- * effects modules.
- *----------------------------------------------------------------------------
-*/
-
-#ifdef _METRICS_ENABLED
-extern EAS_VOID_PTR EAS_Metrics;
-#define EAS_METRICS_INTERFACE &EAS_Metrics
-#ifdef _STATIC_MEMORY
-extern EAS_VOID_PTR eas_MetricsData;
-#define EAS_METRICS_DATA &eas_MetricsData
-#else
-#define EAS_METRICS_DATA NULL
-#endif
-#else
-#define EAS_METRICS_INTERFACE NULL
-#define EAS_METRICS_DATA NULL
-#endif
-
-#ifdef MMAPI_SUPPORT
-extern EAS_VOID_PTR EAS_TC_Parser;
-#define EAS_TONE_CONTROL_PARSER &EAS_TC_Parser
-#ifdef _STATIC_MEMORY
-extern EAS_VOID_PTR eas_TCData;
-#define EAS_TONE_CONTROL_DATA &eas_TCData
-#else
-#define EAS_TONE_CONTROL_DATA NULL
-#endif
-#else
-#define EAS_TONE_CONTROL_PARSER NULL
-#define EAS_TONE_CONTROL_DATA NULL
-#endif
-
-/*lint -e{605} not pretty, but it works */
-EAS_VOID_PTR const optionalModules[] =
-{
- EAS_TONE_CONTROL_PARSER,
- EAS_METRICS_INTERFACE
-};
-
-EAS_VOID_PTR const optionalData[] =
-{
- EAS_TONE_CONTROL_DATA,
- EAS_METRICS_DATA
-};
-
-/*----------------------------------------------------------------------------
- * EAS_CMStaticMemoryModel()
- *----------------------------------------------------------------------------
- * Purpose:
- * This function returns true if EAS has been configured for
- * a static memory model. There are some limitations in the
- * static memory model, see the documentation for more
- * information.
- *
- * Outputs:
- * returns EAS_TRUE if a module is found
- *----------------------------------------------------------------------------
-*/
-EAS_BOOL EAS_CMStaticMemoryModel (void)
-{
-#ifdef _STATIC_MEMORY
- return EAS_TRUE;
-#else
- return EAS_FALSE;
-#endif
-}
-
-/*----------------------------------------------------------------------------
- * EAS_CMEnumModules()
- *----------------------------------------------------------------------------
- * Purpose:
- * This function is used to find pointers to optional modules.
- *
- * Inputs:
- * module - module number
- *
- * Outputs:
- * returns a pointer to the module function table or NULL if no module
- *----------------------------------------------------------------------------
-*/
-EAS_VOID_PTR EAS_CMEnumModules (EAS_INT module)
-{
-
- if (module >= (EAS_INT) NUM_PARSER_MODULES)
- return NULL;
- return parserModules[module];
-}
-
-/*----------------------------------------------------------------------------
- * EAS_CMEnumData()
- *----------------------------------------------------------------------------
- * Purpose:
- * This function is used to find pointers to static memory allocations.
- *
- * Inputs:
- * dataModule - enumerated module number
- *
- * Outputs:
- * Returns handle to data or NULL if not found
- *----------------------------------------------------------------------------
-*/
-/*lint -esym(715, dataModule) used only when _STATIC_MEMORY is defined */
-EAS_VOID_PTR EAS_CMEnumData (EAS_INT dataModule)
-{
-
-#ifdef _STATIC_MEMORY
- switch (dataModule)
- {
-
- /* main instance data for synthesizer */
- case EAS_CM_EAS_DATA:
- return &eas_Data;
-
- /* mix buffer for mix engine */
- case EAS_CM_MIX_BUFFER:
- /*lint -e{545} lint doesn't like this because it sees the underlying type */
- return &eas_MixBuffer;
-
- /* instance data for synth */
- case EAS_CM_SYNTH_DATA:
- return &eas_Synth;
-
- /* instance data for MIDI parser */
- case EAS_CM_MIDI_DATA:
- return &eas_MIDI;
-
- /* instance data for SMF parser */
- case EAS_CM_SMF_DATA:
- return &eas_SMFData;
-
-#ifdef _XMF_PARSER
- /* instance data for XMF parser */
- case EAS_CM_XMF_DATA:
- return &eas_XMFData;
-#endif
-
-#ifdef _SMAF_PARSER
- /* instance data for SMAF parser */
- case EAS_CM_SMAF_DATA:
- return &eas_SMAFData;
-#endif
-
- /* instance data for the PCM engine */
- case EAS_CM_PCM_DATA:
- /*lint -e{545} lint doesn't like this because it sees the underlying type */
- return &eas_PCMData;
-
- case EAS_CM_MIDI_STREAM_DATA:
- return &eas_MIDIData;
-
-#ifdef _OTA_PARSER
- /* instance data for OTA parser */
- case EAS_CM_OTA_DATA:
- return &eas_OTAData;
-#endif
-
-#ifdef _IMELODY_PARSER
- /* instance data for iMelody parser */
- case EAS_CM_IMELODY_DATA:
- return &eas_iMelodyData;
-#endif
-
-#ifdef _RTTTL_PARSER
- /* instance data for RTTTL parser */
- case EAS_CM_RTTTL_DATA:
- return &eas_RTTTLData;
-#endif
-
-#ifdef _WAVE_PARSER
- /* instance data for WAVE parser */
- case EAS_CM_WAVE_DATA:
- return &eas_WaveData;
-#endif
-
-#if defined (_CMX_PARSER) || defined(_MFI_PARSER)
- /* instance data for CMF parser */
- case EAS_CM_CMF_DATA:
- return &eas_CMFData;
-#endif
-
- default:
- return NULL;
- }
-
-#else
- return NULL;
-#endif
-}
-
-/*----------------------------------------------------------------------------
- * EAS_CMEnumFXModules()
- *----------------------------------------------------------------------------
- * Purpose:
- * This function is used to find pointers to optional effects modules.
- *
- * Inputs:
- * module - enumerated module number
- * pModule - pointer to module interface
- *
- * Outputs:
- * Returns pointer to function table or NULL if not found
- *----------------------------------------------------------------------------
-*/
-EAS_VOID_PTR EAS_CMEnumFXModules (EAS_INT module)
-{
-
- if (module >= NUM_EFFECTS_MODULES)
- return NULL;
- return effectsModules[module];
-}
-
-/*----------------------------------------------------------------------------
- * EAS_CMEnumFXData()
- *----------------------------------------------------------------------------
- * Purpose:
- * This function is used to find pointers to static memory allocations.
- *
- * Inputs:
- * dataModule - enumerated module number
- * pData - pointer to handle variable
- *
- * Outputs:
- * Returns handle to data or NULL if not found
- *----------------------------------------------------------------------------
-*/
-EAS_VOID_PTR EAS_CMEnumFXData (EAS_INT dataModule)
-{
-
- if (dataModule >= NUM_EFFECTS_MODULES)
- return NULL;
- return effectsData[dataModule];
-}
-
-/*----------------------------------------------------------------------------
- * EAS_CMEnumOptModules()
- *----------------------------------------------------------------------------
- * Purpose:
- * This function is used to find pointers to optional modules.
- *
- * Inputs:
- * module - enumerated module number
- *
- * Outputs:
- * returns pointer to function table or NULL if no module
- *----------------------------------------------------------------------------
-*/
-EAS_VOID_PTR EAS_CMEnumOptModules (EAS_INT module)
-{
-
- /* sanity check */
- if (module >= NUM_OPTIONAL_MODULES)
- return EAS_FALSE;
- return optionalModules[module];
-}
-
-/*----------------------------------------------------------------------------
- * EAS_CMEnumOptData()
- *----------------------------------------------------------------------------
- * Purpose:
- * This function is used to find pointers to static memory allocations.
- *
- * Inputs:
- * dataModule - enumerated module number
- *
- * Outputs:
- * Returns handle to data or NULL if not found
- *----------------------------------------------------------------------------
-*/
-EAS_VOID_PTR EAS_CMEnumOptData (EAS_INT dataModule)
-{
-
- if (dataModule >= NUM_OPTIONAL_MODULES)
- return NULL;
- return optionalData[dataModule];
-}
-
-
+ *
+ *----------------------------------------------------------------------------
+ * Revision Control:
+ * $Revision: 796 $
+ * $Date: 2007-08-01 00:15:25 -0700 (Wed, 01 Aug 2007) $
+ *----------------------------------------------------------------------------
+*/
+
+#include "eas.h"
+#include "eas_config.h"
+
+
+#ifdef _MFI_PARSER
+/*----------------------------------------------------------------------------
+ * Vendor/Device ID for MFi Extensions
+ *
+ * Define the preprocessor symbols to establish the vendor ID and
+ * device ID for the MFi PCM/ADPCM extensions.
+ *----------------------------------------------------------------------------
+*/
+const EAS_U8 eas_MFIVendorIDMSB = (MFI_VENDOR_ID >> 8) & 0xff;
+const EAS_U8 eas_MFIVendorIDLSB = MFI_VENDOR_ID & 0xff;
+const EAS_U8 eas_MFIDeviceID = MFI_DEVICE_ID;
+#endif
+
+/*----------------------------------------------------------------------------
+ *
+ * parserModules
+ *
+ * This structure is used by the EAS library to locate file parsing
+ * modules.
+ *----------------------------------------------------------------------------
+*/
+
+/* define the external file parsers */
+extern EAS_VOID_PTR EAS_SMF_Parser;
+
+#ifdef _XMF_PARSER
+extern EAS_VOID_PTR EAS_XMF_Parser;
+#endif
+
+#ifdef _SMAF_PARSER
+extern EAS_VOID_PTR EAS_SMAF_Parser;
+#endif
+
+#ifdef _WAVE_PARSER
+extern EAS_VOID_PTR EAS_Wave_Parser;
+#endif
+
+#ifdef _OTA_PARSER
+extern EAS_VOID_PTR EAS_OTA_Parser;
+#endif
+
+#ifdef _IMELODY_PARSER
+extern EAS_VOID_PTR EAS_iMelody_Parser;
+#endif
+
+#ifdef _RTTTL_PARSER
+extern EAS_VOID_PTR EAS_RTTTL_Parser;
+#endif
+
+#if defined (_CMX_PARSER) || defined(_MFI_PARSER)
+extern EAS_VOID_PTR EAS_CMF_Parser;
+#endif
+
+/* initalize pointers to parser interfaces */
+/*lint -e{605} not pretty, but it works */
+EAS_VOID_PTR const parserModules[] =
+{
+ &EAS_SMF_Parser,
+
+#ifdef _XMF_PARSER
+ &EAS_XMF_Parser,
+#endif
+
+#ifdef _WAVE_PARSER
+ &EAS_Wave_Parser,
+#endif
+
+#ifdef _SMAF_PARSER
+ &EAS_SMAF_Parser,
+#endif
+
+#ifdef _OTA_PARSER
+ &EAS_OTA_Parser,
+#endif
+
+#ifdef _IMELODY_PARSER
+ &EAS_iMelody_Parser,
+#endif
+
+#ifdef _RTTTL_PARSER
+ &EAS_RTTTL_Parser,
+#endif
+
+#if defined (_CMX_PARSER) || defined(_MFI_PARSER)
+ &EAS_CMF_Parser
+#endif
+};
+#define NUM_PARSER_MODULES (sizeof(parserModules) / sizeof(EAS_VOID_PTR))
+
+/*----------------------------------------------------------------------------
+ * Data Modules
+ *----------------------------------------------------------------------------
+*/
+
+#ifdef _STATIC_MEMORY
+extern EAS_VOID_PTR eas_SMFData;
+extern EAS_VOID_PTR eas_Data;
+extern EAS_VOID_PTR eas_MixBuffer;
+extern EAS_VOID_PTR eas_Synth;
+extern EAS_VOID_PTR eas_MIDI;
+extern EAS_VOID_PTR eas_PCMData;
+extern EAS_VOID_PTR eas_MIDIData;
+
+#ifdef _XMF_PARSER
+extern EAS_VOID_PTR eas_XMFData;
+#endif
+
+#ifdef _SMAF_PARSER
+extern EAS_VOID_PTR eas_SMAFData;
+#endif
+
+#ifdef _OTA_PARSER
+extern EAS_VOID_PTR eas_OTAData;
+#endif
+
+#ifdef _IMELODY_PARSER
+extern EAS_VOID_PTR eas_iMelodyData;
+#endif
+
+#ifdef _RTTTL_PARSER
+extern EAS_VOID_PTR eas_RTTTLData;
+#endif
+
+#ifdef _WAVE_PARSER
+extern EAS_VOID_PTR eas_WaveData;
+#endif
+
+#if defined (_CMX_PARSER) || defined(_MFI_PARSER)
+extern EAS_VOID_PTR eas_CMFData;
+#endif
+#endif
+
+/*----------------------------------------------------------------------------
+ *
+ * Effects Modules
+ *
+ * These declarations are used by the EAS library to locate
+ * effects modules.
+ *----------------------------------------------------------------------------
+*/
+
+#ifdef _ENHANCER_ENABLED
+extern EAS_VOID_PTR EAS_Enhancer;
+#define EAS_ENHANCER_INTERFACE &EAS_Enhancer
+#ifdef _STATIC_MEMORY
+extern EAS_VOID_PTR eas_EnhancerData;
+#define EAS_ENHANCER_DATA &eas_EnhancerData
+#else
+#define EAS_ENHANCER_DATA NULL
+#endif
+#else
+#define EAS_ENHANCER_INTERFACE NULL
+#define EAS_ENHANCER_DATA NULL
+#endif
+
+#ifdef _COMPRESSOR_ENABLED
+extern EAS_VOID_PTR EAS_Compressor;
+#define EAS_COMPRESSOR_INTERFACE &EAS_Compressor
+#ifdef _STATIC_MEMORY
+extern EAS_VOID_PTR eas_CompressorData;
+#define EAS_COMPRESSOR_DATA &eas_CompressorData
+#else
+#define EAS_COMPRESSOR_DATA NULL
+#endif
+#else
+#define EAS_COMPRESSOR_INTERFACE NULL
+#define EAS_COMPRESSOR_DATA NULL
+#endif
+
+#ifdef _MAXIMIZER_ENABLED
+extern EAS_VOID_PTR EAS_Maximizer;
+#define EAS_MAXIMIZER_INTERFACE &EAS_Maximizer
+#ifdef _STATIC_MEMORY
+extern EAS_VOID_PTR eas_MaximizerData;
+#define EAS_MAXIMIZER_DATA &eas_MaximizerData
+#else
+#define EAS_MAXIMIZER_DATA NULL
+#endif
+#else
+#define EAS_MAXIMIZER_INTERFACE NULL
+#define EAS_MAXIMIZER_DATA NULL
+#endif
+
+
+#ifdef _REVERB_ENABLED
+extern EAS_VOID_PTR EAS_Reverb;
+#define EAS_REVERB_INTERFACE &EAS_Reverb
+#ifdef _STATIC_MEMORY
+extern EAS_VOID_PTR eas_ReverbData;
+#define EAS_REVERB_DATA &eas_ReverbData
+#else
+#define EAS_REVERB_DATA NULL
+#endif
+#else
+#define EAS_REVERB_INTERFACE NULL
+#define EAS_REVERB_DATA NULL
+#endif
+
+#ifdef _CHORUS_ENABLED
+extern EAS_VOID_PTR EAS_Chorus;
+#define EAS_CHORUS_INTERFACE &EAS_Chorus
+#ifdef _STATIC_MEMORY
+extern EAS_VOID_PTR eas_ChorusData;
+#define EAS_CHORUS_DATA &eas_ChorusData
+#else
+#define EAS_CHORUS_DATA NULL
+#endif
+#else
+#define EAS_CHORUS_INTERFACE NULL
+#define EAS_CHORUS_DATA NULL
+#endif
+
+#ifdef _WIDENER_ENABLED
+extern EAS_VOID_PTR EAS_Widener;
+#define EAS_WIDENER_INTERFACE &EAS_Widener
+#ifdef _STATIC_MEMORY
+extern EAS_VOID_PTR eas_WidenerData;
+#define EAS_WIDENER_DATA &eas_WidenerData
+#else
+#define EAS_WIDENER_DATA NULL
+#endif
+#else
+#define EAS_WIDENER_INTERFACE NULL
+#define EAS_WIDENER_DATA NULL
+#endif
+
+#ifdef _GRAPHIC_EQ_ENABLED
+extern EAS_VOID_PTR EAS_GraphicEQ;
+#define EAS_GRAPHIC_EQ_INTERFACE &EAS_GraphicEQ
+#ifdef _STATIC_MEMORY
+extern EAS_VOID_PTR eas_GraphicEQData;
+#define EAS_GRAPHIC_EQ_DATA &eas_GraphicEQData
+#else
+#define EAS_GRAPHIC_EQ_DATA NULL
+#endif
+#else
+#define EAS_GRAPHIC_EQ_INTERFACE NULL
+#define EAS_GRAPHIC_EQ_DATA NULL
+#endif
+
+#ifdef _WOW_ENABLED
+extern EAS_VOID_PTR EAS_Wow;
+#define EAS_WOW_INTERFACE &EAS_Wow
+#ifdef _STATIC_MEMORY
+#error "WOW module requires dynamic memory model"
+#else
+#define EAS_WOW_DATA NULL
+#endif
+#else
+#define EAS_WOW_INTERFACE NULL
+#define EAS_WOW_DATA NULL
+#endif
+
+#ifdef _TONECONTROLEQ_ENABLED
+extern EAS_VOID_PTR EAS_ToneControlEQ;
+#define EAS_TONECONTROLEQ_INTERFACE &EAS_ToneControlEQ
+#ifdef _STATIC_MEMORY
+extern EAS_VOID_PTR eas_ToneControlEQData;
+#define EAS_TONECONTROLEQ_DATA &eas_ToneControlEQData
+#else
+#define EAS_TONECONTROLEQ_DATA NULL
+#endif
+#else
+#define EAS_TONECONTROLEQ_INTERFACE NULL
+#define EAS_TONECONTROLEQ_DATA NULL
+#endif
+
+/*lint -e{605} not pretty, but it works */
+EAS_VOID_PTR const effectsModules[] =
+{
+ EAS_ENHANCER_INTERFACE,
+ EAS_COMPRESSOR_INTERFACE,
+ EAS_REVERB_INTERFACE,
+ EAS_CHORUS_INTERFACE,
+ EAS_WIDENER_INTERFACE,
+ EAS_GRAPHIC_EQ_INTERFACE,
+ EAS_WOW_INTERFACE,
+ EAS_MAXIMIZER_INTERFACE,
+ EAS_TONECONTROLEQ_INTERFACE
+};
+
+EAS_VOID_PTR const effectsData[] =
+{
+ EAS_ENHANCER_DATA,
+ EAS_COMPRESSOR_DATA,
+ EAS_REVERB_DATA,
+ EAS_CHORUS_DATA,
+ EAS_WIDENER_DATA,
+ EAS_GRAPHIC_EQ_DATA,
+ EAS_WOW_DATA,
+ EAS_MAXIMIZER_DATA,
+ EAS_TONECONTROLEQ_DATA
+};
+
+/*----------------------------------------------------------------------------
+ *
+ * Optional Modules
+ *
+ * These declarations are used by the EAS library to locate
+ * effects modules.
+ *----------------------------------------------------------------------------
+*/
+
+#ifdef _METRICS_ENABLED
+extern EAS_VOID_PTR EAS_Metrics;
+#define EAS_METRICS_INTERFACE &EAS_Metrics
+#ifdef _STATIC_MEMORY
+extern EAS_VOID_PTR eas_MetricsData;
+#define EAS_METRICS_DATA &eas_MetricsData
+#else
+#define EAS_METRICS_DATA NULL
+#endif
+#else
+#define EAS_METRICS_INTERFACE NULL
+#define EAS_METRICS_DATA NULL
+#endif
+
+#ifdef MMAPI_SUPPORT
+extern EAS_VOID_PTR EAS_TC_Parser;
+#define EAS_TONE_CONTROL_PARSER &EAS_TC_Parser
+#ifdef _STATIC_MEMORY
+extern EAS_VOID_PTR eas_TCData;
+#define EAS_TONE_CONTROL_DATA &eas_TCData
+#else
+#define EAS_TONE_CONTROL_DATA NULL
+#endif
+#else
+#define EAS_TONE_CONTROL_PARSER NULL
+#define EAS_TONE_CONTROL_DATA NULL
+#endif
+
+/*lint -e{605} not pretty, but it works */
+EAS_VOID_PTR const optionalModules[] =
+{
+ EAS_TONE_CONTROL_PARSER,
+ EAS_METRICS_INTERFACE
+};
+
+EAS_VOID_PTR const optionalData[] =
+{
+ EAS_TONE_CONTROL_DATA,
+ EAS_METRICS_DATA
+};
+
+/*----------------------------------------------------------------------------
+ * EAS_CMStaticMemoryModel()
+ *----------------------------------------------------------------------------
+ * Purpose:
+ * This function returns true if EAS has been configured for
+ * a static memory model. There are some limitations in the
+ * static memory model, see the documentation for more
+ * information.
+ *
+ * Outputs:
+ * returns EAS_TRUE if a module is found
+ *----------------------------------------------------------------------------
+*/
+EAS_BOOL EAS_CMStaticMemoryModel (void)
+{
+#ifdef _STATIC_MEMORY
+ return EAS_TRUE;
+#else
+ return EAS_FALSE;
+#endif
+}
+
+/*----------------------------------------------------------------------------
+ * EAS_CMEnumModules()
+ *----------------------------------------------------------------------------
+ * Purpose:
+ * This function is used to find pointers to optional modules.
+ *
+ * Inputs:
+ * module - module number
+ *
+ * Outputs:
+ * returns a pointer to the module function table or NULL if no module
+ *----------------------------------------------------------------------------
+*/
+EAS_VOID_PTR EAS_CMEnumModules (EAS_INT module)
+{
+
+ if (module >= (EAS_INT) NUM_PARSER_MODULES)
+ return NULL;
+ return parserModules[module];
+}
+
+/*----------------------------------------------------------------------------
+ * EAS_CMEnumData()
+ *----------------------------------------------------------------------------
+ * Purpose:
+ * This function is used to find pointers to static memory allocations.
+ *
+ * Inputs:
+ * dataModule - enumerated module number
+ *
+ * Outputs:
+ * Returns handle to data or NULL if not found
+ *----------------------------------------------------------------------------
+*/
+/*lint -esym(715, dataModule) used only when _STATIC_MEMORY is defined */
+EAS_VOID_PTR EAS_CMEnumData (EAS_INT dataModule)
+{
+
+#ifdef _STATIC_MEMORY
+ switch (dataModule)
+ {
+
+ /* main instance data for synthesizer */
+ case EAS_CM_EAS_DATA:
+ return &eas_Data;
+
+ /* mix buffer for mix engine */
+ case EAS_CM_MIX_BUFFER:
+ /*lint -e{545} lint doesn't like this because it sees the underlying type */
+ return &eas_MixBuffer;
+
+ /* instance data for synth */
+ case EAS_CM_SYNTH_DATA:
+ return &eas_Synth;
+
+ /* instance data for MIDI parser */
+ case EAS_CM_MIDI_DATA:
+ return &eas_MIDI;
+
+ /* instance data for SMF parser */
+ case EAS_CM_SMF_DATA:
+ return &eas_SMFData;
+
+#ifdef _XMF_PARSER
+ /* instance data for XMF parser */
+ case EAS_CM_XMF_DATA:
+ return &eas_XMFData;
+#endif
+
+#ifdef _SMAF_PARSER
+ /* instance data for SMAF parser */
+ case EAS_CM_SMAF_DATA:
+ return &eas_SMAFData;
+#endif
+
+ /* instance data for the PCM engine */
+ case EAS_CM_PCM_DATA:
+ /*lint -e{545} lint doesn't like this because it sees the underlying type */
+ return &eas_PCMData;
+
+ case EAS_CM_MIDI_STREAM_DATA:
+ return &eas_MIDIData;
+
+#ifdef _OTA_PARSER
+ /* instance data for OTA parser */
+ case EAS_CM_OTA_DATA:
+ return &eas_OTAData;
+#endif
+
+#ifdef _IMELODY_PARSER
+ /* instance data for iMelody parser */
+ case EAS_CM_IMELODY_DATA:
+ return &eas_iMelodyData;
+#endif
+
+#ifdef _RTTTL_PARSER
+ /* instance data for RTTTL parser */
+ case EAS_CM_RTTTL_DATA:
+ return &eas_RTTTLData;
+#endif
+
+#ifdef _WAVE_PARSER
+ /* instance data for WAVE parser */
+ case EAS_CM_WAVE_DATA:
+ return &eas_WaveData;
+#endif
+
+#if defined (_CMX_PARSER) || defined(_MFI_PARSER)
+ /* instance data for CMF parser */
+ case EAS_CM_CMF_DATA:
+ return &eas_CMFData;
+#endif
+
+ default:
+ return NULL;
+ }
+
+#else
+ return NULL;
+#endif
+}
+
+/*----------------------------------------------------------------------------
+ * EAS_CMEnumFXModules()
+ *----------------------------------------------------------------------------
+ * Purpose:
+ * This function is used to find pointers to optional effects modules.
+ *
+ * Inputs:
+ * module - enumerated module number
+ * pModule - pointer to module interface
+ *
+ * Outputs:
+ * Returns pointer to function table or NULL if not found
+ *----------------------------------------------------------------------------
+*/
+EAS_VOID_PTR EAS_CMEnumFXModules (EAS_INT module)
+{
+
+ if (module >= NUM_EFFECTS_MODULES)
+ return NULL;
+ return effectsModules[module];
+}
+
+/*----------------------------------------------------------------------------
+ * EAS_CMEnumFXData()
+ *----------------------------------------------------------------------------
+ * Purpose:
+ * This function is used to find pointers to static memory allocations.
+ *
+ * Inputs:
+ * dataModule - enumerated module number
+ * pData - pointer to handle variable
+ *
+ * Outputs:
+ * Returns handle to data or NULL if not found
+ *----------------------------------------------------------------------------
+*/
+EAS_VOID_PTR EAS_CMEnumFXData (EAS_INT dataModule)
+{
+
+ if (dataModule >= NUM_EFFECTS_MODULES)
+ return NULL;
+ return effectsData[dataModule];
+}
+
+/*----------------------------------------------------------------------------
+ * EAS_CMEnumOptModules()
+ *----------------------------------------------------------------------------
+ * Purpose:
+ * This function is used to find pointers to optional modules.
+ *
+ * Inputs:
+ * module - enumerated module number
+ *
+ * Outputs:
+ * returns pointer to function table or NULL if no module
+ *----------------------------------------------------------------------------
+*/
+EAS_VOID_PTR EAS_CMEnumOptModules (EAS_INT module)
+{
+
+ /* sanity check */
+ if (module >= NUM_OPTIONAL_MODULES)
+ return EAS_FALSE;
+ return optionalModules[module];
+}
+
+/*----------------------------------------------------------------------------
+ * EAS_CMEnumOptData()
+ *----------------------------------------------------------------------------
+ * Purpose:
+ * This function is used to find pointers to static memory allocations.
+ *
+ * Inputs:
+ * dataModule - enumerated module number
+ *
+ * Outputs:
+ * Returns handle to data or NULL if not found
+ *----------------------------------------------------------------------------
+*/
+EAS_VOID_PTR EAS_CMEnumOptData (EAS_INT dataModule)
+{
+
+ if (dataModule >= NUM_OPTIONAL_MODULES)
+ return NULL;
+ return optionalData[dataModule];
+}
+
+
diff --git a/arm-fm-22k/host_src/eas_config.h b/arm-fm-22k/host_src/eas_config.h
index d16be4a..49c2ef2 100644
--- a/arm-fm-22k/host_src/eas_config.h
+++ b/arm-fm-22k/host_src/eas_config.h
@@ -1,22 +1,22 @@
-/*----------------------------------------------------------------------------
- *
- * File:
- * eas_config.h
- *
- * Contents and purpose:
- * This header declares the Configuration Module interface (CM). The CM
- * is a module compiled external to the library that sets the configuration
- * for this build. It allows the library to find optional components and
- * links to static memory allocations (when used in a static configuration).
- *
- * NOTE: This module is not intended to be modified by the customer. It
- * needs to be included in the build process with the correct configuration
- * defines (see the library documentation for information on how to configure
- * the library).
- *
- * DO NOT MODIFY THIS FILE!
- *
- * Copyright 2005 Sonic Network Inc.
+/*----------------------------------------------------------------------------
+ *
+ * File:
+ * eas_config.h
+ *
+ * Contents and purpose:
+ * This header declares the Configuration Module interface (CM). The CM
+ * is a module compiled external to the library that sets the configuration
+ * for this build. It allows the library to find optional components and
+ * links to static memory allocations (when used in a static configuration).
+ *
+ * NOTE: This module is not intended to be modified by the customer. It
+ * needs to be included in the build process with the correct configuration
+ * defines (see the library documentation for information on how to configure
+ * the library).
+ *
+ * DO NOT MODIFY THIS FILE!
+ *
+ * Copyright 2005 Sonic Network Inc.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -29,163 +29,163 @@
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
- *
- *----------------------------------------------------------------------------
- * Revision Control:
- * $Revision: 82 $
- * $Date: 2006-07-10 11:45:19 -0700 (Mon, 10 Jul 2006) $
- *----------------------------------------------------------------------------
-*/
-
-// sentinel
-#ifndef _EAS_CONFIG_H
-#define _EAS_CONFIG_H
-
-#include "eas_types.h"
-
-/* list of enumerators for optional modules */
-typedef enum {
- EAS_CM_FILE_PARSERS = 1
-} E_CM_ENUM_MODULES;
-
-/* list of enumerators for module and memory pointers */
-typedef enum {
- EAS_CM_EAS_DATA = 1,
- EAS_CM_MIX_BUFFER,
- EAS_CM_SYNTH_DATA,
- EAS_CM_MIDI_DATA,
- EAS_CM_SMF_DATA,
- EAS_CM_XMF_DATA,
- EAS_CM_SMAF_DATA,
- EAS_CM_PCM_DATA,
- EAS_CM_MIDI_STREAM_DATA,
- EAS_CM_METRICS_DATA,
- EAS_CM_OTA_DATA,
- EAS_CM_IMELODY_DATA,
- EAS_CM_RTTTL_DATA,
- EAS_CM_WAVE_DATA,
- EAS_CM_CMF_DATA
-} E_CM_DATA_MODULES;
-
-typedef struct
-{
- int maxSMFStreams;
- void *pSMFData;
- void *pSMFStream;
-} S_EAS_SMF_PTRS;
-
-typedef struct
-{
- int maxSMAFStreams;
- void *pSMAFData;
- void *pSMAFStream;
-} S_EAS_SMAF_PTRS;
-
-/*----------------------------------------------------------------------------
- * EAS_CMStaticMemoryModel()
- *----------------------------------------------------------------------------
- * Purpose:
- * This function returns true if EAS has been configured for
- * a static memory model. There are some limitations in the
- * static memory model, see the documentation for more
- * information.
- *
- * Outputs:
- * returns EAS_TRUE if a module is found
- *----------------------------------------------------------------------------
-*/
-EAS_BOOL EAS_CMStaticMemoryModel (void);
-
-/*----------------------------------------------------------------------------
- * EAS_CMEnumModules()
- *----------------------------------------------------------------------------
- * Purpose:
- * This function is used to find pointers to optional modules.
- *
- * Inputs:
- * module - module number
- *
- * Outputs:
- * returns a pointer to the module function table or NULL if no module
- *----------------------------------------------------------------------------
-*/
-EAS_VOID_PTR EAS_CMEnumModules (EAS_INT module);
-
-/*----------------------------------------------------------------------------
- * EAS_CMEnumData()
- *----------------------------------------------------------------------------
- * Purpose:
- * This function is used to find pointers to static memory allocations.
- *
- * Inputs:
- * dataModule - enumerated module number
- *
- * Outputs:
- * Returns handle to data or NULL if not found
- *----------------------------------------------------------------------------
-*/
-EAS_VOID_PTR EAS_CMEnumData (EAS_INT dataModule);
-
-/*----------------------------------------------------------------------------
- * EAS_CMEnumFXModules()
- *----------------------------------------------------------------------------
- * Purpose:
- * This function is used to find pointers to optional effects modules.
- *
- * Inputs:
- * module - enumerated module number
- * pModule - pointer to module interface
- *
- * Outputs:
- * Returns pointer to function table or NULL if not found
- *----------------------------------------------------------------------------
-*/
-EAS_VOID_PTR EAS_CMEnumFXModules (EAS_INT module);
-
-/*----------------------------------------------------------------------------
- * EAS_CMEnumFXData()
- *----------------------------------------------------------------------------
- * Purpose:
- * This function is used to find pointers to static memory allocations.
- *
- * Inputs:
- * dataModule - enumerated module number
- * pData - pointer to handle variable
- *
- * Outputs:
- * Returns handle to data or NULL if not found
- *----------------------------------------------------------------------------
-*/
-EAS_VOID_PTR EAS_CMEnumFXData (EAS_INT dataModule);
-
-/*----------------------------------------------------------------------------
- * EAS_CMEnumOptModules()
- *----------------------------------------------------------------------------
- * Purpose:
- * This function is used to find pointers to optional modules.
- *
- * Inputs:
- * module - enumerated module number
- *
- * Outputs:
- * returns pointer to function table or NULL if no module
- *----------------------------------------------------------------------------
-*/
-EAS_VOID_PTR EAS_CMEnumOptModules (EAS_INT module);
-
-/*----------------------------------------------------------------------------
- * EAS_CMEnumOptData()
- *----------------------------------------------------------------------------
- * Purpose:
- * This function is used to find pointers to static memory allocations.
- *
- * Inputs:
- * dataModule - enumerated module number
- *
- * Outputs:
- * Returns handle to data or NULL if not found
- *----------------------------------------------------------------------------
-*/
-EAS_VOID_PTR EAS_CMEnumOptData (EAS_INT dataModule);
-
-#endif /* end _EAS_CONFIG_H */
+ *
+ *----------------------------------------------------------------------------
+ * Revision Control:
+ * $Revision: 82 $
+ * $Date: 2006-07-10 11:45:19 -0700 (Mon, 10 Jul 2006) $
+ *----------------------------------------------------------------------------
+*/
+
+// sentinel
+#ifndef _EAS_CONFIG_H
+#define _EAS_CONFIG_H
+
+#include "eas_types.h"
+
+/* list of enumerators for optional modules */
+typedef enum {
+ EAS_CM_FILE_PARSERS = 1
+} E_CM_ENUM_MODULES;
+
+/* list of enumerators for module and memory pointers */
+typedef enum {
+ EAS_CM_EAS_DATA = 1,
+ EAS_CM_MIX_BUFFER,
+ EAS_CM_SYNTH_DATA,
+ EAS_CM_MIDI_DATA,
+ EAS_CM_SMF_DATA,
+ EAS_CM_XMF_DATA,
+ EAS_CM_SMAF_DATA,
+ EAS_CM_PCM_DATA,
+ EAS_CM_MIDI_STREAM_DATA,
+ EAS_CM_METRICS_DATA,
+ EAS_CM_OTA_DATA,
+ EAS_CM_IMELODY_DATA,
+ EAS_CM_RTTTL_DATA,
+ EAS_CM_WAVE_DATA,
+ EAS_CM_CMF_DATA
+} E_CM_DATA_MODULES;
+
+typedef struct
+{
+ int maxSMFStreams;
+ void *pSMFData;
+ void *pSMFStream;
+} S_EAS_SMF_PTRS;
+
+typedef struct
+{
+ int maxSMAFStreams;
+ void *pSMAFData;
+ void *pSMAFStream;
+} S_EAS_SMAF_PTRS;
+
+/*----------------------------------------------------------------------------
+ * EAS_CMStaticMemoryModel()
+ *----------------------------------------------------------------------------
+ * Purpose:
+ * This function returns true if EAS has been configured for
+ * a static memory model. There are some limitations in the
+ * static memory model, see the documentation for more
+ * information.
+ *
+ * Outputs:
+ * returns EAS_TRUE if a module is found
+ *----------------------------------------------------------------------------
+*/
+EAS_BOOL EAS_CMStaticMemoryModel (void);
+
+/*----------------------------------------------------------------------------
+ * EAS_CMEnumModules()
+ *----------------------------------------------------------------------------
+ * Purpose:
+ * This function is used to find pointers to optional modules.
+ *
+ * Inputs:
+ * module - module number
+ *
+ * Outputs:
+ * returns a pointer to the module function table or NULL if no module
+ *----------------------------------------------------------------------------
+*/
+EAS_VOID_PTR EAS_CMEnumModules (EAS_INT module);
+
+/*----------------------------------------------------------------------------
+ * EAS_CMEnumData()
+ *----------------------------------------------------------------------------
+ * Purpose:
+ * This function is used to find pointers to static memory allocations.
+ *
+ * Inputs:
+ * dataModule - enumerated module number
+ *
+ * Outputs:
+ * Returns handle to data or NULL if not found
+ *----------------------------------------------------------------------------
+*/
+EAS_VOID_PTR EAS_CMEnumData (EAS_INT dataModule);
+
+/*----------------------------------------------------------------------------
+ * EAS_CMEnumFXModules()
+ *----------------------------------------------------------------------------
+ * Purpose:
+ * This function is used to find pointers to optional effects modules.
+ *
+ * Inputs:
+ * module - enumerated module number
+ * pModule - pointer to module interface
+ *
+ * Outputs:
+ * Returns pointer to function table or NULL if not found
+ *----------------------------------------------------------------------------
+*/
+EAS_VOID_PTR EAS_CMEnumFXModules (EAS_INT module);
+
+/*----------------------------------------------------------------------------
+ * EAS_CMEnumFXData()
+ *----------------------------------------------------------------------------
+ * Purpose:
+ * This function is used to find pointers to static memory allocations.
+ *
+ * Inputs:
+ * dataModule - enumerated module number
+ * pData - pointer to handle variable
+ *
+ * Outputs:
+ * Returns handle to data or NULL if not found
+ *----------------------------------------------------------------------------
+*/
+EAS_VOID_PTR EAS_CMEnumFXData (EAS_INT dataModule);
+
+/*----------------------------------------------------------------------------
+ * EAS_CMEnumOptModules()
+ *----------------------------------------------------------------------------
+ * Purpose:
+ * This function is used to find pointers to optional modules.
+ *
+ * Inputs:
+ * module - enumerated module number
+ *
+ * Outputs:
+ * returns pointer to function table or NULL if no module
+ *----------------------------------------------------------------------------
+*/
+EAS_VOID_PTR EAS_CMEnumOptModules (EAS_INT module);
+
+/*----------------------------------------------------------------------------
+ * EAS_CMEnumOptData()
+ *----------------------------------------------------------------------------
+ * Purpose:
+ * This function is used to find pointers to static memory allocations.
+ *
+ * Inputs:
+ * dataModule - enumerated module number
+ *
+ * Outputs:
+ * Returns handle to data or NULL if not found
+ *----------------------------------------------------------------------------
+*/
+EAS_VOID_PTR EAS_CMEnumOptData (EAS_INT dataModule);
+
+#endif /* end _EAS_CONFIG_H */
diff --git a/arm-fm-22k/host_src/eas_debugmsgs.h b/arm-fm-22k/host_src/eas_debugmsgs.h
index 436875b..de60259 100644
--- a/arm-fm-22k/host_src/eas_debugmsgs.h
+++ b/arm-fm-22k/host_src/eas_debugmsgs.h
@@ -1,43 +1,43 @@
-/* Auto-generated from source file: eas_chorusdata.c */
-/* Auto-generated from source file: eas_imelodydata.c */
-/* Auto-generated from source file: eas_mididata.c */
-/* Auto-generated from source file: eas_pan.c */
-/* Auto-generated from source file: eas_wavefiledata.c */
-/* Auto-generated from source file: eas_voicemgt.c */
-/* Auto-generated from source file: eas_ota.c */
-/* Auto-generated from source file: eas_mixbuf.c */
-/* Auto-generated from source file: eas_fmsndlib.c */
-/* Auto-generated from source file: eas_rtttl.c */
-/* Auto-generated from source file: eas_reverb.c */
-/* Auto-generated from source file: eas_fmsynth.c */
-/* Auto-generated from source file: eas_pcmdata.c */
-/* Auto-generated from source file: eas_chorus.c */
-/* Auto-generated from source file: eas_math.c */
-/* Auto-generated from source file: eas_fmengine.c */
-/* Auto-generated from source file: eas_smfdata.c */
-/* Auto-generated from source file: eas_fmtables.c */
-/* Auto-generated from source file: eas_imelody.c */
-/* Auto-generated from source file: eas_public.c */
-/* Auto-generated from source file: eas_rtttldata.c */
-/* Auto-generated from source file: eas_reverbdata.c */
-/* Auto-generated from source file: eas_imaadpcm.c */
-{ 0x2380b977, 0x00000006, "eas_imaadpcm.c[305]: IMADecoderLocate: Time=%d, samples=%d\n" },
-{ 0x2380b977, 0x00000007, "eas_imaadpcm.c[328]: IMADecoderLocate: Looped sample, numBlocks=%d, samplesPerLoop=%d, samplesInLastBlock=%d, samples=%d\n" },
-{ 0x2380b977, 0x00000008, "eas_imaadpcm.c[335]: IMADecoderLocate: Byte location in audio = %d\n" },
-{ 0x2380b977, 0x00000009, "eas_imaadpcm.c[345]: IMADecoderLocate: bytesLeft = %d\n" },
-/* Auto-generated from source file: eas_midi.c */
-/* Auto-generated from source file: eas_otadata.c */
-/* Auto-generated from source file: eas_ima_tables.c */
-/* Auto-generated from source file: eas_data.c */
-/* Auto-generated from source file: eas_pcm.c */
-/* Auto-generated from source file: eas_mixer.c */
-/* Auto-generated from source file: eas_wavefile.c */
-/* Auto-generated from source file: eas_smf.c */
-/* Auto-generated from source file: eas_wave.c */
-/* Auto-generated from source file: eas_hostmm.c */
-{ 0x1a54b6e8, 0x00000001, "eas_hostmm.c[586]: Vibrate state: %d\n" },
-{ 0x1a54b6e8, 0x00000002, "eas_hostmm.c[601]: LED state: %d\n" },
-{ 0x1a54b6e8, 0x00000003, "eas_hostmm.c[616]: Backlight state: %d\n" },
-/* Auto-generated from source file: eas_config.c */
-/* Auto-generated from source file: eas_main.c */
-{ 0xe624f4d9, 0x00000005, "eas_main.c[106]: Play length: %d.%03d (secs)\n" },
+/* Auto-generated from source file: eas_chorusdata.c */
+/* Auto-generated from source file: eas_imelodydata.c */
+/* Auto-generated from source file: eas_mididata.c */
+/* Auto-generated from source file: eas_pan.c */
+/* Auto-generated from source file: eas_wavefiledata.c */
+/* Auto-generated from source file: eas_voicemgt.c */
+/* Auto-generated from source file: eas_ota.c */
+/* Auto-generated from source file: eas_mixbuf.c */
+/* Auto-generated from source file: eas_fmsndlib.c */
+/* Auto-generated from source file: eas_rtttl.c */
+/* Auto-generated from source file: eas_reverb.c */
+/* Auto-generated from source file: eas_fmsynth.c */
+/* Auto-generated from source file: eas_pcmdata.c */
+/* Auto-generated from source file: eas_chorus.c */
+/* Auto-generated from source file: eas_math.c */
+/* Auto-generated from source file: eas_fmengine.c */
+/* Auto-generated from source file: eas_smfdata.c */
+/* Auto-generated from source file: eas_fmtables.c */
+/* Auto-generated from source file: eas_imelody.c */
+/* Auto-generated from source file: eas_public.c */
+/* Auto-generated from source file: eas_rtttldata.c */
+/* Auto-generated from source file: eas_reverbdata.c */
+/* Auto-generated from source file: eas_imaadpcm.c */
+{ 0x2380b977, 0x00000006, "eas_imaadpcm.c[305]: IMADecoderLocate: Time=%d, samples=%d\n" },
+{ 0x2380b977, 0x00000007, "eas_imaadpcm.c[328]: IMADecoderLocate: Looped sample, numBlocks=%d, samplesPerLoop=%d, samplesInLastBlock=%d, samples=%d\n" },
+{ 0x2380b977, 0x00000008, "eas_imaadpcm.c[335]: IMADecoderLocate: Byte location in audio = %d\n" },
+{ 0x2380b977, 0x00000009, "eas_imaadpcm.c[345]: IMADecoderLocate: bytesLeft = %d\n" },
+/* Auto-generated from source file: eas_midi.c */
+/* Auto-generated from source file: eas_otadata.c */
+/* Auto-generated from source file: eas_ima_tables.c */
+/* Auto-generated from source file: eas_data.c */
+/* Auto-generated from source file: eas_pcm.c */
+/* Auto-generated from source file: eas_mixer.c */
+/* Auto-generated from source file: eas_wavefile.c */
+/* Auto-generated from source file: eas_smf.c */
+/* Auto-generated from source file: eas_wave.c */
+/* Auto-generated from source file: eas_hostmm.c */
+{ 0x1a54b6e8, 0x00000001, "eas_hostmm.c[586]: Vibrate state: %d\n" },
+{ 0x1a54b6e8, 0x00000002, "eas_hostmm.c[601]: LED state: %d\n" },
+{ 0x1a54b6e8, 0x00000003, "eas_hostmm.c[616]: Backlight state: %d\n" },
+/* Auto-generated from source file: eas_config.c */
+/* Auto-generated from source file: eas_main.c */
+{ 0xe624f4d9, 0x00000005, "eas_main.c[106]: Play length: %d.%03d (secs)\n" },
diff --git a/arm-fm-22k/host_src/eas_host.h b/arm-fm-22k/host_src/eas_host.h
index 0db0e30..b356982 100644
--- a/arm-fm-22k/host_src/eas_host.h
+++ b/arm-fm-22k/host_src/eas_host.h
@@ -1,16 +1,16 @@
-/*----------------------------------------------------------------------------
- *
- * File:
- * eas_host.h
- *
- * Contents and purpose:
- * This header defines the host wrapper functions for stdio, stdlib, etc.
- * The host application must provide an abstraction layer for these functions
- * to support certain features, such as SMAF and SMF-1 conversion.
- *
- * DO NOT MODIFY THIS FILE!
- *
- * Copyright 2005 Sonic Network Inc.
+/*----------------------------------------------------------------------------
+ *
+ * File:
+ * eas_host.h
+ *
+ * Contents and purpose:
+ * This header defines the host wrapper functions for stdio, stdlib, etc.
+ * The host application must provide an abstraction layer for these functions
+ * to support certain features, such as SMAF and SMF-1 conversion.
+ *
+ * DO NOT MODIFY THIS FILE!
+ *
+ * Copyright 2005 Sonic Network Inc.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -23,61 +23,61 @@
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
- *
- *----------------------------------------------------------------------------
- * Revision Control:
- * $Revision: 82 $
- * $Date: 2006-07-10 11:45:19 -0700 (Mon, 10 Jul 2006) $
- *----------------------------------------------------------------------------
-*/
-
-// sentinel
-#ifndef _EAS_HOST_H
-#define _EAS_HOST_H
-
-#include "eas_types.h"
-
-/* for C++ linkage */
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-/* initialization and shutdown routines */
-extern EAS_RESULT EAS_HWInit(EAS_HW_DATA_HANDLE *hwInstData);
-extern EAS_RESULT EAS_HWShutdown(EAS_HW_DATA_HANDLE hwInstData);
-
-/* memory functions */
-extern void *EAS_HWMemSet(void *s, int c, EAS_I32 n);
-extern void *EAS_HWMemCpy(void *s1, const void *s2, EAS_I32 n);
-extern EAS_I32 EAS_HWMemCmp(const void *s1, const void *s2, EAS_I32 n);
-
-/* memory allocation */
-extern void *EAS_HWMalloc(EAS_HW_DATA_HANDLE hwInstData, EAS_I32 size);
-extern void EAS_HWFree(EAS_HW_DATA_HANDLE hwInstData, void *p);
-
-/* file I/O */
-extern EAS_RESULT EAS_HWOpenFile(EAS_HW_DATA_HANDLE hwInstData, EAS_FILE_LOCATOR locator, EAS_FILE_HANDLE *pFile, EAS_FILE_MODE mode);
-extern EAS_RESULT EAS_HWReadFile(EAS_HW_DATA_HANDLE hwInstData, EAS_FILE_HANDLE file, void *pBuffer, EAS_I32 n, EAS_I32 *pBytesRead);
-extern EAS_RESULT EAS_HWGetByte(EAS_HW_DATA_HANDLE hwInstData, EAS_FILE_HANDLE file, void *p);
-extern EAS_RESULT EAS_HWGetWord (EAS_HW_DATA_HANDLE hwInstData, EAS_FILE_HANDLE file, void *p, EAS_BOOL msbFirst);
-extern EAS_RESULT EAS_HWGetDWord (EAS_HW_DATA_HANDLE hwInstData, EAS_FILE_HANDLE file, void *p, EAS_BOOL msbFirst);
-extern EAS_RESULT EAS_HWFilePos (EAS_HW_DATA_HANDLE hwInstData, EAS_FILE_HANDLE file, EAS_I32 *pPosition);
-extern EAS_RESULT EAS_HWFileSeek (EAS_HW_DATA_HANDLE hwInstData, EAS_FILE_HANDLE file, EAS_I32 position);
-extern EAS_RESULT EAS_HWFileSeekOfs (EAS_HW_DATA_HANDLE hwInstData, EAS_FILE_HANDLE file, EAS_I32 position);
-extern EAS_RESULT EAS_HWFileLength (EAS_HW_DATA_HANDLE hwInstData, EAS_FILE_HANDLE file, EAS_I32 *pLength);
-extern EAS_RESULT EAS_HWDupHandle (EAS_HW_DATA_HANDLE hwInstData, EAS_FILE_HANDLE file, EAS_FILE_HANDLE* pFile);
-extern EAS_RESULT EAS_HWCloseFile (EAS_HW_DATA_HANDLE hwInstData, EAS_FILE_HANDLE file);
-
-/* vibrate, LED, and backlight functions */
-extern EAS_RESULT EAS_HWVibrate(EAS_HW_DATA_HANDLE hwInstData, EAS_BOOL state);
-extern EAS_RESULT EAS_HWLED(EAS_HW_DATA_HANDLE hwInstData, EAS_BOOL state);
-extern EAS_RESULT EAS_HWBackLight(EAS_HW_DATA_HANDLE hwInstData, EAS_BOOL state);
-
-#ifdef __cplusplus
-} /* end extern "C" */
-#endif
-
-
-/* host yield function */
-extern EAS_BOOL EAS_HWYield(EAS_HW_DATA_HANDLE hwInstData);
-#endif /* end _EAS_HOST_H */
+ *
+ *----------------------------------------------------------------------------
+ * Revision Control:
+ * $Revision: 82 $
+ * $Date: 2006-07-10 11:45:19 -0700 (Mon, 10 Jul 2006) $
+ *----------------------------------------------------------------------------
+*/
+
+// sentinel
+#ifndef _EAS_HOST_H
+#define _EAS_HOST_H
+
+#include "eas_types.h"
+
+/* for C++ linkage */
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+/* initialization and shutdown routines */
+extern EAS_RESULT EAS_HWInit(EAS_HW_DATA_HANDLE *hwInstData);
+extern EAS_RESULT EAS_HWShutdown(EAS_HW_DATA_HANDLE hwInstData);
+
+/* memory functions */
+extern void *EAS_HWMemSet(void *s, int c, EAS_I32 n);
+extern void *EAS_HWMemCpy(void *s1, const void *s2, EAS_I32 n);
+extern EAS_I32 EAS_HWMemCmp(const void *s1, const void *s2, EAS_I32 n);
+
+/* memory allocation */
+extern void *EAS_HWMalloc(EAS_HW_DATA_HANDLE hwInstData, EAS_I32 size);
+extern void EAS_HWFree(EAS_HW_DATA_HANDLE hwInstData, void *p);
+
+/* file I/O */
+extern EAS_RESULT EAS_HWOpenFile(EAS_HW_DATA_HANDLE hwInstData, EAS_FILE_LOCATOR locator, EAS_FILE_HANDLE *pFile, EAS_FILE_MODE mode);
+extern EAS_RESULT EAS_HWReadFile(EAS_HW_DATA_HANDLE hwInstData, EAS_FILE_HANDLE file, void *pBuffer, EAS_I32 n, EAS_I32 *pBytesRead);
+extern EAS_RESULT EAS_HWGetByte(EAS_HW_DATA_HANDLE hwInstData, EAS_FILE_HANDLE file, void *p);
+extern EAS_RESULT EAS_HWGetWord (EAS_HW_DATA_HANDLE hwInstData, EAS_FILE_HANDLE file, void *p, EAS_BOOL msbFirst);
+extern EAS_RESULT EAS_HWGetDWord (EAS_HW_DATA_HANDLE hwInstData, EAS_FILE_HANDLE file, void *p, EAS_BOOL msbFirst);
+extern EAS_RESULT EAS_HWFilePos (EAS_HW_DATA_HANDLE hwInstData, EAS_FILE_HANDLE file, EAS_I32 *pPosition);
+extern EAS_RESULT EAS_HWFileSeek (EAS_HW_DATA_HANDLE hwInstData, EAS_FILE_HANDLE file, EAS_I32 position);
+extern EAS_RESULT EAS_HWFileSeekOfs (EAS_HW_DATA_HANDLE hwInstData, EAS_FILE_HANDLE file, EAS_I32 position);
+extern EAS_RESULT EAS_HWFileLength (EAS_HW_DATA_HANDLE hwInstData, EAS_FILE_HANDLE file, EAS_I32 *pLength);
+extern EAS_RESULT EAS_HWDupHandle (EAS_HW_DATA_HANDLE hwInstData, EAS_FILE_HANDLE file, EAS_FILE_HANDLE* pFile);
+extern EAS_RESULT EAS_HWCloseFile (EAS_HW_DATA_HANDLE hwInstData, EAS_FILE_HANDLE file);
+
+/* vibrate, LED, and backlight functions */
+extern EAS_RESULT EAS_HWVibrate(EAS_HW_DATA_HANDLE hwInstData, EAS_BOOL state);
+extern EAS_RESULT EAS_HWLED(EAS_HW_DATA_HANDLE hwInstData, EAS_BOOL state);
+extern EAS_RESULT EAS_HWBackLight(EAS_HW_DATA_HANDLE hwInstData, EAS_BOOL state);
+
+#ifdef __cplusplus
+} /* end extern "C" */
+#endif
+
+
+/* host yield function */
+extern EAS_BOOL EAS_HWYield(EAS_HW_DATA_HANDLE hwInstData);
+#endif /* end _EAS_HOST_H */
diff --git a/arm-fm-22k/host_src/eas_hostmm.c b/arm-fm-22k/host_src/eas_hostmm.c
index 7e58838..df24cf2 100644
--- a/arm-fm-22k/host_src/eas_hostmm.c
+++ b/arm-fm-22k/host_src/eas_hostmm.c
@@ -1,33 +1,33 @@
-/*----------------------------------------------------------------------------
- *
- * File:
- * eas_hostmm.c
- *
- * Contents and purpose:
- * This file contains the host wrapper functions for stdio, stdlib, etc.
- * This is a sample version that maps the requested files to an
- * allocated memory block and uses in-memory pointers to replace
- * file system calls. The file locator (EAS_FILE_LOCATOR) handle passed
- * HWOpenFile is the same one that is passed to EAS_OpenFile. If your
- * system stores data in fixed locations (such as flash) instead of
- * using a file system, you can use the locator handle to point to
- * your memory. You will need a way of knowing the length of the
- * data stored at that location in order to respond correctly in the
- * HW_FileLength function.
- *
- * Modify this file to suit the needs of your particular system.
- *
- * EAS_MAX_FILE_HANDLES sets the maximum number of MIDI streams within
- * a MIDI type 1 file that can be played.
- *
- * EAS_HW_FILE is a structure to support the file I/O functions. It
- * comprises the base memory pointer, the file read pointer, and
- * the dup flag, which when sets, indicates that the file handle has
- * been duplicated. If your system uses in-memory resources, you
- * can eliminate the duplicate handle logic, and simply copy the
- * base memory pointer and file read pointer to the duplicate handle.
- *
- * Copyright 2005 Sonic Network Inc.
+/*----------------------------------------------------------------------------
+ *
+ * File:
+ * eas_hostmm.c
+ *
+ * Contents and purpose:
+ * This file contains the host wrapper functions for stdio, stdlib, etc.
+ * This is a sample version that maps the requested files to an
+ * allocated memory block and uses in-memory pointers to replace
+ * file system calls. The file locator (EAS_FILE_LOCATOR) handle passed
+ * HWOpenFile is the same one that is passed to EAS_OpenFile. If your
+ * system stores data in fixed locations (such as flash) instead of
+ * using a file system, you can use the locator handle to point to
+ * your memory. You will need a way of knowing the length of the
+ * data stored at that location in order to respond correctly in the
+ * HW_FileLength function.
+ *
+ * Modify this file to suit the needs of your particular system.
+ *
+ * EAS_MAX_FILE_HANDLES sets the maximum number of MIDI streams within
+ * a MIDI type 1 file that can be played.
+ *
+ * EAS_HW_FILE is a structure to support the file I/O functions. It
+ * comprises the base memory pointer, the file read pointer, and
+ * the dup flag, which when sets, indicates that the file handle has
+ * been duplicated. If your system uses in-memory resources, you
+ * can eliminate the duplicate handle logic, and simply copy the
+ * base memory pointer and file read pointer to the duplicate handle.
+ *
+ * Copyright 2005 Sonic Network Inc.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -40,621 +40,621 @@
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
- *
- *----------------------------------------------------------------------------
- * Revision Control:
- * $Revision: 795 $
- * $Date: 2007-08-01 00:14:45 -0700 (Wed, 01 Aug 2007) $
- *----------------------------------------------------------------------------
-*/
-
-#ifdef _lint
-#include "lint_stdlib.h"
-#else
-#include <stdio.h>
-#include <stdlib.h>
-#include <string.h>
-#endif
-
-#include "eas_host.h"
-
-/* Only for debugging LED, vibrate, and backlight functions */
-#include "eas_report.h"
-
-/* this module requires dynamic memory support */
-#ifdef _STATIC_MEMORY
-#error "eas_hostmm.c requires the dynamic memory model!\n"
-#endif
-
-#ifndef EAS_MAX_FILE_HANDLES
-#define EAS_MAX_FILE_HANDLES 32
-#endif
-
-/*
- * this structure and the related function are here
- * to support the ability to create duplicate handles
- * and buffering it in memory. If your system uses
- * in-memory resources, you can eliminate the calls
- * to malloc and free, the dup flag, and simply track
- * the file size and read position.
- */
-typedef struct eas_hw_file_tag
-{
- EAS_I32 fileSize;
- EAS_I32 filePos;
- EAS_BOOL dup;
- EAS_U8 *buffer;
-} EAS_HW_FILE;
-
-typedef struct eas_hw_inst_data_tag
-{
- EAS_HW_FILE files[EAS_MAX_FILE_HANDLES];
-} EAS_HW_INST_DATA;
-
-/*----------------------------------------------------------------------------
- * EAS_HWInit
- *
- * Initialize host wrapper interface
- *
- *----------------------------------------------------------------------------
-*/
-EAS_RESULT EAS_HWInit (EAS_HW_DATA_HANDLE *pHWInstData)
-{
-
- /* need to track file opens for duplicate handles */
- *pHWInstData = malloc(sizeof(EAS_HW_INST_DATA));
- if (!(*pHWInstData))
- return EAS_ERROR_MALLOC_FAILED;
-
- EAS_HWMemSet(*pHWInstData, 0, sizeof(EAS_HW_INST_DATA));
- return EAS_SUCCESS;
-}
-
-/*----------------------------------------------------------------------------
- * EAS_HWShutdown
- *
- * Shut down host wrapper interface
- *
- *----------------------------------------------------------------------------
-*/
-EAS_RESULT EAS_HWShutdown (EAS_HW_DATA_HANDLE hwInstData)
-{
-
- free(hwInstData);
- return EAS_SUCCESS;
-}
-
-/*----------------------------------------------------------------------------
- *
- * EAS_HWMalloc
- *
- * Allocates dynamic memory
- *
- *----------------------------------------------------------------------------
-*/
-/*lint -esym(715, hwInstData) hwInstData available for customer use */
-void *EAS_HWMalloc (EAS_HW_DATA_HANDLE hwInstData, EAS_I32 size)
-{
- return malloc((size_t) size);
-}
-
-/*----------------------------------------------------------------------------
- *
- * EAS_HWFree
- *
- * Frees dynamic memory
- *
- *----------------------------------------------------------------------------
-*/
-/*lint -esym(715, hwInstData) hwInstData available for customer use */
-void EAS_HWFree (EAS_HW_DATA_HANDLE hwInstData, void *p)
-{
- free(p);
-}
-
-/*----------------------------------------------------------------------------
- *
- * EAS_HWMemCpy
- *
- * Copy memory wrapper
- *
- *----------------------------------------------------------------------------
-*/
-void *EAS_HWMemCpy (void *dest, const void *src, EAS_I32 amount)
-{
- return memcpy(dest, src, (size_t) amount);
-}
-
-/*----------------------------------------------------------------------------
- *
- * EAS_HWMemSet
- *
- * Set memory wrapper
- *
- *----------------------------------------------------------------------------
-*/
-void *EAS_HWMemSet (void *dest, int val, EAS_I32 amount)
-{
- return memset(dest, val, (size_t) amount);
-}
-
-/*----------------------------------------------------------------------------
- *
- * EAS_HWMemCmp
- *
- * Compare memory wrapper
- *
- *----------------------------------------------------------------------------
-*/
-EAS_I32 EAS_HWMemCmp (const void *s1, const void *s2, EAS_I32 amount)
-{
- return (EAS_I32) memcmp(s1, s2, (size_t) amount);
-}
-
-/*----------------------------------------------------------------------------
- *
- * EAS_HWOpenFile
- *
- * Open a file for read or write
- *
- *----------------------------------------------------------------------------
-*/
-EAS_RESULT EAS_HWOpenFile (EAS_HW_DATA_HANDLE hwInstData, EAS_FILE_LOCATOR locator, EAS_FILE_HANDLE *pFile, EAS_FILE_MODE mode)
-{
- EAS_HW_FILE *file;
- FILE *ioFile;
- int i, temp;
-
- /* set return value to NULL */
- *pFile = NULL;
-
- /* only support read mode at this time */
- if (mode != EAS_FILE_READ)
- return EAS_ERROR_INVALID_FILE_MODE;
-
- /* find an empty entry in the file table */
- file = hwInstData->files;
- for (i = 0; i < EAS_MAX_FILE_HANDLES; i++)
- {
- /* is this slot being used? */
- if (file->buffer == NULL)
- {
- /* open the file */
- if ((ioFile = fopen(locator,"rb")) == NULL)
- return EAS_ERROR_FILE_OPEN_FAILED;
-
- /* determine the file size */
- if (fseek(ioFile, 0L, SEEK_END) != 0)
- return EAS_ERROR_FILE_LENGTH;
- if ((file->fileSize = ftell(ioFile)) == -1L)
- return EAS_ERROR_FILE_LENGTH;
- if (fseek(ioFile, 0L, SEEK_SET) != 0)
- return EAS_ERROR_FILE_LENGTH;
-
- /* allocate a buffer */
- file->buffer = EAS_HWMalloc(hwInstData, file->fileSize);
- if (file->buffer == NULL)
- {
- fclose(ioFile);
- return EAS_ERROR_MALLOC_FAILED;
- }
-
- /* read the file into memory */
- temp = (int) fread(file->buffer, (size_t) file->fileSize, 1, ioFile);
-
- /* close the file - don't need it any more */
- fclose(ioFile);
-
- /* check for error reading file */
- if (temp != 1)
- return EAS_ERROR_FILE_READ_FAILED;
-
- /* initialize some values */
- file->filePos = 0;
- file->dup = EAS_FALSE;
-
- *pFile = file;
- return EAS_SUCCESS;
- }
- file++;
- }
-
- /* too many open files */
- return EAS_ERROR_MAX_FILES_OPEN;
-}
-
-/*----------------------------------------------------------------------------
- *
- * EAS_HWReadFile
- *
- * Read data from a file
- *
- *----------------------------------------------------------------------------
-*/
-/*lint -esym(715, hwInstData) hwInstData available for customer use */
-EAS_RESULT EAS_HWReadFile (EAS_HW_DATA_HANDLE hwInstData, EAS_FILE_HANDLE file, void *pBuffer, EAS_I32 n, EAS_I32 *pBytesRead)
-{
- EAS_I32 count;
-
- /* make sure we have a valid handle */
- if (file->buffer == NULL)
- return EAS_ERROR_INVALID_HANDLE;
-
- /* calculate the bytes to read */
- count = file->fileSize - file->filePos;
- if (n < count)
- count = n;
-
- /* copy the data to the requested location, and advance the pointer */
- if (count)
- EAS_HWMemCpy(pBuffer, &file->buffer[file->filePos], count);
- file->filePos += count;
- *pBytesRead = count;
-
- /* were n bytes read? */
- if (count!= n)
- return EAS_EOF;
- return EAS_SUCCESS;
-}
-
-/*----------------------------------------------------------------------------
- *
- * EAS_HWGetByte
- *
- * Read a byte from a file
- *
- *----------------------------------------------------------------------------
-*/
-/*lint -esym(715, hwInstData) hwInstData available for customer use */
-EAS_RESULT EAS_HWGetByte (EAS_HW_DATA_HANDLE hwInstData, EAS_FILE_HANDLE file, void *p)
-{
-
- /* make sure we have a valid handle */
- if (file->buffer == NULL)
- return EAS_ERROR_INVALID_HANDLE;
-
- /* check for end of file */
- if (file->filePos >= file->fileSize)
- {
- *((EAS_U8*) p) = 0;
- return EAS_EOF;
- }
-
- /* get a character from the buffer */
- *((EAS_U8*) p) = file->buffer[file->filePos++];
- return EAS_SUCCESS;
-}
-
-/*----------------------------------------------------------------------------
- *
- * EAS_HWGetWord
- *
- * Returns the current location in the file
- *
- *----------------------------------------------------------------------------
-*/
-/*lint -esym(715, hwInstData) hwInstData available for customer use */
-EAS_RESULT EAS_HWGetWord (EAS_HW_DATA_HANDLE hwInstData, EAS_FILE_HANDLE file, void *p, EAS_BOOL msbFirst)
-{
- EAS_RESULT result;
- EAS_U8 c1, c2;
-
- /* read 2 bytes from the file */
- if ((result = EAS_HWGetByte(hwInstData, file, &c1)) != EAS_SUCCESS)
- return result;
- if ((result = EAS_HWGetByte(hwInstData, file, &c2)) != EAS_SUCCESS)
- return result;
-
- /* order them as requested */
- if (msbFirst)
- *((EAS_U16*) p) = ((EAS_U16) c1 << 8) | c2;
- else
- *((EAS_U16*) p) = ((EAS_U16) c2 << 8) | c1;
-
- return EAS_SUCCESS;
-}
-
-/*----------------------------------------------------------------------------
- *
- * EAS_HWGetDWord
- *
- * Returns the current location in the file
- *
- *----------------------------------------------------------------------------
-*/
-/*lint -esym(715, hwInstData) hwInstData available for customer use */
-EAS_RESULT EAS_HWGetDWord (EAS_HW_DATA_HANDLE hwInstData, EAS_FILE_HANDLE file, void *p, EAS_BOOL msbFirst)
-{
- EAS_RESULT result;
- EAS_U8 c1, c2,c3,c4;
-
- /* read 4 bytes from the file */
- if ((result = EAS_HWGetByte(hwInstData, file, &c1)) != EAS_SUCCESS)
- return result;
- if ((result = EAS_HWGetByte(hwInstData, file, &c2)) != EAS_SUCCESS)
- return result;
- if ((result = EAS_HWGetByte(hwInstData, file, &c3)) != EAS_SUCCESS)
- return result;
- if ((result = EAS_HWGetByte(hwInstData, file, &c4)) != EAS_SUCCESS)
- return result;
-
- /* order them as requested */
- if (msbFirst)
- *((EAS_U32*) p) = ((EAS_U32) c1 << 24) | ((EAS_U32) c2 << 16) | ((EAS_U32) c3 << 8) | c4;
- else
- *((EAS_U32*) p)= ((EAS_U32) c4 << 24) | ((EAS_U32) c3 << 16) | ((EAS_U32) c2 << 8) | c1;
-
- return EAS_SUCCESS;
-}
-
-/*----------------------------------------------------------------------------
- *
- * EAS_HWFilePos
- *
- * Returns the current location in the file
- *
- *----------------------------------------------------------------------------
-*/
-/*lint -esym(715, hwInstData) hwInstData available for customer use */
-EAS_RESULT EAS_HWFilePos (EAS_HW_DATA_HANDLE hwInstData, EAS_FILE_HANDLE file, EAS_I32 *pPosition)
-{
-
- /* make sure we have a valid handle */
- if (file->buffer == NULL)
- return EAS_ERROR_INVALID_HANDLE;
-
- *pPosition = file->filePos;
- return EAS_SUCCESS;
-} /* end EAS_HWFilePos */
-
-/*----------------------------------------------------------------------------
- *
- * EAS_HWFileSeek
- *
- * Seek to a specific location in the file
- *
- *----------------------------------------------------------------------------
-*/
-/*lint -esym(715, hwInstData) hwInstData available for customer use */
-EAS_RESULT EAS_HWFileSeek (EAS_HW_DATA_HANDLE hwInstData, EAS_FILE_HANDLE file, EAS_I32 position)
-{
-
- /* make sure we have a valid handle */
- if (file->buffer == NULL)
- return EAS_ERROR_INVALID_HANDLE;
-
- /* validate new position */
- if ((position < 0) || (position > file->fileSize))
- return EAS_ERROR_FILE_SEEK;
-
- /* save new position */
- file->filePos = position;
- return EAS_SUCCESS;
-}
-
-/*----------------------------------------------------------------------------
- *
- * EAS_HWFileSeekOfs
- *
- * Seek forward or back relative to the current position
- *
- *----------------------------------------------------------------------------
-*/
-/*lint -esym(715, hwInstData) hwInstData available for customer use */
-EAS_RESULT EAS_HWFileSeekOfs (EAS_HW_DATA_HANDLE hwInstData, EAS_FILE_HANDLE file, EAS_I32 position)
-{
-
- /* make sure we have a valid handle */
- if (file->buffer == NULL)
- return EAS_ERROR_INVALID_HANDLE;
-
- /* determine the file position */
- position += file->filePos;
- if ((position < 0) || (position > file->fileSize))
- return EAS_ERROR_FILE_SEEK;
-
- /* save new position */
- file->filePos = position;
- return EAS_SUCCESS;
-}
-
-/*----------------------------------------------------------------------------
- *
- * EAS_HWFileLength
- *
- * Return the file length
- *
- *----------------------------------------------------------------------------
-*/
-/*lint -esym(715, hwInstData) hwInstData available for customer use */
-EAS_RESULT EAS_HWFileLength (EAS_HW_DATA_HANDLE hwInstData, EAS_FILE_HANDLE file, EAS_I32 *pLength)
-{
-
- /* make sure we have a valid handle */
- if (file->buffer == NULL)
- return EAS_ERROR_INVALID_HANDLE;
-
- *pLength = file->fileSize;
- return EAS_SUCCESS;
-}
-
-/*----------------------------------------------------------------------------
- *
- * EAS_HWDupHandle
- *
- * Duplicate a file handle
- *
- *----------------------------------------------------------------------------
-*/
-EAS_RESULT EAS_HWDupHandle (EAS_HW_DATA_HANDLE hwInstData, EAS_FILE_HANDLE file, EAS_FILE_HANDLE *pDupFile)
-{
- EAS_HW_FILE *dupFile;
- int i;
-
- /* make sure we have a valid handle */
- if (file->buffer == NULL)
- return EAS_ERROR_INVALID_HANDLE;
-
- /* find an empty entry in the file table */
- dupFile = hwInstData->files;
- for (i = 0; i < EAS_MAX_FILE_HANDLES; i++)
- {
- /* is this slot being used? */
- if (dupFile->buffer == NULL)
- {
-
- /* copy info from the handle to be duplicated */
- dupFile->filePos = file->filePos;
- dupFile->fileSize = file->fileSize;
- dupFile->buffer = file->buffer;
-
- /* set the duplicate handle flag */
- dupFile->dup = file->dup = EAS_TRUE;
-
- *pDupFile = dupFile;
- return EAS_SUCCESS;
- }
- dupFile++;
- }
-
- /* too many open files */
- return EAS_ERROR_MAX_FILES_OPEN;
-}
-
-/*----------------------------------------------------------------------------
- *
- * EAS_HWClose
- *
- * Wrapper for fclose function
- *
- *----------------------------------------------------------------------------
-*/
-EAS_RESULT EAS_HWCloseFile (EAS_HW_DATA_HANDLE hwInstData, EAS_FILE_HANDLE file1)
-{
- EAS_HW_FILE *file2,*dupFile;
- int i;
-
-
- /* make sure we have a valid handle */
- if (file1->buffer == NULL)
- return EAS_ERROR_INVALID_HANDLE;
-
- /* check for duplicate handle */
- if (file1->dup)
- {
- dupFile = NULL;
- file2 = hwInstData->files;
- for (i = 0; i < EAS_MAX_FILE_HANDLES; i++)
- {
- /* check for duplicate */
- if ((file1 != file2) && (file2->buffer == file1->buffer))
- {
- /* is there more than one duplicate? */
- if (dupFile != NULL)
- {
- /* clear this entry and return */
- file1->buffer = NULL;
- return EAS_SUCCESS;
- }
-
- /* this is the first duplicate found */
- else
- dupFile = file2;
- }
- file2++;
- }
-
- /* there is only one duplicate, clear the dup flag */
- if (dupFile)
- dupFile->dup = EAS_FALSE;
- else
- /* if we get here, there's a serious problem */
- return EAS_ERROR_HANDLE_INTEGRITY;
-
- /* clear this entry and return */
- file1->buffer = NULL;
- return EAS_SUCCESS;
- }
-
- /* no duplicates -free the buffer */
- EAS_HWFree(hwInstData, file1->buffer);
-
- /* clear this entry and return */
- file1->buffer = NULL;
- return EAS_SUCCESS;
-}
-
-/*----------------------------------------------------------------------------
- *
- * EAS_HWVibrate
- *
- * Turn on/off vibrate function
- *
- *----------------------------------------------------------------------------
-*/
-/*lint -esym(715, hwInstData) hwInstData available for customer use */
-EAS_RESULT EAS_HWVibrate (EAS_HW_DATA_HANDLE hwInstData, EAS_BOOL state)
-{
- EAS_ReportEx(_EAS_SEVERITY_NOFILTER, 0x1a54b6e8, 0x00000001 , state);
- return EAS_SUCCESS;
-} /* end EAS_HWVibrate */
-
-/*----------------------------------------------------------------------------
- *
- * EAS_HWLED
- *
- * Turn on/off LED
- *
- *----------------------------------------------------------------------------
-*/
-/*lint -esym(715, hwInstData) hwInstData available for customer use */
-EAS_RESULT EAS_HWLED (EAS_HW_DATA_HANDLE hwInstData, EAS_BOOL state)
-{
- EAS_ReportEx(_EAS_SEVERITY_NOFILTER, 0x1a54b6e8, 0x00000002 , state);
- return EAS_SUCCESS;
-}
-
-/*----------------------------------------------------------------------------
- *
- * EAS_HWBackLight
- *
- * Turn on/off backlight
- *
- *----------------------------------------------------------------------------
-*/
-/*lint -esym(715, hwInstData) hwInstData available for customer use */
-EAS_RESULT EAS_HWBackLight (EAS_HW_DATA_HANDLE hwInstData, EAS_BOOL state)
-{
- EAS_ReportEx(_EAS_SEVERITY_NOFILTER, 0x1a54b6e8, 0x00000003 , state);
- return EAS_SUCCESS;
-}
-
-/*----------------------------------------------------------------------------
- *
- * EAS_HWYield
- *
- * This function is called periodically by the EAS library to give the
- * host an opportunity to allow other tasks to run. There are two ways to
- * use this call:
- *
- * If you have a multi-tasking OS, you can call the yield function in the
- * OS to allow other tasks to run. In this case, return EAS_FALSE to tell
- * the EAS library to continue processing when control returns from this
- * function.
- *
- * If tasks run in a single thread by sequential function calls (sometimes
- * call a "commutator loop"), return EAS_TRUE to cause the EAS Library to
- * return to the caller. Be sure to check the number of bytes rendered
- * before passing the audio buffer to the codec - it may not be filled.
- * The next call to EAS_Render will continue processing until the buffer
- * has been filled.
- *
- *----------------------------------------------------------------------------
-*/
-/*lint -esym(715, hwInstData) hwInstData available for customer use */
-EAS_BOOL EAS_HWYield (EAS_HW_DATA_HANDLE hwInstData)
-{
- /* put your code here */
- return EAS_FALSE;
-}
-
+ *
+ *----------------------------------------------------------------------------
+ * Revision Control:
+ * $Revision: 795 $
+ * $Date: 2007-08-01 00:14:45 -0700 (Wed, 01 Aug 2007) $
+ *----------------------------------------------------------------------------
+*/
+
+#ifdef _lint
+#include "lint_stdlib.h"
+#else
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+#endif
+
+#include "eas_host.h"
+
+/* Only for debugging LED, vibrate, and backlight functions */
+#include "eas_report.h"
+
+/* this module requires dynamic memory support */
+#ifdef _STATIC_MEMORY
+#error "eas_hostmm.c requires the dynamic memory model!\n"
+#endif
+
+#ifndef EAS_MAX_FILE_HANDLES
+#define EAS_MAX_FILE_HANDLES 32
+#endif
+
+/*
+ * this structure and the related function are here
+ * to support the ability to create duplicate handles
+ * and buffering it in memory. If your system uses
+ * in-memory resources, you can eliminate the calls
+ * to malloc and free, the dup flag, and simply track
+ * the file size and read position.
+ */
+typedef struct eas_hw_file_tag
+{
+ EAS_I32 fileSize;
+ EAS_I32 filePos;
+ EAS_BOOL dup;
+ EAS_U8 *buffer;
+} EAS_HW_FILE;
+
+typedef struct eas_hw_inst_data_tag
+{
+ EAS_HW_FILE files[EAS_MAX_FILE_HANDLES];
+} EAS_HW_INST_DATA;
+
+/*----------------------------------------------------------------------------
+ * EAS_HWInit
+ *
+ * Initialize host wrapper interface
+ *
+ *----------------------------------------------------------------------------
+*/
+EAS_RESULT EAS_HWInit (EAS_HW_DATA_HANDLE *pHWInstData)
+{
+
+ /* need to track file opens for duplicate handles */
+ *pHWInstData = malloc(sizeof(EAS_HW_INST_DATA));
+ if (!(*pHWInstData))
+ return EAS_ERROR_MALLOC_FAILED;
+
+ EAS_HWMemSet(*pHWInstData, 0, sizeof(EAS_HW_INST_DATA));
+ return EAS_SUCCESS;
+}
+
+/*----------------------------------------------------------------------------
+ * EAS_HWShutdown
+ *
+ * Shut down host wrapper interface
+ *
+ *----------------------------------------------------------------------------
+*/
+EAS_RESULT EAS_HWShutdown (EAS_HW_DATA_HANDLE hwInstData)
+{
+
+ free(hwInstData);
+ return EAS_SUCCESS;
+}
+
+/*----------------------------------------------------------------------------
+ *
+ * EAS_HWMalloc
+ *
+ * Allocates dynamic memory
+ *
+ *----------------------------------------------------------------------------
+*/
+/*lint -esym(715, hwInstData) hwInstData available for customer use */
+void *EAS_HWMalloc (EAS_HW_DATA_HANDLE hwInstData, EAS_I32 size)
+{
+ return malloc((size_t) size);
+}
+
+/*----------------------------------------------------------------------------
+ *
+ * EAS_HWFree
+ *
+ * Frees dynamic memory
+ *
+ *----------------------------------------------------------------------------
+*/
+/*lint -esym(715, hwInstData) hwInstData available for customer use */
+void EAS_HWFree (EAS_HW_DATA_HANDLE hwInstData, void *p)
+{
+ free(p);
+}
+
+/*----------------------------------------------------------------------------
+ *
+ * EAS_HWMemCpy
+ *
+ * Copy memory wrapper
+ *
+ *----------------------------------------------------------------------------
+*/
+void *EAS_HWMemCpy (void *dest, const void *src, EAS_I32 amount)
+{
+ return memcpy(dest, src, (size_t) amount);
+}
+
+/*----------------------------------------------------------------------------
+ *
+ * EAS_HWMemSet
+ *
+ * Set memory wrapper
+ *
+ *----------------------------------------------------------------------------
+*/
+void *EAS_HWMemSet (void *dest, int val, EAS_I32 amount)
+{
+ return memset(dest, val, (size_t) amount);
+}
+
+/*----------------------------------------------------------------------------
+ *
+ * EAS_HWMemCmp
+ *
+ * Compare memory wrapper
+ *
+ *----------------------------------------------------------------------------
+*/
+EAS_I32 EAS_HWMemCmp (const void *s1, const void *s2, EAS_I32 amount)
+{
+ return (EAS_I32) memcmp(s1, s2, (size_t) amount);
+}
+
+/*----------------------------------------------------------------------------
+ *
+ * EAS_HWOpenFile
+ *
+ * Open a file for read or write
+ *
+ *----------------------------------------------------------------------------
+*/
+EAS_RESULT EAS_HWOpenFile (EAS_HW_DATA_HANDLE hwInstData, EAS_FILE_LOCATOR locator, EAS_FILE_HANDLE *pFile, EAS_FILE_MODE mode)
+{
+ EAS_HW_FILE *file;
+ FILE *ioFile;
+ int i, temp;
+
+ /* set return value to NULL */
+ *pFile = NULL;
+
+ /* only support read mode at this time */
+ if (mode != EAS_FILE_READ)
+ return EAS_ERROR_INVALID_FILE_MODE;
+
+ /* find an empty entry in the file table */
+ file = hwInstData->files;
+ for (i = 0; i < EAS_MAX_FILE_HANDLES; i++)
+ {
+ /* is this slot being used? */
+ if (file->buffer == NULL)
+ {
+ /* open the file */
+ if ((ioFile = fopen(locator,"rb")) == NULL)
+ return EAS_ERROR_FILE_OPEN_FAILED;
+
+ /* determine the file size */
+ if (fseek(ioFile, 0L, SEEK_END) != 0)
+ return EAS_ERROR_FILE_LENGTH;
+ if ((file->fileSize = ftell(ioFile)) == -1L)
+ return EAS_ERROR_FILE_LENGTH;
+ if (fseek(ioFile, 0L, SEEK_SET) != 0)
+ return EAS_ERROR_FILE_LENGTH;
+
+ /* allocate a buffer */
+ file->buffer = EAS_HWMalloc(hwInstData, file->fileSize);
+ if (file->buffer == NULL)
+ {
+ fclose(ioFile);
+ return EAS_ERROR_MALLOC_FAILED;
+ }
+
+ /* read the file into memory */
+ temp = (int) fread(file->buffer, (size_t) file->fileSize, 1, ioFile);
+
+ /* close the file - don't need it any more */
+ fclose(ioFile);
+
+ /* check for error reading file */
+ if (temp != 1)
+ return EAS_ERROR_FILE_READ_FAILED;
+
+ /* initialize some values */
+ file->filePos = 0;
+ file->dup = EAS_FALSE;
+
+ *pFile = file;
+ return EAS_SUCCESS;
+ }
+ file++;
+ }
+
+ /* too many open files */
+ return EAS_ERROR_MAX_FILES_OPEN;
+}
+
+/*----------------------------------------------------------------------------
+ *
+ * EAS_HWReadFile
+ *
+ * Read data from a file
+ *
+ *----------------------------------------------------------------------------
+*/
+/*lint -esym(715, hwInstData) hwInstData available for customer use */
+EAS_RESULT EAS_HWReadFile (EAS_HW_DATA_HANDLE hwInstData, EAS_FILE_HANDLE file, void *pBuffer, EAS_I32 n, EAS_I32 *pBytesRead)
+{
+ EAS_I32 count;
+
+ /* make sure we have a valid handle */
+ if (file->buffer == NULL)
+ return EAS_ERROR_INVALID_HANDLE;
+
+ /* calculate the bytes to read */
+ count = file->fileSize - file->filePos;
+ if (n < count)
+ count = n;
+
+ /* copy the data to the requested location, and advance the pointer */
+ if (count)
+ EAS_HWMemCpy(pBuffer, &file->buffer[file->filePos], count);
+ file->filePos += count;
+ *pBytesRead = count;
+
+ /* were n bytes read? */
+ if (count!= n)
+ return EAS_EOF;
+ return EAS_SUCCESS;
+}
+
+/*----------------------------------------------------------------------------
+ *
+ * EAS_HWGetByte
+ *
+ * Read a byte from a file
+ *
+ *----------------------------------------------------------------------------
+*/
+/*lint -esym(715, hwInstData) hwInstData available for customer use */
+EAS_RESULT EAS_HWGetByte (EAS_HW_DATA_HANDLE hwInstData, EAS_FILE_HANDLE file, void *p)
+{
+
+ /* make sure we have a valid handle */
+ if (file->buffer == NULL)
+ return EAS_ERROR_INVALID_HANDLE;
+
+ /* check for end of file */
+ if (file->filePos >= file->fileSize)
+ {
+ *((EAS_U8*) p) = 0;
+ return EAS_EOF;
+ }
+
+ /* get a character from the buffer */
+ *((EAS_U8*) p) = file->buffer[file->filePos++];
+ return EAS_SUCCESS;
+}
+
+/*----------------------------------------------------------------------------
+ *
+ * EAS_HWGetWord
+ *
+ * Returns the current location in the file
+ *
+ *----------------------------------------------------------------------------
+*/
+/*lint -esym(715, hwInstData) hwInstData available for customer use */
+EAS_RESULT EAS_HWGetWord (EAS_HW_DATA_HANDLE hwInstData, EAS_FILE_HANDLE file, void *p, EAS_BOOL msbFirst)
+{
+ EAS_RESULT result;
+ EAS_U8 c1, c2;
+
+ /* read 2 bytes from the file */
+ if ((result = EAS_HWGetByte(hwInstData, file, &c1)) != EAS_SUCCESS)
+ return result;
+ if ((result = EAS_HWGetByte(hwInstData, file, &c2)) != EAS_SUCCESS)
+ return result;
+
+ /* order them as requested */
+ if (msbFirst)
+ *((EAS_U16*) p) = ((EAS_U16) c1 << 8) | c2;
+ else
+ *((EAS_U16*) p) = ((EAS_U16) c2 << 8) | c1;
+
+ return EAS_SUCCESS;
+}
+
+/*----------------------------------------------------------------------------
+ *
+ * EAS_HWGetDWord
+ *
+ * Returns the current location in the file
+ *
+ *----------------------------------------------------------------------------
+*/
+/*lint -esym(715, hwInstData) hwInstData available for customer use */
+EAS_RESULT EAS_HWGetDWord (EAS_HW_DATA_HANDLE hwInstData, EAS_FILE_HANDLE file, void *p, EAS_BOOL msbFirst)
+{
+ EAS_RESULT result;
+ EAS_U8 c1, c2,c3,c4;
+
+ /* read 4 bytes from the file */
+ if ((result = EAS_HWGetByte(hwInstData, file, &c1)) != EAS_SUCCESS)
+ return result;
+ if ((result = EAS_HWGetByte(hwInstData, file, &c2)) != EAS_SUCCESS)
+ return result;
+ if ((result = EAS_HWGetByte(hwInstData, file, &c3)) != EAS_SUCCESS)
+ return result;
+ if ((result = EAS_HWGetByte(hwInstData, file, &c4)) != EAS_SUCCESS)
+ return result;
+
+ /* order them as requested */
+ if (msbFirst)
+ *((EAS_U32*) p) = ((EAS_U32) c1 << 24) | ((EAS_U32) c2 << 16) | ((EAS_U32) c3 << 8) | c4;
+ else
+ *((EAS_U32*) p)= ((EAS_U32) c4 << 24) | ((EAS_U32) c3 << 16) | ((EAS_U32) c2 << 8) | c1;
+
+ return EAS_SUCCESS;
+}
+
+/*----------------------------------------------------------------------------
+ *
+ * EAS_HWFilePos
+ *
+ * Returns the current location in the file
+ *
+ *----------------------------------------------------------------------------
+*/
+/*lint -esym(715, hwInstData) hwInstData available for customer use */
+EAS_RESULT EAS_HWFilePos (EAS_HW_DATA_HANDLE hwInstData, EAS_FILE_HANDLE file, EAS_I32 *pPosition)
+{
+
+ /* make sure we have a valid handle */
+ if (file->buffer == NULL)
+ return EAS_ERROR_INVALID_HANDLE;
+
+ *pPosition = file->filePos;
+ return EAS_SUCCESS;
+} /* end EAS_HWFilePos */
+
+/*----------------------------------------------------------------------------
+ *
+ * EAS_HWFileSeek
+ *
+ * Seek to a specific location in the file
+ *
+ *----------------------------------------------------------------------------
+*/
+/*lint -esym(715, hwInstData) hwInstData available for customer use */
+EAS_RESULT EAS_HWFileSeek (EAS_HW_DATA_HANDLE hwInstData, EAS_FILE_HANDLE file, EAS_I32 position)
+{
+
+ /* make sure we have a valid handle */
+ if (file->buffer == NULL)
+ return EAS_ERROR_INVALID_HANDLE;
+
+ /* validate new position */
+ if ((position < 0) || (position > file->fileSize))
+ return EAS_ERROR_FILE_SEEK;
+
+ /* save new position */
+ file->filePos = position;
+ return EAS_SUCCESS;
+}
+
+/*----------------------------------------------------------------------------
+ *
+ * EAS_HWFileSeekOfs
+ *
+ * Seek forward or back relative to the current position
+ *
+ *----------------------------------------------------------------------------
+*/
+/*lint -esym(715, hwInstData) hwInstData available for customer use */
+EAS_RESULT EAS_HWFileSeekOfs (EAS_HW_DATA_HANDLE hwInstData, EAS_FILE_HANDLE file, EAS_I32 position)
+{
+
+ /* make sure we have a valid handle */
+ if (file->buffer == NULL)
+ return EAS_ERROR_INVALID_HANDLE;
+
+ /* determine the file position */
+ position += file->filePos;
+ if ((position < 0) || (position > file->fileSize))
+ return EAS_ERROR_FILE_SEEK;
+
+ /* save new position */
+ file->filePos = position;
+ return EAS_SUCCESS;
+}
+
+/*----------------------------------------------------------------------------
+ *
+ * EAS_HWFileLength
+ *
+ * Return the file length
+ *
+ *----------------------------------------------------------------------------
+*/
+/*lint -esym(715, hwInstData) hwInstData available for customer use */
+EAS_RESULT EAS_HWFileLength (EAS_HW_DATA_HANDLE hwInstData, EAS_FILE_HANDLE file, EAS_I32 *pLength)
+{
+
+ /* make sure we have a valid handle */
+ if (file->buffer == NULL)
+ return EAS_ERROR_INVALID_HANDLE;
+
+ *pLength = file->fileSize;
+ return EAS_SUCCESS;
+}
+
+/*----------------------------------------------------------------------------
+ *
+ * EAS_HWDupHandle
+ *
+ * Duplicate a file handle
+ *
+ *----------------------------------------------------------------------------
+*/
+EAS_RESULT EAS_HWDupHandle (EAS_HW_DATA_HANDLE hwInstData, EAS_FILE_HANDLE file, EAS_FILE_HANDLE *pDupFile)
+{
+ EAS_HW_FILE *dupFile;
+ int i;
+
+ /* make sure we have a valid handle */
+ if (file->buffer == NULL)
+ return EAS_ERROR_INVALID_HANDLE;
+
+ /* find an empty entry in the file table */
+ dupFile = hwInstData->files;
+ for (i = 0; i < EAS_MAX_FILE_HANDLES; i++)
+ {
+ /* is this slot being used? */
+ if (dupFile->buffer == NULL)
+ {
+
+ /* copy info from the handle to be duplicated */
+ dupFile->filePos = file->filePos;
+ dupFile->fileSize = file->fileSize;
+ dupFile->buffer = file->buffer;
+
+ /* set the duplicate handle flag */
+ dupFile->dup = file->dup = EAS_TRUE;
+
+ *pDupFile = dupFile;
+ return EAS_SUCCESS;
+ }
+ dupFile++;
+ }
+
+ /* too many open files */
+ return EAS_ERROR_MAX_FILES_OPEN;
+}
+
+/*----------------------------------------------------------------------------
+ *
+ * EAS_HWClose
+ *
+ * Wrapper for fclose function
+ *
+ *----------------------------------------------------------------------------
+*/
+EAS_RESULT EAS_HWCloseFile (EAS_HW_DATA_HANDLE hwInstData, EAS_FILE_HANDLE file1)
+{
+ EAS_HW_FILE *file2,*dupFile;
+ int i;
+
+
+ /* make sure we have a valid handle */
+ if (file1->buffer == NULL)
+ return EAS_ERROR_INVALID_HANDLE;
+
+ /* check for duplicate handle */
+ if (file1->dup)
+ {
+ dupFile = NULL;
+ file2 = hwInstData->files;
+ for (i = 0; i < EAS_MAX_FILE_HANDLES; i++)
+ {
+ /* check for duplicate */
+ if ((file1 != file2) && (file2->buffer == file1->buffer))
+ {
+ /* is there more than one duplicate? */
+ if (dupFile != NULL)
+ {
+ /* clear this entry and return */
+ file1->buffer = NULL;
+ return EAS_SUCCESS;
+ }
+
+ /* this is the first duplicate found */
+ else
+ dupFile = file2;
+ }
+ file2++;
+ }
+
+ /* there is only one duplicate, clear the dup flag */
+ if (dupFile)
+ dupFile->dup = EAS_FALSE;
+ else
+ /* if we get here, there's a serious problem */
+ return EAS_ERROR_HANDLE_INTEGRITY;
+
+ /* clear this entry and return */
+ file1->buffer = NULL;
+ return EAS_SUCCESS;
+ }
+
+ /* no duplicates -free the buffer */
+ EAS_HWFree(hwInstData, file1->buffer);
+
+ /* clear this entry and return */
+ file1->buffer = NULL;
+ return EAS_SUCCESS;
+}
+
+/*----------------------------------------------------------------------------
+ *
+ * EAS_HWVibrate
+ *
+ * Turn on/off vibrate function
+ *
+ *----------------------------------------------------------------------------
+*/
+/*lint -esym(715, hwInstData) hwInstData available for customer use */
+EAS_RESULT EAS_HWVibrate (EAS_HW_DATA_HANDLE hwInstData, EAS_BOOL state)
+{
+ EAS_ReportEx(_EAS_SEVERITY_NOFILTER, 0x1a54b6e8, 0x00000001 , state);
+ return EAS_SUCCESS;
+} /* end EAS_HWVibrate */
+
+/*----------------------------------------------------------------------------
+ *
+ * EAS_HWLED
+ *
+ * Turn on/off LED
+ *
+ *----------------------------------------------------------------------------
+*/
+/*lint -esym(715, hwInstData) hwInstData available for customer use */
+EAS_RESULT EAS_HWLED (EAS_HW_DATA_HANDLE hwInstData, EAS_BOOL state)
+{
+ EAS_ReportEx(_EAS_SEVERITY_NOFILTER, 0x1a54b6e8, 0x00000002 , state);
+ return EAS_SUCCESS;
+}
+
+/*----------------------------------------------------------------------------
+ *
+ * EAS_HWBackLight
+ *
+ * Turn on/off backlight
+ *
+ *----------------------------------------------------------------------------
+*/
+/*lint -esym(715, hwInstData) hwInstData available for customer use */
+EAS_RESULT EAS_HWBackLight (EAS_HW_DATA_HANDLE hwInstData, EAS_BOOL state)
+{
+ EAS_ReportEx(_EAS_SEVERITY_NOFILTER, 0x1a54b6e8, 0x00000003 , state);
+ return EAS_SUCCESS;
+}
+
+/*----------------------------------------------------------------------------
+ *
+ * EAS_HWYield
+ *
+ * This function is called periodically by the EAS library to give the
+ * host an opportunity to allow other tasks to run. There are two ways to
+ * use this call:
+ *
+ * If you have a multi-tasking OS, you can call the yield function in the
+ * OS to allow other tasks to run. In this case, return EAS_FALSE to tell
+ * the EAS library to continue processing when control returns from this
+ * function.
+ *
+ * If tasks run in a single thread by sequential function calls (sometimes
+ * call a "commutator loop"), return EAS_TRUE to cause the EAS Library to
+ * return to the caller. Be sure to check the number of bytes rendered
+ * before passing the audio buffer to the codec - it may not be filled.
+ * The next call to EAS_Render will continue processing until the buffer
+ * has been filled.
+ *
+ *----------------------------------------------------------------------------
+*/
+/*lint -esym(715, hwInstData) hwInstData available for customer use */
+EAS_BOOL EAS_HWYield (EAS_HW_DATA_HANDLE hwInstData)
+{
+ /* put your code here */
+ return EAS_FALSE;
+}
+
diff --git a/arm-fm-22k/host_src/eas_main.c b/arm-fm-22k/host_src/eas_main.c
index 809a132..6ebb13e 100644
--- a/arm-fm-22k/host_src/eas_main.c
+++ b/arm-fm-22k/host_src/eas_main.c
@@ -1,13 +1,13 @@
-/*----------------------------------------------------------------------------
- *
- * File:
- * eas_main.c
- *
- * Contents and purpose:
- * The entry point and high-level functions for the EAS Synthesizer test
- * harness.
- *
- * Copyright Sonic Network Inc. 2004
+/*----------------------------------------------------------------------------
+ *
+ * File:
+ * eas_main.c
+ *
+ * Contents and purpose:
+ * The entry point and high-level functions for the EAS Synthesizer test
+ * harness.
+ *
+ * Copyright Sonic Network Inc. 2004
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -20,442 +20,442 @@
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
- *
- *----------------------------------------------------------------------------
- * Revision Control:
- * $Revision: 775 $
- * $Date: 2007-07-20 10:11:11 -0700 (Fri, 20 Jul 2007) $
- *----------------------------------------------------------------------------
-*/
-
-#ifdef _lint
-#include "lint_stdlib.h"
-#else
-#include <stdio.h>
-#include <string.h>
-#include <stdlib.h>
-#include <time.h>
-#endif
-
-#include "eas.h"
-#include "eas_wave.h"
-#include "eas_report.h"
-
-/* determines how many EAS buffers to fill a host buffer */
-#define NUM_BUFFERS 8
-
-/* default file to play if no filename is specified on the command line */
-static const char defaultTestFile[] = "test.mid";
-
-EAS_I32 polyphony;
-
-/* prototypes for helper functions */
-static void StrCopy(char *dest, const char *src, EAS_I32 size);
-static EAS_BOOL ChangeFileExt(char *str, const char *ext, EAS_I32 size);
-static EAS_RESULT PlayFile (EAS_DATA_HANDLE easData, const char* filename, const char* outputFile, const S_EAS_LIB_CONFIG *pLibConfig, void *buffer, EAS_I32 bufferSize);
-static EAS_BOOL EASLibraryCheck (const S_EAS_LIB_CONFIG *pLibConfig);
-
-/* main is defined after playfile to avoid the need for two passes through lint */
-
-/*----------------------------------------------------------------------------
- * PlayFile()
- *----------------------------------------------------------------------------
- * Purpose:
- * This function plays the file requested by filename
- *
- * Inputs:
- *
- * Outputs:
- *
- *----------------------------------------------------------------------------
-*/
-
-static EAS_RESULT PlayFile (EAS_DATA_HANDLE easData, const char* filename, const char* outputFile, const S_EAS_LIB_CONFIG *pLibConfig, void *buffer, EAS_I32 bufferSize)
-{
- EAS_HANDLE handle;
- EAS_RESULT result, reportResult;
- EAS_I32 count;
- EAS_STATE state;
- EAS_I32 playTime;
- char waveFilename[256];
- WAVE_FILE *wFile;
- EAS_INT i;
- EAS_PCM *p;
-
- /* determine the name of the output file */
- wFile = NULL;
- if (outputFile == NULL)
- {
- StrCopy(waveFilename, filename, sizeof(waveFilename));
- if (!ChangeFileExt(waveFilename, "wav", sizeof(waveFilename)))
- {
- { /* dpp: EAS_ReportEx(_EAS_SEVERITY_ERROR, "Error in output filename %s\n", waveFilename); */ }
- return EAS_FAILURE;
- }
- outputFile = waveFilename;
- }
-
- /* call EAS library to open file */
- if ((reportResult = EAS_OpenFile(easData, filename, &handle)) != EAS_SUCCESS)
- {
- { /* dpp: EAS_ReportEx(_EAS_SEVERITY_ERROR, "EAS_OpenFile returned %ld\n", reportResult); */ }
- return reportResult;
- }
-
- /* prepare to play the file */
- if ((result = EAS_Prepare(easData, handle)) != EAS_SUCCESS)
- {
- { /* dpp: EAS_ReportEx(_EAS_SEVERITY_ERROR, "EAS_Prepare returned %ld\n", result); */ }
- reportResult = result;
- }
-
- /* get play length */
- if ((result = EAS_ParseMetaData(easData, handle, &playTime)) != EAS_SUCCESS)
- {
- { /* dpp: EAS_ReportEx(_EAS_SEVERITY_ERROR, "EAS_ParseMetaData returned %ld\n", result); */ }
- return result;
- }
- EAS_ReportEx(_EAS_SEVERITY_NOFILTER, 0xe624f4d9, 0x00000005 , playTime / 1000, playTime % 1000);
-
- if (reportResult == EAS_SUCCESS)
- {
- /* create the output file */
- wFile = WaveFileCreate(outputFile, pLibConfig->numChannels, pLibConfig->sampleRate, sizeof(EAS_PCM) * 8);
- if (!wFile)
- {
- { /* dpp: EAS_ReportEx(_EAS_SEVERITY_ERROR, "Unable to create output file %s\n", waveFilename); */ }
- reportResult = EAS_FAILURE;
- }
- }
-
- /* rendering loop */
- while (reportResult == EAS_SUCCESS)
- {
-
- /* we may render several buffers here to fill one host buffer */
- for (i = 0, p = buffer; i < NUM_BUFFERS; i++, p+= pLibConfig->mixBufferSize * pLibConfig->numChannels)
- {
-
- /* get the current time */
- if ((result = EAS_GetLocation(easData, handle, &playTime)) != EAS_SUCCESS)
- {
- { /* dpp: EAS_ReportEx(_EAS_SEVERITY_ERROR, "EAS_GetLocation returned %d\n",result); */ }
- if (reportResult == EAS_SUCCESS)
- reportResult = result;
- break;
- }
- { /* dpp: EAS_ReportEx(_EAS_SEVERITY_DETAIL, "Parser time: %d.%03d\n", playTime / 1000, playTime % 1000); */ }
-
- /* render a buffer of audio */
- if ((result = EAS_Render(easData, p, pLibConfig->mixBufferSize, &count)) != EAS_SUCCESS)
- {
- { /* dpp: EAS_ReportEx(_EAS_SEVERITY_ERROR, "EAS_Render returned %d\n",result); */ }
- if (reportResult == EAS_SUCCESS)
- reportResult = result;
- }
- }
-
- if (result == EAS_SUCCESS)
- {
- /* write it to the wave file */
- if (WaveFileWrite(wFile, buffer, bufferSize) != bufferSize)
- {
- { /* dpp: EAS_ReportEx(_EAS_SEVERITY_ERROR, "WaveFileWrite failed\n"); */ }
- reportResult = EAS_FAILURE;
- }
- }
-
- if (reportResult == EAS_SUCCESS)
- {
- /* check stream state */
- if ((result = EAS_State(easData, handle, &state)) != EAS_SUCCESS)
- {
- { /* dpp: EAS_ReportEx(_EAS_SEVERITY_ERROR, "EAS_State returned %d\n", result); */ }
- reportResult = result;
- }
-
- /* is playback complete */
- if ((state == EAS_STATE_STOPPED) || (state == EAS_STATE_ERROR))
- break;
- }
- }
-
- /* close the output file */
- if (wFile)
- {
- if (!WaveFileClose(wFile))
- {
- { /* dpp: EAS_ReportEx(_EAS_SEVERITY_ERROR, "Error closing wave file %s\n", waveFilename); */ }
- if (reportResult == EAS_SUCCESS)
- result = EAS_FAILURE;
- }
- }
-
- /* close the input file */
- if ((result = EAS_CloseFile(easData,handle)) != EAS_SUCCESS)
- {
- { /* dpp: EAS_ReportEx(_EAS_SEVERITY_ERROR, "EAS_Close returned %ld\n", result); */ }
- if (reportResult == EAS_SUCCESS)
- result = EAS_FAILURE;
- }
-
- return reportResult;
-} /* end PlayFile */
-
-/*----------------------------------------------------------------------------
- * main()
- *----------------------------------------------------------------------------
- * Purpose: The entry point for the EAS sample application
- *
- * Inputs:
- *
- * Outputs:
- *
- *----------------------------------------------------------------------------
-*/
-int main( int argc, char **argv )
-{
- EAS_DATA_HANDLE easData;
- const S_EAS_LIB_CONFIG *pLibConfig;
- void *buffer;
- EAS_RESULT result, playResult;
- EAS_I32 bufferSize;
- int i;
- int temp;
- FILE *debugFile;
- char *outputFile = NULL;
-
- /* set the error reporting level */
- EAS_SetDebugLevel(_EAS_SEVERITY_INFO);
- debugFile = NULL;
-
- /* process command-line arguments */
- for (i = 1; i < argc; i++)
- {
- /* check for switch */
- if (argv[i][0] == '-')
- {
- switch (argv[i][1])
- {
- case 'd':
- temp = argv[i][2];
- if ((temp >= '0') || (temp <= '9'))
- EAS_SetDebugLevel(temp);
- else
- { /* dpp: EAS_ReportEx(_EAS_SEVERITY_WARNING, "Invalid debug level %d\n", temp); */ }
- break;
- case 'f':
- if ((debugFile = fopen(&argv[i][2],"w")) == NULL)
- { /* dpp: EAS_ReportEx(_EAS_SEVERITY_WARNING, "Unable to create debug file %s\n", &argv[i][2]); */ }
- else
- EAS_SetDebugFile(debugFile, EAS_TRUE);
- break;
- case 'o':
- outputFile = &argv[i][2];
- break;
- case 'p':
- polyphony = atoi(&argv[i][2]);
- if (polyphony < 1)
- polyphony = 1;
- { /* dpp: EAS_ReportEx(_EAS_SEVERITY_INFO, "Polyphony set to %d\n", polyphony); */ }
- break;
- default:
- break;
- }
- continue;
- }
- }
-
- /* assume success */
- playResult = EAS_SUCCESS;
-
- /* get the library configuration */
- pLibConfig = EAS_Config();
- if (!EASLibraryCheck(pLibConfig))
- return -1;
- if (polyphony > pLibConfig->maxVoices)
- polyphony = pLibConfig->maxVoices;
-
- /* calculate buffer size */
- bufferSize = pLibConfig->mixBufferSize * pLibConfig->numChannels * (EAS_I32)sizeof(EAS_PCM) * NUM_BUFFERS;
-
- /* allocate output buffer memory */
- buffer = malloc((EAS_U32)bufferSize);
- if (!buffer)
- {
- { /* dpp: EAS_ReportEx(_EAS_SEVERITY_FATAL, "Error allocating memory for audio buffer\n"); */ }
- return EAS_FAILURE;
- }
-
- /* initialize the EAS library */
- polyphony = pLibConfig->maxVoices;
- if ((result = EAS_Init(&easData)) != EAS_SUCCESS)
- {
- { /* dpp: EAS_ReportEx(_EAS_SEVERITY_FATAL, "EAS_Init returned %ld - aborting!\n", result); */ }
- free(buffer);
- return result;
- }
-
- /*
- * Some debugging environments don't allow for passed parameters.
- * In this case, just play the default MIDI file "test.mid"
- */
- if (argc < 2)
- {
- { /* dpp: EAS_ReportEx(_EAS_SEVERITY_INFO, "Playing '%s'\n", defaultTestFile); */ }
- if ((playResult = PlayFile(easData, defaultTestFile, NULL, pLibConfig, buffer, bufferSize)) != EAS_SUCCESS)
- {
- { /* dpp: EAS_ReportEx(_EAS_SEVERITY_ERROR, "Error %d playing file %s\n", playResult, defaultTestFile); */ }
- }
- }
- /* iterate through the list of files to be played */
- else
- {
- for (i = 1; i < argc; i++)
- {
- /* check for switch */
- if (argv[i][0] != '-')
- {
-
- { /* dpp: EAS_ReportEx(_EAS_SEVERITY_INFO, "Playing '%s'\n", argv[i]); */ }
- if ((playResult = PlayFile(easData, argv[i], outputFile, pLibConfig, buffer, bufferSize)) != EAS_SUCCESS)
- {
- { /* dpp: EAS_ReportEx(_EAS_SEVERITY_ERROR, "Error %d playing file %s\n", playResult, argv[i]); */ }
- break;
- }
- }
- }
- }
-
- /* shutdown the EAS library */
- if ((result = EAS_Shutdown(easData)) != EAS_SUCCESS)
- {
- { /* dpp: EAS_ReportEx(_EAS_SEVERITY_FATAL, "EAS_Shutdown returned %ld\n", result); */ }
- }
-
- /* free the output buffer */
- free(buffer);
-
- /* close the debug file */
- if (debugFile)
- fclose(debugFile);
-
- /* play errors take precedence over shutdown errors */
- if (playResult != EAS_SUCCESS)
- return playResult;
- return result;
-} /* end main */
-
-/*----------------------------------------------------------------------------
- * StrCopy()
- *----------------------------------------------------------------------------
- * Purpose:
- * Safe string copy
- *
- * Inputs:
- *
- * Outputs:
- *
- *----------------------------------------------------------------------------
-*/
-static void StrCopy(char *dest, const char *src, EAS_I32 size)
-{
- int len;
-
- strncpy(dest, src, (size_t) size-1);
- len = (int) strlen(src);
- if (len < size)
- dest[len] = 0;
-} /* end StrCopy */
-
-/*----------------------------------------------------------------------------
- * ChangeFileExt()
- *----------------------------------------------------------------------------
- * Purpose:
- * Changes the file extension of a filename
- *
- * Inputs:
- *
- * Outputs:
- *
- *----------------------------------------------------------------------------
-*/
-static EAS_BOOL ChangeFileExt(char *str, const char *ext, EAS_I32 size)
-{
- char *p;
-
- /* find the extension, if any */
- p = strrchr(str,'.');
- if (!p)
- {
- if ((EAS_I32)(strlen(str) + 5) > size)
- return EAS_FALSE;
- strcat(str,".");
- strcat(str,ext);
- return EAS_TRUE;
- }
-
- /* make sure there's room for the extension */
- p++;
- *p = 0;
- if ((EAS_I32)(strlen(str) + 4) > size)
- return EAS_FALSE;
- strcat(str,ext);
- return EAS_TRUE;
-} /* end ChangeFileExt */
-
-/*----------------------------------------------------------------------------
- * EASLibraryCheck()
- *----------------------------------------------------------------------------
- * Purpose:
- * Displays the library version and checks it against the header
- * file used to build this code.
- *
- * Inputs:
- * pLibConfig - library configuration retrieved from the library
- *
- * Outputs:
- * returns EAS_TRUE if matched
- *
- * Side Effects:
- *
- *----------------------------------------------------------------------------
-*/
-static EAS_BOOL EASLibraryCheck (const S_EAS_LIB_CONFIG *pLibConfig)
-{
-
- /* display the library version */
- { /* dpp: EAS_ReportEx(_EAS_SEVERITY_INFO, "EAS Library Version %d.%d.%d.%d\n",
- pLibConfig->libVersion >> 24,
- (pLibConfig->libVersion >> 16) & 0x0f,
- (pLibConfig->libVersion >> 8) & 0x0f,
- pLibConfig->libVersion & 0x0f); */ }
-
- /* display some info about the library build */
- if (pLibConfig->checkedVersion)
- { /* dpp: EAS_ReportEx(_EAS_SEVERITY_INFO, "\tChecked library\n"); */ }
- { /* dpp: EAS_ReportEx(_EAS_SEVERITY_INFO, "\tMaximum polyphony: %d\n", pLibConfig->maxVoices); */ }
- { /* dpp: EAS_ReportEx(_EAS_SEVERITY_INFO, "\tNumber of channels: %d\n", pLibConfig->numChannels); */ }
- { /* dpp: EAS_ReportEx(_EAS_SEVERITY_INFO, "\tSample rate: %d\n", pLibConfig->sampleRate); */ }
- { /* dpp: EAS_ReportEx(_EAS_SEVERITY_INFO, "\tMix buffer size: %d\n", pLibConfig->mixBufferSize); */ }
- if (pLibConfig->filterEnabled)
- { /* dpp: EAS_ReportEx(_EAS_SEVERITY_INFO, "\tFilter enabled\n"); */ }
-#ifndef _WIN32_WCE
- { /* dpp: EAS_ReportEx(_EAS_SEVERITY_INFO, "\tLibrary Build Timestamp: %s", ctime((time_t*)&pLibConfig->buildTimeStamp)); */ }
-#endif
- { /* dpp: EAS_ReportEx(_EAS_SEVERITY_INFO, "\tLibrary Build ID: %s\n", pLibConfig->buildGUID); */ }
-
- /* check it against the header file used to build this code */
- /*lint -e{778} constant expression used for display purposes may evaluate to zero */
- if (LIB_VERSION != pLibConfig->libVersion)
- {
- { /* dpp: EAS_ReportEx(_EAS_SEVERITY_FATAL, "Library version does not match header files. EAS Header Version %d.%d.%d.%d\n",
- LIB_VERSION >> 24,
- (LIB_VERSION >> 16) & 0x0f,
- (LIB_VERSION >> 8) & 0x0f,
- LIB_VERSION & 0x0f); */ }
- return EAS_FALSE;
- }
- return EAS_TRUE;
-} /* end EASLibraryCheck */
-
+ *
+ *----------------------------------------------------------------------------
+ * Revision Control:
+ * $Revision: 775 $
+ * $Date: 2007-07-20 10:11:11 -0700 (Fri, 20 Jul 2007) $
+ *----------------------------------------------------------------------------
+*/
+
+#ifdef _lint
+#include "lint_stdlib.h"
+#else
+#include <stdio.h>
+#include <string.h>
+#include <stdlib.h>
+#include <time.h>
+#endif
+
+#include "eas.h"
+#include "eas_wave.h"
+#include "eas_report.h"
+
+/* determines how many EAS buffers to fill a host buffer */
+#define NUM_BUFFERS 8
+
+/* default file to play if no filename is specified on the command line */
+static const char defaultTestFile[] = "test.mid";
+
+EAS_I32 polyphony;
+
+/* prototypes for helper functions */
+static void StrCopy(char *dest, const char *src, EAS_I32 size);
+static EAS_BOOL ChangeFileExt(char *str, const char *ext, EAS_I32 size);
+static EAS_RESULT PlayFile (EAS_DATA_HANDLE easData, const char* filename, const char* outputFile, const S_EAS_LIB_CONFIG *pLibConfig, void *buffer, EAS_I32 bufferSize);
+static EAS_BOOL EASLibraryCheck (const S_EAS_LIB_CONFIG *pLibConfig);
+
+/* main is defined after playfile to avoid the need for two passes through lint */
+
+/*----------------------------------------------------------------------------
+ * PlayFile()
+ *----------------------------------------------------------------------------
+ * Purpose:
+ * This function plays the file requested by filename
+ *
+ * Inputs:
+ *
+ * Outputs:
+ *
+ *----------------------------------------------------------------------------
+*/
+
+static EAS_RESULT PlayFile (EAS_DATA_HANDLE easData, const char* filename, const char* outputFile, const S_EAS_LIB_CONFIG *pLibConfig, void *buffer, EAS_I32 bufferSize)
+{
+ EAS_HANDLE handle;
+ EAS_RESULT result, reportResult;
+ EAS_I32 count;
+ EAS_STATE state;
+ EAS_I32 playTime;
+ char waveFilename[256];
+ WAVE_FILE *wFile;
+ EAS_INT i;
+ EAS_PCM *p;
+
+ /* determine the name of the output file */
+ wFile = NULL;
+ if (outputFile == NULL)
+ {
+ StrCopy(waveFilename, filename, sizeof(waveFilename));
+ if (!ChangeFileExt(waveFilename, "wav", sizeof(waveFilename)))
+ {
+ { /* dpp: EAS_ReportEx(_EAS_SEVERITY_ERROR, "Error in output filename %s\n", waveFilename); */ }
+ return EAS_FAILURE;
+ }
+ outputFile = waveFilename;
+ }
+
+ /* call EAS library to open file */
+ if ((reportResult = EAS_OpenFile(easData, filename, &handle)) != EAS_SUCCESS)
+ {
+ { /* dpp: EAS_ReportEx(_EAS_SEVERITY_ERROR, "EAS_OpenFile returned %ld\n", reportResult); */ }
+ return reportResult;
+ }
+
+ /* prepare to play the file */
+ if ((result = EAS_Prepare(easData, handle)) != EAS_SUCCESS)
+ {
+ { /* dpp: EAS_ReportEx(_EAS_SEVERITY_ERROR, "EAS_Prepare returned %ld\n", result); */ }
+ reportResult = result;
+ }
+
+ /* get play length */
+ if ((result = EAS_ParseMetaData(easData, handle, &playTime)) != EAS_SUCCESS)
+ {
+ { /* dpp: EAS_ReportEx(_EAS_SEVERITY_ERROR, "EAS_ParseMetaData returned %ld\n", result); */ }
+ return result;
+ }
+ EAS_ReportEx(_EAS_SEVERITY_NOFILTER, 0xe624f4d9, 0x00000005 , playTime / 1000, playTime % 1000);
+
+ if (reportResult == EAS_SUCCESS)
+ {
+ /* create the output file */
+ wFile = WaveFileCreate(outputFile, pLibConfig->numChannels, pLibConfig->sampleRate, sizeof(EAS_PCM) * 8);
+ if (!wFile)
+ {
+ { /* dpp: EAS_ReportEx(_EAS_SEVERITY_ERROR, "Unable to create output file %s\n", waveFilename); */ }
+ reportResult = EAS_FAILURE;
+ }
+ }
+
+ /* rendering loop */
+ while (reportResult == EAS_SUCCESS)
+ {
+
+ /* we may render several buffers here to fill one host buffer */
+ for (i = 0, p = buffer; i < NUM_BUFFERS; i++, p+= pLibConfig->mixBufferSize * pLibConfig->numChannels)
+ {
+
+ /* get the current time */
+ if ((result = EAS_GetLocation(easData, handle, &playTime)) != EAS_SUCCESS)
+ {
+ { /* dpp: EAS_ReportEx(_EAS_SEVERITY_ERROR, "EAS_GetLocation returned %d\n",result); */ }
+ if (reportResult == EAS_SUCCESS)
+ reportResult = result;
+ break;
+ }
+ { /* dpp: EAS_ReportEx(_EAS_SEVERITY_DETAIL, "Parser time: %d.%03d\n", playTime / 1000, playTime % 1000); */ }
+
+ /* render a buffer of audio */
+ if ((result = EAS_Render(easData, p, pLibConfig->mixBufferSize, &count)) != EAS_SUCCESS)
+ {
+ { /* dpp: EAS_ReportEx(_EAS_SEVERITY_ERROR, "EAS_Render returned %d\n",result); */ }
+ if (reportResult == EAS_SUCCESS)
+ reportResult = result;
+ }
+ }
+
+ if (result == EAS_SUCCESS)
+ {
+ /* write it to the wave file */
+ if (WaveFileWrite(wFile, buffer, bufferSize) != bufferSize)
+ {
+ { /* dpp: EAS_ReportEx(_EAS_SEVERITY_ERROR, "WaveFileWrite failed\n"); */ }
+ reportResult = EAS_FAILURE;
+ }
+ }
+
+ if (reportResult == EAS_SUCCESS)
+ {
+ /* check stream state */
+ if ((result = EAS_State(easData, handle, &state)) != EAS_SUCCESS)
+ {
+ { /* dpp: EAS_ReportEx(_EAS_SEVERITY_ERROR, "EAS_State returned %d\n", result); */ }
+ reportResult = result;
+ }
+
+ /* is playback complete */
+ if ((state == EAS_STATE_STOPPED) || (state == EAS_STATE_ERROR))
+ break;
+ }
+ }
+
+ /* close the output file */
+ if (wFile)
+ {
+ if (!WaveFileClose(wFile))
+ {
+ { /* dpp: EAS_ReportEx(_EAS_SEVERITY_ERROR, "Error closing wave file %s\n", waveFilename); */ }
+ if (reportResult == EAS_SUCCESS)
+ result = EAS_FAILURE;
+ }
+ }
+
+ /* close the input file */
+ if ((result = EAS_CloseFile(easData,handle)) != EAS_SUCCESS)
+ {
+ { /* dpp: EAS_ReportEx(_EAS_SEVERITY_ERROR, "EAS_Close returned %ld\n", result); */ }
+ if (reportResult == EAS_SUCCESS)
+ result = EAS_FAILURE;
+ }
+
+ return reportResult;
+} /* end PlayFile */
+
+/*----------------------------------------------------------------------------
+ * main()
+ *----------------------------------------------------------------------------
+ * Purpose: The entry point for the EAS sample application
+ *
+ * Inputs:
+ *
+ * Outputs:
+ *
+ *----------------------------------------------------------------------------
+*/
+int main( int argc, char **argv )
+{
+ EAS_DATA_HANDLE easData;
+ const S_EAS_LIB_CONFIG *pLibConfig;
+ void *buffer;
+ EAS_RESULT result, playResult;
+ EAS_I32 bufferSize;
+ int i;
+ int temp;
+ FILE *debugFile;
+ char *outputFile = NULL;
+
+ /* set the error reporting level */
+ EAS_SetDebugLevel(_EAS_SEVERITY_INFO);
+ debugFile = NULL;
+
+ /* process command-line arguments */
+ for (i = 1; i < argc; i++)
+ {
+ /* check for switch */
+ if (argv[i][0] == '-')
+ {
+ switch (argv[i][1])
+ {
+ case 'd':
+ temp = argv[i][2];
+ if ((temp >= '0') || (temp <= '9'))
+ EAS_SetDebugLevel(temp);
+ else
+ { /* dpp: EAS_ReportEx(_EAS_SEVERITY_WARNING, "Invalid debug level %d\n", temp); */ }
+ break;
+ case 'f':
+ if ((debugFile = fopen(&argv[i][2],"w")) == NULL)
+ { /* dpp: EAS_ReportEx(_EAS_SEVERITY_WARNING, "Unable to create debug file %s\n", &argv[i][2]); */ }
+ else
+ EAS_SetDebugFile(debugFile, EAS_TRUE);
+ break;
+ case 'o':
+ outputFile = &argv[i][2];
+ break;
+ case 'p':
+ polyphony = atoi(&argv[i][2]);
+ if (polyphony < 1)
+ polyphony = 1;
+ { /* dpp: EAS_ReportEx(_EAS_SEVERITY_INFO, "Polyphony set to %d\n", polyphony); */ }
+ break;
+ default:
+ break;
+ }
+ continue;
+ }
+ }
+
+ /* assume success */
+ playResult = EAS_SUCCESS;
+
+ /* get the library configuration */
+ pLibConfig = EAS_Config();
+ if (!EASLibraryCheck(pLibConfig))
+ return -1;
+ if (polyphony > pLibConfig->maxVoices)
+ polyphony = pLibConfig->maxVoices;
+
+ /* calculate buffer size */
+ bufferSize = pLibConfig->mixBufferSize * pLibConfig->numChannels * (EAS_I32)sizeof(EAS_PCM) * NUM_BUFFERS;
+
+ /* allocate output buffer memory */
+ buffer = malloc((EAS_U32)bufferSize);
+ if (!buffer)
+ {
+ { /* dpp: EAS_ReportEx(_EAS_SEVERITY_FATAL, "Error allocating memory for audio buffer\n"); */ }
+ return EAS_FAILURE;
+ }
+
+ /* initialize the EAS library */
+ polyphony = pLibConfig->maxVoices;
+ if ((result = EAS_Init(&easData)) != EAS_SUCCESS)
+ {
+ { /* dpp: EAS_ReportEx(_EAS_SEVERITY_FATAL, "EAS_Init returned %ld - aborting!\n", result); */ }
+ free(buffer);
+ return result;
+ }
+
+ /*
+ * Some debugging environments don't allow for passed parameters.
+ * In this case, just play the default MIDI file "test.mid"
+ */
+ if (argc < 2)
+ {
+ { /* dpp: EAS_ReportEx(_EAS_SEVERITY_INFO, "Playing '%s'\n", defaultTestFile); */ }
+ if ((playResult = PlayFile(easData, defaultTestFile, NULL, pLibConfig, buffer, bufferSize)) != EAS_SUCCESS)
+ {
+ { /* dpp: EAS_ReportEx(_EAS_SEVERITY_ERROR, "Error %d playing file %s\n", playResult, defaultTestFile); */ }
+ }
+ }
+ /* iterate through the list of files to be played */
+ else
+ {
+ for (i = 1; i < argc; i++)
+ {
+ /* check for switch */
+ if (argv[i][0] != '-')
+ {
+
+ { /* dpp: EAS_ReportEx(_EAS_SEVERITY_INFO, "Playing '%s'\n", argv[i]); */ }
+ if ((playResult = PlayFile(easData, argv[i], outputFile, pLibConfig, buffer, bufferSize)) != EAS_SUCCESS)
+ {
+ { /* dpp: EAS_ReportEx(_EAS_SEVERITY_ERROR, "Error %d playing file %s\n", playResult, argv[i]); */ }
+ break;
+ }
+ }
+ }
+ }
+
+ /* shutdown the EAS library */
+ if ((result = EAS_Shutdown(easData)) != EAS_SUCCESS)
+ {
+ { /* dpp: EAS_ReportEx(_EAS_SEVERITY_FATAL, "EAS_Shutdown returned %ld\n", result); */ }
+ }
+
+ /* free the output buffer */
+ free(buffer);
+
+ /* close the debug file */
+ if (debugFile)
+ fclose(debugFile);
+
+ /* play errors take precedence over shutdown errors */
+ if (playResult != EAS_SUCCESS)
+ return playResult;
+ return result;
+} /* end main */
+
+/*----------------------------------------------------------------------------
+ * StrCopy()
+ *----------------------------------------------------------------------------
+ * Purpose:
+ * Safe string copy
+ *
+ * Inputs:
+ *
+ * Outputs:
+ *
+ *----------------------------------------------------------------------------
+*/
+static void StrCopy(char *dest, const char *src, EAS_I32 size)
+{
+ int len;
+
+ strncpy(dest, src, (size_t) size-1);
+ len = (int) strlen(src);
+ if (len < size)
+ dest[len] = 0;
+} /* end StrCopy */
+
+/*----------------------------------------------------------------------------
+ * ChangeFileExt()
+ *----------------------------------------------------------------------------
+ * Purpose:
+ * Changes the file extension of a filename
+ *
+ * Inputs:
+ *
+ * Outputs:
+ *
+ *----------------------------------------------------------------------------
+*/
+static EAS_BOOL ChangeFileExt(char *str, const char *ext, EAS_I32 size)
+{
+ char *p;
+
+ /* find the extension, if any */
+ p = strrchr(str,'.');
+ if (!p)
+ {
+ if ((EAS_I32)(strlen(str) + 5) > size)
+ return EAS_FALSE;
+ strcat(str,".");
+ strcat(str,ext);
+ return EAS_TRUE;
+ }
+
+ /* make sure there's room for the extension */
+ p++;
+ *p = 0;
+ if ((EAS_I32)(strlen(str) + 4) > size)
+ return EAS_FALSE;
+ strcat(str,ext);
+ return EAS_TRUE;
+} /* end ChangeFileExt */
+
+/*----------------------------------------------------------------------------
+ * EASLibraryCheck()
+ *----------------------------------------------------------------------------
+ * Purpose:
+ * Displays the library version and checks it against the header
+ * file used to build this code.
+ *
+ * Inputs:
+ * pLibConfig - library configuration retrieved from the library
+ *
+ * Outputs:
+ * returns EAS_TRUE if matched
+ *
+ * Side Effects:
+ *
+ *----------------------------------------------------------------------------
+*/
+static EAS_BOOL EASLibraryCheck (const S_EAS_LIB_CONFIG *pLibConfig)
+{
+
+ /* display the library version */
+ { /* dpp: EAS_ReportEx(_EAS_SEVERITY_INFO, "EAS Library Version %d.%d.%d.%d\n",
+ pLibConfig->libVersion >> 24,
+ (pLibConfig->libVersion >> 16) & 0x0f,
+ (pLibConfig->libVersion >> 8) & 0x0f,
+ pLibConfig->libVersion & 0x0f); */ }
+
+ /* display some info about the library build */
+ if (pLibConfig->checkedVersion)
+ { /* dpp: EAS_ReportEx(_EAS_SEVERITY_INFO, "\tChecked library\n"); */ }
+ { /* dpp: EAS_ReportEx(_EAS_SEVERITY_INFO, "\tMaximum polyphony: %d\n", pLibConfig->maxVoices); */ }
+ { /* dpp: EAS_ReportEx(_EAS_SEVERITY_INFO, "\tNumber of channels: %d\n", pLibConfig->numChannels); */ }
+ { /* dpp: EAS_ReportEx(_EAS_SEVERITY_INFO, "\tSample rate: %d\n", pLibConfig->sampleRate); */ }
+ { /* dpp: EAS_ReportEx(_EAS_SEVERITY_INFO, "\tMix buffer size: %d\n", pLibConfig->mixBufferSize); */ }
+ if (pLibConfig->filterEnabled)
+ { /* dpp: EAS_ReportEx(_EAS_SEVERITY_INFO, "\tFilter enabled\n"); */ }
+#ifndef _WIN32_WCE
+ { /* dpp: EAS_ReportEx(_EAS_SEVERITY_INFO, "\tLibrary Build Timestamp: %s", ctime((time_t*)&pLibConfig->buildTimeStamp)); */ }
+#endif
+ { /* dpp: EAS_ReportEx(_EAS_SEVERITY_INFO, "\tLibrary Build ID: %s\n", pLibConfig->buildGUID); */ }
+
+ /* check it against the header file used to build this code */
+ /*lint -e{778} constant expression used for display purposes may evaluate to zero */
+ if (LIB_VERSION != pLibConfig->libVersion)
+ {
+ { /* dpp: EAS_ReportEx(_EAS_SEVERITY_FATAL, "Library version does not match header files. EAS Header Version %d.%d.%d.%d\n",
+ LIB_VERSION >> 24,
+ (LIB_VERSION >> 16) & 0x0f,
+ (LIB_VERSION >> 8) & 0x0f,
+ LIB_VERSION & 0x0f); */ }
+ return EAS_FALSE;
+ }
+ return EAS_TRUE;
+} /* end EASLibraryCheck */
+
diff --git a/arm-fm-22k/host_src/eas_report.c b/arm-fm-22k/host_src/eas_report.c
index d4dd22c..04a828c 100644
--- a/arm-fm-22k/host_src/eas_report.c
+++ b/arm-fm-22k/host_src/eas_report.c
@@ -1,13 +1,13 @@
-/*----------------------------------------------------------------------------
- *
- * File:
- * eas_report.c
- *
- * Contents and purpose:
- * This file contains the debug message handling routines for the EAS library.
- * These routines should be modified as needed for your system.
- *
- * Copyright 2005 Sonic Network Inc.
+/*----------------------------------------------------------------------------
+ *
+ * File:
+ * eas_report.c
+ *
+ * Contents and purpose:
+ * This file contains the debug message handling routines for the EAS library.
+ * These routines should be modified as needed for your system.
+ *
+ * Copyright 2005 Sonic Network Inc.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -20,245 +20,245 @@
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
- *
- *----------------------------------------------------------------------------
- * Revision Control:
- * $Revision: 659 $
- * $Date: 2007-04-24 13:36:35 -0700 (Tue, 24 Apr 2007) $
- *----------------------------------------------------------------------------
-*/
-
-#ifdef _lint
-#include "lint_stdlib.h"
-#else
-#include <stdlib.h>
-#include <stdio.h>
-#include <stdarg.h>
-#endif
-
-#include "eas_report.h"
-
-static int severityLevel = 9999;
-
-/* debug file */
-static FILE *debugFile = NULL;
-int flush = 0;
-
-#ifndef _NO_DEBUG_PREPROCESSOR
-
-/* structure should have an #include for each error message header file */
-S_DEBUG_MESSAGES debugMessages[] =
-{
-#ifndef UNIFIED_DEBUG_MESSAGES
-#include "eas_config_msgs.h"
-
-
-#include "eas_host_msgs.h"
-#include "eas_hostmm_msgs.h"
-#include "eas_math_msgs.h"
-#include "eas_midi_msgs.h"
-#include "eas_mixer_msgs.h"
-#include "eas_pcm_msgs.h"
-#include "eas_public_msgs.h"
-#include "eas_smf_msgs.h"
-#include "eas_wave_msgs.h"
-#include "eas_voicemgt_msgs.h"
-
-#ifdef _FM_SYNTH
-#include "eas_fmsynth_msgs.h"
-#include "eas_fmengine_msgs.h"
-#endif
-
-#ifdef _WT_SYNTH
-#include "eas_wtsynth_msgs.h"
-#include "eas_wtengine_msgs.h"
-#endif
-
-#ifdef _ARM_TEST_MAIN
-#include "arm_main_msgs.h"
-#endif
-
-#ifdef _EAS_MAIN
-#include "eas_main_msgs.h"
-#endif
-
-#ifdef _EAS_MAIN_IPC
-#include "eas_main_ipc_msgs.h"
-#endif
-
-#ifdef _METRICS_ENABLED
-#include "eas_perf_msgs.h"
-#endif
-
-#ifdef _COMPRESSOR_ENABLED
-#include "eas_compressor_msgs.h"
-#endif
-
-#ifdef _ENHANCER_ENABLED
-#include "eas_enhancer_msgs.h"
-#endif
-
-#ifdef _WOW_ENABLED
-#include "eas_wow_msgs.h"
-#endif
-
-#ifdef _SMAF_PARSER
-#include "eas_smaf_msgs.h"
-#endif
-
-#ifdef _OTA_PARSER
-#include "eas_ota_msgs.h"
-#endif
-
-#ifdef _IMELODY_PARSER
-#include "eas_imelody_msgs.h"
-#endif
-
-#ifdef _WAVE_PARSER
-#include "eas_wavefile_msgs.h"
-#endif
-
-#if defined(_CMX_PARSER) || defined(_MFI_PARSER)
-#include "eas_cmf_msgs.h"
-#endif
-
-#if defined(_CMX_PARSER) || defined(_MFI_PARSER) || defined(_WAVE_PARSER)
-#include "eas_imaadpcm_msgs.h"
-#endif
-
-#else
-#include "eas_debugmsgs.h"
-#endif
-
-/* denotes end of error messages */
-{ 0,0,0 }
-};
-
-/*----------------------------------------------------------------------------
- * EAS_ReportEx()
- *
- * This is the error message handler. The default handler outputs error
- * messages to stdout. Modify this as needed for your system.
- *----------------------------------------------------------------------------
-*/
-void EAS_ReportEx (int severity, unsigned long hashCode, int serialNum, ...)
-{
- va_list vargs;
- int i;
-
- /* check severity level */
- if (severity > severityLevel)
- return;
-
- /* find the error message and output to stdout */
- /*lint -e{661} we check for NULL pointer - no fence post error here */
- for (i = 0; debugMessages[i].m_pDebugMsg; i++)
- {
- if ((debugMessages[i].m_nHashCode == hashCode) &&
- (debugMessages[i].m_nSerialNum == serialNum))
- {
- /*lint -e{826} <allow variable args> */
- va_start(vargs, serialNum);
- if (debugFile)
- {
- vfprintf(debugFile, debugMessages[i].m_pDebugMsg, vargs);
- if (flush)
- fflush(debugFile);
- }
- else
- {
- vprintf(debugMessages[i].m_pDebugMsg, vargs);
- }
- va_end(vargs);
- return;
- }
- }
- printf("Unrecognized error: Severity=%d; HashCode=%lu; SerialNum=%d\n", severity, hashCode, serialNum);
-} /* end EAS_ReportEx */
-
-#else
-/*----------------------------------------------------------------------------
- * EAS_Report()
- *
- * This is the error message handler. The default handler outputs error
- * messages to stdout. Modify this as needed for your system.
- *----------------------------------------------------------------------------
-*/
-void EAS_Report (int severity, const char *fmt, ...)
-{
- va_list vargs;
-
- /* check severity level */
- if (severity > severityLevel)
- return;
-
- /*lint -e{826} <allow variable args> */
- va_start(vargs, fmt);
- if (debugFile)
- {
- vfprintf(debugFile, fmt, vargs);
- if (flush)
- fflush(debugFile);
- }
- else
- {
- vprintf(fmt, vargs);
- }
- va_end(vargs);
-} /* end EAS_Report */
-
-/*----------------------------------------------------------------------------
- * EAS_ReportX()
- *
- * This is the error message handler. The default handler outputs error
- * messages to stdout. Modify this as needed for your system.
- *----------------------------------------------------------------------------
-*/
-void EAS_ReportX (int severity, const char *fmt, ...)
-{
- va_list vargs;
-
- /* check severity level */
- if (severity > severityLevel)
- return;
-
- /*lint -e{826} <allow variable args> */
- va_start(vargs, fmt);
- if (debugFile)
- {
- vfprintf(debugFile, fmt, vargs);
- if (flush)
- fflush(debugFile);
- }
- else
- {
- vprintf(fmt, vargs);
- }
- va_end(vargs);
-} /* end EAS_ReportX */
-#endif
-
-/*----------------------------------------------------------------------------
- * EAS_SetDebugLevel()
- *
- * Sets the level for debug message output
- *----------------------------------------------------------------------------
-*/
-
-void EAS_SetDebugLevel (int severity)
-{
- severityLevel = severity;
-} /* end EAS_SetDebugLevel */
-
-/*----------------------------------------------------------------------------
- * EAS_SetDebugFile()
- *
- * Redirect debugger output to the specified file.
- *----------------------------------------------------------------------------
-*/
-void EAS_SetDebugFile (void *file, int flushAfterWrite)
-{
- debugFile = (FILE*) file;
- flush = flushAfterWrite;
-} /* end EAS_SetDebugFile */
-
+ *
+ *----------------------------------------------------------------------------
+ * Revision Control:
+ * $Revision: 659 $
+ * $Date: 2007-04-24 13:36:35 -0700 (Tue, 24 Apr 2007) $
+ *----------------------------------------------------------------------------
+*/
+
+#ifdef _lint
+#include "lint_stdlib.h"
+#else
+#include <stdlib.h>
+#include <stdio.h>
+#include <stdarg.h>
+#endif
+
+#include "eas_report.h"
+
+static int severityLevel = 9999;
+
+/* debug file */
+static FILE *debugFile = NULL;
+int flush = 0;
+
+#ifndef _NO_DEBUG_PREPROCESSOR
+
+/* structure should have an #include for each error message header file */
+S_DEBUG_MESSAGES debugMessages[] =
+{
+#ifndef UNIFIED_DEBUG_MESSAGES
+#include "eas_config_msgs.h"
+
+
+#include "eas_host_msgs.h"
+#include "eas_hostmm_msgs.h"
+#include "eas_math_msgs.h"
+#include "eas_midi_msgs.h"
+#include "eas_mixer_msgs.h"
+#include "eas_pcm_msgs.h"
+#include "eas_public_msgs.h"
+#include "eas_smf_msgs.h"
+#include "eas_wave_msgs.h"
+#include "eas_voicemgt_msgs.h"
+
+#ifdef _FM_SYNTH
+#include "eas_fmsynth_msgs.h"
+#include "eas_fmengine_msgs.h"
+#endif
+
+#ifdef _WT_SYNTH
+#include "eas_wtsynth_msgs.h"
+#include "eas_wtengine_msgs.h"
+#endif
+
+#ifdef _ARM_TEST_MAIN
+#include "arm_main_msgs.h"
+#endif
+
+#ifdef _EAS_MAIN
+#include "eas_main_msgs.h"
+#endif
+
+#ifdef _EAS_MAIN_IPC
+#include "eas_main_ipc_msgs.h"
+#endif
+
+#ifdef _METRICS_ENABLED
+#include "eas_perf_msgs.h"
+#endif
+
+#ifdef _COMPRESSOR_ENABLED
+#include "eas_compressor_msgs.h"
+#endif
+
+#ifdef _ENHANCER_ENABLED
+#include "eas_enhancer_msgs.h"
+#endif
+
+#ifdef _WOW_ENABLED
+#include "eas_wow_msgs.h"
+#endif
+
+#ifdef _SMAF_PARSER
+#include "eas_smaf_msgs.h"
+#endif
+
+#ifdef _OTA_PARSER
+#include "eas_ota_msgs.h"
+#endif
+
+#ifdef _IMELODY_PARSER
+#include "eas_imelody_msgs.h"
+#endif
+
+#ifdef _WAVE_PARSER
+#include "eas_wavefile_msgs.h"
+#endif
+
+#if defined(_CMX_PARSER) || defined(_MFI_PARSER)
+#include "eas_cmf_msgs.h"
+#endif
+
+#if defined(_CMX_PARSER) || defined(_MFI_PARSER) || defined(_WAVE_PARSER)
+#include "eas_imaadpcm_msgs.h"
+#endif
+
+#else
+#include "eas_debugmsgs.h"
+#endif
+
+/* denotes end of error messages */
+{ 0,0,0 }
+};
+
+/*----------------------------------------------------------------------------
+ * EAS_ReportEx()
+ *
+ * This is the error message handler. The default handler outputs error
+ * messages to stdout. Modify this as needed for your system.
+ *----------------------------------------------------------------------------
+*/
+void EAS_ReportEx (int severity, unsigned long hashCode, int serialNum, ...)
+{
+ va_list vargs;
+ int i;
+
+ /* check severity level */
+ if (severity > severityLevel)
+ return;
+
+ /* find the error message and output to stdout */
+ /*lint -e{661} we check for NULL pointer - no fence post error here */
+ for (i = 0; debugMessages[i].m_pDebugMsg; i++)
+ {
+ if ((debugMessages[i].m_nHashCode == hashCode) &&
+ (debugMessages[i].m_nSerialNum == serialNum))
+ {
+ /*lint -e{826} <allow variable args> */
+ va_start(vargs, serialNum);
+ if (debugFile)
+ {
+ vfprintf(debugFile, debugMessages[i].m_pDebugMsg, vargs);
+ if (flush)
+ fflush(debugFile);
+ }
+ else
+ {
+ vprintf(debugMessages[i].m_pDebugMsg, vargs);
+ }
+ va_end(vargs);
+ return;
+ }
+ }
+ printf("Unrecognized error: Severity=%d; HashCode=%lu; SerialNum=%d\n", severity, hashCode, serialNum);
+} /* end EAS_ReportEx */
+
+#else
+/*----------------------------------------------------------------------------
+ * EAS_Report()
+ *
+ * This is the error message handler. The default handler outputs error
+ * messages to stdout. Modify this as needed for your system.
+ *----------------------------------------------------------------------------
+*/
+void EAS_Report (int severity, const char *fmt, ...)
+{
+ va_list vargs;
+
+ /* check severity level */
+ if (severity > severityLevel)
+ return;
+
+ /*lint -e{826} <allow variable args> */
+ va_start(vargs, fmt);
+ if (debugFile)
+ {
+ vfprintf(debugFile, fmt, vargs);
+ if (flush)
+ fflush(debugFile);
+ }
+ else
+ {
+ vprintf(fmt, vargs);
+ }
+ va_end(vargs);
+} /* end EAS_Report */
+
+/*----------------------------------------------------------------------------
+ * EAS_ReportX()
+ *
+ * This is the error message handler. The default handler outputs error
+ * messages to stdout. Modify this as needed for your system.
+ *----------------------------------------------------------------------------
+*/
+void EAS_ReportX (int severity, const char *fmt, ...)
+{
+ va_list vargs;
+
+ /* check severity level */
+ if (severity > severityLevel)
+ return;
+
+ /*lint -e{826} <allow variable args> */
+ va_start(vargs, fmt);
+ if (debugFile)
+ {
+ vfprintf(debugFile, fmt, vargs);
+ if (flush)
+ fflush(debugFile);
+ }
+ else
+ {
+ vprintf(fmt, vargs);
+ }
+ va_end(vargs);
+} /* end EAS_ReportX */
+#endif
+
+/*----------------------------------------------------------------------------
+ * EAS_SetDebugLevel()
+ *
+ * Sets the level for debug message output
+ *----------------------------------------------------------------------------
+*/
+
+void EAS_SetDebugLevel (int severity)
+{
+ severityLevel = severity;
+} /* end EAS_SetDebugLevel */
+
+/*----------------------------------------------------------------------------
+ * EAS_SetDebugFile()
+ *
+ * Redirect debugger output to the specified file.
+ *----------------------------------------------------------------------------
+*/
+void EAS_SetDebugFile (void *file, int flushAfterWrite)
+{
+ debugFile = (FILE*) file;
+ flush = flushAfterWrite;
+} /* end EAS_SetDebugFile */
+
diff --git a/arm-fm-22k/host_src/eas_report.h b/arm-fm-22k/host_src/eas_report.h
index 9d7c8e8..b603b12 100644
--- a/arm-fm-22k/host_src/eas_report.h
+++ b/arm-fm-22k/host_src/eas_report.h
@@ -1,15 +1,15 @@
-/*----------------------------------------------------------------------------
- *
- * File:
- * eas_report.h
- *
- * Contents and purpose:
- * This file contains the debug message handling routines for the EAS library.
- * These routines should be modified as needed for your system.
- *
- * DO NOT MODIFY THIS FILE!
- *
- * Copyright 2005 Sonic Network Inc.
+/*----------------------------------------------------------------------------
+ *
+ * File:
+ * eas_report.h
+ *
+ * Contents and purpose:
+ * This file contains the debug message handling routines for the EAS library.
+ * These routines should be modified as needed for your system.
+ *
+ * DO NOT MODIFY THIS FILE!
+ *
+ * Copyright 2005 Sonic Network Inc.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -22,56 +22,56 @@
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
- *
- *----------------------------------------------------------------------------
- * Revision Control:
- * $Revision: 82 $
- * $Date: 2006-07-10 11:45:19 -0700 (Mon, 10 Jul 2006) $
- *----------------------------------------------------------------------------
-*/
-
-/* sentinel */
-#ifndef _EAS_REPORT_H
-#define _EAS_REPORT_H
-
-#define _EAS_SEVERITY_NOFILTER 0
-#define _EAS_SEVERITY_FATAL 1
-#define _EAS_SEVERITY_ERROR 2
-#define _EAS_SEVERITY_WARNING 3
-#define _EAS_SEVERITY_INFO 4
-#define _EAS_SEVERITY_DETAIL 5
-
-/* for C++ linkage */
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-#ifndef _NO_DEBUG_PREPROCESSOR
-
-/* structure for included debug message header files */
-typedef struct
-{
- unsigned long m_nHashCode;
- int m_nSerialNum;
- char *m_pDebugMsg;
-} S_DEBUG_MESSAGES;
-
-/* debug message handling prototypes */
-extern void EAS_ReportEx (int severity, unsigned long hashCode, int serialNum, ...);
-
-#else
-
-/* these prototypes are used if the debug preprocessor is not used */
-extern void EAS_Report (int severity, const char* fmt, ...);
-extern void EAS_ReportX (int severity, const char* fmt, ...);
-
-#endif
-
-extern void EAS_SetDebugLevel (int severity);
-extern void EAS_SetDebugFile (void *file, int flushAfterWrite);
-
-#ifdef __cplusplus
-} /* end extern "C" */
-#endif
-
-#endif
+ *
+ *----------------------------------------------------------------------------
+ * Revision Control:
+ * $Revision: 82 $
+ * $Date: 2006-07-10 11:45:19 -0700 (Mon, 10 Jul 2006) $
+ *----------------------------------------------------------------------------
+*/
+
+/* sentinel */
+#ifndef _EAS_REPORT_H
+#define _EAS_REPORT_H
+
+#define _EAS_SEVERITY_NOFILTER 0
+#define _EAS_SEVERITY_FATAL 1
+#define _EAS_SEVERITY_ERROR 2
+#define _EAS_SEVERITY_WARNING 3
+#define _EAS_SEVERITY_INFO 4
+#define _EAS_SEVERITY_DETAIL 5
+
+/* for C++ linkage */
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#ifndef _NO_DEBUG_PREPROCESSOR
+
+/* structure for included debug message header files */
+typedef struct
+{
+ unsigned long m_nHashCode;
+ int m_nSerialNum;
+ char *m_pDebugMsg;
+} S_DEBUG_MESSAGES;
+
+/* debug message handling prototypes */
+extern void EAS_ReportEx (int severity, unsigned long hashCode, int serialNum, ...);
+
+#else
+
+/* these prototypes are used if the debug preprocessor is not used */
+extern void EAS_Report (int severity, const char* fmt, ...);
+extern void EAS_ReportX (int severity, const char* fmt, ...);
+
+#endif
+
+extern void EAS_SetDebugLevel (int severity);
+extern void EAS_SetDebugFile (void *file, int flushAfterWrite);
+
+#ifdef __cplusplus
+} /* end extern "C" */
+#endif
+
+#endif
diff --git a/arm-fm-22k/host_src/eas_reverb.h b/arm-fm-22k/host_src/eas_reverb.h
index a2535fb..559abed 100644
--- a/arm-fm-22k/host_src/eas_reverb.h
+++ b/arm-fm-22k/host_src/eas_reverb.h
@@ -1,13 +1,13 @@
-/*----------------------------------------------------------------------------
- *
- * File:
- * eas_reverb.h
- *
- * Contents and purpose:
- * Contains parameter enumerations for the Reverb effect
- *
- *
- * Copyright Sonic Network Inc. 2006
+/*----------------------------------------------------------------------------
+ *
+ * File:
+ * eas_reverb.h
+ *
+ * Contents and purpose:
+ * Contains parameter enumerations for the Reverb effect
+ *
+ *
+ * Copyright Sonic Network Inc. 2006
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -20,35 +20,35 @@
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
- *
- *----------------------------------------------------------------------------
- * Revision Control:
- * $Revision: 300 $
- * $Date: 2006-09-11 17:37:20 -0700 (Mon, 11 Sep 2006) $
- *----------------------------------------------------------------------------
-*/
-
-#ifndef _EAS_REVERB_H
-#define _EAS_REVERB_H
-
-
-/* enumerated parameter settings for Reverb effect */
-typedef enum
-{
- EAS_PARAM_REVERB_BYPASS,
- EAS_PARAM_REVERB_PRESET,
- EAS_PARAM_REVERB_WET,
- EAS_PARAM_REVERB_DRY
-} E_REVERB_PARAMS;
-
-
-typedef enum
-{
- EAS_PARAM_REVERB_LARGE_HALL,
- EAS_PARAM_REVERB_HALL,
- EAS_PARAM_REVERB_CHAMBER,
- EAS_PARAM_REVERB_ROOM,
-} E_REVERB_PRESETS;
-
-
-#endif /* _REVERB_H */
+ *
+ *----------------------------------------------------------------------------
+ * Revision Control:
+ * $Revision: 300 $
+ * $Date: 2006-09-11 17:37:20 -0700 (Mon, 11 Sep 2006) $
+ *----------------------------------------------------------------------------
+*/
+
+#ifndef _EAS_REVERB_H
+#define _EAS_REVERB_H
+
+
+/* enumerated parameter settings for Reverb effect */
+typedef enum
+{
+ EAS_PARAM_REVERB_BYPASS,
+ EAS_PARAM_REVERB_PRESET,
+ EAS_PARAM_REVERB_WET,
+ EAS_PARAM_REVERB_DRY
+} E_REVERB_PARAMS;
+
+
+typedef enum
+{
+ EAS_PARAM_REVERB_LARGE_HALL,
+ EAS_PARAM_REVERB_HALL,
+ EAS_PARAM_REVERB_CHAMBER,
+ EAS_PARAM_REVERB_ROOM,
+} E_REVERB_PRESETS;
+
+
+#endif /* _REVERB_H */
diff --git a/arm-fm-22k/host_src/eas_types.h b/arm-fm-22k/host_src/eas_types.h
index f0293ef..45fa4b2 100644
--- a/arm-fm-22k/host_src/eas_types.h
+++ b/arm-fm-22k/host_src/eas_types.h
@@ -1,17 +1,17 @@
-/*----------------------------------------------------------------------------
- *
- * File:
- * eas_types.h
- *
- * Contents and purpose:
- * The public interface header for the EAS synthesizer.
- *
- * This header only contains declarations that are specific
- * to this implementation.
- *
- * DO NOT MODIFY THIS FILE!
- *
- * Copyright Sonic Network Inc. 2004
+/*----------------------------------------------------------------------------
+ *
+ * File:
+ * eas_types.h
+ *
+ * Contents and purpose:
+ * The public interface header for the EAS synthesizer.
+ *
+ * This header only contains declarations that are specific
+ * to this implementation.
+ *
+ * DO NOT MODIFY THIS FILE!
+ *
+ * Copyright Sonic Network Inc. 2004
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -24,245 +24,245 @@
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
- *
- *----------------------------------------------------------------------------
- * Revision Control:
- * $Revision: 726 $
- * $Date: 2007-06-14 23:10:46 -0700 (Thu, 14 Jun 2007) $
- *----------------------------------------------------------------------------
-*/
-
-#ifndef _EAS_TYPES_H
-#define _EAS_TYPES_H
-
-/* EAS_RESULT return codes */
-typedef long EAS_RESULT;
-#define EAS_SUCCESS 0
-#define EAS_FAILURE -1
-#define EAS_ERROR_INVALID_MODULE -2
-#define EAS_ERROR_MALLOC_FAILED -3
-#define EAS_ERROR_FILE_POS -4
-#define EAS_ERROR_INVALID_FILE_MODE -5
-#define EAS_ERROR_FILE_SEEK -6
-#define EAS_ERROR_FILE_LENGTH -7
-#define EAS_ERROR_NOT_IMPLEMENTED -8
-#define EAS_ERROR_CLOSE_FAILED -9
-#define EAS_ERROR_FILE_OPEN_FAILED -10
-#define EAS_ERROR_INVALID_HANDLE -11
-#define EAS_ERROR_NO_MIX_BUFFER -12
-#define EAS_ERROR_PARAMETER_RANGE -13
-#define EAS_ERROR_MAX_FILES_OPEN -14
-#define EAS_ERROR_UNRECOGNIZED_FORMAT -15
-#define EAS_BUFFER_SIZE_MISMATCH -16
-#define EAS_ERROR_FILE_FORMAT -17
-#define EAS_ERROR_SMF_NOT_INITIALIZED -18
-#define EAS_ERROR_LOCATE_BEYOND_END -19
-#define EAS_ERROR_INVALID_PCM_TYPE -20
-#define EAS_ERROR_MAX_PCM_STREAMS -21
-#define EAS_ERROR_NO_VOICE_ALLOCATED -22
-#define EAS_ERROR_INVALID_CHANNEL -23
-#define EAS_ERROR_ALREADY_STOPPED -24
-#define EAS_ERROR_FILE_READ_FAILED -25
-#define EAS_ERROR_HANDLE_INTEGRITY -26
-#define EAS_ERROR_MAX_STREAMS_OPEN -27
-#define EAS_ERROR_INVALID_PARAMETER -28
-#define EAS_ERROR_FEATURE_NOT_AVAILABLE -29
-#define EAS_ERROR_SOUND_LIBRARY -30
-#define EAS_ERROR_NOT_VALID_IN_THIS_STATE -31
-#define EAS_ERROR_NO_VIRTUAL_SYNTHESIZER -32
-#define EAS_ERROR_FILE_ALREADY_OPEN -33
-#define EAS_ERROR_FILE_ALREADY_CLOSED -34
-#define EAS_ERROR_INCOMPATIBLE_VERSION -35
-#define EAS_ERROR_QUEUE_IS_FULL -36
-#define EAS_ERROR_QUEUE_IS_EMPTY -37
-#define EAS_ERROR_FEATURE_ALREADY_ACTIVE -38
-
-/* special return codes */
-#define EAS_EOF 3
-#define EAS_STREAM_BUFFERING 4
-#define EAS_BUFFER_FULL 5
-
-/* EAS_STATE return codes */
-typedef long EAS_STATE;
-typedef enum
-{
- EAS_STATE_READY = 0,
- EAS_STATE_PLAY,
- EAS_STATE_STOPPING,
- EAS_STATE_PAUSING,
- EAS_STATE_STOPPED,
- EAS_STATE_PAUSED,
- EAS_STATE_OPEN,
- EAS_STATE_ERROR,
- EAS_STATE_EMPTY
-} E_EAS_STATE;
-
-/* constants */
-#ifndef EAS_CONST
-#define EAS_CONST const
-#endif
-
-/* definition for public interface functions */
-#ifndef EAS_PUBLIC
-#define EAS_PUBLIC
-#endif
-
-/* boolean values */
-typedef unsigned EAS_BOOL;
-typedef unsigned char EAS_BOOL8;
-
-#define EAS_FALSE 0
-#define EAS_TRUE 1
-
-/* scalar variable definitions */
-typedef unsigned char EAS_U8;
-typedef signed char EAS_I8;
-typedef char EAS_CHAR;
-
-typedef unsigned short EAS_U16;
-typedef short EAS_I16;
-
-typedef unsigned long EAS_U32;
-typedef long EAS_I32;
-
-typedef unsigned EAS_UINT;
-typedef int EAS_INT;
-typedef long EAS_LONG;
-
-/* audio output type */
-typedef short EAS_PCM;
-
-/* file open modes */
-typedef EAS_I32 EAS_FILE_MODE;
-#define EAS_FILE_READ 1
-#define EAS_FILE_WRITE 2
-
-/* file locator e.g. filename or memory pointer */
-typedef const void *EAS_FILE_LOCATOR;
-
-/* handle to stream */
-typedef struct s_eas_stream_tag *EAS_HANDLE;
-
-/* handle to file */
-typedef struct eas_hw_file_tag *EAS_FILE_HANDLE;
-
-/* handle for synthesizer data */
-typedef struct s_eas_data_tag *EAS_DATA_HANDLE;
-
-/* handle to persistent data for host wrapper interface */
-typedef struct eas_hw_inst_data_tag *EAS_HW_DATA_HANDLE;
-
-/* handle to sound library */
-typedef struct s_eas_sndlib_tag *EAS_SNDLIB_HANDLE;
-typedef struct s_eas_dls_tag *EAS_DLSLIB_HANDLE;
-
-/* pointer to frame buffer - used in split architecture only */
-typedef struct s_eas_frame_buffer_tag *EAS_FRAME_BUFFER_HANDLE;
-
-/* untyped pointer for instance data */
-typedef void *EAS_VOID_PTR;
-
-/* inline functions */
-#ifndef EAS_INLINE
-#if defined (__XCC__)
-#define EAS_INLINE __inline__
-#elif defined (__GNUC__)
-#define EAS_INLINE inline static
-#else
-#define EAS_INLINE __inline
-#endif
-#endif
-
-/* define NULL value */
-#ifndef NULL
-#define NULL 0
-#endif
-
-/* metadata types for metadata return codes */
-typedef enum
-{
- EAS_METADATA_UNKNOWN = 0,
- EAS_METADATA_TITLE,
- EAS_METADATA_AUTHOR,
- EAS_METADATA_COPYRIGHT,
- EAS_METADATA_LYRIC,
- EAS_METADATA_TEXT
-} E_EAS_METADATA_TYPE;
-
-/* metadata callback function */
-typedef void (*EAS_METADATA_CBFUNC) (E_EAS_METADATA_TYPE metaDataType, char *metaDataBuf, EAS_VOID_PTR pUserData);
-
-/* file types for metadata return codes */
-typedef enum
-{
- EAS_FILE_UNKNOWN = 0,
- EAS_FILE_SMF0,
- EAS_FILE_SMF1,
- EAS_FILE_SMAF_UNKNOWN,
- EAS_FILE_SMAF_MA2,
- EAS_FILE_SMAF_MA3,
- EAS_FILE_SMAF_MA5,
- EAS_FILE_CMX,
- EAS_FILE_MFI,
- EAS_FILE_OTA,
- EAS_FILE_IMELODY,
- EAS_FILE_RTTTL,
- EAS_FILE_XMF0,
- EAS_FILE_XMF1,
- EAS_FILE_WAVE_PCM,
- EAS_FILE_WAVE_IMA_ADPCM,
- EAS_FILE_MMAPI_TONE_CONTROL
-} E_EAS_FILE_TYPE;
-
-/* enumeration for synthesizers */
-typedef enum
-{
- EAS_MCU_SYNTH = 0,
- EAS_DSP_SYNTH
-} E_SYNTHESIZER;
-
-/* external audio callback program change */
-typedef struct s_ext_audio_prg_chg_tag
-{
- EAS_U16 bank;
- EAS_U8 program;
- EAS_U8 channel;
-} S_EXT_AUDIO_PRG_CHG;
-
-/* external audio callback event */
-typedef struct s_ext_audio_event_tag
-{
- EAS_U8 channel;
- EAS_U8 note;
- EAS_U8 velocity;
- EAS_BOOL8 noteOn;
-} S_EXT_AUDIO_EVENT;
-
-typedef struct s_midi_controllers_tag
-{
- EAS_U8 modWheel; /* CC1 */
- EAS_U8 volume; /* CC7 */
- EAS_U8 pan; /* CC10 */
- EAS_U8 expression; /* CC11 */
- EAS_U8 channelPressure; /* MIDI channel pressure */
-
-#ifdef _REVERB
- EAS_U8 reverbSend; /* CC91 */
-#endif
-
-#ifdef _CHORUS
- EAS_U8 chorusSend; /* CC93 */
-#endif
-} S_MIDI_CONTROLLERS;
-
-/* iMode play modes enumeration for EAS_SetPlayMode */
-typedef enum
-{
- IMODE_PLAY_ALL = 0,
- IMODE_PLAY_PARTIAL
-} E_I_MODE_PLAY_MODE;
-
-typedef EAS_BOOL (*EAS_EXT_PRG_CHG_FUNC) (EAS_VOID_PTR pInstData, S_EXT_AUDIO_PRG_CHG *pPrgChg);
-typedef EAS_BOOL (*EAS_EXT_EVENT_FUNC) (EAS_VOID_PTR pInstData, S_EXT_AUDIO_EVENT *pEvent);
-
-#endif /* #ifndef _EAS_TYPES_H */
+ *
+ *----------------------------------------------------------------------------
+ * Revision Control:
+ * $Revision: 726 $
+ * $Date: 2007-06-14 23:10:46 -0700 (Thu, 14 Jun 2007) $
+ *----------------------------------------------------------------------------
+*/
+
+#ifndef _EAS_TYPES_H
+#define _EAS_TYPES_H
+
+/* EAS_RESULT return codes */
+typedef long EAS_RESULT;
+#define EAS_SUCCESS 0
+#define EAS_FAILURE -1
+#define EAS_ERROR_INVALID_MODULE -2
+#define EAS_ERROR_MALLOC_FAILED -3
+#define EAS_ERROR_FILE_POS -4
+#define EAS_ERROR_INVALID_FILE_MODE -5
+#define EAS_ERROR_FILE_SEEK -6
+#define EAS_ERROR_FILE_LENGTH -7
+#define EAS_ERROR_NOT_IMPLEMENTED -8
+#define EAS_ERROR_CLOSE_FAILED -9
+#define EAS_ERROR_FILE_OPEN_FAILED -10
+#define EAS_ERROR_INVALID_HANDLE -11
+#define EAS_ERROR_NO_MIX_BUFFER -12
+#define EAS_ERROR_PARAMETER_RANGE -13
+#define EAS_ERROR_MAX_FILES_OPEN -14
+#define EAS_ERROR_UNRECOGNIZED_FORMAT -15
+#define EAS_BUFFER_SIZE_MISMATCH -16
+#define EAS_ERROR_FILE_FORMAT -17
+#define EAS_ERROR_SMF_NOT_INITIALIZED -18
+#define EAS_ERROR_LOCATE_BEYOND_END -19
+#define EAS_ERROR_INVALID_PCM_TYPE -20
+#define EAS_ERROR_MAX_PCM_STREAMS -21
+#define EAS_ERROR_NO_VOICE_ALLOCATED -22
+#define EAS_ERROR_INVALID_CHANNEL -23
+#define EAS_ERROR_ALREADY_STOPPED -24
+#define EAS_ERROR_FILE_READ_FAILED -25
+#define EAS_ERROR_HANDLE_INTEGRITY -26
+#define EAS_ERROR_MAX_STREAMS_OPEN -27
+#define EAS_ERROR_INVALID_PARAMETER -28
+#define EAS_ERROR_FEATURE_NOT_AVAILABLE -29
+#define EAS_ERROR_SOUND_LIBRARY -30
+#define EAS_ERROR_NOT_VALID_IN_THIS_STATE -31
+#define EAS_ERROR_NO_VIRTUAL_SYNTHESIZER -32
+#define EAS_ERROR_FILE_ALREADY_OPEN -33
+#define EAS_ERROR_FILE_ALREADY_CLOSED -34
+#define EAS_ERROR_INCOMPATIBLE_VERSION -35
+#define EAS_ERROR_QUEUE_IS_FULL -36
+#define EAS_ERROR_QUEUE_IS_EMPTY -37
+#define EAS_ERROR_FEATURE_ALREADY_ACTIVE -38
+
+/* special return codes */
+#define EAS_EOF 3
+#define EAS_STREAM_BUFFERING 4
+#define EAS_BUFFER_FULL 5
+
+/* EAS_STATE return codes */
+typedef long EAS_STATE;
+typedef enum
+{
+ EAS_STATE_READY = 0,
+ EAS_STATE_PLAY,
+ EAS_STATE_STOPPING,
+ EAS_STATE_PAUSING,
+ EAS_STATE_STOPPED,
+ EAS_STATE_PAUSED,
+ EAS_STATE_OPEN,
+ EAS_STATE_ERROR,
+ EAS_STATE_EMPTY
+} E_EAS_STATE;
+
+/* constants */
+#ifndef EAS_CONST
+#define EAS_CONST const
+#endif
+
+/* definition for public interface functions */
+#ifndef EAS_PUBLIC
+#define EAS_PUBLIC
+#endif
+
+/* boolean values */
+typedef unsigned EAS_BOOL;
+typedef unsigned char EAS_BOOL8;
+
+#define EAS_FALSE 0
+#define EAS_TRUE 1
+
+/* scalar variable definitions */
+typedef unsigned char EAS_U8;
+typedef signed char EAS_I8;
+typedef char EAS_CHAR;
+
+typedef unsigned short EAS_U16;
+typedef short EAS_I16;
+
+typedef unsigned long EAS_U32;
+typedef long EAS_I32;
+
+typedef unsigned EAS_UINT;
+typedef int EAS_INT;
+typedef long EAS_LONG;
+
+/* audio output type */
+typedef short EAS_PCM;
+
+/* file open modes */
+typedef EAS_I32 EAS_FILE_MODE;
+#define EAS_FILE_READ 1
+#define EAS_FILE_WRITE 2
+
+/* file locator e.g. filename or memory pointer */
+typedef const void *EAS_FILE_LOCATOR;
+
+/* handle to stream */
+typedef struct s_eas_stream_tag *EAS_HANDLE;
+
+/* handle to file */
+typedef struct eas_hw_file_tag *EAS_FILE_HANDLE;
+
+/* handle for synthesizer data */
+typedef struct s_eas_data_tag *EAS_DATA_HANDLE;
+
+/* handle to persistent data for host wrapper interface */
+typedef struct eas_hw_inst_data_tag *EAS_HW_DATA_HANDLE;
+
+/* handle to sound library */
+typedef struct s_eas_sndlib_tag *EAS_SNDLIB_HANDLE;
+typedef struct s_eas_dls_tag *EAS_DLSLIB_HANDLE;
+
+/* pointer to frame buffer - used in split architecture only */
+typedef struct s_eas_frame_buffer_tag *EAS_FRAME_BUFFER_HANDLE;
+
+/* untyped pointer for instance data */
+typedef void *EAS_VOID_PTR;
+
+/* inline functions */
+#ifndef EAS_INLINE
+#if defined (__XCC__)
+#define EAS_INLINE __inline__
+#elif defined (__GNUC__)
+#define EAS_INLINE inline static
+#else
+#define EAS_INLINE __inline
+#endif
+#endif
+
+/* define NULL value */
+#ifndef NULL
+#define NULL 0
+#endif
+
+/* metadata types for metadata return codes */
+typedef enum
+{
+ EAS_METADATA_UNKNOWN = 0,
+ EAS_METADATA_TITLE,
+ EAS_METADATA_AUTHOR,
+ EAS_METADATA_COPYRIGHT,
+ EAS_METADATA_LYRIC,
+ EAS_METADATA_TEXT
+} E_EAS_METADATA_TYPE;
+
+/* metadata callback function */
+typedef void (*EAS_METADATA_CBFUNC) (E_EAS_METADATA_TYPE metaDataType, char *metaDataBuf, EAS_VOID_PTR pUserData);
+
+/* file types for metadata return codes */
+typedef enum
+{
+ EAS_FILE_UNKNOWN = 0,
+ EAS_FILE_SMF0,
+ EAS_FILE_SMF1,
+ EAS_FILE_SMAF_UNKNOWN,
+ EAS_FILE_SMAF_MA2,
+ EAS_FILE_SMAF_MA3,
+ EAS_FILE_SMAF_MA5,
+ EAS_FILE_CMX,
+ EAS_FILE_MFI,
+ EAS_FILE_OTA,
+ EAS_FILE_IMELODY,
+ EAS_FILE_RTTTL,
+ EAS_FILE_XMF0,
+ EAS_FILE_XMF1,
+ EAS_FILE_WAVE_PCM,
+ EAS_FILE_WAVE_IMA_ADPCM,
+ EAS_FILE_MMAPI_TONE_CONTROL
+} E_EAS_FILE_TYPE;
+
+/* enumeration for synthesizers */
+typedef enum
+{
+ EAS_MCU_SYNTH = 0,
+ EAS_DSP_SYNTH
+} E_SYNTHESIZER;
+
+/* external audio callback program change */
+typedef struct s_ext_audio_prg_chg_tag
+{
+ EAS_U16 bank;
+ EAS_U8 program;
+ EAS_U8 channel;
+} S_EXT_AUDIO_PRG_CHG;
+
+/* external audio callback event */
+typedef struct s_ext_audio_event_tag
+{
+ EAS_U8 channel;
+ EAS_U8 note;
+ EAS_U8 velocity;
+ EAS_BOOL8 noteOn;
+} S_EXT_AUDIO_EVENT;
+
+typedef struct s_midi_controllers_tag
+{
+ EAS_U8 modWheel; /* CC1 */
+ EAS_U8 volume; /* CC7 */
+ EAS_U8 pan; /* CC10 */
+ EAS_U8 expression; /* CC11 */
+ EAS_U8 channelPressure; /* MIDI channel pressure */
+
+#ifdef _REVERB
+ EAS_U8 reverbSend; /* CC91 */
+#endif
+
+#ifdef _CHORUS
+ EAS_U8 chorusSend; /* CC93 */
+#endif
+} S_MIDI_CONTROLLERS;
+
+/* iMode play modes enumeration for EAS_SetPlayMode */
+typedef enum
+{
+ IMODE_PLAY_ALL = 0,
+ IMODE_PLAY_PARTIAL
+} E_I_MODE_PLAY_MODE;
+
+typedef EAS_BOOL (*EAS_EXT_PRG_CHG_FUNC) (EAS_VOID_PTR pInstData, S_EXT_AUDIO_PRG_CHG *pPrgChg);
+typedef EAS_BOOL (*EAS_EXT_EVENT_FUNC) (EAS_VOID_PTR pInstData, S_EXT_AUDIO_EVENT *pEvent);
+
+#endif /* #ifndef _EAS_TYPES_H */
diff --git a/arm-fm-22k/host_src/eas_wave.c b/arm-fm-22k/host_src/eas_wave.c
index 02fed6e..4f6ffbd 100644
--- a/arm-fm-22k/host_src/eas_wave.c
+++ b/arm-fm-22k/host_src/eas_wave.c
@@ -1,13 +1,13 @@
-/*----------------------------------------------------------------------------
- *
- * File:
- * eas_wave.c
- *
- * Contents and purpose:
- * This module contains .WAV file functions for the EAS synthesizer
- * test harness.
- *
- * Copyright Sonic Network Inc. 2005
+/*----------------------------------------------------------------------------
+ *
+ * File:
+ * eas_wave.c
+ *
+ * Contents and purpose:
+ * This module contains .WAV file functions for the EAS synthesizer
+ * test harness.
+ *
+ * Copyright Sonic Network Inc. 2005
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -20,404 +20,404 @@
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
- *----------------------------------------------------------------------------
- * Revision Control:
- * $Revision: 658 $
- * $Date: 2007-04-24 13:35:49 -0700 (Tue, 24 Apr 2007) $
- *----------------------------------------------------------------------------
-*/
-
-/* lint complaints about most C library headers, so we use our own during lint step */
-#ifdef _lint
-#include "lint_stdlib.h"
-#else
-#include <stdio.h>
-#include <stdlib.h>
-#endif
-
-#include "eas_wave.h"
-
-/* .WAV file format tags */
-const EAS_U32 riffTag = 0x46464952;
-const EAS_U32 waveTag = 0x45564157;
-const EAS_U32 fmtTag = 0x20746d66;
-const EAS_U32 dataTag = 0x61746164;
-
-#ifdef _BIG_ENDIAN
-/*----------------------------------------------------------------------------
- * FlipDWord()
- *----------------------------------------------------------------------------
- * Purpose: Endian flip a DWORD for big-endian processors
- *
- * Inputs:
- *
- * Outputs:
- *
- *----------------------------------------------------------------------------
-*/
-static void FlipDWord (EAS_U32 *pValue)
-{
- EAS_U8 *p;
- EAS_U32 temp;
-
- p = (EAS_U8*) pValue;
- temp = (((((p[3] << 8) | p[2]) << 8) | p[1]) << 8) | p[0];
- *pValue = temp;
-}
-
-/*----------------------------------------------------------------------------
- * FlipWord()
- *----------------------------------------------------------------------------
- * Purpose: Endian flip a WORD for big-endian processors
- *
- * Inputs:
- *
- * Outputs:
- *
- *----------------------------------------------------------------------------
-*/
-static void FlipWord (EAS_U16 *pValue)
-{
- EAS_U8 *p;
- EAS_U16 temp;
-
- p = (EAS_U8*) pValue;
- temp = (p[1] << 8) | p[0];
- *pValue = temp;
-}
-
-/*----------------------------------------------------------------------------
- * FlipWaveHeader()
- *----------------------------------------------------------------------------
- * Purpose: Endian flip the wave header for big-endian processors
- *
- * Inputs:
- *
- * Outputs:
- *
- *----------------------------------------------------------------------------
-*/
-static void FlipWaveHeader (WAVE_HEADER *p)
-{
-
- FlipDWord(&p->nRiffTag);
- FlipDWord(&p->nRiffSize);
- FlipDWord(&p->nWaveTag);
- FlipDWord(&p->nFmtTag);
- FlipDWord(&p->nFmtSize);
- FlipDWord(&p->nDataTag);
- FlipDWord(&p->nDataSize);
- FlipWord(&p->fc.wFormatTag);
- FlipWord(&p->fc.nChannels);
- FlipDWord(&p->fc.nSamplesPerSec);
- FlipDWord(&p->fc.nAvgBytesPerSec);
- FlipWord(&p->fc.nBlockAlign);
- FlipWord(&p->fc.wBitsPerSample);
-
-}
-#endif
-
-/*----------------------------------------------------------------------------
- * WaveFileCreate()
- *----------------------------------------------------------------------------
- * Purpose: Opens a wave file for writing and writes the header
- *
- * Inputs:
- *
- * Outputs:
- *
- *----------------------------------------------------------------------------
-*/
-
-WAVE_FILE *WaveFileCreate (const char *filename, EAS_I32 nChannels, EAS_I32 nSamplesPerSec, EAS_I32 wBitsPerSample)
-{
- WAVE_FILE *wFile;
-
- /* allocate memory */
- wFile = malloc(sizeof(WAVE_FILE));
- if (!wFile)
- return NULL;
- wFile->write = EAS_TRUE;
-
- /* create the file */
- wFile->file = fopen(filename,"wb");
- if (!wFile->file)
- {
- free(wFile);
- return NULL;
- }
-
- /* initialize PCM format .WAV file header */
- wFile->wh.nRiffTag = riffTag;
- wFile->wh.nRiffSize = sizeof(WAVE_HEADER) - 8;
- wFile->wh.nWaveTag = waveTag;
- wFile->wh.nFmtTag = fmtTag;
- wFile->wh.nFmtSize = sizeof(FMT_CHUNK);
-
- /* initalize 'fmt' chunk */
- wFile->wh.fc.wFormatTag = 1;
- wFile->wh.fc.nChannels = (EAS_U16) nChannels;
- wFile->wh.fc.nSamplesPerSec = (EAS_U32) nSamplesPerSec;
- wFile->wh.fc.wBitsPerSample = (EAS_U16) wBitsPerSample;
- wFile->wh.fc.nBlockAlign = (EAS_U16) (nChannels * (EAS_U16) (wBitsPerSample / 8));
- wFile->wh.fc.nAvgBytesPerSec = wFile->wh.fc.nBlockAlign * (EAS_U32) nSamplesPerSec;
-
- /* initialize 'data' chunk */
- wFile->wh.nDataTag = dataTag;
- wFile->wh.nDataSize = 0;
-
-#ifdef _BIG_ENDIAN
- FlipWaveHeader(&wFile->wh);
-#endif
-
- /* write the header */
- if (fwrite(&wFile->wh, sizeof(WAVE_HEADER), 1, wFile->file) != 1)
- {
- fclose(wFile->file);
- free(wFile);
- return NULL;
- }
-
-#ifdef _BIG_ENDIAN
- FlipWaveHeader(&wFile->wh);
-#endif
-
- /* return the file handle */
- return wFile;
-} /* end WaveFileCreate */
-
-/*----------------------------------------------------------------------------
- * WaveFileWrite()
- *----------------------------------------------------------------------------
- * Purpose: Writes data to the wave file
- *
- * Inputs:
- *
- * Outputs:
- *
- *----------------------------------------------------------------------------
-*/
-EAS_I32 WaveFileWrite (WAVE_FILE *wFile, void *buffer, EAS_I32 n)
-{
- EAS_I32 count;
-
- /* make sure we have an open file */
- if (wFile == NULL)
- {
- return 0;
- }
-
-#ifdef _BIG_ENDIAN
- {
- EAS_I32 i;
- EAS_U16 *p;
- p = buffer;
- i = n >> 1;
- while (i--)
- FlipWord(p++);
- }
-#endif
-
- /* write the data */
- count = (EAS_I32) fwrite(buffer, 1, (size_t) n, wFile->file);
-
- /* add the number of bytes written */
- wFile->wh.nRiffSize += (EAS_U32) count;
- wFile->wh.nDataSize += (EAS_U32) count;
-
- /* return the count of bytes written */
- return count;
-} /* end WriteWaveHeader */
-
-/*----------------------------------------------------------------------------
- * WaveFileClose()
- *----------------------------------------------------------------------------
- * Purpose: Opens a wave file for writing and writes the header
- *
- * Inputs:
- *
- * Outputs:
- *
- *----------------------------------------------------------------------------
-*/
-
-EAS_BOOL WaveFileClose (WAVE_FILE *wFile)
-{
- EAS_I32 count = 1;
-
- /* return to beginning of file and write the header */
- if (wFile->write)
- {
- if (fseek(wFile->file, 0L, SEEK_SET) == 0)
- {
-
-#ifdef _BIG_ENDIAN
- FlipWaveHeader(&wFile->wh);
-#endif
- count = (EAS_I32) fwrite(&wFile->wh, sizeof(WAVE_HEADER), 1, wFile->file);
-#ifdef _BIG_ENDIAN
- FlipWaveHeader(&wFile->wh);
-#endif
- }
- }
-
- /* close the file */
- if (fclose(wFile->file) != 0)
- count = 0;
-
- /* free the memory */
- free(wFile);
-
- /* return the file handle */
- return (count == 1 ? EAS_TRUE : EAS_FALSE);
-} /* end WaveFileClose */
-
-#ifdef _WAVE_FILE_READ
-#ifdef _BIG_ENDIAN
-#error "WaveFileOpen not currently supported on big-endian processors"
-#endif
-/*----------------------------------------------------------------------------
- * WaveFileOpen()
- *----------------------------------------------------------------------------
- * Purpose: Opens a wave file for reading and reads the header
- *
- * Inputs:
- *
- * Outputs:
- *
- *----------------------------------------------------------------------------
-*/
-
-WAVE_FILE *WaveFileOpen (const char *filename)
-{
- WAVE_FILE *wFile;
- struct
- {
- EAS_U32 tag;
- EAS_U32 size;
- } chunk;
- EAS_U32 tag;
- EAS_I32 startChunkPos;
- EAS_INT state;
- EAS_BOOL done;
-
- /* allocate memory */
- wFile = malloc(sizeof(WAVE_FILE));
- if (!wFile)
- return NULL;
-
- /* open the file */
- wFile->write = EAS_FALSE;
- wFile->file = fopen(filename,"rb");
- if (!wFile->file)
- {
- free(wFile);
- return NULL;
- }
-
- /* make lint happy */
- chunk.tag = chunk.size = 0;
- startChunkPos = 0;
-
- /* read the RIFF tag and file size */
- state = 0;
- done = EAS_FALSE;
- while (!done)
- {
-
- switch(state)
- {
- /* read the RIFF tag */
- case 0:
- if (fread(&chunk, sizeof(chunk), 1, wFile->file) != 1)
- done = EAS_TRUE;
- else
- {
- if (chunk.tag != riffTag)
- done = EAS_TRUE;
- else
- state++;
- }
- break;
-
- /* read the WAVE tag */
- case 1:
- if (fread(&tag, sizeof(tag), 1, wFile->file) != 1)
- done = EAS_TRUE;
- else
- {
- if (tag != waveTag)
- done = EAS_TRUE;
- else
- state++;
- }
- break;
-
- /* looking for fmt chunk */
- case 2:
- if (fread(&chunk, sizeof(chunk), 1, wFile->file) != 1)
- done = EAS_TRUE;
- else
- {
- startChunkPos = ftell(wFile->file);
-
- /* not fmt tag, skip it */
- if (chunk.tag != fmtTag)
- fseek(wFile->file, startChunkPos + (EAS_I32) chunk.size, SEEK_SET);
- else
- state++;
- }
- break;
-
- /* read fmt chunk */
- case 3:
- if (fread(&wFile->wh.fc, sizeof(FMT_CHUNK), 1, wFile->file) != 1)
- done = EAS_TRUE;
- else
- {
- fseek(wFile->file, startChunkPos + (EAS_I32) chunk.size, SEEK_SET);
- state++;
- }
- break;
-
- /* looking for data chunk */
- case 4:
- if (fread(&chunk, sizeof(chunk), 1, wFile->file) != 1)
- done = EAS_TRUE;
- else
- {
- startChunkPos = ftell(wFile->file);
-
- /* not data tag, skip it */
- if (chunk.tag != dataTag)
- fseek(wFile->file, startChunkPos + (EAS_I32) chunk.size, SEEK_SET);
- else
- {
- wFile->dataSize = chunk.size;
- state++;
- done = EAS_TRUE;
- }
- }
- break;
-
- default:
- done = EAS_TRUE;
- break;
- }
- }
-
- /* if not final state, an error occurred */
- if (state != 5)
- {
- fclose(wFile->file);
- free(wFile);
- return NULL;
- }
-
- /* return the file handle */
- return wFile;
-} /* end WaveFileOpen */
-#endif
-
-
-
+ *----------------------------------------------------------------------------
+ * Revision Control:
+ * $Revision: 658 $
+ * $Date: 2007-04-24 13:35:49 -0700 (Tue, 24 Apr 2007) $
+ *----------------------------------------------------------------------------
+*/
+
+/* lint complaints about most C library headers, so we use our own during lint step */
+#ifdef _lint
+#include "lint_stdlib.h"
+#else
+#include <stdio.h>
+#include <stdlib.h>
+#endif
+
+#include "eas_wave.h"
+
+/* .WAV file format tags */
+const EAS_U32 riffTag = 0x46464952;
+const EAS_U32 waveTag = 0x45564157;
+const EAS_U32 fmtTag = 0x20746d66;
+const EAS_U32 dataTag = 0x61746164;
+
+#ifdef _BIG_ENDIAN
+/*----------------------------------------------------------------------------
+ * FlipDWord()
+ *----------------------------------------------------------------------------
+ * Purpose: Endian flip a DWORD for big-endian processors
+ *
+ * Inputs:
+ *
+ * Outputs:
+ *
+ *----------------------------------------------------------------------------
+*/
+static void FlipDWord (EAS_U32 *pValue)
+{
+ EAS_U8 *p;
+ EAS_U32 temp;
+
+ p = (EAS_U8*) pValue;
+ temp = (((((p[3] << 8) | p[2]) << 8) | p[1]) << 8) | p[0];
+ *pValue = temp;
+}
+
+/*----------------------------------------------------------------------------
+ * FlipWord()
+ *----------------------------------------------------------------------------
+ * Purpose: Endian flip a WORD for big-endian processors
+ *
+ * Inputs:
+ *
+ * Outputs:
+ *
+ *----------------------------------------------------------------------------
+*/
+static void FlipWord (EAS_U16 *pValue)
+{
+ EAS_U8 *p;
+ EAS_U16 temp;
+
+ p = (EAS_U8*) pValue;
+ temp = (p[1] << 8) | p[0];
+ *pValue = temp;
+}
+
+/*----------------------------------------------------------------------------
+ * FlipWaveHeader()
+ *----------------------------------------------------------------------------
+ * Purpose: Endian flip the wave header for big-endian processors
+ *
+ * Inputs:
+ *
+ * Outputs:
+ *
+ *----------------------------------------------------------------------------
+*/
+static void FlipWaveHeader (WAVE_HEADER *p)
+{
+
+ FlipDWord(&p->nRiffTag);
+ FlipDWord(&p->nRiffSize);
+ FlipDWord(&p->nWaveTag);
+ FlipDWord(&p->nFmtTag);
+ FlipDWord(&p->nFmtSize);
+ FlipDWord(&p->nDataTag);
+ FlipDWord(&p->nDataSize);
+ FlipWord(&p->fc.wFormatTag);
+ FlipWord(&p->fc.nChannels);
+ FlipDWord(&p->fc.nSamplesPerSec);
+ FlipDWord(&p->fc.nAvgBytesPerSec);
+ FlipWord(&p->fc.nBlockAlign);
+ FlipWord(&p->fc.wBitsPerSample);
+
+}
+#endif
+
+/*----------------------------------------------------------------------------
+ * WaveFileCreate()
+ *----------------------------------------------------------------------------
+ * Purpose: Opens a wave file for writing and writes the header
+ *
+ * Inputs:
+ *
+ * Outputs:
+ *
+ *----------------------------------------------------------------------------
+*/
+
+WAVE_FILE *WaveFileCreate (const char *filename, EAS_I32 nChannels, EAS_I32 nSamplesPerSec, EAS_I32 wBitsPerSample)
+{
+ WAVE_FILE *wFile;
+
+ /* allocate memory */
+ wFile = malloc(sizeof(WAVE_FILE));
+ if (!wFile)
+ return NULL;
+ wFile->write = EAS_TRUE;
+
+ /* create the file */
+ wFile->file = fopen(filename,"wb");
+ if (!wFile->file)
+ {
+ free(wFile);
+ return NULL;
+ }
+
+ /* initialize PCM format .WAV file header */
+ wFile->wh.nRiffTag = riffTag;
+ wFile->wh.nRiffSize = sizeof(WAVE_HEADER) - 8;
+ wFile->wh.nWaveTag = waveTag;
+ wFile->wh.nFmtTag = fmtTag;
+ wFile->wh.nFmtSize = sizeof(FMT_CHUNK);
+
+ /* initalize 'fmt' chunk */
+ wFile->wh.fc.wFormatTag = 1;
+ wFile->wh.fc.nChannels = (EAS_U16) nChannels;
+ wFile->wh.fc.nSamplesPerSec = (EAS_U32) nSamplesPerSec;
+ wFile->wh.fc.wBitsPerSample = (EAS_U16) wBitsPerSample;
+ wFile->wh.fc.nBlockAlign = (EAS_U16) (nChannels * (EAS_U16) (wBitsPerSample / 8));
+ wFile->wh.fc.nAvgBytesPerSec = wFile->wh.fc.nBlockAlign * (EAS_U32) nSamplesPerSec;
+
+ /* initialize 'data' chunk */
+ wFile->wh.nDataTag = dataTag;
+ wFile->wh.nDataSize = 0;
+
+#ifdef _BIG_ENDIAN
+ FlipWaveHeader(&wFile->wh);
+#endif
+
+ /* write the header */
+ if (fwrite(&wFile->wh, sizeof(WAVE_HEADER), 1, wFile->file) != 1)
+ {
+ fclose(wFile->file);
+ free(wFile);
+ return NULL;
+ }
+
+#ifdef _BIG_ENDIAN
+ FlipWaveHeader(&wFile->wh);
+#endif
+
+ /* return the file handle */
+ return wFile;
+} /* end WaveFileCreate */
+
+/*----------------------------------------------------------------------------
+ * WaveFileWrite()
+ *----------------------------------------------------------------------------
+ * Purpose: Writes data to the wave file
+ *
+ * Inputs:
+ *
+ * Outputs:
+ *
+ *----------------------------------------------------------------------------
+*/
+EAS_I32 WaveFileWrite (WAVE_FILE *wFile, void *buffer, EAS_I32 n)
+{
+ EAS_I32 count;
+
+ /* make sure we have an open file */
+ if (wFile == NULL)
+ {
+ return 0;
+ }
+
+#ifdef _BIG_ENDIAN
+ {
+ EAS_I32 i;
+ EAS_U16 *p;
+ p = buffer;
+ i = n >> 1;
+ while (i--)
+ FlipWord(p++);
+ }
+#endif
+
+ /* write the data */
+ count = (EAS_I32) fwrite(buffer, 1, (size_t) n, wFile->file);
+
+ /* add the number of bytes written */
+ wFile->wh.nRiffSize += (EAS_U32) count;
+ wFile->wh.nDataSize += (EAS_U32) count;
+
+ /* return the count of bytes written */
+ return count;
+} /* end WriteWaveHeader */
+
+/*----------------------------------------------------------------------------
+ * WaveFileClose()
+ *----------------------------------------------------------------------------
+ * Purpose: Opens a wave file for writing and writes the header
+ *
+ * Inputs:
+ *
+ * Outputs:
+ *
+ *----------------------------------------------------------------------------
+*/
+
+EAS_BOOL WaveFileClose (WAVE_FILE *wFile)
+{
+ EAS_I32 count = 1;
+
+ /* return to beginning of file and write the header */
+ if (wFile->write)
+ {
+ if (fseek(wFile->file, 0L, SEEK_SET) == 0)
+ {
+
+#ifdef _BIG_ENDIAN
+ FlipWaveHeader(&wFile->wh);
+#endif
+ count = (EAS_I32) fwrite(&wFile->wh, sizeof(WAVE_HEADER), 1, wFile->file);
+#ifdef _BIG_ENDIAN
+ FlipWaveHeader(&wFile->wh);
+#endif
+ }
+ }
+
+ /* close the file */
+ if (fclose(wFile->file) != 0)
+ count = 0;
+
+ /* free the memory */
+ free(wFile);
+
+ /* return the file handle */
+ return (count == 1 ? EAS_TRUE : EAS_FALSE);
+} /* end WaveFileClose */
+
+#ifdef _WAVE_FILE_READ
+#ifdef _BIG_ENDIAN
+#error "WaveFileOpen not currently supported on big-endian processors"
+#endif
+/*----------------------------------------------------------------------------
+ * WaveFileOpen()
+ *----------------------------------------------------------------------------
+ * Purpose: Opens a wave file for reading and reads the header
+ *
+ * Inputs:
+ *
+ * Outputs:
+ *
+ *----------------------------------------------------------------------------
+*/
+
+WAVE_FILE *WaveFileOpen (const char *filename)
+{
+ WAVE_FILE *wFile;
+ struct
+ {
+ EAS_U32 tag;
+ EAS_U32 size;
+ } chunk;
+ EAS_U32 tag;
+ EAS_I32 startChunkPos;
+ EAS_INT state;
+ EAS_BOOL done;
+
+ /* allocate memory */
+ wFile = malloc(sizeof(WAVE_FILE));
+ if (!wFile)
+ return NULL;
+
+ /* open the file */
+ wFile->write = EAS_FALSE;
+ wFile->file = fopen(filename,"rb");
+ if (!wFile->file)
+ {
+ free(wFile);
+ return NULL;
+ }
+
+ /* make lint happy */
+ chunk.tag = chunk.size = 0;
+ startChunkPos = 0;
+
+ /* read the RIFF tag and file size */
+ state = 0;
+ done = EAS_FALSE;
+ while (!done)
+ {
+
+ switch(state)
+ {
+ /* read the RIFF tag */
+ case 0:
+ if (fread(&chunk, sizeof(chunk), 1, wFile->file) != 1)
+ done = EAS_TRUE;
+ else
+ {
+ if (chunk.tag != riffTag)
+ done = EAS_TRUE;
+ else
+ state++;
+ }
+ break;
+
+ /* read the WAVE tag */
+ case 1:
+ if (fread(&tag, sizeof(tag), 1, wFile->file) != 1)
+ done = EAS_TRUE;
+ else
+ {
+ if (tag != waveTag)
+ done = EAS_TRUE;
+ else
+ state++;
+ }
+ break;
+
+ /* looking for fmt chunk */
+ case 2:
+ if (fread(&chunk, sizeof(chunk), 1, wFile->file) != 1)
+ done = EAS_TRUE;
+ else
+ {
+ startChunkPos = ftell(wFile->file);
+
+ /* not fmt tag, skip it */
+ if (chunk.tag != fmtTag)
+ fseek(wFile->file, startChunkPos + (EAS_I32) chunk.size, SEEK_SET);
+ else
+ state++;
+ }
+ break;
+
+ /* read fmt chunk */
+ case 3:
+ if (fread(&wFile->wh.fc, sizeof(FMT_CHUNK), 1, wFile->file) != 1)
+ done = EAS_TRUE;
+ else
+ {
+ fseek(wFile->file, startChunkPos + (EAS_I32) chunk.size, SEEK_SET);
+ state++;
+ }
+ break;
+
+ /* looking for data chunk */
+ case 4:
+ if (fread(&chunk, sizeof(chunk), 1, wFile->file) != 1)
+ done = EAS_TRUE;
+ else
+ {
+ startChunkPos = ftell(wFile->file);
+
+ /* not data tag, skip it */
+ if (chunk.tag != dataTag)
+ fseek(wFile->file, startChunkPos + (EAS_I32) chunk.size, SEEK_SET);
+ else
+ {
+ wFile->dataSize = chunk.size;
+ state++;
+ done = EAS_TRUE;
+ }
+ }
+ break;
+
+ default:
+ done = EAS_TRUE;
+ break;
+ }
+ }
+
+ /* if not final state, an error occurred */
+ if (state != 5)
+ {
+ fclose(wFile->file);
+ free(wFile);
+ return NULL;
+ }
+
+ /* return the file handle */
+ return wFile;
+} /* end WaveFileOpen */
+#endif
+
+
+
diff --git a/arm-fm-22k/host_src/eas_wave.h b/arm-fm-22k/host_src/eas_wave.h
index ca388f5..968782f 100644
--- a/arm-fm-22k/host_src/eas_wave.h
+++ b/arm-fm-22k/host_src/eas_wave.h
@@ -1,14 +1,14 @@
-/*----------------------------------------------------------------------------
- *
- * File:
- * eas_wave.h
- *
- * Contents and purpose:
- * Writes output to a .WAV file
- *
- * DO NOT MODIFY THIS FILE!
- *
- * Copyright Sonic Network Inc. 2005
+/*----------------------------------------------------------------------------
+ *
+ * File:
+ * eas_wave.h
+ *
+ * Contents and purpose:
+ * Writes output to a .WAV file
+ *
+ * DO NOT MODIFY THIS FILE!
+ *
+ * Copyright Sonic Network Inc. 2005
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -21,54 +21,54 @@
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
- *----------------------------------------------------------------------------
- * Revision Control:
- * $Revision: 82 $
- * $Date: 2006-07-10 11:45:19 -0700 (Mon, 10 Jul 2006) $
- *----------------------------------------------------------------------------
-*/
-
-#include "eas_types.h"
-
-/* sentinel */
-#ifndef _EAS_WAVE_H
-#define _EAS_WAVE_H
-
-/* .WAV file format chunk */
-typedef struct {
- EAS_U16 wFormatTag;
- EAS_U16 nChannels;
- EAS_U32 nSamplesPerSec;
- EAS_U32 nAvgBytesPerSec;
- EAS_U16 nBlockAlign;
- EAS_U16 wBitsPerSample;
-} FMT_CHUNK;
-
-/* .WAV file header */
-typedef struct {
- EAS_U32 nRiffTag;
- EAS_U32 nRiffSize;
- EAS_U32 nWaveTag;
- EAS_U32 nFmtTag;
- EAS_U32 nFmtSize;
- FMT_CHUNK fc;
- EAS_U32 nDataTag;
- EAS_U32 nDataSize;
-} WAVE_HEADER;
-
-typedef struct {
- WAVE_HEADER wh;
- FILE *file;
- EAS_BOOL write;
- EAS_U32 dataSize;
-} WAVE_FILE;
-
-WAVE_FILE *WaveFileCreate (const char *filename, EAS_I32 nChannels, EAS_I32 nSamplesPerSec, EAS_I32 wBitsPerSample);
-EAS_I32 WaveFileWrite (WAVE_FILE *wFile, void *buffer, EAS_I32 n);
-EAS_BOOL WaveFileClose (WAVE_FILE *wFile);
-WAVE_FILE *WaveFileOpen (const char *filename);
-
-#endif /* end #ifndef _EAS_WAVE_H */
-
-
-
+ *----------------------------------------------------------------------------
+ * Revision Control:
+ * $Revision: 82 $
+ * $Date: 2006-07-10 11:45:19 -0700 (Mon, 10 Jul 2006) $
+ *----------------------------------------------------------------------------
+*/
+
+#include "eas_types.h"
+
+/* sentinel */
+#ifndef _EAS_WAVE_H
+#define _EAS_WAVE_H
+
+/* .WAV file format chunk */
+typedef struct {
+ EAS_U16 wFormatTag;
+ EAS_U16 nChannels;
+ EAS_U32 nSamplesPerSec;
+ EAS_U32 nAvgBytesPerSec;
+ EAS_U16 nBlockAlign;
+ EAS_U16 wBitsPerSample;
+} FMT_CHUNK;
+
+/* .WAV file header */
+typedef struct {
+ EAS_U32 nRiffTag;
+ EAS_U32 nRiffSize;
+ EAS_U32 nWaveTag;
+ EAS_U32 nFmtTag;
+ EAS_U32 nFmtSize;
+ FMT_CHUNK fc;
+ EAS_U32 nDataTag;
+ EAS_U32 nDataSize;
+} WAVE_HEADER;
+
+typedef struct {
+ WAVE_HEADER wh;
+ FILE *file;
+ EAS_BOOL write;
+ EAS_U32 dataSize;
+} WAVE_FILE;
+
+WAVE_FILE *WaveFileCreate (const char *filename, EAS_I32 nChannels, EAS_I32 nSamplesPerSec, EAS_I32 wBitsPerSample);
+EAS_I32 WaveFileWrite (WAVE_FILE *wFile, void *buffer, EAS_I32 n);
+EAS_BOOL WaveFileClose (WAVE_FILE *wFile);
+WAVE_FILE *WaveFileOpen (const char *filename);
+
+#endif /* end #ifndef _EAS_WAVE_H */
+
+
+
diff --git a/arm-fm-22k/lib_src/eas_audioconst.h b/arm-fm-22k/lib_src/eas_audioconst.h
index 1cfa404..066148e 100644
--- a/arm-fm-22k/lib_src/eas_audioconst.h
+++ b/arm-fm-22k/lib_src/eas_audioconst.h
@@ -1,13 +1,13 @@
-/*----------------------------------------------------------------------------
- *
- * File:
- * eas_audioconst.h
- *
- * Contents and purpose:
- * Defines audio constants related to the sample rate, bit size, etc.
- *
- *
- * Copyright Sonic Network Inc. 2005
+/*----------------------------------------------------------------------------
+ *
+ * File:
+ * eas_audioconst.h
+ *
+ * Contents and purpose:
+ * Defines audio constants related to the sample rate, bit size, etc.
+ *
+ *
+ * Copyright Sonic Network Inc. 2005
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -20,78 +20,78 @@
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
- *
- *----------------------------------------------------------------------------
- * Revision Control:
- * $Revision: 82 $
- * $Date: 2006-07-10 11:45:19 -0700 (Mon, 10 Jul 2006) $
- *----------------------------------------------------------------------------
-*/
-
-#ifndef _EAS_AUDIOCONST_H
-#define _EAS_AUDIOCONST_H
-
-/*----------------------------------------------------------------------------
- * These macros define the various characteristics of the defined sample rates
- *----------------------------------------------------------------------------
- * BUFFER_SIZE_IN_MONO_SAMPLES size of buffer in samples
- * _OUTPUT_SAMPLE_RATE compiled output sample rate
- * AUDIO_FRAME_LENGTH length of an audio frame in 256ths of a millisecond
- * SYNTH_UPDATE_PERIOD_IN_BITS length of an audio frame (2^x samples)
- *----------------------------------------------------------------------------
-*/
-
-#if defined (_SAMPLE_RATE_8000)
-#define BUFFER_SIZE_IN_MONO_SAMPLES 32
-#define _OUTPUT_SAMPLE_RATE 8000
-#define AUDIO_FRAME_LENGTH 1024
-#define SYNTH_UPDATE_PERIOD_IN_BITS 5
-
-#elif defined (_SAMPLE_RATE_16000)
-#define BUFFER_SIZE_IN_MONO_SAMPLES 64
-#define _OUTPUT_SAMPLE_RATE 16000
-#define AUDIO_FRAME_LENGTH 1024
-#define SYNTH_UPDATE_PERIOD_IN_BITS 6
-
-#elif defined (_SAMPLE_RATE_20000)
-#define BUFFER_SIZE_IN_MONO_SAMPLES 128
-#define _OUTPUT_SAMPLE_RATE 20000
-#define AUDIO_FRAME_LENGTH 1638
-#define SYNTH_UPDATE_PERIOD_IN_BITS 7
-
-#elif defined (_SAMPLE_RATE_22050)
-#define BUFFER_SIZE_IN_MONO_SAMPLES 128
-#define _OUTPUT_SAMPLE_RATE 22050
-#define AUDIO_FRAME_LENGTH 1486
-#define SYNTH_UPDATE_PERIOD_IN_BITS 7
-
-#elif defined (_SAMPLE_RATE_24000)
-#define BUFFER_SIZE_IN_MONO_SAMPLES 128
-#define _OUTPUT_SAMPLE_RATE 24000
-#define AUDIO_FRAME_LENGTH 1365
-#define SYNTH_UPDATE_PERIOD_IN_BITS 7
-
-#elif defined (_SAMPLE_RATE_32000)
-#define BUFFER_SIZE_IN_MONO_SAMPLES 128
-#define _OUTPUT_SAMPLE_RATE 32000
-#define AUDIO_FRAME_LENGTH 1024
-#define SYNTH_UPDATE_PERIOD_IN_BITS 7
-
-#elif defined (_SAMPLE_RATE_44100)
-#define BUFFER_SIZE_IN_MONO_SAMPLES 256
-#define _OUTPUT_SAMPLE_RATE 44100
-#define AUDIO_FRAME_LENGTH 1486
-#define SYNTH_UPDATE_PERIOD_IN_BITS 8
-
-#elif defined (_SAMPLE_RATE_48000)
-#define BUFFER_SIZE_IN_MONO_SAMPLES 256
-#define _OUTPUT_SAMPLE_RATE 48000
-#define AUDIO_FRAME_LENGTH 1365
-#define SYNTH_UPDATE_PERIOD_IN_BITS 8
-
-#else
-#error "_SAMPLE_RATE_XXXXX must be defined to valid rate"
-#endif
-
-#endif /* #ifndef _EAS_AUDIOCONST_H */
-
+ *
+ *----------------------------------------------------------------------------
+ * Revision Control:
+ * $Revision: 82 $
+ * $Date: 2006-07-10 11:45:19 -0700 (Mon, 10 Jul 2006) $
+ *----------------------------------------------------------------------------
+*/
+
+#ifndef _EAS_AUDIOCONST_H
+#define _EAS_AUDIOCONST_H
+
+/*----------------------------------------------------------------------------
+ * These macros define the various characteristics of the defined sample rates
+ *----------------------------------------------------------------------------
+ * BUFFER_SIZE_IN_MONO_SAMPLES size of buffer in samples
+ * _OUTPUT_SAMPLE_RATE compiled output sample rate
+ * AUDIO_FRAME_LENGTH length of an audio frame in 256ths of a millisecond
+ * SYNTH_UPDATE_PERIOD_IN_BITS length of an audio frame (2^x samples)
+ *----------------------------------------------------------------------------
+*/
+
+#if defined (_SAMPLE_RATE_8000)
+#define BUFFER_SIZE_IN_MONO_SAMPLES 32
+#define _OUTPUT_SAMPLE_RATE 8000
+#define AUDIO_FRAME_LENGTH 1024
+#define SYNTH_UPDATE_PERIOD_IN_BITS 5
+
+#elif defined (_SAMPLE_RATE_16000)
+#define BUFFER_SIZE_IN_MONO_SAMPLES 64
+#define _OUTPUT_SAMPLE_RATE 16000
+#define AUDIO_FRAME_LENGTH 1024
+#define SYNTH_UPDATE_PERIOD_IN_BITS 6
+
+#elif defined (_SAMPLE_RATE_20000)
+#define BUFFER_SIZE_IN_MONO_SAMPLES 128
+#define _OUTPUT_SAMPLE_RATE 20000
+#define AUDIO_FRAME_LENGTH 1638
+#define SYNTH_UPDATE_PERIOD_IN_BITS 7
+
+#elif defined (_SAMPLE_RATE_22050)
+#define BUFFER_SIZE_IN_MONO_SAMPLES 128
+#define _OUTPUT_SAMPLE_RATE 22050
+#define AUDIO_FRAME_LENGTH 1486
+#define SYNTH_UPDATE_PERIOD_IN_BITS 7
+
+#elif defined (_SAMPLE_RATE_24000)
+#define BUFFER_SIZE_IN_MONO_SAMPLES 128
+#define _OUTPUT_SAMPLE_RATE 24000
+#define AUDIO_FRAME_LENGTH 1365
+#define SYNTH_UPDATE_PERIOD_IN_BITS 7
+
+#elif defined (_SAMPLE_RATE_32000)
+#define BUFFER_SIZE_IN_MONO_SAMPLES 128
+#define _OUTPUT_SAMPLE_RATE 32000
+#define AUDIO_FRAME_LENGTH 1024
+#define SYNTH_UPDATE_PERIOD_IN_BITS 7
+
+#elif defined (_SAMPLE_RATE_44100)
+#define BUFFER_SIZE_IN_MONO_SAMPLES 256
+#define _OUTPUT_SAMPLE_RATE 44100
+#define AUDIO_FRAME_LENGTH 1486
+#define SYNTH_UPDATE_PERIOD_IN_BITS 8
+
+#elif defined (_SAMPLE_RATE_48000)
+#define BUFFER_SIZE_IN_MONO_SAMPLES 256
+#define _OUTPUT_SAMPLE_RATE 48000
+#define AUDIO_FRAME_LENGTH 1365
+#define SYNTH_UPDATE_PERIOD_IN_BITS 8
+
+#else
+#error "_SAMPLE_RATE_XXXXX must be defined to valid rate"
+#endif
+
+#endif /* #ifndef _EAS_AUDIOCONST_H */
+
diff --git a/arm-fm-22k/lib_src/eas_chorus.c b/arm-fm-22k/lib_src/eas_chorus.c
index bc42237..4a2c8d0 100644
--- a/arm-fm-22k/lib_src/eas_chorus.c
+++ b/arm-fm-22k/lib_src/eas_chorus.c
@@ -1,13 +1,13 @@
-/*----------------------------------------------------------------------------
- *
- * File:
- * eas_chorus.c
- *
- * Contents and purpose:
- * Contains the implementation of the Chorus effect.
- *
- *
- * Copyright Sonic Network Inc. 2006
+/*----------------------------------------------------------------------------
+ *
+ * File:
+ * eas_chorus.c
+ *
+ * Contents and purpose:
+ * Contains the implementation of the Chorus effect.
+ *
+ *
+ * Copyright Sonic Network Inc. 2006
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -20,585 +20,585 @@
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
- *
- *----------------------------------------------------------------------------
- * Revision Control:
- * $Revision: 499 $
- * $Date: 2006-12-11 16:07:20 -0800 (Mon, 11 Dec 2006) $
- *----------------------------------------------------------------------------
-*/
-
-#include "eas_data.h"
-#include "eas_effects.h"
-#include "eas_math.h"
-#include "eas_chorusdata.h"
-#include "eas_chorus.h"
-#include "eas_config.h"
-#include "eas_host.h"
-#include "eas_report.h"
-
-/* prototypes for effects interface */
-static EAS_RESULT ChorusInit (EAS_DATA_HANDLE pEASData, EAS_VOID_PTR *pInstData);
-static void ChorusProcess (EAS_VOID_PTR pInstData, EAS_PCM *pSrc, EAS_PCM *pDst, EAS_I32 numSamples);
-static EAS_RESULT ChorusShutdown (EAS_DATA_HANDLE pEASData, EAS_VOID_PTR pInstData);
-static EAS_RESULT ChorusGetParam (EAS_VOID_PTR pInstData, EAS_I32 param, EAS_I32 *pValue);
-static EAS_RESULT ChorusSetParam (EAS_VOID_PTR pInstData, EAS_I32 param, EAS_I32 value);
-
-/* common effects interface for configuration module */
-const S_EFFECTS_INTERFACE EAS_Chorus =
-{
- ChorusInit,
- ChorusProcess,
- ChorusShutdown,
- ChorusGetParam,
- ChorusSetParam
-};
-
-
-
-//LFO shape table used by the chorus, larger table would sound better
-//this is a sine wave, where 32767 = 1.0
-static const EAS_I16 EAS_chorusShape[CHORUS_SHAPE_SIZE] = {
- 0, 1608, 3212, 4808, 6393, 7962, 9512, 11309, 12539, 14010, 15446, 16846, 18204, 19519, 20787, 22005, 23170,
- 24279, 25329, 26319, 27245, 28105, 28898, 29621, 30273, 30852, 31356, 31785, 32137, 32412, 32609, 32728,
- 32767, 32728, 32609, 32412, 32137, 31785, 31356, 30852, 30273, 29621, 28898, 28105, 27245, 26319, 25329,
- 24279, 23170, 22005, 20787, 19519, 18204, 16846, 15446, 14010, 12539, 11039, 9512, 7962, 6393, 4808, 3212,
- 1608, 0, -1608, -3212, -4808, -6393, -7962, -9512, -11309, -12539, -14010, -15446, -16846, -18204, -19519,
- -20787, -22005, -23170, -24279, -25329, -26319, -27245, -28105, -28898, -29621, -30273, -30852, -31356, -31785,
- -32137, -32412, -32609, -32728, -32767, -32728, -32609, -32412, -32137, -31785, -31356, -30852, -30273, -29621,
- -28898, -28105, -27245, -26319, -25329, -24279, -23170, -22005, -20787, -19519, -18204, -16846, -15446, -14010,
- -12539, -11039, -9512, -7962, -6393, -4808, -3212, -1608
-};
-
-/*----------------------------------------------------------------------------
- * InitializeChorus()
- *----------------------------------------------------------------------------
- * Purpose: Initializes chorus parameters
- *
- *
- * Inputs:
- *
- * Outputs:
- *
- *----------------------------------------------------------------------------
-*/
-static EAS_RESULT ChorusInit (EAS_DATA_HANDLE pEASData, EAS_VOID_PTR *pInstData)
-{
- S_CHORUS_OBJECT *pChorusData;
- S_CHORUS_PRESET *pPreset;
- EAS_I32 index;
-
- /* check Configuration Module for data allocation */
- if (pEASData->staticMemoryModel)
- pChorusData = EAS_CMEnumFXData(EAS_MODULE_CHORUS);
-
- /* allocate dynamic memory */
- else
- pChorusData = EAS_HWMalloc(pEASData->hwInstData, sizeof(S_CHORUS_OBJECT));
-
- if (pChorusData == NULL)
- {
- { /* dpp: EAS_ReportEx(_EAS_SEVERITY_FATAL, "Failed to allocate Chorus memory\n"); */ }
- return EAS_ERROR_MALLOC_FAILED;
- }
-
- /* clear the structure */
- EAS_HWMemSet(pChorusData, 0, sizeof(S_CHORUS_OBJECT));
-
- ChorusReadInPresets(pChorusData);
-
- /* set some default values */
- pChorusData->bypass = EAS_CHORUS_BYPASS_DEFAULT;
- pChorusData->preset = EAS_CHORUS_PRESET_DEFAULT;
- pChorusData->m_nLevel = EAS_CHORUS_LEVEL_DEFAULT;
- pChorusData->m_nRate = EAS_CHORUS_RATE_DEFAULT;
- pChorusData->m_nDepth = EAS_CHORUS_DEPTH_DEFAULT;
-
- //chorus rate and depth need some massaging from preset value (which is sample rate independent)
-
- //convert rate from steps of .05 Hz to value which can be used as phase increment,
- //with current CHORUS_SHAPE_SIZE and rate limits, this fits into 16 bits
- //want to compute ((shapeSize * 65536) * (storedRate/20))/sampleRate;
- //computing it as below allows rate steps to be evenly spaced
- //uses 32 bit divide, but only once when new value is selected
- pChorusData->m_nRate = (EAS_I16)
- ((((EAS_I32)CHORUS_SHAPE_SIZE<<16)/(20*(EAS_I32)_OUTPUT_SAMPLE_RATE)) * pChorusData->m_nRate);
-
- //convert depth from steps of .05 ms, to samples, with 16 bit whole part, discard fraction
- //want to compute ((depth * sampleRate)/20000)
- //use the following approximation since 105/32 is roughly 65536/20000
- /*lint -e{704} use shift for performance */
- pChorusData->m_nDepth = (EAS_I16)
- (((((EAS_I32)pChorusData->m_nDepth * _OUTPUT_SAMPLE_RATE)>>5) * 105) >> 16);
-
- pChorusData->m_nLevel = pChorusData->m_nLevel;
-
- //zero delay memory for chorus
- for (index = CHORUS_L_SIZE - 1; index >= 0; index--)
- {
- pChorusData->chorusDelayL[index] = 0;
- }
- for (index = CHORUS_R_SIZE - 1; index >= 0; index--)
- {
- pChorusData->chorusDelayR[index] = 0;
- }
-
- //init delay line index, these are used to implement circular delay buffer
- pChorusData->chorusIndexL = 0;
- pChorusData->chorusIndexR = 0;
-
- //init LFO phase
- //16 bit whole part, 16 bit fraction
- pChorusData->lfoLPhase = 0;
- pChorusData->lfoRPhase = (CHORUS_SHAPE_SIZE << 16) >> 2; // 1/4 of total, i.e. 90 degrees out of phase;
-
- //init chorus delay position
- //right now chorus delay is a compile-time value, as is sample rate
- pChorusData->chorusTapPosition = (EAS_I16)((CHORUS_DELAY_MS * _OUTPUT_SAMPLE_RATE)/1000);
-
- //now copy from the new preset into Chorus
- pPreset = &pChorusData->m_sPreset.m_sPreset[pChorusData->m_nNextChorus];
-
- pChorusData->m_nLevel = pPreset->m_nLevel;
- pChorusData->m_nRate = pPreset->m_nRate;
- pChorusData->m_nDepth = pPreset->m_nDepth;
-
- pChorusData->m_nRate = (EAS_I16)
- ((((EAS_I32)CHORUS_SHAPE_SIZE<<16)/(20*(EAS_I32)_OUTPUT_SAMPLE_RATE)) * pChorusData->m_nRate);
-
- /*lint -e{704} use shift for performance */
- pChorusData->m_nDepth = (EAS_I16)
- (((((EAS_I32)pChorusData->m_nDepth * _OUTPUT_SAMPLE_RATE)>>5) * 105) >> 16);
-
- *pInstData = pChorusData;
-
- return EAS_SUCCESS;
-} /* end ChorusInit */
-
-/*----------------------------------------------------------------------------
- * WeightedTap()
- *----------------------------------------------------------------------------
- * Purpose: Does fractional array look-up using linear interpolation
- *
- * first convert indexDesired to actual desired index by taking into account indexReference
- * then do linear interpolation between two actual samples using fractional part
- *
- * Inputs:
- * array: pointer to array of signed 16 bit values, typically either PCM data or control data
- * indexReference: the circular buffer relative offset
- * indexDesired: the fractional index we are looking up (16 bits index + 16 bits fraction)
- * indexLimit: the total size of the array, used to compute buffer wrap
- *
- * Outputs:
- * Value from the input array, linearly interpolated between two actual data values
- *
- *----------------------------------------------------------------------------
-*/
-static EAS_I16 WeightedTap(const EAS_I16 *array, EAS_I16 indexReference, EAS_I32 indexDesired, EAS_I16 indexLimit)
-{
- EAS_I16 index;
- EAS_I16 fraction;
- EAS_I16 val1;
- EAS_I16 val2;
-
- //separate indexDesired into whole and fractional parts
- /*lint -e{704} use shift for performance */
- index = (EAS_I16)(indexDesired >> 16);
- /*lint -e{704} use shift for performance */
- fraction = (EAS_I16)((indexDesired>>1) & 0x07FFF); //just use 15 bits of fractional part
-
- //adjust whole part by indexReference
- index = indexReference - index;
- //make sure we stay within array bounds, this implements circular buffer
- while (index < 0)
- {
- index += indexLimit;
- }
-
- //get two adjacent values from the array
- val1 = array[index];
-
- //handle special case when index == 0, else typical case
- if (index == 0)
- {
- val2 = array[indexLimit-1]; //get last value from array
- }
- else
- {
- val2 = array[index-1]; //get previous value from array
- }
-
- //compute linear interpolation as (val1 + ((val2-val1)*fraction))
- return(val1 + (EAS_I16)MULT_EG1_EG1(val2-val1,fraction));
-}
-
-/*----------------------------------------------------------------------------
- * ChorusProcess()
- *----------------------------------------------------------------------------
- * Purpose: compute the chorus on the input buffer, and mix into output buffer
- *
- *
- * Inputs:
- * src: pointer to input buffer of PCM values to be processed
- * dst: pointer to output buffer of PCM values we are to sume the result with
- * bufSize: the number of sample frames (i.e. stereo samples) in the buffer
- *
- * Outputs:
- * None
- *
- *----------------------------------------------------------------------------
-*/
-//compute the chorus, and mix into output buffer
-static void ChorusProcess (EAS_VOID_PTR pInstData, EAS_PCM *pSrc, EAS_PCM *pDst, EAS_I32 numSamples)
-{
- EAS_I32 ix;
- EAS_I32 nChannelNumber;
- EAS_I16 lfoValueLeft;
- EAS_I16 lfoValueRight;
- EAS_I32 positionOffsetL;
- EAS_I32 positionOffsetR;
- EAS_PCM tapL;
- EAS_PCM tapR;
- EAS_I32 tempValue;
- EAS_PCM nInputSample;
- EAS_I32 nOutputSample;
- EAS_PCM *pIn;
- EAS_PCM *pOut;
-
- S_CHORUS_OBJECT *pChorusData;
-
- pChorusData = (S_CHORUS_OBJECT*) pInstData;
-
- //if the chorus is disabled or turned all the way down
- if (pChorusData->bypass == EAS_TRUE || pChorusData->m_nLevel == 0)
- {
- if (pSrc != pDst)
- EAS_HWMemCpy(pSrc, pDst, numSamples * NUM_OUTPUT_CHANNELS * (EAS_I32) sizeof(EAS_PCM));
- return;
- }
-
- if (pChorusData->m_nNextChorus != pChorusData->m_nCurrentChorus)
- {
- ChorusUpdate(pChorusData);
- }
-
- for (nChannelNumber = 0; nChannelNumber < NUM_OUTPUT_CHANNELS; nChannelNumber++)
- {
-
- pIn = pSrc + nChannelNumber;
- pOut = pDst + nChannelNumber;
-
- if(nChannelNumber==0)
- {
- for (ix = 0; ix < numSamples; ix++)
- {
- nInputSample = *pIn;
- pIn += NUM_OUTPUT_CHANNELS;
-
- //feed input into chorus delay line
- pChorusData->chorusDelayL[pChorusData->chorusIndexL] = nInputSample;
-
- //compute chorus lfo value using phase as fractional index into chorus shape table
- //resulting value is between -1.0 and 1.0, expressed as signed 16 bit number
- lfoValueLeft = WeightedTap(EAS_chorusShape, 0, pChorusData->lfoLPhase, CHORUS_SHAPE_SIZE);
-
- //scale chorus depth by lfo value to get relative fractional sample index
- //index is expressed as 32 bit number with 16 bit fractional part
- /*lint -e{703} use shift for performance */
- positionOffsetL = pChorusData->m_nDepth * (((EAS_I32)lfoValueLeft) << 1);
-
- //add fixed chorus delay to get actual fractional sample index
- positionOffsetL += ((EAS_I32)pChorusData->chorusTapPosition) << 16;
-
- //get tap value from chorus delay using fractional sample index
- tapL = WeightedTap(pChorusData->chorusDelayL, pChorusData->chorusIndexL, positionOffsetL, CHORUS_L_SIZE);
-
- //scale by chorus level, then sum with input buffer contents and saturate
- tempValue = MULT_EG1_EG1(tapL, pChorusData->m_nLevel);
- nOutputSample = SATURATE(tempValue + nInputSample);
-
- *pOut = (EAS_I16)SATURATE(nOutputSample);
- pOut += NUM_OUTPUT_CHANNELS;
-
-
- //increment chorus delay index and make it wrap as needed
- //this implements circular buffer
- if ((pChorusData->chorusIndexL+=1) >= CHORUS_L_SIZE)
- pChorusData->chorusIndexL = 0;
-
- //increment fractional lfo phase, and make it wrap as needed
- pChorusData->lfoLPhase += pChorusData->m_nRate;
- while (pChorusData->lfoLPhase >= (CHORUS_SHAPE_SIZE<<16))
- {
- pChorusData->lfoLPhase -= (CHORUS_SHAPE_SIZE<<16);
- }
- }
- }
- else
- {
- for (ix = 0; ix < numSamples; ix++)
- {
- nInputSample = *pIn;
- pIn += NUM_OUTPUT_CHANNELS;
-
- //feed input into chorus delay line
- pChorusData->chorusDelayR[pChorusData->chorusIndexR] = nInputSample;
-
- //compute chorus lfo value using phase as fractional index into chorus shape table
- //resulting value is between -1.0 and 1.0, expressed as signed 16 bit number
- lfoValueRight = WeightedTap(EAS_chorusShape, 0, pChorusData->lfoRPhase, CHORUS_SHAPE_SIZE);
-
- //scale chorus depth by lfo value to get relative fractional sample index
- //index is expressed as 32 bit number with 16 bit fractional part
- /*lint -e{703} use shift for performance */
- positionOffsetR = pChorusData->m_nDepth * (((EAS_I32)lfoValueRight) << 1);
-
- //add fixed chorus delay to get actual fractional sample index
- positionOffsetR += ((EAS_I32)pChorusData->chorusTapPosition) << 16;
-
- //get tap value from chorus delay using fractional sample index
- tapR = WeightedTap(pChorusData->chorusDelayR, pChorusData->chorusIndexR, positionOffsetR, CHORUS_R_SIZE);
-
- //scale by chorus level, then sum with output buffer contents and saturate
- tempValue = MULT_EG1_EG1(tapR, pChorusData->m_nLevel);
- nOutputSample = SATURATE(tempValue + nInputSample);
-
- *pOut = (EAS_I16)SATURATE(nOutputSample);
- pOut += NUM_OUTPUT_CHANNELS;
-
- //increment chorus delay index and make it wrap as needed
- //this implements circular buffer
- if ((pChorusData->chorusIndexR+=1) >= CHORUS_R_SIZE)
- pChorusData->chorusIndexR = 0;
-
- //increment fractional lfo phase, and make it wrap as needed
- pChorusData->lfoRPhase += pChorusData->m_nRate;
- while (pChorusData->lfoRPhase >= (CHORUS_SHAPE_SIZE<<16))
- {
- pChorusData->lfoRPhase -= (CHORUS_SHAPE_SIZE<<16);
- }
- }
- }
-
- }
-} /* end ChorusProcess */
-
-
-
-/*----------------------------------------------------------------------------
- * ChorusShutdown()
- *----------------------------------------------------------------------------
- * Purpose:
- * Initializes the Chorus effect.
- *
- * Inputs:
- * pInstData - handle to instance data
- *
- * Outputs:
- *
- *
- * Side Effects:
- *
- *----------------------------------------------------------------------------
-*/
-static EAS_RESULT ChorusShutdown (EAS_DATA_HANDLE pEASData, EAS_VOID_PTR pInstData)
-{
- /* check Configuration Module for static memory allocation */
- if (!pEASData->staticMemoryModel)
- EAS_HWFree(pEASData->hwInstData, pInstData);
- return EAS_SUCCESS;
-} /* end ChorusShutdown */
-
-/*----------------------------------------------------------------------------
- * ChorusGetParam()
- *----------------------------------------------------------------------------
- * Purpose:
- * Get a Chorus parameter
- *
- * Inputs:
- * pInstData - handle to instance data
- * param - parameter index
- * *pValue - pointer to variable to hold retrieved value
- *
- * Outputs:
- *
- *
- * Side Effects:
- *
- *----------------------------------------------------------------------------
-*/
-static EAS_RESULT ChorusGetParam (EAS_VOID_PTR pInstData, EAS_I32 param, EAS_I32 *pValue)
-{
- S_CHORUS_OBJECT *p;
-
- p = (S_CHORUS_OBJECT*) pInstData;
-
- switch (param)
- {
- case EAS_PARAM_CHORUS_BYPASS:
- *pValue = (EAS_I32) p->bypass;
- break;
- case EAS_PARAM_CHORUS_PRESET:
- *pValue = (EAS_I8) p->m_nCurrentChorus;
- break;
- case EAS_PARAM_CHORUS_RATE:
- *pValue = (EAS_I32) p->m_nRate;
- break;
- case EAS_PARAM_CHORUS_DEPTH:
- *pValue = (EAS_I32) p->m_nDepth;
- break;
- case EAS_PARAM_CHORUS_LEVEL:
- *pValue = (EAS_I32) p->m_nLevel;
- break;
- default:
- return EAS_ERROR_INVALID_PARAMETER;
- }
- return EAS_SUCCESS;
-} /* end ChorusGetParam */
-
-
-/*----------------------------------------------------------------------------
- * ChorusSetParam()
- *----------------------------------------------------------------------------
- * Purpose:
- * Set a Chorus parameter
- *
- * Inputs:
- * pInstData - handle to instance data
- * param - parameter index
- * *pValue - new paramter value
- *
- * Outputs:
- *
- *
- * Side Effects:
- *
- *----------------------------------------------------------------------------
-*/
-static EAS_RESULT ChorusSetParam (EAS_VOID_PTR pInstData, EAS_I32 param, EAS_I32 value)
-{
- S_CHORUS_OBJECT *p;
-
- p = (S_CHORUS_OBJECT*) pInstData;
-
- switch (param)
- {
- case EAS_PARAM_CHORUS_BYPASS:
- p->bypass = (EAS_BOOL) value;
- break;
- case EAS_PARAM_CHORUS_PRESET:
- if(value!=EAS_PARAM_CHORUS_PRESET1 && value!=EAS_PARAM_CHORUS_PRESET2 &&
- value!=EAS_PARAM_CHORUS_PRESET3 && value!=EAS_PARAM_CHORUS_PRESET4)
- return EAS_ERROR_INVALID_PARAMETER;
- p->m_nNextChorus = (EAS_I8)value;
- break;
- case EAS_PARAM_CHORUS_RATE:
- if(value<EAS_CHORUS_RATE_MIN || value>EAS_CHORUS_RATE_MAX)
- return EAS_ERROR_INVALID_PARAMETER;
- p->m_nRate = (EAS_I16) value;
- break;
- case EAS_PARAM_CHORUS_DEPTH:
- if(value<EAS_CHORUS_DEPTH_MIN || value>EAS_CHORUS_DEPTH_MAX)
- return EAS_ERROR_INVALID_PARAMETER;
- p->m_nDepth = (EAS_I16) value;
- break;
- case EAS_PARAM_CHORUS_LEVEL:
- if(value<EAS_CHORUS_LEVEL_MIN || value>EAS_CHORUS_LEVEL_MAX)
- return EAS_ERROR_INVALID_PARAMETER;
- p->m_nLevel = (EAS_I16) value;
- break;
-
- default:
- return EAS_ERROR_INVALID_PARAMETER;
- }
- return EAS_SUCCESS;
-} /* end ChorusSetParam */
-
-
-/*----------------------------------------------------------------------------
- * ChorusReadInPresets()
- *----------------------------------------------------------------------------
- * Purpose: sets global Chorus preset bank to defaults
- *
- * Inputs:
- *
- * Outputs:
- *
- *----------------------------------------------------------------------------
-*/
-static EAS_RESULT ChorusReadInPresets(S_CHORUS_OBJECT *pChorusData)
-{
-
- int preset = 0;
- int defaultPreset = 0;
-
- //now init any remaining presets to defaults
- for (defaultPreset = preset; defaultPreset < CHORUS_MAX_TYPE; defaultPreset++)
- {
- S_CHORUS_PRESET *pPreset = &pChorusData->m_sPreset.m_sPreset[defaultPreset];
- if (defaultPreset == 0 || defaultPreset > CHORUS_MAX_TYPE-1)
- {
- pPreset->m_nDepth = 39;
- pPreset->m_nRate = 30;
- pPreset->m_nLevel = 32767;
- }
- else if (defaultPreset == 1)
- {
- pPreset->m_nDepth = 21;
- pPreset->m_nRate = 45;
- pPreset->m_nLevel = 25000;
- }
- else if (defaultPreset == 2)
- {
- pPreset->m_nDepth = 53;
- pPreset->m_nRate = 25;
- pPreset->m_nLevel = 32000;
- }
- else if (defaultPreset == 3)
- {
- pPreset->m_nDepth = 32;
- pPreset->m_nRate = 37;
- pPreset->m_nLevel = 29000;
- }
- }
-
- return EAS_SUCCESS;
-}
-
-
-/*----------------------------------------------------------------------------
- * ChorusUpdate
- *----------------------------------------------------------------------------
- * Purpose:
- * Update the Chorus preset parameters as required
- *
- * Inputs:
- *
- * Outputs:
- *
- *
- * Side Effects:
- * - chorus paramters will be changed
- * - m_nCurrentRoom := m_nNextRoom
- *----------------------------------------------------------------------------
-*/
-static EAS_RESULT ChorusUpdate(S_CHORUS_OBJECT *pChorusData)
-{
- S_CHORUS_PRESET *pPreset = &pChorusData->m_sPreset.m_sPreset[pChorusData->m_nNextChorus];
-
- pChorusData->m_nLevel = pPreset->m_nLevel;
- pChorusData->m_nRate = pPreset->m_nRate;
- pChorusData->m_nDepth = pPreset->m_nDepth;
-
- pChorusData->m_nRate = (EAS_I16)
- ((((EAS_I32)CHORUS_SHAPE_SIZE<<16)/(20*(EAS_I32)_OUTPUT_SAMPLE_RATE)) * pChorusData->m_nRate);
-
- /*lint -e{704} use shift for performance */
- pChorusData->m_nDepth = (EAS_I16)
- (((((EAS_I32)pChorusData->m_nDepth * _OUTPUT_SAMPLE_RATE)>>5) * 105) >> 16);
-
- pChorusData->m_nCurrentChorus = pChorusData->m_nNextChorus;
-
- return EAS_SUCCESS;
-
-} /* end ChorusUpdate */
+ *
+ *----------------------------------------------------------------------------
+ * Revision Control:
+ * $Revision: 499 $
+ * $Date: 2006-12-11 16:07:20 -0800 (Mon, 11 Dec 2006) $
+ *----------------------------------------------------------------------------
+*/
+
+#include "eas_data.h"
+#include "eas_effects.h"
+#include "eas_math.h"
+#include "eas_chorusdata.h"
+#include "eas_chorus.h"
+#include "eas_config.h"
+#include "eas_host.h"
+#include "eas_report.h"
+
+/* prototypes for effects interface */
+static EAS_RESULT ChorusInit (EAS_DATA_HANDLE pEASData, EAS_VOID_PTR *pInstData);
+static void ChorusProcess (EAS_VOID_PTR pInstData, EAS_PCM *pSrc, EAS_PCM *pDst, EAS_I32 numSamples);
+static EAS_RESULT ChorusShutdown (EAS_DATA_HANDLE pEASData, EAS_VOID_PTR pInstData);
+static EAS_RESULT ChorusGetParam (EAS_VOID_PTR pInstData, EAS_I32 param, EAS_I32 *pValue);
+static EAS_RESULT ChorusSetParam (EAS_VOID_PTR pInstData, EAS_I32 param, EAS_I32 value);
+
+/* common effects interface for configuration module */
+const S_EFFECTS_INTERFACE EAS_Chorus =
+{
+ ChorusInit,
+ ChorusProcess,
+ ChorusShutdown,
+ ChorusGetParam,
+ ChorusSetParam
+};
+
+
+
+//LFO shape table used by the chorus, larger table would sound better
+//this is a sine wave, where 32767 = 1.0
+static const EAS_I16 EAS_chorusShape[CHORUS_SHAPE_SIZE] = {
+ 0, 1608, 3212, 4808, 6393, 7962, 9512, 11309, 12539, 14010, 15446, 16846, 18204, 19519, 20787, 22005, 23170,
+ 24279, 25329, 26319, 27245, 28105, 28898, 29621, 30273, 30852, 31356, 31785, 32137, 32412, 32609, 32728,
+ 32767, 32728, 32609, 32412, 32137, 31785, 31356, 30852, 30273, 29621, 28898, 28105, 27245, 26319, 25329,
+ 24279, 23170, 22005, 20787, 19519, 18204, 16846, 15446, 14010, 12539, 11039, 9512, 7962, 6393, 4808, 3212,
+ 1608, 0, -1608, -3212, -4808, -6393, -7962, -9512, -11309, -12539, -14010, -15446, -16846, -18204, -19519,
+ -20787, -22005, -23170, -24279, -25329, -26319, -27245, -28105, -28898, -29621, -30273, -30852, -31356, -31785,
+ -32137, -32412, -32609, -32728, -32767, -32728, -32609, -32412, -32137, -31785, -31356, -30852, -30273, -29621,
+ -28898, -28105, -27245, -26319, -25329, -24279, -23170, -22005, -20787, -19519, -18204, -16846, -15446, -14010,
+ -12539, -11039, -9512, -7962, -6393, -4808, -3212, -1608
+};
+
+/*----------------------------------------------------------------------------
+ * InitializeChorus()
+ *----------------------------------------------------------------------------
+ * Purpose: Initializes chorus parameters
+ *
+ *
+ * Inputs:
+ *
+ * Outputs:
+ *
+ *----------------------------------------------------------------------------
+*/
+static EAS_RESULT ChorusInit (EAS_DATA_HANDLE pEASData, EAS_VOID_PTR *pInstData)
+{
+ S_CHORUS_OBJECT *pChorusData;
+ S_CHORUS_PRESET *pPreset;
+ EAS_I32 index;
+
+ /* check Configuration Module for data allocation */
+ if (pEASData->staticMemoryModel)
+ pChorusData = EAS_CMEnumFXData(EAS_MODULE_CHORUS);
+
+ /* allocate dynamic memory */
+ else
+ pChorusData = EAS_HWMalloc(pEASData->hwInstData, sizeof(S_CHORUS_OBJECT));
+
+ if (pChorusData == NULL)
+ {
+ { /* dpp: EAS_ReportEx(_EAS_SEVERITY_FATAL, "Failed to allocate Chorus memory\n"); */ }
+ return EAS_ERROR_MALLOC_FAILED;
+ }
+
+ /* clear the structure */
+ EAS_HWMemSet(pChorusData, 0, sizeof(S_CHORUS_OBJECT));
+
+ ChorusReadInPresets(pChorusData);
+
+ /* set some default values */
+ pChorusData->bypass = EAS_CHORUS_BYPASS_DEFAULT;
+ pChorusData->preset = EAS_CHORUS_PRESET_DEFAULT;
+ pChorusData->m_nLevel = EAS_CHORUS_LEVEL_DEFAULT;
+ pChorusData->m_nRate = EAS_CHORUS_RATE_DEFAULT;
+ pChorusData->m_nDepth = EAS_CHORUS_DEPTH_DEFAULT;
+
+ //chorus rate and depth need some massaging from preset value (which is sample rate independent)
+
+ //convert rate from steps of .05 Hz to value which can be used as phase increment,
+ //with current CHORUS_SHAPE_SIZE and rate limits, this fits into 16 bits
+ //want to compute ((shapeSize * 65536) * (storedRate/20))/sampleRate;
+ //computing it as below allows rate steps to be evenly spaced
+ //uses 32 bit divide, but only once when new value is selected
+ pChorusData->m_nRate = (EAS_I16)
+ ((((EAS_I32)CHORUS_SHAPE_SIZE<<16)/(20*(EAS_I32)_OUTPUT_SAMPLE_RATE)) * pChorusData->m_nRate);
+
+ //convert depth from steps of .05 ms, to samples, with 16 bit whole part, discard fraction
+ //want to compute ((depth * sampleRate)/20000)
+ //use the following approximation since 105/32 is roughly 65536/20000
+ /*lint -e{704} use shift for performance */
+ pChorusData->m_nDepth = (EAS_I16)
+ (((((EAS_I32)pChorusData->m_nDepth * _OUTPUT_SAMPLE_RATE)>>5) * 105) >> 16);
+
+ pChorusData->m_nLevel = pChorusData->m_nLevel;
+
+ //zero delay memory for chorus
+ for (index = CHORUS_L_SIZE - 1; index >= 0; index--)
+ {
+ pChorusData->chorusDelayL[index] = 0;
+ }
+ for (index = CHORUS_R_SIZE - 1; index >= 0; index--)
+ {
+ pChorusData->chorusDelayR[index] = 0;
+ }
+
+ //init delay line index, these are used to implement circular delay buffer
+ pChorusData->chorusIndexL = 0;
+ pChorusData->chorusIndexR = 0;
+
+ //init LFO phase
+ //16 bit whole part, 16 bit fraction
+ pChorusData->lfoLPhase = 0;
+ pChorusData->lfoRPhase = (CHORUS_SHAPE_SIZE << 16) >> 2; // 1/4 of total, i.e. 90 degrees out of phase;
+
+ //init chorus delay position
+ //right now chorus delay is a compile-time value, as is sample rate
+ pChorusData->chorusTapPosition = (EAS_I16)((CHORUS_DELAY_MS * _OUTPUT_SAMPLE_RATE)/1000);
+
+ //now copy from the new preset into Chorus
+ pPreset = &pChorusData->m_sPreset.m_sPreset[pChorusData->m_nNextChorus];
+
+ pChorusData->m_nLevel = pPreset->m_nLevel;
+ pChorusData->m_nRate = pPreset->m_nRate;
+ pChorusData->m_nDepth = pPreset->m_nDepth;
+
+ pChorusData->m_nRate = (EAS_I16)
+ ((((EAS_I32)CHORUS_SHAPE_SIZE<<16)/(20*(EAS_I32)_OUTPUT_SAMPLE_RATE)) * pChorusData->m_nRate);
+
+ /*lint -e{704} use shift for performance */
+ pChorusData->m_nDepth = (EAS_I16)
+ (((((EAS_I32)pChorusData->m_nDepth * _OUTPUT_SAMPLE_RATE)>>5) * 105) >> 16);
+
+ *pInstData = pChorusData;
+
+ return EAS_SUCCESS;
+} /* end ChorusInit */
+
+/*----------------------------------------------------------------------------
+ * WeightedTap()
+ *----------------------------------------------------------------------------
+ * Purpose: Does fractional array look-up using linear interpolation
+ *
+ * first convert indexDesired to actual desired index by taking into account indexReference
+ * then do linear interpolation between two actual samples using fractional part
+ *
+ * Inputs:
+ * array: pointer to array of signed 16 bit values, typically either PCM data or control data
+ * indexReference: the circular buffer relative offset
+ * indexDesired: the fractional index we are looking up (16 bits index + 16 bits fraction)
+ * indexLimit: the total size of the array, used to compute buffer wrap
+ *
+ * Outputs:
+ * Value from the input array, linearly interpolated between two actual data values
+ *
+ *----------------------------------------------------------------------------
+*/
+static EAS_I16 WeightedTap(const EAS_I16 *array, EAS_I16 indexReference, EAS_I32 indexDesired, EAS_I16 indexLimit)
+{
+ EAS_I16 index;
+ EAS_I16 fraction;
+ EAS_I16 val1;
+ EAS_I16 val2;
+
+ //separate indexDesired into whole and fractional parts
+ /*lint -e{704} use shift for performance */
+ index = (EAS_I16)(indexDesired >> 16);
+ /*lint -e{704} use shift for performance */
+ fraction = (EAS_I16)((indexDesired>>1) & 0x07FFF); //just use 15 bits of fractional part
+
+ //adjust whole part by indexReference
+ index = indexReference - index;
+ //make sure we stay within array bounds, this implements circular buffer
+ while (index < 0)
+ {
+ index += indexLimit;
+ }
+
+ //get two adjacent values from the array
+ val1 = array[index];
+
+ //handle special case when index == 0, else typical case
+ if (index == 0)
+ {
+ val2 = array[indexLimit-1]; //get last value from array
+ }
+ else
+ {
+ val2 = array[index-1]; //get previous value from array
+ }
+
+ //compute linear interpolation as (val1 + ((val2-val1)*fraction))
+ return(val1 + (EAS_I16)MULT_EG1_EG1(val2-val1,fraction));
+}
+
+/*----------------------------------------------------------------------------
+ * ChorusProcess()
+ *----------------------------------------------------------------------------
+ * Purpose: compute the chorus on the input buffer, and mix into output buffer
+ *
+ *
+ * Inputs:
+ * src: pointer to input buffer of PCM values to be processed
+ * dst: pointer to output buffer of PCM values we are to sume the result with
+ * bufSize: the number of sample frames (i.e. stereo samples) in the buffer
+ *
+ * Outputs:
+ * None
+ *
+ *----------------------------------------------------------------------------
+*/
+//compute the chorus, and mix into output buffer
+static void ChorusProcess (EAS_VOID_PTR pInstData, EAS_PCM *pSrc, EAS_PCM *pDst, EAS_I32 numSamples)
+{
+ EAS_I32 ix;
+ EAS_I32 nChannelNumber;
+ EAS_I16 lfoValueLeft;
+ EAS_I16 lfoValueRight;
+ EAS_I32 positionOffsetL;
+ EAS_I32 positionOffsetR;
+ EAS_PCM tapL;
+ EAS_PCM tapR;
+ EAS_I32 tempValue;
+ EAS_PCM nInputSample;
+ EAS_I32 nOutputSample;
+ EAS_PCM *pIn;
+ EAS_PCM *pOut;
+
+ S_CHORUS_OBJECT *pChorusData;
+
+ pChorusData = (S_CHORUS_OBJECT*) pInstData;
+
+ //if the chorus is disabled or turned all the way down
+ if (pChorusData->bypass == EAS_TRUE || pChorusData->m_nLevel == 0)
+ {
+ if (pSrc != pDst)
+ EAS_HWMemCpy(pSrc, pDst, numSamples * NUM_OUTPUT_CHANNELS * (EAS_I32) sizeof(EAS_PCM));
+ return;
+ }
+
+ if (pChorusData->m_nNextChorus != pChorusData->m_nCurrentChorus)
+ {
+ ChorusUpdate(pChorusData);
+ }
+
+ for (nChannelNumber = 0; nChannelNumber < NUM_OUTPUT_CHANNELS; nChannelNumber++)
+ {
+
+ pIn = pSrc + nChannelNumber;
+ pOut = pDst + nChannelNumber;
+
+ if(nChannelNumber==0)
+ {
+ for (ix = 0; ix < numSamples; ix++)
+ {
+ nInputSample = *pIn;
+ pIn += NUM_OUTPUT_CHANNELS;
+
+ //feed input into chorus delay line
+ pChorusData->chorusDelayL[pChorusData->chorusIndexL] = nInputSample;
+
+ //compute chorus lfo value using phase as fractional index into chorus shape table
+ //resulting value is between -1.0 and 1.0, expressed as signed 16 bit number
+ lfoValueLeft = WeightedTap(EAS_chorusShape, 0, pChorusData->lfoLPhase, CHORUS_SHAPE_SIZE);
+
+ //scale chorus depth by lfo value to get relative fractional sample index
+ //index is expressed as 32 bit number with 16 bit fractional part
+ /*lint -e{703} use shift for performance */
+ positionOffsetL = pChorusData->m_nDepth * (((EAS_I32)lfoValueLeft) << 1);
+
+ //add fixed chorus delay to get actual fractional sample index
+ positionOffsetL += ((EAS_I32)pChorusData->chorusTapPosition) << 16;
+
+ //get tap value from chorus delay using fractional sample index
+ tapL = WeightedTap(pChorusData->chorusDelayL, pChorusData->chorusIndexL, positionOffsetL, CHORUS_L_SIZE);
+
+ //scale by chorus level, then sum with input buffer contents and saturate
+ tempValue = MULT_EG1_EG1(tapL, pChorusData->m_nLevel);
+ nOutputSample = SATURATE(tempValue + nInputSample);
+
+ *pOut = (EAS_I16)SATURATE(nOutputSample);
+ pOut += NUM_OUTPUT_CHANNELS;
+
+
+ //increment chorus delay index and make it wrap as needed
+ //this implements circular buffer
+ if ((pChorusData->chorusIndexL+=1) >= CHORUS_L_SIZE)
+ pChorusData->chorusIndexL = 0;
+
+ //increment fractional lfo phase, and make it wrap as needed
+ pChorusData->lfoLPhase += pChorusData->m_nRate;
+ while (pChorusData->lfoLPhase >= (CHORUS_SHAPE_SIZE<<16))
+ {
+ pChorusData->lfoLPhase -= (CHORUS_SHAPE_SIZE<<16);
+ }
+ }
+ }
+ else
+ {
+ for (ix = 0; ix < numSamples; ix++)
+ {
+ nInputSample = *pIn;
+ pIn += NUM_OUTPUT_CHANNELS;
+
+ //feed input into chorus delay line
+ pChorusData->chorusDelayR[pChorusData->chorusIndexR] = nInputSample;
+
+ //compute chorus lfo value using phase as fractional index into chorus shape table
+ //resulting value is between -1.0 and 1.0, expressed as signed 16 bit number
+ lfoValueRight = WeightedTap(EAS_chorusShape, 0, pChorusData->lfoRPhase, CHORUS_SHAPE_SIZE);
+
+ //scale chorus depth by lfo value to get relative fractional sample index
+ //index is expressed as 32 bit number with 16 bit fractional part
+ /*lint -e{703} use shift for performance */
+ positionOffsetR = pChorusData->m_nDepth * (((EAS_I32)lfoValueRight) << 1);
+
+ //add fixed chorus delay to get actual fractional sample index
+ positionOffsetR += ((EAS_I32)pChorusData->chorusTapPosition) << 16;
+
+ //get tap value from chorus delay using fractional sample index
+ tapR = WeightedTap(pChorusData->chorusDelayR, pChorusData->chorusIndexR, positionOffsetR, CHORUS_R_SIZE);
+
+ //scale by chorus level, then sum with output buffer contents and saturate
+ tempValue = MULT_EG1_EG1(tapR, pChorusData->m_nLevel);
+ nOutputSample = SATURATE(tempValue + nInputSample);
+
+ *pOut = (EAS_I16)SATURATE(nOutputSample);
+ pOut += NUM_OUTPUT_CHANNELS;
+
+ //increment chorus delay index and make it wrap as needed
+ //this implements circular buffer
+ if ((pChorusData->chorusIndexR+=1) >= CHORUS_R_SIZE)
+ pChorusData->chorusIndexR = 0;
+
+ //increment fractional lfo phase, and make it wrap as needed
+ pChorusData->lfoRPhase += pChorusData->m_nRate;
+ while (pChorusData->lfoRPhase >= (CHORUS_SHAPE_SIZE<<16))
+ {
+ pChorusData->lfoRPhase -= (CHORUS_SHAPE_SIZE<<16);
+ }
+ }
+ }
+
+ }
+} /* end ChorusProcess */
+
+
+
+/*----------------------------------------------------------------------------
+ * ChorusShutdown()
+ *----------------------------------------------------------------------------
+ * Purpose:
+ * Initializes the Chorus effect.
+ *
+ * Inputs:
+ * pInstData - handle to instance data
+ *
+ * Outputs:
+ *
+ *
+ * Side Effects:
+ *
+ *----------------------------------------------------------------------------
+*/
+static EAS_RESULT ChorusShutdown (EAS_DATA_HANDLE pEASData, EAS_VOID_PTR pInstData)
+{
+ /* check Configuration Module for static memory allocation */
+ if (!pEASData->staticMemoryModel)
+ EAS_HWFree(pEASData->hwInstData, pInstData);
+ return EAS_SUCCESS;
+} /* end ChorusShutdown */
+
+/*----------------------------------------------------------------------------
+ * ChorusGetParam()
+ *----------------------------------------------------------------------------
+ * Purpose:
+ * Get a Chorus parameter
+ *
+ * Inputs:
+ * pInstData - handle to instance data
+ * param - parameter index
+ * *pValue - pointer to variable to hold retrieved value
+ *
+ * Outputs:
+ *
+ *
+ * Side Effects:
+ *
+ *----------------------------------------------------------------------------
+*/
+static EAS_RESULT ChorusGetParam (EAS_VOID_PTR pInstData, EAS_I32 param, EAS_I32 *pValue)
+{
+ S_CHORUS_OBJECT *p;
+
+ p = (S_CHORUS_OBJECT*) pInstData;
+
+ switch (param)
+ {
+ case EAS_PARAM_CHORUS_BYPASS:
+ *pValue = (EAS_I32) p->bypass;
+ break;
+ case EAS_PARAM_CHORUS_PRESET:
+ *pValue = (EAS_I8) p->m_nCurrentChorus;
+ break;
+ case EAS_PARAM_CHORUS_RATE:
+ *pValue = (EAS_I32) p->m_nRate;
+ break;
+ case EAS_PARAM_CHORUS_DEPTH:
+ *pValue = (EAS_I32) p->m_nDepth;
+ break;
+ case EAS_PARAM_CHORUS_LEVEL:
+ *pValue = (EAS_I32) p->m_nLevel;
+ break;
+ default:
+ return EAS_ERROR_INVALID_PARAMETER;
+ }
+ return EAS_SUCCESS;
+} /* end ChorusGetParam */
+
+
+/*----------------------------------------------------------------------------
+ * ChorusSetParam()
+ *----------------------------------------------------------------------------
+ * Purpose:
+ * Set a Chorus parameter
+ *
+ * Inputs:
+ * pInstData - handle to instance data
+ * param - parameter index
+ * *pValue - new paramter value
+ *
+ * Outputs:
+ *
+ *
+ * Side Effects:
+ *
+ *----------------------------------------------------------------------------
+*/
+static EAS_RESULT ChorusSetParam (EAS_VOID_PTR pInstData, EAS_I32 param, EAS_I32 value)
+{
+ S_CHORUS_OBJECT *p;
+
+ p = (S_CHORUS_OBJECT*) pInstData;
+
+ switch (param)
+ {
+ case EAS_PARAM_CHORUS_BYPASS:
+ p->bypass = (EAS_BOOL) value;
+ break;
+ case EAS_PARAM_CHORUS_PRESET:
+ if(value!=EAS_PARAM_CHORUS_PRESET1 && value!=EAS_PARAM_CHORUS_PRESET2 &&
+ value!=EAS_PARAM_CHORUS_PRESET3 && value!=EAS_PARAM_CHORUS_PRESET4)
+ return EAS_ERROR_INVALID_PARAMETER;
+ p->m_nNextChorus = (EAS_I8)value;
+ break;
+ case EAS_PARAM_CHORUS_RATE:
+ if(value<EAS_CHORUS_RATE_MIN || value>EAS_CHORUS_RATE_MAX)
+ return EAS_ERROR_INVALID_PARAMETER;
+ p->m_nRate = (EAS_I16) value;
+ break;
+ case EAS_PARAM_CHORUS_DEPTH:
+ if(value<EAS_CHORUS_DEPTH_MIN || value>EAS_CHORUS_DEPTH_MAX)
+ return EAS_ERROR_INVALID_PARAMETER;
+ p->m_nDepth = (EAS_I16) value;
+ break;
+ case EAS_PARAM_CHORUS_LEVEL:
+ if(value<EAS_CHORUS_LEVEL_MIN || value>EAS_CHORUS_LEVEL_MAX)
+ return EAS_ERROR_INVALID_PARAMETER;
+ p->m_nLevel = (EAS_I16) value;
+ break;
+
+ default:
+ return EAS_ERROR_INVALID_PARAMETER;
+ }
+ return EAS_SUCCESS;
+} /* end ChorusSetParam */
+
+
+/*----------------------------------------------------------------------------
+ * ChorusReadInPresets()
+ *----------------------------------------------------------------------------
+ * Purpose: sets global Chorus preset bank to defaults
+ *
+ * Inputs:
+ *
+ * Outputs:
+ *
+ *----------------------------------------------------------------------------
+*/
+static EAS_RESULT ChorusReadInPresets(S_CHORUS_OBJECT *pChorusData)
+{
+
+ int preset = 0;
+ int defaultPreset = 0;
+
+ //now init any remaining presets to defaults
+ for (defaultPreset = preset; defaultPreset < CHORUS_MAX_TYPE; defaultPreset++)
+ {
+ S_CHORUS_PRESET *pPreset = &pChorusData->m_sPreset.m_sPreset[defaultPreset];
+ if (defaultPreset == 0 || defaultPreset > CHORUS_MAX_TYPE-1)
+ {
+ pPreset->m_nDepth = 39;
+ pPreset->m_nRate = 30;
+ pPreset->m_nLevel = 32767;
+ }
+ else if (defaultPreset == 1)
+ {
+ pPreset->m_nDepth = 21;
+ pPreset->m_nRate = 45;
+ pPreset->m_nLevel = 25000;
+ }
+ else if (defaultPreset == 2)
+ {
+ pPreset->m_nDepth = 53;
+ pPreset->m_nRate = 25;
+ pPreset->m_nLevel = 32000;
+ }
+ else if (defaultPreset == 3)
+ {
+ pPreset->m_nDepth = 32;
+ pPreset->m_nRate = 37;
+ pPreset->m_nLevel = 29000;
+ }
+ }
+
+ return EAS_SUCCESS;
+}
+
+
+/*----------------------------------------------------------------------------
+ * ChorusUpdate
+ *----------------------------------------------------------------------------
+ * Purpose:
+ * Update the Chorus preset parameters as required
+ *
+ * Inputs:
+ *
+ * Outputs:
+ *
+ *
+ * Side Effects:
+ * - chorus paramters will be changed
+ * - m_nCurrentRoom := m_nNextRoom
+ *----------------------------------------------------------------------------
+*/
+static EAS_RESULT ChorusUpdate(S_CHORUS_OBJECT *pChorusData)
+{
+ S_CHORUS_PRESET *pPreset = &pChorusData->m_sPreset.m_sPreset[pChorusData->m_nNextChorus];
+
+ pChorusData->m_nLevel = pPreset->m_nLevel;
+ pChorusData->m_nRate = pPreset->m_nRate;
+ pChorusData->m_nDepth = pPreset->m_nDepth;
+
+ pChorusData->m_nRate = (EAS_I16)
+ ((((EAS_I32)CHORUS_SHAPE_SIZE<<16)/(20*(EAS_I32)_OUTPUT_SAMPLE_RATE)) * pChorusData->m_nRate);
+
+ /*lint -e{704} use shift for performance */
+ pChorusData->m_nDepth = (EAS_I16)
+ (((((EAS_I32)pChorusData->m_nDepth * _OUTPUT_SAMPLE_RATE)>>5) * 105) >> 16);
+
+ pChorusData->m_nCurrentChorus = pChorusData->m_nNextChorus;
+
+ return EAS_SUCCESS;
+
+} /* end ChorusUpdate */
diff --git a/arm-fm-22k/lib_src/eas_chorusdata.c b/arm-fm-22k/lib_src/eas_chorusdata.c
index caee1ed..ec71ff8 100644
--- a/arm-fm-22k/lib_src/eas_chorusdata.c
+++ b/arm-fm-22k/lib_src/eas_chorusdata.c
@@ -1,13 +1,13 @@
-/*----------------------------------------------------------------------------
- *
- * File:
- * eas_chorusdata.c
- *
- * Contents and purpose:
- * Contains the static data allocation for the Chorus effect
- *
- *
- * Copyright Sonic Network Inc. 2006
+/*----------------------------------------------------------------------------
+ *
+ * File:
+ * eas_chorusdata.c
+ *
+ * Contents and purpose:
+ * Contains the static data allocation for the Chorus effect
+ *
+ *
+ * Copyright Sonic Network Inc. 2006
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -20,15 +20,15 @@
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
- *
- *----------------------------------------------------------------------------
- * Revision Control:
- * $Revision: 550 $
- * $Date: 2007-02-02 09:37:03 -0800 (Fri, 02 Feb 2007) $
- *----------------------------------------------------------------------------
-*/
-
-#include "eas_chorusdata.h"
-
-S_CHORUS_OBJECT eas_ChorusData;
-
+ *
+ *----------------------------------------------------------------------------
+ * Revision Control:
+ * $Revision: 550 $
+ * $Date: 2007-02-02 09:37:03 -0800 (Fri, 02 Feb 2007) $
+ *----------------------------------------------------------------------------
+*/
+
+#include "eas_chorusdata.h"
+
+S_CHORUS_OBJECT eas_ChorusData;
+
diff --git a/arm-fm-22k/lib_src/eas_chorusdata.h b/arm-fm-22k/lib_src/eas_chorusdata.h
index 4420ddd..ec8daa4 100644
--- a/arm-fm-22k/lib_src/eas_chorusdata.h
+++ b/arm-fm-22k/lib_src/eas_chorusdata.h
@@ -1,13 +1,13 @@
-/*----------------------------------------------------------------------------
- *
- * File:
- * eas_chorusdata.h
- *
- * Contents and purpose:
- * Contains the prototypes for the Chorus effect.
- *
- *
- * Copyright Sonic Network Inc. 2006
+/*----------------------------------------------------------------------------
+ *
+ * File:
+ * eas_chorusdata.h
+ *
+ * Contents and purpose:
+ * Contains the prototypes for the Chorus effect.
+ *
+ *
+ * Copyright Sonic Network Inc. 2006
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -20,141 +20,141 @@
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
- *
- *----------------------------------------------------------------------------
- * Revision Control:
- * $Revision: 309 $
- * $Date: 2006-09-12 18:52:45 -0700 (Tue, 12 Sep 2006) $
- *----------------------------------------------------------------------------
-*/
-
-#ifndef _EAS_CHORUS_H
-#define _EAS_CHORUS_H
-
-#include "eas_types.h"
-#include "eas_audioconst.h"
-
-//defines for chorus
-
-#define EAS_CHORUS_BYPASS_DEFAULT 1
-#define EAS_CHORUS_PRESET_DEFAULT 0
-#define EAS_CHORUS_RATE_DEFAULT 30
-#define EAS_CHORUS_DEPTH_DEFAULT 39
-#define EAS_CHORUS_LEVEL_DEFAULT 32767
-
-#define EAS_CHORUS_LEVEL_MIN 0
-#define EAS_CHORUS_LEVEL_MAX 32767
-
-#define EAS_CHORUS_RATE_MIN 10
-#define EAS_CHORUS_RATE_MAX 50
-
-#define EAS_CHORUS_DEPTH_MIN 15
-#define EAS_CHORUS_DEPTH_MAX 60
-
-#define CHORUS_SIZE_MS 20
-#define CHORUS_L_SIZE ((CHORUS_SIZE_MS*_OUTPUT_SAMPLE_RATE)/1000)
-#define CHORUS_R_SIZE CHORUS_L_SIZE
-#define CHORUS_SHAPE_SIZE 128
-#define CHORUS_DELAY_MS 10
-
-#define CHORUS_MAX_TYPE 4 // any Chorus numbers larger than this are invalid
-
-typedef struct
-{
- EAS_I16 m_nRate;
- EAS_I16 m_nDepth;
- EAS_I16 m_nLevel;
-
-} S_CHORUS_PRESET;
-
-typedef struct
-{
- S_CHORUS_PRESET m_sPreset[CHORUS_MAX_TYPE]; //array of presets
-
-} S_CHORUS_PRESET_BANK;
-
-/* parameters for each Chorus */
-typedef struct
-{
- EAS_I32 lfoLPhase;
- EAS_I32 lfoRPhase;
- EAS_I16 chorusIndexL;
- EAS_I16 chorusIndexR;
- EAS_U16 chorusTapPosition;
-
- EAS_I16 m_nRate;
- EAS_I16 m_nDepth;
- EAS_I16 m_nLevel;
-
- //delay lines used by the chorus, longer would sound better
- EAS_PCM chorusDelayL[CHORUS_L_SIZE];
- EAS_PCM chorusDelayR[CHORUS_R_SIZE];
-
- EAS_BOOL bypass;
- EAS_I8 preset;
-
- EAS_I16 m_nCurrentChorus; // preset number for current Chorus
- EAS_I16 m_nNextChorus; // preset number for next Chorus
-
- S_CHORUS_PRESET pPreset;
-
- S_CHORUS_PRESET_BANK m_sPreset;
-
-} S_CHORUS_OBJECT;
-
-
-/*----------------------------------------------------------------------------
- * WeightedTap()
- *----------------------------------------------------------------------------
- * Purpose: Does fractional array look-up using linear interpolation
- *
- * first convert indexDesired to actual desired index by taking into account indexReference
- * then do linear interpolation between two actual samples using fractional part
- *
- * Inputs:
- * array: pointer to array of signed 16 bit values, typically either PCM data or control data
- * indexReference: the circular buffer relative offset
- * indexDesired: the fractional index we are looking up (16 bits index + 16 bits fraction)
- * indexLimit: the total size of the array, used to compute buffer wrap
- *
- * Outputs:
- * Value from the input array, linearly interpolated between two actual data values
- *
- *----------------------------------------------------------------------------
-*/
-static EAS_I16 WeightedTap(const EAS_I16 *array, EAS_I16 indexReference, EAS_I32 indexDesired, EAS_I16 indexLimit);
-
-/*----------------------------------------------------------------------------
- * ChorusReadInPresets()
- *----------------------------------------------------------------------------
- * Purpose: sets global Chorus preset bank to defaults
- *
- * Inputs:
- *
- * Outputs:
- *
- *----------------------------------------------------------------------------
-*/
-static EAS_RESULT ChorusReadInPresets(S_CHORUS_OBJECT *pChorusData);
-
-/*----------------------------------------------------------------------------
- * ChorusUpdate
- *----------------------------------------------------------------------------
- * Purpose:
- * Update the Chorus preset parameters as required
- *
- * Inputs:
- *
- * Outputs:
- *
- *
- * Side Effects:
- * - chorus paramters will be changed
- * - m_nCurrentChorus := m_nNextChorus
- *----------------------------------------------------------------------------
-*/
-static EAS_RESULT ChorusUpdate(S_CHORUS_OBJECT* pChorusData);
-
-#endif /* #ifndef _EAS_CHORUSDATA_H */
-
-
+ *
+ *----------------------------------------------------------------------------
+ * Revision Control:
+ * $Revision: 309 $
+ * $Date: 2006-09-12 18:52:45 -0700 (Tue, 12 Sep 2006) $
+ *----------------------------------------------------------------------------
+*/
+
+#ifndef _EAS_CHORUS_H
+#define _EAS_CHORUS_H
+
+#include "eas_types.h"
+#include "eas_audioconst.h"
+
+//defines for chorus
+
+#define EAS_CHORUS_BYPASS_DEFAULT 1
+#define EAS_CHORUS_PRESET_DEFAULT 0
+#define EAS_CHORUS_RATE_DEFAULT 30
+#define EAS_CHORUS_DEPTH_DEFAULT 39
+#define EAS_CHORUS_LEVEL_DEFAULT 32767
+
+#define EAS_CHORUS_LEVEL_MIN 0
+#define EAS_CHORUS_LEVEL_MAX 32767
+
+#define EAS_CHORUS_RATE_MIN 10
+#define EAS_CHORUS_RATE_MAX 50
+
+#define EAS_CHORUS_DEPTH_MIN 15
+#define EAS_CHORUS_DEPTH_MAX 60
+
+#define CHORUS_SIZE_MS 20
+#define CHORUS_L_SIZE ((CHORUS_SIZE_MS*_OUTPUT_SAMPLE_RATE)/1000)
+#define CHORUS_R_SIZE CHORUS_L_SIZE
+#define CHORUS_SHAPE_SIZE 128
+#define CHORUS_DELAY_MS 10
+
+#define CHORUS_MAX_TYPE 4 // any Chorus numbers larger than this are invalid
+
+typedef struct
+{
+ EAS_I16 m_nRate;
+ EAS_I16 m_nDepth;
+ EAS_I16 m_nLevel;
+
+} S_CHORUS_PRESET;
+
+typedef struct
+{
+ S_CHORUS_PRESET m_sPreset[CHORUS_MAX_TYPE]; //array of presets
+
+} S_CHORUS_PRESET_BANK;
+
+/* parameters for each Chorus */
+typedef struct
+{
+ EAS_I32 lfoLPhase;
+ EAS_I32 lfoRPhase;
+ EAS_I16 chorusIndexL;
+ EAS_I16 chorusIndexR;
+ EAS_U16 chorusTapPosition;
+
+ EAS_I16 m_nRate;
+ EAS_I16 m_nDepth;
+ EAS_I16 m_nLevel;
+
+ //delay lines used by the chorus, longer would sound better
+ EAS_PCM chorusDelayL[CHORUS_L_SIZE];
+ EAS_PCM chorusDelayR[CHORUS_R_SIZE];
+
+ EAS_BOOL bypass;
+ EAS_I8 preset;
+
+ EAS_I16 m_nCurrentChorus; // preset number for current Chorus
+ EAS_I16 m_nNextChorus; // preset number for next Chorus
+
+ S_CHORUS_PRESET pPreset;
+
+ S_CHORUS_PRESET_BANK m_sPreset;
+
+} S_CHORUS_OBJECT;
+
+
+/*----------------------------------------------------------------------------
+ * WeightedTap()
+ *----------------------------------------------------------------------------
+ * Purpose: Does fractional array look-up using linear interpolation
+ *
+ * first convert indexDesired to actual desired index by taking into account indexReference
+ * then do linear interpolation between two actual samples using fractional part
+ *
+ * Inputs:
+ * array: pointer to array of signed 16 bit values, typically either PCM data or control data
+ * indexReference: the circular buffer relative offset
+ * indexDesired: the fractional index we are looking up (16 bits index + 16 bits fraction)
+ * indexLimit: the total size of the array, used to compute buffer wrap
+ *
+ * Outputs:
+ * Value from the input array, linearly interpolated between two actual data values
+ *
+ *----------------------------------------------------------------------------
+*/
+static EAS_I16 WeightedTap(const EAS_I16 *array, EAS_I16 indexReference, EAS_I32 indexDesired, EAS_I16 indexLimit);
+
+/*----------------------------------------------------------------------------
+ * ChorusReadInPresets()
+ *----------------------------------------------------------------------------
+ * Purpose: sets global Chorus preset bank to defaults
+ *
+ * Inputs:
+ *
+ * Outputs:
+ *
+ *----------------------------------------------------------------------------
+*/
+static EAS_RESULT ChorusReadInPresets(S_CHORUS_OBJECT *pChorusData);
+
+/*----------------------------------------------------------------------------
+ * ChorusUpdate
+ *----------------------------------------------------------------------------
+ * Purpose:
+ * Update the Chorus preset parameters as required
+ *
+ * Inputs:
+ *
+ * Outputs:
+ *
+ *
+ * Side Effects:
+ * - chorus paramters will be changed
+ * - m_nCurrentChorus := m_nNextChorus
+ *----------------------------------------------------------------------------
+*/
+static EAS_RESULT ChorusUpdate(S_CHORUS_OBJECT* pChorusData);
+
+#endif /* #ifndef _EAS_CHORUSDATA_H */
+
+
diff --git a/arm-fm-22k/lib_src/eas_ctype.h b/arm-fm-22k/lib_src/eas_ctype.h
index 8503870..14fa96f 100644
--- a/arm-fm-22k/lib_src/eas_ctype.h
+++ b/arm-fm-22k/lib_src/eas_ctype.h
@@ -1,14 +1,14 @@
-/*----------------------------------------------------------------------------
- *
- * File:
- * eas_ctype.h
- *
- * Contents and purpose:
- * This is a replacement for the CRT ctype.h functions. These
- * functions are currently ASCII only, but eventually, we will want
- * to support wide-characters for localization.
- *
- * Copyright (c) 2005 Sonic Network Inc.
+/*----------------------------------------------------------------------------
+ *
+ * File:
+ * eas_ctype.h
+ *
+ * Contents and purpose:
+ * This is a replacement for the CRT ctype.h functions. These
+ * functions are currently ASCII only, but eventually, we will want
+ * to support wide-characters for localization.
+ *
+ * Copyright (c) 2005 Sonic Network Inc.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -21,21 +21,21 @@
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
- *
- *----------------------------------------------------------------------------
- * Revision Control:
- * $Revision: 429 $
- * $Date: 2006-10-19 23:50:15 -0700 (Thu, 19 Oct 2006) $
- *----------------------------------------------------------------------------
-*/
-
-#ifndef _EAS_CTYPE_H
-#define _EAS_CTYPE_H
-
-EAS_INLINE EAS_I8 IsDigit (EAS_I8 c) { return ((c >= '0') && (c <= '9')); }
-EAS_INLINE EAS_I8 IsSpace (EAS_I8 c) { return (((c >= 9) && (c <= 13)) || (c == ' ')); }
-EAS_INLINE EAS_I8 ToUpper (EAS_I8 c) { if ((c >= 'a') && (c <= 'z')) return c & ~0x20; else return c; }
-EAS_INLINE EAS_I8 ToLower (EAS_I8 c) { if ((c >= 'A') && (c <= 'Z')) return c |= 0x20; else return c; }
-
-#endif
-
+ *
+ *----------------------------------------------------------------------------
+ * Revision Control:
+ * $Revision: 429 $
+ * $Date: 2006-10-19 23:50:15 -0700 (Thu, 19 Oct 2006) $
+ *----------------------------------------------------------------------------
+*/
+
+#ifndef _EAS_CTYPE_H
+#define _EAS_CTYPE_H
+
+EAS_INLINE EAS_I8 IsDigit (EAS_I8 c) { return ((c >= '0') && (c <= '9')); }
+EAS_INLINE EAS_I8 IsSpace (EAS_I8 c) { return (((c >= 9) && (c <= 13)) || (c == ' ')); }
+EAS_INLINE EAS_I8 ToUpper (EAS_I8 c) { if ((c >= 'a') && (c <= 'z')) return c & ~0x20; else return c; }
+EAS_INLINE EAS_I8 ToLower (EAS_I8 c) { if ((c >= 'A') && (c <= 'Z')) return c |= 0x20; else return c; }
+
+#endif
+
diff --git a/arm-fm-22k/lib_src/eas_data.c b/arm-fm-22k/lib_src/eas_data.c
index bb60ef2..31a4e6a 100644
--- a/arm-fm-22k/lib_src/eas_data.c
+++ b/arm-fm-22k/lib_src/eas_data.c
@@ -1,12 +1,12 @@
-/*----------------------------------------------------------------------------
- *
- * File:
- * eas_data.c
- *
- * Contents and purpose:
- * Contains a data allocation for synthesizer
- *
- * Copyright Sonic Network Inc. 2004
+/*----------------------------------------------------------------------------
+ *
+ * File:
+ * eas_data.c
+ *
+ * Contents and purpose:
+ * Contains a data allocation for synthesizer
+ *
+ * Copyright Sonic Network Inc. 2004
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -19,19 +19,19 @@
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
- *
- *----------------------------------------------------------------------------
- * Revision Control:
- * $Revision: 547 $
- * $Date: 2007-01-31 16:30:17 -0800 (Wed, 31 Jan 2007) $
- *----------------------------------------------------------------------------
-*/
-
-// includes
-#include "eas_data.h"
-
-// globals
-S_EAS_DATA eas_Data;
-S_VOICE_MGR eas_Synth;
-S_SYNTH eas_MIDI;
-
+ *
+ *----------------------------------------------------------------------------
+ * Revision Control:
+ * $Revision: 547 $
+ * $Date: 2007-01-31 16:30:17 -0800 (Wed, 31 Jan 2007) $
+ *----------------------------------------------------------------------------
+*/
+
+// includes
+#include "eas_data.h"
+
+// globals
+S_EAS_DATA eas_Data;
+S_VOICE_MGR eas_Synth;
+S_SYNTH eas_MIDI;
+
diff --git a/arm-fm-22k/lib_src/eas_data.h b/arm-fm-22k/lib_src/eas_data.h
index 0a47d04..e2fcb1a 100644
--- a/arm-fm-22k/lib_src/eas_data.h
+++ b/arm-fm-22k/lib_src/eas_data.h
@@ -1,13 +1,13 @@
-/*----------------------------------------------------------------------------
- *
- * File:
- * eas_data.h
- *
- * Contents and purpose:
- * This header defines all types, to support dynamic allocation of the
- * memory resources needed for persistent EAS data.
- *
- * Copyright 2004 Sonic Network Inc.
+/*----------------------------------------------------------------------------
+ *
+ * File:
+ * eas_data.h
+ *
+ * Contents and purpose:
+ * This header defines all types, to support dynamic allocation of the
+ * memory resources needed for persistent EAS data.
+ *
+ * Copyright 2004 Sonic Network Inc.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -20,112 +20,112 @@
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
- *
- *----------------------------------------------------------------------------
- * Revision Control:
- * $Revision: 842 $
- * $Date: 2007-08-23 14:32:31 -0700 (Thu, 23 Aug 2007) $
- *----------------------------------------------------------------------------
-*/
-
-#ifndef _EAS_DATA_H
-#define _EAS_DATA_H
-
-#include "eas_types.h"
-#include "eas_synthcfg.h"
-#include "eas.h"
-#include "eas_audioconst.h"
-#include "eas_sndlib.h"
-#include "eas_pcm.h"
-#include "eas_pcmdata.h"
-#include "eas_synth.h"
-#include "eas_miditypes.h"
-#include "eas_effects.h"
-
-#ifdef AUX_MIXER
-#include "eas_auxmixdata.h"
-#endif
-
-#ifdef JET_INTERFACE
-#include "jet.h"
-#endif
-
-#ifdef _METRICS_ENABLED
-#include "eas_perf.h"
-#endif
-
-#ifndef MAX_NUMBER_STREAMS
-#define MAX_NUMBER_STREAMS 4
-#endif
-
-/* flags for S_EAS_STREAM */
-#define STREAM_FLAGS_PARSED 1
-#define STREAM_FLAGS_PAUSE 2
-#define STREAM_FLAGS_LOCATE 4
-#define STREAM_FLAGS_RESUME 8
-
-/* structure for parsing a stream */
-typedef struct s_eas_stream_tag
-{
- void *pParserModule;
- EAS_U32 time;
- EAS_U32 frameLength;
- EAS_I32 repeatCount;
- EAS_VOID_PTR handle;
- EAS_U8 volume;
- EAS_BOOL8 streamFlags;
-} S_EAS_STREAM;
-
-/* default master volume is -10dB */
-#define DEFAULT_VOLUME 90
-#define DEFAULT_STREAM_VOLUME 100
-#define DEFAULT_STREAM_GAIN 14622
-
-/* 10 dB of boost available for individual parsers */
-#define STREAM_VOLUME_HEADROOM 10
-
-/* amalgamated persistent data type */
-typedef struct s_eas_data_tag
-{
-#ifdef _CHECKED_BUILD
- EAS_U32 handleCheck;
-#endif
- EAS_HW_DATA_HANDLE hwInstData;
-
- S_EFFECTS_MODULE effectsModules[NUM_EFFECTS_MODULES];
-
-#ifdef _METRICS_ENABLED
- S_METRICS_INTERFACE *pMetricsModule;
- EAS_VOID_PTR pMetricsData;
-#endif
-
- EAS_I32 *pMixBuffer;
- EAS_PCM *pOutputAudioBuffer;
-
-#ifdef AUX_MIXER
- S_EAS_AUX_MIXER auxMixer;
-#endif
-
-#ifdef _MAXIMIZER_ENABLED
- EAS_VOID_PTR pMaximizerData;
-#endif
-
- S_EAS_STREAM streams[MAX_NUMBER_STREAMS];
-
- S_PCM_STATE *pPCMStreams;
-
- S_VOICE_MGR *pVoiceMgr;
-
-#ifdef JET_INTERFACE
- JET_DATA_HANDLE jetHandle;
-#endif
-
- EAS_U32 renderTime;
- EAS_I16 masterGain;
- EAS_U8 masterVolume;
- EAS_BOOL8 staticMemoryModel;
- EAS_BOOL8 searchHeaderFlag;
-} S_EAS_DATA;
-
-#endif
-
+ *
+ *----------------------------------------------------------------------------
+ * Revision Control:
+ * $Revision: 842 $
+ * $Date: 2007-08-23 14:32:31 -0700 (Thu, 23 Aug 2007) $
+ *----------------------------------------------------------------------------
+*/
+
+#ifndef _EAS_DATA_H
+#define _EAS_DATA_H
+
+#include "eas_types.h"
+#include "eas_synthcfg.h"
+#include "eas.h"
+#include "eas_audioconst.h"
+#include "eas_sndlib.h"
+#include "eas_pcm.h"
+#include "eas_pcmdata.h"
+#include "eas_synth.h"
+#include "eas_miditypes.h"
+#include "eas_effects.h"
+
+#ifdef AUX_MIXER
+#include "eas_auxmixdata.h"
+#endif
+
+#ifdef JET_INTERFACE
+#include "jet.h"
+#endif
+
+#ifdef _METRICS_ENABLED
+#include "eas_perf.h"
+#endif
+
+#ifndef MAX_NUMBER_STREAMS
+#define MAX_NUMBER_STREAMS 4
+#endif
+
+/* flags for S_EAS_STREAM */
+#define STREAM_FLAGS_PARSED 1
+#define STREAM_FLAGS_PAUSE 2
+#define STREAM_FLAGS_LOCATE 4
+#define STREAM_FLAGS_RESUME 8
+
+/* structure for parsing a stream */
+typedef struct s_eas_stream_tag
+{
+ void *pParserModule;
+ EAS_U32 time;
+ EAS_U32 frameLength;
+ EAS_I32 repeatCount;
+ EAS_VOID_PTR handle;
+ EAS_U8 volume;
+ EAS_BOOL8 streamFlags;
+} S_EAS_STREAM;
+
+/* default master volume is -10dB */
+#define DEFAULT_VOLUME 90
+#define DEFAULT_STREAM_VOLUME 100
+#define DEFAULT_STREAM_GAIN 14622
+
+/* 10 dB of boost available for individual parsers */
+#define STREAM_VOLUME_HEADROOM 10
+
+/* amalgamated persistent data type */
+typedef struct s_eas_data_tag
+{
+#ifdef _CHECKED_BUILD
+ EAS_U32 handleCheck;
+#endif
+ EAS_HW_DATA_HANDLE hwInstData;
+
+ S_EFFECTS_MODULE effectsModules[NUM_EFFECTS_MODULES];
+
+#ifdef _METRICS_ENABLED
+ S_METRICS_INTERFACE *pMetricsModule;
+ EAS_VOID_PTR pMetricsData;
+#endif
+
+ EAS_I32 *pMixBuffer;
+ EAS_PCM *pOutputAudioBuffer;
+
+#ifdef AUX_MIXER
+ S_EAS_AUX_MIXER auxMixer;
+#endif
+
+#ifdef _MAXIMIZER_ENABLED
+ EAS_VOID_PTR pMaximizerData;
+#endif
+
+ S_EAS_STREAM streams[MAX_NUMBER_STREAMS];
+
+ S_PCM_STATE *pPCMStreams;
+
+ S_VOICE_MGR *pVoiceMgr;
+
+#ifdef JET_INTERFACE
+ JET_DATA_HANDLE jetHandle;
+#endif
+
+ EAS_U32 renderTime;
+ EAS_I16 masterGain;
+ EAS_U8 masterVolume;
+ EAS_BOOL8 staticMemoryModel;
+ EAS_BOOL8 searchHeaderFlag;
+} S_EAS_DATA;
+
+#endif
+
diff --git a/arm-fm-22k/lib_src/eas_effects.h b/arm-fm-22k/lib_src/eas_effects.h
index 01e64c0..86dedac 100644
--- a/arm-fm-22k/lib_src/eas_effects.h
+++ b/arm-fm-22k/lib_src/eas_effects.h
@@ -1,12 +1,12 @@
-/*----------------------------------------------------------------------------
- *
- * File:
- * eas_effects.h
- *
- * Contents and purpose:
- * Defines a generic effects interface.
- *
- * Copyright Sonic Network Inc. 2005
+/*----------------------------------------------------------------------------
+ *
+ * File:
+ * eas_effects.h
+ *
+ * Contents and purpose:
+ * Defines a generic effects interface.
+ *
+ * Copyright Sonic Network Inc. 2005
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -19,43 +19,43 @@
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
- *
- *----------------------------------------------------------------------------
- * Revision Control:
- * $Revision: 82 $
- * $Date: 2006-07-10 11:45:19 -0700 (Mon, 10 Jul 2006) $
- *----------------------------------------------------------------------------
-*/
-
-#ifndef _EAS_EFFECTS_H
-#define _EAS_EFFECTS_H
-
-#include "eas_types.h"
-
-typedef struct
-{
- EAS_RESULT (*pfInit)(EAS_DATA_HANDLE pEASData, EAS_VOID_PTR *pInstData);
- void (*pfProcess)(EAS_VOID_PTR pInstData, EAS_PCM *in, EAS_PCM *out, EAS_I32 numSamples);
- EAS_RESULT (*pfShutdown)(EAS_DATA_HANDLE pEASData, EAS_VOID_PTR pInstData);
- EAS_RESULT (*pFGetParam)(EAS_VOID_PTR pInstData, EAS_I32 param, EAS_I32 *pValue);
- EAS_RESULT (*pFSetParam)(EAS_VOID_PTR pInstData, EAS_I32 param, EAS_I32 value);
-} S_EFFECTS_INTERFACE;
-
-typedef struct
-{
- EAS_RESULT (*pfInit)(EAS_DATA_HANDLE pEASData, EAS_VOID_PTR *pInstData);
- void (*pfProcess)(EAS_VOID_PTR pInstData, EAS_I32 *in, EAS_I32 *out, EAS_I32 numSamples);
- EAS_RESULT (*pfShutdown)(EAS_DATA_HANDLE pEASData, EAS_VOID_PTR pInstData);
- EAS_RESULT (*pFGetParam)(EAS_VOID_PTR pInstData, EAS_I32 param, EAS_I32 *pValue);
- EAS_RESULT (*pFSetParam)(EAS_VOID_PTR pInstData, EAS_I32 param, EAS_I32 value);
-} S_EFFECTS32_INTERFACE;
-
-/* mixer instance data */
-typedef struct
-{
- S_EFFECTS_INTERFACE *effect;
- EAS_VOID_PTR effectData;
-} S_EFFECTS_MODULE;
-
-#endif /* end _EAS_EFFECTS_H */
-
+ *
+ *----------------------------------------------------------------------------
+ * Revision Control:
+ * $Revision: 82 $
+ * $Date: 2006-07-10 11:45:19 -0700 (Mon, 10 Jul 2006) $
+ *----------------------------------------------------------------------------
+*/
+
+#ifndef _EAS_EFFECTS_H
+#define _EAS_EFFECTS_H
+
+#include "eas_types.h"
+
+typedef struct
+{
+ EAS_RESULT (*pfInit)(EAS_DATA_HANDLE pEASData, EAS_VOID_PTR *pInstData);
+ void (*pfProcess)(EAS_VOID_PTR pInstData, EAS_PCM *in, EAS_PCM *out, EAS_I32 numSamples);
+ EAS_RESULT (*pfShutdown)(EAS_DATA_HANDLE pEASData, EAS_VOID_PTR pInstData);
+ EAS_RESULT (*pFGetParam)(EAS_VOID_PTR pInstData, EAS_I32 param, EAS_I32 *pValue);
+ EAS_RESULT (*pFSetParam)(EAS_VOID_PTR pInstData, EAS_I32 param, EAS_I32 value);
+} S_EFFECTS_INTERFACE;
+
+typedef struct
+{
+ EAS_RESULT (*pfInit)(EAS_DATA_HANDLE pEASData, EAS_VOID_PTR *pInstData);
+ void (*pfProcess)(EAS_VOID_PTR pInstData, EAS_I32 *in, EAS_I32 *out, EAS_I32 numSamples);
+ EAS_RESULT (*pfShutdown)(EAS_DATA_HANDLE pEASData, EAS_VOID_PTR pInstData);
+ EAS_RESULT (*pFGetParam)(EAS_VOID_PTR pInstData, EAS_I32 param, EAS_I32 *pValue);
+ EAS_RESULT (*pFSetParam)(EAS_VOID_PTR pInstData, EAS_I32 param, EAS_I32 value);
+} S_EFFECTS32_INTERFACE;
+
+/* mixer instance data */
+typedef struct
+{
+ S_EFFECTS_INTERFACE *effect;
+ EAS_VOID_PTR effectData;
+} S_EFFECTS_MODULE;
+
+#endif /* end _EAS_EFFECTS_H */
+
diff --git a/arm-fm-22k/lib_src/eas_fmengine.c b/arm-fm-22k/lib_src/eas_fmengine.c
index 9c3da66..ea7f69c 100644
--- a/arm-fm-22k/lib_src/eas_fmengine.c
+++ b/arm-fm-22k/lib_src/eas_fmengine.c
@@ -1,12 +1,12 @@
-/*----------------------------------------------------------------------------
- *
- * File:
- * eas_fmengine.c
- *
- * Contents and purpose:
- * Implements the low-level FM synthesizer functions.
- *
- * Copyright Sonic Network Inc. 2004, 2005
+/*----------------------------------------------------------------------------
+ *
+ * File:
+ * eas_fmengine.c
+ *
+ * Contents and purpose:
+ * Implements the low-level FM synthesizer functions.
+ *
+ * Copyright Sonic Network Inc. 2004, 2005
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -19,767 +19,767 @@
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
- *
- *----------------------------------------------------------------------------
- * Revision Control:
- * $Revision: 795 $
- * $Date: 2007-08-01 00:14:45 -0700 (Wed, 01 Aug 2007) $
- *----------------------------------------------------------------------------
-*/
-
-/* includes */
-#include "eas_types.h"
-#include "eas_math.h"
-#include "eas_audioconst.h"
-#include "eas_fmengine.h"
-
-#if defined(EAS_FM_SYNTH) || defined(EAS_HYBRID_SYNTH) || defined(EAS_SPLIT_HYBRID_SYNTH) || defined(EAS_SPLIT_FM_SYNTH)
-#include "eas_data.h"
-#endif
-
-/* externals */
-extern const EAS_I16 sineTable[];
-extern const EAS_U8 fmScaleTable[16];
-
-// saturation constants for 32-bit to 16-bit conversion
-#define _EAS_MAX_OUTPUT 32767
-#define _EAS_MIN_OUTPUT -32767
-
-static S_FM_ENG_VOICE voices[NUM_FM_VOICES];
-
-/* local prototypes */
-void FM_SynthMixVoice (S_FM_ENG_VOICE *p, EAS_U16 gainTarget, EAS_I32 numSamplesToAdd, EAS_PCM *pInputBuffer, EAS_I32 *pBuffer);
-
-/* used in development environment */
-#if defined(_SATURATION_MONITOR)
-static EAS_BOOL bSaturated = EAS_FALSE;
-
-/*----------------------------------------------------------------------------
- * FM_CheckSaturation()
- *----------------------------------------------------------------------------
- * Purpose:
- * Allows the sound development tool to check for saturation at the voice
- * level. Useful for tuning the level controls.
- *
- * Inputs:
- *
- * Outputs:
- * Returns true if saturation has occurred since the last time the function
- * was called.
- *
- * Side Effects:
- * Resets the saturation flag
- *----------------------------------------------------------------------------
-*/
-EAS_BOOL FM_CheckSaturation ()
-{
- EAS_BOOL bTemp;
- bTemp = bSaturated;
- bSaturated = EAS_FALSE;
- return bTemp;
-}
-#endif
-
-/*----------------------------------------------------------------------------
- * FM_Saturate()
- *----------------------------------------------------------------------------
- * Purpose:
- * This inline function saturates a 32-bit number to 16-bits
- *
- * Inputs:
- * psEASData - pointer to overall EAS data structure
- *
- * Outputs:
- * Returns a 16-bit integer
- *----------------------------------------------------------------------------
-*/
-EAS_INLINE EAS_I16 FM_Saturate (EAS_I32 nValue)
-{
- if (nValue > _EAS_MAX_OUTPUT)
- {
-#if defined(_SATURATION_MONITOR)
- bSaturated = EAS_TRUE;
-#endif
- return _EAS_MAX_OUTPUT;
- }
- if (nValue < _EAS_MIN_OUTPUT)
- {
-#if defined(_SATURATION_MONITOR)
- bSaturated = EAS_TRUE;
-#endif
- return _EAS_MIN_OUTPUT;
- }
- return (EAS_I16) nValue;
-}
-
-/*----------------------------------------------------------------------------
- * FM_Noise()
- *----------------------------------------------------------------------------
- * Purpose:
- * A 31-bit low-cost linear congruential PRNG algorithm used to
- * generate noise.
- *
- * Inputs:
- * pnSeed - pointer to 32-bit PRNG seed
- *
- * Outputs:
- * Returns a 16-bit integer
- *----------------------------------------------------------------------------
-*/
-EAS_INLINE EAS_I16 FM_Noise (EAS_U32 *pnSeed)
-{
- *pnSeed = *pnSeed * 214013L + 2531011L;
- return (EAS_I16) ((*pnSeed >> 15) & 0xffff);
-}
-
-/*----------------------------------------------------------------------------
- * FM_PhaseInc()
- *----------------------------------------------------------------------------
- * Purpose:
- * Transform pitch cents to linear phase increment
- *
- * Inputs:
- * nCents - measured in cents
- * psEASData - pointer to overall EAS data structure
- *
- * Outputs:
- * nResult - int.frac result (where frac has NUM_DENTS_FRAC_BITS)
- *
- * Side Effects:
- *
- *----------------------------------------------------------------------------
-*/
-static EAS_I32 FM_PhaseInc (EAS_I32 nCents)
-{
- EAS_I32 nDents;
- EAS_I32 nExponentInt, nExponentFrac;
- EAS_I32 nTemp1, nTemp2;
- EAS_I32 nResult;
-
- /* convert cents to dents */
- nDents = FMUL_15x15(nCents, CENTS_TO_DENTS);
- nExponentInt = GET_DENTS_INT_PART(nDents) + (32 - SINE_TABLE_SIZE_IN_BITS - NUM_EG1_FRAC_BITS);
- nExponentFrac = GET_DENTS_FRAC_PART(nDents);
-
- /* implement 2^(fracPart) as a power series */
- nTemp1 = GN2_TO_X2 + MULT_DENTS_COEF(nExponentFrac, GN2_TO_X3);
- nTemp2 = GN2_TO_X1 + MULT_DENTS_COEF(nExponentFrac, nTemp1);
- nTemp1 = GN2_TO_X0 + MULT_DENTS_COEF(nExponentFrac, nTemp2);
-
- /*
- implement 2^(intPart) as
- a left shift for intPart >= 0 or
- a left shift for intPart < 0
- */
- if (nExponentInt >= 0)
- {
- /* left shift for positive exponents */
- /*lint -e{703} <avoid multiply for performance>*/
- nResult = nTemp1 << nExponentInt;
- }
- else
- {
- /* right shift for negative exponents */
- nExponentInt = -nExponentInt;
- nResult = nTemp1 >> nExponentInt;
- }
-
- return nResult;
-}
-
-#if (NUM_OUTPUT_CHANNELS == 2)
-/*----------------------------------------------------------------------------
- * FM_CalculatePan()
- *----------------------------------------------------------------------------
- * Purpose:
- * Assign the left and right gain values corresponding to the given pan value.
- *
- * Inputs:
- * psVoice - ptr to the voice we have assigned for this channel
- * psArticulation - ptr to this voice's articulation
- * psEASData - pointer to overall EAS data structure
- *
- * Outputs:
- *
- * Side Effects:
- * the given voice's m_nGainLeft and m_nGainRight are assigned
- *----------------------------------------------------------------------------
-*/
-static void FM_CalculatePan (EAS_I16 pan, EAS_U16 *pGainLeft, EAS_U16 *pGainRight)
-{
- EAS_I32 nTemp;
- EAS_INT nNetAngle;
-
- /*
- Implement the following
- sin(x) = (2-4*c)*x^2 + c + x
- cos(x) = (2-4*c)*x^2 + c - x
-
- where c = 1/sqrt(2)
- using the a0 + x*(a1 + x*a2) approach
- */
-
- /*
- Get the Midi CC10 pan value for this voice's channel
- convert the pan value to an "angle" representation suitable for
- our sin, cos calculator. This representation is NOT necessarily the same
- as the transform in the GM manuals because of our sin, cos calculator.
- "angle" = (CC10 - 64)/128
- */
- /*lint -e{703} <avoid multiply for performance reasons>*/
- nNetAngle = ((EAS_I32) pan) << (NUM_EG1_FRAC_BITS -7);
-
- /* calculate sin */
- nTemp = EG1_ONE + FMUL_15x15(COEFF_PAN_G2, nNetAngle);
- nTemp = COEFF_PAN_G0 + FMUL_15x15(nTemp, nNetAngle);
-
- if (nTemp > SYNTH_FULL_SCALE_EG1_GAIN)
- nTemp = SYNTH_FULL_SCALE_EG1_GAIN;
- else if (nTemp < 0)
- nTemp = 0;
-
- *pGainRight = (EAS_U16) nTemp;
-
- /* calculate cos */
- nTemp = -EG1_ONE + FMUL_15x15(COEFF_PAN_G2, nNetAngle);
- nTemp = COEFF_PAN_G0 + FMUL_15x15(nTemp, nNetAngle);
-
- if (nTemp > SYNTH_FULL_SCALE_EG1_GAIN)
- nTemp = SYNTH_FULL_SCALE_EG1_GAIN;
- else if (nTemp < 0)
- nTemp = 0;
-
- *pGainLeft = (EAS_U16) nTemp;
-}
-#endif /* #if (NUM_OUTPUT_CHANNELS == 2) */
-
-/*----------------------------------------------------------------------------
- * FM_Operator()
- *----------------------------------------------------------------------------
- * Purpose:
- * Synthesizes a buffer of samples based on passed parameters.
- *
- * Inputs:
- * nNumSamplesToAdd - number of samples to synthesize
- * psEASData - pointer to overall EAS data structure
- *
- * Outputs:
- *
- * Side Effects:
- *
- *----------------------------------------------------------------------------
-*/
-void FM_Operator (
- S_FM_ENG_OPER *p,
- EAS_I32 numSamplesToAdd,
- EAS_PCM *pBuffer,
- EAS_PCM *pModBuffer,
- EAS_BOOL mix,
- EAS_U16 gainTarget,
- EAS_I16 pitch,
- EAS_U8 feedback,
- EAS_I16 *pLastOutput)
-{
- EAS_I32 gain;
- EAS_I32 gainInc;
- EAS_U32 phase;
- EAS_U32 phaseInc;
- EAS_U32 phaseTemp;
- EAS_I32 temp;
- EAS_I32 temp2;
-
- /* establish local gain variable */
- gain = (EAS_I32) p->gain << 16;
-
- /* calculate gain increment */
- /*lint -e{703} use shift for performance */
- gainInc = ((EAS_I32) gainTarget - (EAS_I32) p->gain) << (16 - SYNTH_UPDATE_PERIOD_IN_BITS);
-
- /* establish local phase variables */
- phase = p->phase;
-
- /* calculate the new phase increment */
- phaseInc = (EAS_U32) FM_PhaseInc(pitch);
-
- /* restore final output from previous frame for feedback loop */
- if (pLastOutput)
- temp = *pLastOutput;
- else
- temp = 0;
-
- /* generate a buffer of samples */
- while (numSamplesToAdd--)
- {
-
- /* incorporate modulation */
- if (pModBuffer)
- {
- /*lint -e{701} use shift for performance */
- temp = *pModBuffer++ << FM_MODULATOR_INPUT_SHIFT;
- }
-
- /* incorporate feedback */
- else
- {
- /*lint -e{703} use shift for performance */
- temp = (temp * (EAS_I32) feedback) << FM_FEEDBACK_SHIFT;
- }
-
- /*lint -e{737} <use this behavior to avoid extra mask step> */
- phaseTemp = phase + temp;
-
- /* fetch sample from wavetable */
- temp = sineTable[phaseTemp >> (32 - SINE_TABLE_SIZE_IN_BITS)];
-
- /* increment operator phase */
- phase += phaseInc;
-
- /* internal gain for modulation effects */
- temp = FMUL_15x15(temp, (gain >> 16));
-
- /* output gain calculation */
- temp2 = FMUL_15x15(temp, p->outputGain);
-
- /* saturating add to buffer */
- if (mix)
- {
- temp2 += *pBuffer;
- *pBuffer++ = FM_Saturate(temp2);
- }
-
- /* output to buffer */
- else
- *pBuffer++ = (EAS_I16) temp2;
-
- /* increment gain */
- gain += gainInc;
-
- }
-
- /* save phase and gain */
- p->phase = phase;
- p->gain = gainTarget;
-
- /* save last output for feedback in next frame */
- if (pLastOutput)
- *pLastOutput = (EAS_I16) temp;
-}
-
-/*----------------------------------------------------------------------------
- * FM_NoiseOperator()
- *----------------------------------------------------------------------------
- * Purpose:
- * Synthesizes a buffer of samples based on passed parameters.
- *
- * Inputs:
- * nNumSamplesToAdd - number of samples to synthesize
- * psEASData - pointer to overall EAS data structure
- *
- * Outputs:
- *
- * Side Effects:
- *
- *----------------------------------------------------------------------------
-*/
-void FM_NoiseOperator (
- S_FM_ENG_OPER *p,
- EAS_I32 numSamplesToAdd,
- EAS_PCM *pBuffer,
- EAS_BOOL mix,
- EAS_U16 gainTarget,
- EAS_U8 feedback,
- EAS_I16 *pLastOutput)
-{
- EAS_I32 gain;
- EAS_I32 gainInc;
- EAS_U32 phase;
- EAS_I32 temp;
- EAS_I32 temp2;
-
- /* establish local gain variable */
- gain = (EAS_I32) p->gain << 16;
-
- /* calculate gain increment */
- /*lint -e{703} use shift for performance */
- gainInc = ((EAS_I32) gainTarget - (EAS_I32) p->gain) << (16 - SYNTH_UPDATE_PERIOD_IN_BITS);
-
- /* establish local phase variables */
- phase = p->phase;
-
- /* establish local phase variables */
- phase = p->phase;
-
- /* recall last sample for filter Z-1 term */
- temp = 0;
- if (pLastOutput)
- temp = *pLastOutput;
-
- /* generate a buffer of samples */
- while (numSamplesToAdd--)
- {
-
- /* if using filter */
- if (pLastOutput)
- {
- /* use PRNG for noise */
- temp2 = FM_Noise(&phase);
-
- /*lint -e{704} use shift for performance */
- temp += ((temp2 -temp) * feedback) >> 8;
- }
- else
- {
- temp = FM_Noise(&phase);
- }
-
- /* internal gain for modulation effects */
- temp2 = FMUL_15x15(temp, (gain >> 16));
-
- /* output gain calculation */
- temp2 = FMUL_15x15(temp2, p->outputGain);
-
- /* saturating add to buffer */
- if (mix)
- {
- temp2 += *pBuffer;
- *pBuffer++ = FM_Saturate(temp2);
- }
-
- /* output to buffer */
- else
- *pBuffer++ = (EAS_I16) temp2;
-
- /* increment gain */
- gain += gainInc;
-
- }
-
- /* save phase and gain */
- p->phase = phase;
- p->gain = gainTarget;
-
- /* save last output for feedback in next frame */
- if (pLastOutput)
- *pLastOutput = (EAS_I16) temp;
-}
-
-/*----------------------------------------------------------------------------
- * FM_ConfigVoice()
- *----------------------------------------------------------------------------
- * Purpose:
- * Receives parameters to start a new voice.
- *
- * Inputs:
- * voiceNum - voice number to start
- * vCfg - configuration data
- * pMixBuffer - pointer to host supplied buffer
- *
- * Outputs:
- *
- * Side Effects:
- *
- * Notes:
- * pFrameBuffer is not used in the test version, but is passed as a
- * courtesy to split architecture implementations. It can be used as
- * as pointer to the interprocessor communications buffer when the
- * synthesis parameters are passed off to a DSP for synthesis.
- *----------------------------------------------------------------------------
-*/
-/*lint -esym(715, pFrameBuffer) pFrameBuffer not used in test version - see above */
-void FM_ConfigVoice (EAS_I32 voiceNum, S_FM_VOICE_CONFIG *vCfg, EAS_FRAME_BUFFER_HANDLE pFrameBuffer)
-{
- S_FM_ENG_VOICE *pVoice;
- EAS_INT i;
-
- /* establish pointer to voice data */
- pVoice = &voices[voiceNum];
-
- /* save data */
- pVoice->feedback = vCfg->feedback;
- pVoice->flags = vCfg->flags;
- pVoice->voiceGain = vCfg->voiceGain;
-
- /* initialize Z-1 terms */
- pVoice->op1Out = 0;
- pVoice->op3Out = 0;
-
- /* initialize operators */
- for (i = 0; i < 4; i++)
- {
- /* save operator data */
- pVoice->oper[i].gain = vCfg->gain[i];
- pVoice->oper[i].outputGain = vCfg->outputGain[i];
- pVoice->oper[i].outputGain = vCfg->outputGain[i];
-
- /* initalize operator */
- pVoice->oper[i].phase = 0;
- }
-
- /* calculate pan */
-#if NUM_OUTPUT_CHANNELS == 2
- FM_CalculatePan(vCfg->pan, &pVoice->gainLeft, &pVoice->gainRight);
-#endif
-}
-
-/*----------------------------------------------------------------------------
- * FM_ProcessVoice()
- *----------------------------------------------------------------------------
- * Purpose:
- * Synthesizes a buffer of samples based on calculated parameters.
- *
- * Inputs:
- * nNumSamplesToAdd - number of samples to synthesize
- * psEASData - pointer to overall EAS data structure
- *
- * Outputs:
- *
- * Side Effects:
- *
- * Notes:
- * pOut is not used in the test version, but is passed as a
- * courtesy to split architecture implementations. It can be used as
- * as pointer to the interprocessor communications buffer when the
- * synthesis parameters are passed off to a DSP for synthesis.
- *----------------------------------------------------------------------------
-*/
-/*lint -esym(715, pOut) pOut not used in test version - see above */
-void FM_ProcessVoice (
- EAS_I32 voiceNum,
- S_FM_VOICE_FRAME *pFrame,
- EAS_I32 numSamplesToAdd,
- EAS_PCM *pTempBuffer,
- EAS_PCM *pBuffer,
- EAS_I32 *pMixBuffer,
- EAS_FRAME_BUFFER_HANDLE pFrameBuffer)
-{
- S_FM_ENG_VOICE *p;
- EAS_PCM *pOutBuf;
- EAS_PCM *pMod;
- EAS_BOOL mix;
- EAS_U8 feedback1;
- EAS_U8 feedback3;
- EAS_U8 mode;
-
- /* establish pointer to voice data */
- p = &voices[voiceNum];
- mode = p->flags & 0x07;
-
- /* lookup feedback values */
- feedback1 = fmScaleTable[p->feedback >> 4];
- feedback3 = fmScaleTable[p->feedback & 0x0f];
-
- /* operator 3 is on output bus in modes 0, 1, and 3 */
- if ((mode == 0) || (mode == 1) || (mode == 3))
- pOutBuf = pBuffer;
- else
- pOutBuf = pTempBuffer;
-
- if (p->flags & FLAG_FM_ENG_VOICE_OP3_NOISE)
- {
- FM_NoiseOperator(
- p->oper + 2,
- numSamplesToAdd,
- pOutBuf,
- EAS_FALSE,
- pFrame->gain[2],
- feedback3,
- &p->op3Out);
- }
- else
- {
- FM_Operator(
- p->oper + 2,
- numSamplesToAdd,
- pOutBuf,
- 0,
- EAS_FALSE,
- pFrame->gain[2],
- pFrame->pitch[2],
- feedback3,
- &p->op3Out);
- }
-
- /* operator 4 is on output bus in modes 0, 1, and 2 */
- if (mode < 3)
- pOutBuf = pBuffer;
- else
- pOutBuf = pTempBuffer;
-
- /* operator 4 is modulated in modes 2, 4, and 5 */
- if ((mode == 2) || (mode == 4) || (mode == 5))
- pMod = pTempBuffer;
- else
- pMod = 0;
-
- /* operator 4 is in mix mode in modes 0 and 1 */
- mix = (mode < 2);
-
- if (p->flags & FLAG_FM_ENG_VOICE_OP4_NOISE)
- {
- FM_NoiseOperator(
- p->oper + 3,
- numSamplesToAdd,
- pOutBuf,
- mix,
- pFrame->gain[3],
- 0,
- 0);
- }
- else
- {
- FM_Operator(
- p->oper + 3,
- numSamplesToAdd,
- pOutBuf,
- pMod,
- mix,
- pFrame->gain[3],
- pFrame->pitch[3],
- 0,
- 0);
- }
-
- /* operator 1 is on output bus in mode 0 */
- if (mode == 0)
- pOutBuf = pBuffer;
- else
- pOutBuf = pTempBuffer;
-
- /* operator 1 is modulated in modes 3 and 4 */
- if ((mode == 3) || (mode == 4))
- pMod = pTempBuffer;
- else
- pMod = 0;
-
- /* operator 1 is in mix mode in modes 0 and 5 */
- mix = ((mode == 0) || (mode == 5));
-
- if (p->flags & FLAG_FM_ENG_VOICE_OP1_NOISE)
- {
- FM_NoiseOperator(
- p->oper,
- numSamplesToAdd,
- pOutBuf,
- mix,
- pFrame->gain[0],
- feedback1,
- &p->op1Out);
- }
- else
- {
- FM_Operator(
- p->oper,
- numSamplesToAdd,
- pOutBuf,
- pMod,
- mix,
- pFrame->gain[0],
- pFrame->pitch[0],
- feedback1,
- &p->op1Out);
- }
-
- /* operator 2 is modulated in all modes except 0 */
- if (mode != 0)
- pMod = pTempBuffer;
- else
- pMod = 0;
-
- /* operator 1 is in mix mode in modes 0 -3 */
- mix = (mode < 4);
-
- if (p->flags & FLAG_FM_ENG_VOICE_OP2_NOISE)
- {
- FM_NoiseOperator(
- p->oper + 1,
- numSamplesToAdd,
- pBuffer,
- mix,
- pFrame->gain[1],
- 0,
- 0);
- }
- else
- {
- FM_Operator(
- p->oper + 1,
- numSamplesToAdd,
- pBuffer,
- pMod,
- mix,
- pFrame->gain[1],
- pFrame->pitch[1],
- 0,
- 0);
- }
-
- /* mix voice output to synthesizer output buffer */
- FM_SynthMixVoice(p, pFrame->voiceGain, numSamplesToAdd, pBuffer, pMixBuffer);
-}
-
-/*----------------------------------------------------------------------------
- * FM_SynthMixVoice()
- *----------------------------------------------------------------------------
- * Purpose:
- * Mixes the voice output buffer into the final mix using an anti-zipper
- * filter.
- *
- * Inputs:
- * nNumSamplesToAdd - number of samples to synthesize
- * psEASData - pointer to overall EAS data structure
- *
- * Outputs:
- *
- * Side Effects:
- *
- *----------------------------------------------------------------------------
-*/
-void FM_SynthMixVoice(S_FM_ENG_VOICE *p, EAS_U16 nGainTarget, EAS_I32 numSamplesToAdd, EAS_PCM *pInputBuffer, EAS_I32 *pBuffer)
-{
- EAS_I32 nGain;
- EAS_I32 nGainInc;
- EAS_I32 nTemp;
-
- /* restore previous gain */
- /*lint -e{703} <use shift for performance> */
- nGain = (EAS_I32) p->voiceGain << 16;
-
- /* calculate gain increment */
- /*lint -e{703} <use shift for performance> */
- nGainInc = ((EAS_I32) nGainTarget - (EAS_I32) p->voiceGain) << (16 - SYNTH_UPDATE_PERIOD_IN_BITS);
-
- /* mix the output buffer */
- while (numSamplesToAdd--)
- {
- /* output gain calculation */
- nTemp = *pInputBuffer++;
-
- /* sum to output buffer */
-#if (NUM_OUTPUT_CHANNELS == 2)
-
- /*lint -e{704} <use shift for performance> */
- nTemp = ((EAS_I32) nTemp * (nGain >> 16)) >> FM_GAIN_SHIFT;
-
- /*lint -e{704} <use shift for performance> */
- {
- EAS_I32 nTemp2;
- nTemp = nTemp >> FM_STEREO_PRE_GAIN_SHIFT;
- nTemp2 = (nTemp * p->gainLeft) >> FM_STEREO_POST_GAIN_SHIFT;
- *pBuffer++ += nTemp2;
- nTemp2 = (nTemp * p->gainRight) >> FM_STEREO_POST_GAIN_SHIFT;
- *pBuffer++ += nTemp2;
- }
-#else
- /*lint -e{704} <use shift for performance> */
- nTemp = ((EAS_I32) nTemp * (nGain >> 16)) >> FM_MONO_GAIN_SHIFT;
- *pBuffer++ += nTemp;
-#endif
-
- /* increment gain for anti-zipper filter */
- nGain += nGainInc;
- }
-
- /* save gain */
- p->voiceGain = nGainTarget;
-}
-
+ *
+ *----------------------------------------------------------------------------
+ * Revision Control:
+ * $Revision: 795 $
+ * $Date: 2007-08-01 00:14:45 -0700 (Wed, 01 Aug 2007) $
+ *----------------------------------------------------------------------------
+*/
+
+/* includes */
+#include "eas_types.h"
+#include "eas_math.h"
+#include "eas_audioconst.h"
+#include "eas_fmengine.h"
+
+#if defined(EAS_FM_SYNTH) || defined(EAS_HYBRID_SYNTH) || defined(EAS_SPLIT_HYBRID_SYNTH) || defined(EAS_SPLIT_FM_SYNTH)
+#include "eas_data.h"
+#endif
+
+/* externals */
+extern const EAS_I16 sineTable[];
+extern const EAS_U8 fmScaleTable[16];
+
+// saturation constants for 32-bit to 16-bit conversion
+#define _EAS_MAX_OUTPUT 32767
+#define _EAS_MIN_OUTPUT -32767
+
+static S_FM_ENG_VOICE voices[NUM_FM_VOICES];
+
+/* local prototypes */
+void FM_SynthMixVoice (S_FM_ENG_VOICE *p, EAS_U16 gainTarget, EAS_I32 numSamplesToAdd, EAS_PCM *pInputBuffer, EAS_I32 *pBuffer);
+
+/* used in development environment */
+#if defined(_SATURATION_MONITOR)
+static EAS_BOOL bSaturated = EAS_FALSE;
+
+/*----------------------------------------------------------------------------
+ * FM_CheckSaturation()
+ *----------------------------------------------------------------------------
+ * Purpose:
+ * Allows the sound development tool to check for saturation at the voice
+ * level. Useful for tuning the level controls.
+ *
+ * Inputs:
+ *
+ * Outputs:
+ * Returns true if saturation has occurred since the last time the function
+ * was called.
+ *
+ * Side Effects:
+ * Resets the saturation flag
+ *----------------------------------------------------------------------------
+*/
+EAS_BOOL FM_CheckSaturation ()
+{
+ EAS_BOOL bTemp;
+ bTemp = bSaturated;
+ bSaturated = EAS_FALSE;
+ return bTemp;
+}
+#endif
+
+/*----------------------------------------------------------------------------
+ * FM_Saturate()
+ *----------------------------------------------------------------------------
+ * Purpose:
+ * This inline function saturates a 32-bit number to 16-bits
+ *
+ * Inputs:
+ * psEASData - pointer to overall EAS data structure
+ *
+ * Outputs:
+ * Returns a 16-bit integer
+ *----------------------------------------------------------------------------
+*/
+EAS_INLINE EAS_I16 FM_Saturate (EAS_I32 nValue)
+{
+ if (nValue > _EAS_MAX_OUTPUT)
+ {
+#if defined(_SATURATION_MONITOR)
+ bSaturated = EAS_TRUE;
+#endif
+ return _EAS_MAX_OUTPUT;
+ }
+ if (nValue < _EAS_MIN_OUTPUT)
+ {
+#if defined(_SATURATION_MONITOR)
+ bSaturated = EAS_TRUE;
+#endif
+ return _EAS_MIN_OUTPUT;
+ }
+ return (EAS_I16) nValue;
+}
+
+/*----------------------------------------------------------------------------
+ * FM_Noise()
+ *----------------------------------------------------------------------------
+ * Purpose:
+ * A 31-bit low-cost linear congruential PRNG algorithm used to
+ * generate noise.
+ *
+ * Inputs:
+ * pnSeed - pointer to 32-bit PRNG seed
+ *
+ * Outputs:
+ * Returns a 16-bit integer
+ *----------------------------------------------------------------------------
+*/
+EAS_INLINE EAS_I16 FM_Noise (EAS_U32 *pnSeed)
+{
+ *pnSeed = *pnSeed * 214013L + 2531011L;
+ return (EAS_I16) ((*pnSeed >> 15) & 0xffff);
+}
+
+/*----------------------------------------------------------------------------
+ * FM_PhaseInc()
+ *----------------------------------------------------------------------------
+ * Purpose:
+ * Transform pitch cents to linear phase increment
+ *
+ * Inputs:
+ * nCents - measured in cents
+ * psEASData - pointer to overall EAS data structure
+ *
+ * Outputs:
+ * nResult - int.frac result (where frac has NUM_DENTS_FRAC_BITS)
+ *
+ * Side Effects:
+ *
+ *----------------------------------------------------------------------------
+*/
+static EAS_I32 FM_PhaseInc (EAS_I32 nCents)
+{
+ EAS_I32 nDents;
+ EAS_I32 nExponentInt, nExponentFrac;
+ EAS_I32 nTemp1, nTemp2;
+ EAS_I32 nResult;
+
+ /* convert cents to dents */
+ nDents = FMUL_15x15(nCents, CENTS_TO_DENTS);
+ nExponentInt = GET_DENTS_INT_PART(nDents) + (32 - SINE_TABLE_SIZE_IN_BITS - NUM_EG1_FRAC_BITS);
+ nExponentFrac = GET_DENTS_FRAC_PART(nDents);
+
+ /* implement 2^(fracPart) as a power series */
+ nTemp1 = GN2_TO_X2 + MULT_DENTS_COEF(nExponentFrac, GN2_TO_X3);
+ nTemp2 = GN2_TO_X1 + MULT_DENTS_COEF(nExponentFrac, nTemp1);
+ nTemp1 = GN2_TO_X0 + MULT_DENTS_COEF(nExponentFrac, nTemp2);
+
+ /*
+ implement 2^(intPart) as
+ a left shift for intPart >= 0 or
+ a left shift for intPart < 0
+ */
+ if (nExponentInt >= 0)
+ {
+ /* left shift for positive exponents */
+ /*lint -e{703} <avoid multiply for performance>*/
+ nResult = nTemp1 << nExponentInt;
+ }
+ else
+ {
+ /* right shift for negative exponents */
+ nExponentInt = -nExponentInt;
+ nResult = nTemp1 >> nExponentInt;
+ }
+
+ return nResult;
+}
+
+#if (NUM_OUTPUT_CHANNELS == 2)
+/*----------------------------------------------------------------------------
+ * FM_CalculatePan()
+ *----------------------------------------------------------------------------
+ * Purpose:
+ * Assign the left and right gain values corresponding to the given pan value.
+ *
+ * Inputs:
+ * psVoice - ptr to the voice we have assigned for this channel
+ * psArticulation - ptr to this voice's articulation
+ * psEASData - pointer to overall EAS data structure
+ *
+ * Outputs:
+ *
+ * Side Effects:
+ * the given voice's m_nGainLeft and m_nGainRight are assigned
+ *----------------------------------------------------------------------------
+*/
+static void FM_CalculatePan (EAS_I16 pan, EAS_U16 *pGainLeft, EAS_U16 *pGainRight)
+{
+ EAS_I32 nTemp;
+ EAS_INT nNetAngle;
+
+ /*
+ Implement the following
+ sin(x) = (2-4*c)*x^2 + c + x
+ cos(x) = (2-4*c)*x^2 + c - x
+
+ where c = 1/sqrt(2)
+ using the a0 + x*(a1 + x*a2) approach
+ */
+
+ /*
+ Get the Midi CC10 pan value for this voice's channel
+ convert the pan value to an "angle" representation suitable for
+ our sin, cos calculator. This representation is NOT necessarily the same
+ as the transform in the GM manuals because of our sin, cos calculator.
+ "angle" = (CC10 - 64)/128
+ */
+ /*lint -e{703} <avoid multiply for performance reasons>*/
+ nNetAngle = ((EAS_I32) pan) << (NUM_EG1_FRAC_BITS -7);
+
+ /* calculate sin */
+ nTemp = EG1_ONE + FMUL_15x15(COEFF_PAN_G2, nNetAngle);
+ nTemp = COEFF_PAN_G0 + FMUL_15x15(nTemp, nNetAngle);
+
+ if (nTemp > SYNTH_FULL_SCALE_EG1_GAIN)
+ nTemp = SYNTH_FULL_SCALE_EG1_GAIN;
+ else if (nTemp < 0)
+ nTemp = 0;
+
+ *pGainRight = (EAS_U16) nTemp;
+
+ /* calculate cos */
+ nTemp = -EG1_ONE + FMUL_15x15(COEFF_PAN_G2, nNetAngle);
+ nTemp = COEFF_PAN_G0 + FMUL_15x15(nTemp, nNetAngle);
+
+ if (nTemp > SYNTH_FULL_SCALE_EG1_GAIN)
+ nTemp = SYNTH_FULL_SCALE_EG1_GAIN;
+ else if (nTemp < 0)
+ nTemp = 0;
+
+ *pGainLeft = (EAS_U16) nTemp;
+}
+#endif /* #if (NUM_OUTPUT_CHANNELS == 2) */
+
+/*----------------------------------------------------------------------------
+ * FM_Operator()
+ *----------------------------------------------------------------------------
+ * Purpose:
+ * Synthesizes a buffer of samples based on passed parameters.
+ *
+ * Inputs:
+ * nNumSamplesToAdd - number of samples to synthesize
+ * psEASData - pointer to overall EAS data structure
+ *
+ * Outputs:
+ *
+ * Side Effects:
+ *
+ *----------------------------------------------------------------------------
+*/
+void FM_Operator (
+ S_FM_ENG_OPER *p,
+ EAS_I32 numSamplesToAdd,
+ EAS_PCM *pBuffer,
+ EAS_PCM *pModBuffer,
+ EAS_BOOL mix,
+ EAS_U16 gainTarget,
+ EAS_I16 pitch,
+ EAS_U8 feedback,
+ EAS_I16 *pLastOutput)
+{
+ EAS_I32 gain;
+ EAS_I32 gainInc;
+ EAS_U32 phase;
+ EAS_U32 phaseInc;
+ EAS_U32 phaseTemp;
+ EAS_I32 temp;
+ EAS_I32 temp2;
+
+ /* establish local gain variable */
+ gain = (EAS_I32) p->gain << 16;
+
+ /* calculate gain increment */
+ /*lint -e{703} use shift for performance */
+ gainInc = ((EAS_I32) gainTarget - (EAS_I32) p->gain) << (16 - SYNTH_UPDATE_PERIOD_IN_BITS);
+
+ /* establish local phase variables */
+ phase = p->phase;
+
+ /* calculate the new phase increment */
+ phaseInc = (EAS_U32) FM_PhaseInc(pitch);
+
+ /* restore final output from previous frame for feedback loop */
+ if (pLastOutput)
+ temp = *pLastOutput;
+ else
+ temp = 0;
+
+ /* generate a buffer of samples */
+ while (numSamplesToAdd--)
+ {
+
+ /* incorporate modulation */
+ if (pModBuffer)
+ {
+ /*lint -e{701} use shift for performance */
+ temp = *pModBuffer++ << FM_MODULATOR_INPUT_SHIFT;
+ }
+
+ /* incorporate feedback */
+ else
+ {
+ /*lint -e{703} use shift for performance */
+ temp = (temp * (EAS_I32) feedback) << FM_FEEDBACK_SHIFT;
+ }
+
+ /*lint -e{737} <use this behavior to avoid extra mask step> */
+ phaseTemp = phase + temp;
+
+ /* fetch sample from wavetable */
+ temp = sineTable[phaseTemp >> (32 - SINE_TABLE_SIZE_IN_BITS)];
+
+ /* increment operator phase */
+ phase += phaseInc;
+
+ /* internal gain for modulation effects */
+ temp = FMUL_15x15(temp, (gain >> 16));
+
+ /* output gain calculation */
+ temp2 = FMUL_15x15(temp, p->outputGain);
+
+ /* saturating add to buffer */
+ if (mix)
+ {
+ temp2 += *pBuffer;
+ *pBuffer++ = FM_Saturate(temp2);
+ }
+
+ /* output to buffer */
+ else
+ *pBuffer++ = (EAS_I16) temp2;
+
+ /* increment gain */
+ gain += gainInc;
+
+ }
+
+ /* save phase and gain */
+ p->phase = phase;
+ p->gain = gainTarget;
+
+ /* save last output for feedback in next frame */
+ if (pLastOutput)
+ *pLastOutput = (EAS_I16) temp;
+}
+
+/*----------------------------------------------------------------------------
+ * FM_NoiseOperator()
+ *----------------------------------------------------------------------------
+ * Purpose:
+ * Synthesizes a buffer of samples based on passed parameters.
+ *
+ * Inputs:
+ * nNumSamplesToAdd - number of samples to synthesize
+ * psEASData - pointer to overall EAS data structure
+ *
+ * Outputs:
+ *
+ * Side Effects:
+ *
+ *----------------------------------------------------------------------------
+*/
+void FM_NoiseOperator (
+ S_FM_ENG_OPER *p,
+ EAS_I32 numSamplesToAdd,
+ EAS_PCM *pBuffer,
+ EAS_BOOL mix,
+ EAS_U16 gainTarget,
+ EAS_U8 feedback,
+ EAS_I16 *pLastOutput)
+{
+ EAS_I32 gain;
+ EAS_I32 gainInc;
+ EAS_U32 phase;
+ EAS_I32 temp;
+ EAS_I32 temp2;
+
+ /* establish local gain variable */
+ gain = (EAS_I32) p->gain << 16;
+
+ /* calculate gain increment */
+ /*lint -e{703} use shift for performance */
+ gainInc = ((EAS_I32) gainTarget - (EAS_I32) p->gain) << (16 - SYNTH_UPDATE_PERIOD_IN_BITS);
+
+ /* establish local phase variables */
+ phase = p->phase;
+
+ /* establish local phase variables */
+ phase = p->phase;
+
+ /* recall last sample for filter Z-1 term */
+ temp = 0;
+ if (pLastOutput)
+ temp = *pLastOutput;
+
+ /* generate a buffer of samples */
+ while (numSamplesToAdd--)
+ {
+
+ /* if using filter */
+ if (pLastOutput)
+ {
+ /* use PRNG for noise */
+ temp2 = FM_Noise(&phase);
+
+ /*lint -e{704} use shift for performance */
+ temp += ((temp2 -temp) * feedback) >> 8;
+ }
+ else
+ {
+ temp = FM_Noise(&phase);
+ }
+
+ /* internal gain for modulation effects */
+ temp2 = FMUL_15x15(temp, (gain >> 16));
+
+ /* output gain calculation */
+ temp2 = FMUL_15x15(temp2, p->outputGain);
+
+ /* saturating add to buffer */
+ if (mix)
+ {
+ temp2 += *pBuffer;
+ *pBuffer++ = FM_Saturate(temp2);
+ }
+
+ /* output to buffer */
+ else
+ *pBuffer++ = (EAS_I16) temp2;
+
+ /* increment gain */
+ gain += gainInc;
+
+ }
+
+ /* save phase and gain */
+ p->phase = phase;
+ p->gain = gainTarget;
+
+ /* save last output for feedback in next frame */
+ if (pLastOutput)
+ *pLastOutput = (EAS_I16) temp;
+}
+
+/*----------------------------------------------------------------------------
+ * FM_ConfigVoice()
+ *----------------------------------------------------------------------------
+ * Purpose:
+ * Receives parameters to start a new voice.
+ *
+ * Inputs:
+ * voiceNum - voice number to start
+ * vCfg - configuration data
+ * pMixBuffer - pointer to host supplied buffer
+ *
+ * Outputs:
+ *
+ * Side Effects:
+ *
+ * Notes:
+ * pFrameBuffer is not used in the test version, but is passed as a
+ * courtesy to split architecture implementations. It can be used as
+ * as pointer to the interprocessor communications buffer when the
+ * synthesis parameters are passed off to a DSP for synthesis.
+ *----------------------------------------------------------------------------
+*/
+/*lint -esym(715, pFrameBuffer) pFrameBuffer not used in test version - see above */
+void FM_ConfigVoice (EAS_I32 voiceNum, S_FM_VOICE_CONFIG *vCfg, EAS_FRAME_BUFFER_HANDLE pFrameBuffer)
+{
+ S_FM_ENG_VOICE *pVoice;
+ EAS_INT i;
+
+ /* establish pointer to voice data */
+ pVoice = &voices[voiceNum];
+
+ /* save data */
+ pVoice->feedback = vCfg->feedback;
+ pVoice->flags = vCfg->flags;
+ pVoice->voiceGain = vCfg->voiceGain;
+
+ /* initialize Z-1 terms */
+ pVoice->op1Out = 0;
+ pVoice->op3Out = 0;
+
+ /* initialize operators */
+ for (i = 0; i < 4; i++)
+ {
+ /* save operator data */
+ pVoice->oper[i].gain = vCfg->gain[i];
+ pVoice->oper[i].outputGain = vCfg->outputGain[i];
+ pVoice->oper[i].outputGain = vCfg->outputGain[i];
+
+ /* initalize operator */
+ pVoice->oper[i].phase = 0;
+ }
+
+ /* calculate pan */
+#if NUM_OUTPUT_CHANNELS == 2
+ FM_CalculatePan(vCfg->pan, &pVoice->gainLeft, &pVoice->gainRight);
+#endif
+}
+
+/*----------------------------------------------------------------------------
+ * FM_ProcessVoice()
+ *----------------------------------------------------------------------------
+ * Purpose:
+ * Synthesizes a buffer of samples based on calculated parameters.
+ *
+ * Inputs:
+ * nNumSamplesToAdd - number of samples to synthesize
+ * psEASData - pointer to overall EAS data structure
+ *
+ * Outputs:
+ *
+ * Side Effects:
+ *
+ * Notes:
+ * pOut is not used in the test version, but is passed as a
+ * courtesy to split architecture implementations. It can be used as
+ * as pointer to the interprocessor communications buffer when the
+ * synthesis parameters are passed off to a DSP for synthesis.
+ *----------------------------------------------------------------------------
+*/
+/*lint -esym(715, pOut) pOut not used in test version - see above */
+void FM_ProcessVoice (
+ EAS_I32 voiceNum,
+ S_FM_VOICE_FRAME *pFrame,
+ EAS_I32 numSamplesToAdd,
+ EAS_PCM *pTempBuffer,
+ EAS_PCM *pBuffer,
+ EAS_I32 *pMixBuffer,
+ EAS_FRAME_BUFFER_HANDLE pFrameBuffer)
+{
+ S_FM_ENG_VOICE *p;
+ EAS_PCM *pOutBuf;
+ EAS_PCM *pMod;
+ EAS_BOOL mix;
+ EAS_U8 feedback1;
+ EAS_U8 feedback3;
+ EAS_U8 mode;
+
+ /* establish pointer to voice data */
+ p = &voices[voiceNum];
+ mode = p->flags & 0x07;
+
+ /* lookup feedback values */
+ feedback1 = fmScaleTable[p->feedback >> 4];
+ feedback3 = fmScaleTable[p->feedback & 0x0f];
+
+ /* operator 3 is on output bus in modes 0, 1, and 3 */
+ if ((mode == 0) || (mode == 1) || (mode == 3))
+ pOutBuf = pBuffer;
+ else
+ pOutBuf = pTempBuffer;
+
+ if (p->flags & FLAG_FM_ENG_VOICE_OP3_NOISE)
+ {
+ FM_NoiseOperator(
+ p->oper + 2,
+ numSamplesToAdd,
+ pOutBuf,
+ EAS_FALSE,
+ pFrame->gain[2],
+ feedback3,
+ &p->op3Out);
+ }
+ else
+ {
+ FM_Operator(
+ p->oper + 2,
+ numSamplesToAdd,
+ pOutBuf,
+ 0,
+ EAS_FALSE,
+ pFrame->gain[2],
+ pFrame->pitch[2],
+ feedback3,
+ &p->op3Out);
+ }
+
+ /* operator 4 is on output bus in modes 0, 1, and 2 */
+ if (mode < 3)
+ pOutBuf = pBuffer;
+ else
+ pOutBuf = pTempBuffer;
+
+ /* operator 4 is modulated in modes 2, 4, and 5 */
+ if ((mode == 2) || (mode == 4) || (mode == 5))
+ pMod = pTempBuffer;
+ else
+ pMod = 0;
+
+ /* operator 4 is in mix mode in modes 0 and 1 */
+ mix = (mode < 2);
+
+ if (p->flags & FLAG_FM_ENG_VOICE_OP4_NOISE)
+ {
+ FM_NoiseOperator(
+ p->oper + 3,
+ numSamplesToAdd,
+ pOutBuf,
+ mix,
+ pFrame->gain[3],
+ 0,
+ 0);
+ }
+ else
+ {
+ FM_Operator(
+ p->oper + 3,
+ numSamplesToAdd,
+ pOutBuf,
+ pMod,
+ mix,
+ pFrame->gain[3],
+ pFrame->pitch[3],
+ 0,
+ 0);
+ }
+
+ /* operator 1 is on output bus in mode 0 */
+ if (mode == 0)
+ pOutBuf = pBuffer;
+ else
+ pOutBuf = pTempBuffer;
+
+ /* operator 1 is modulated in modes 3 and 4 */
+ if ((mode == 3) || (mode == 4))
+ pMod = pTempBuffer;
+ else
+ pMod = 0;
+
+ /* operator 1 is in mix mode in modes 0 and 5 */
+ mix = ((mode == 0) || (mode == 5));
+
+ if (p->flags & FLAG_FM_ENG_VOICE_OP1_NOISE)
+ {
+ FM_NoiseOperator(
+ p->oper,
+ numSamplesToAdd,
+ pOutBuf,
+ mix,
+ pFrame->gain[0],
+ feedback1,
+ &p->op1Out);
+ }
+ else
+ {
+ FM_Operator(
+ p->oper,
+ numSamplesToAdd,
+ pOutBuf,
+ pMod,
+ mix,
+ pFrame->gain[0],
+ pFrame->pitch[0],
+ feedback1,
+ &p->op1Out);
+ }
+
+ /* operator 2 is modulated in all modes except 0 */
+ if (mode != 0)
+ pMod = pTempBuffer;
+ else
+ pMod = 0;
+
+ /* operator 1 is in mix mode in modes 0 -3 */
+ mix = (mode < 4);
+
+ if (p->flags & FLAG_FM_ENG_VOICE_OP2_NOISE)
+ {
+ FM_NoiseOperator(
+ p->oper + 1,
+ numSamplesToAdd,
+ pBuffer,
+ mix,
+ pFrame->gain[1],
+ 0,
+ 0);
+ }
+ else
+ {
+ FM_Operator(
+ p->oper + 1,
+ numSamplesToAdd,
+ pBuffer,
+ pMod,
+ mix,
+ pFrame->gain[1],
+ pFrame->pitch[1],
+ 0,
+ 0);
+ }
+
+ /* mix voice output to synthesizer output buffer */
+ FM_SynthMixVoice(p, pFrame->voiceGain, numSamplesToAdd, pBuffer, pMixBuffer);
+}
+
+/*----------------------------------------------------------------------------
+ * FM_SynthMixVoice()
+ *----------------------------------------------------------------------------
+ * Purpose:
+ * Mixes the voice output buffer into the final mix using an anti-zipper
+ * filter.
+ *
+ * Inputs:
+ * nNumSamplesToAdd - number of samples to synthesize
+ * psEASData - pointer to overall EAS data structure
+ *
+ * Outputs:
+ *
+ * Side Effects:
+ *
+ *----------------------------------------------------------------------------
+*/
+void FM_SynthMixVoice(S_FM_ENG_VOICE *p, EAS_U16 nGainTarget, EAS_I32 numSamplesToAdd, EAS_PCM *pInputBuffer, EAS_I32 *pBuffer)
+{
+ EAS_I32 nGain;
+ EAS_I32 nGainInc;
+ EAS_I32 nTemp;
+
+ /* restore previous gain */
+ /*lint -e{703} <use shift for performance> */
+ nGain = (EAS_I32) p->voiceGain << 16;
+
+ /* calculate gain increment */
+ /*lint -e{703} <use shift for performance> */
+ nGainInc = ((EAS_I32) nGainTarget - (EAS_I32) p->voiceGain) << (16 - SYNTH_UPDATE_PERIOD_IN_BITS);
+
+ /* mix the output buffer */
+ while (numSamplesToAdd--)
+ {
+ /* output gain calculation */
+ nTemp = *pInputBuffer++;
+
+ /* sum to output buffer */
+#if (NUM_OUTPUT_CHANNELS == 2)
+
+ /*lint -e{704} <use shift for performance> */
+ nTemp = ((EAS_I32) nTemp * (nGain >> 16)) >> FM_GAIN_SHIFT;
+
+ /*lint -e{704} <use shift for performance> */
+ {
+ EAS_I32 nTemp2;
+ nTemp = nTemp >> FM_STEREO_PRE_GAIN_SHIFT;
+ nTemp2 = (nTemp * p->gainLeft) >> FM_STEREO_POST_GAIN_SHIFT;
+ *pBuffer++ += nTemp2;
+ nTemp2 = (nTemp * p->gainRight) >> FM_STEREO_POST_GAIN_SHIFT;
+ *pBuffer++ += nTemp2;
+ }
+#else
+ /*lint -e{704} <use shift for performance> */
+ nTemp = ((EAS_I32) nTemp * (nGain >> 16)) >> FM_MONO_GAIN_SHIFT;
+ *pBuffer++ += nTemp;
+#endif
+
+ /* increment gain for anti-zipper filter */
+ nGain += nGainInc;
+ }
+
+ /* save gain */
+ p->voiceGain = nGainTarget;
+}
+
diff --git a/arm-fm-22k/lib_src/eas_fmengine.h b/arm-fm-22k/lib_src/eas_fmengine.h
index 4ddc12b..dd248f8 100644
--- a/arm-fm-22k/lib_src/eas_fmengine.h
+++ b/arm-fm-22k/lib_src/eas_fmengine.h
@@ -1,12 +1,12 @@
-/*----------------------------------------------------------------------------
- *
- * File:
- * eas_fmengine.h
- *
- * Contents and purpose:
- * Declarations, interfaces, and prototypes for FM synthesize low-level.
- *
- * Copyright Sonic Network Inc. 2004
+/*----------------------------------------------------------------------------
+ *
+ * File:
+ * eas_fmengine.h
+ *
+ * Contents and purpose:
+ * Declarations, interfaces, and prototypes for FM synthesize low-level.
+ *
+ * Copyright Sonic Network Inc. 2004
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -19,103 +19,103 @@
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
- *
- *----------------------------------------------------------------------------
- * Revision Control:
- * $Revision: 664 $
- * $Date: 2007-04-25 13:11:22 -0700 (Wed, 25 Apr 2007) $
- *----------------------------------------------------------------------------
-*/
-
-/* sentinel */
-#ifndef _FMENGINE_H
-#define _FMENGINE_H
-
-/* check for split architecture */
-#if defined (EAS_SPLIT_HYBRID_SYNTH) || defined(EAS_SPLIT_FM_SYNTH)
-#define FM_OFFBOARD
-#endif
-
-/* output level to mix buffer (3 = -24dB) */
-#define FM_GAIN_SHIFT 3
-#define FM_MONO_GAIN_SHIFT 9
-
-/* voice output level for stereo 15 = +6dB */
-#define FM_STEREO_PRE_GAIN_SHIFT 11
-#define FM_STEREO_POST_GAIN_SHIFT 10
-
-/* modulator input level shift (21 = -30dB) */
-#define FM_MODULATOR_INPUT_SHIFT 21
-
-/* feedback control level shift (7 = 0dB) */
-#define FM_FEEDBACK_SHIFT 7
-
-/* synth final output level */
-#define SYNTH_POST_GAIN_SHIFT 14
-
-/* LFO modulation to gain control */
-#define FM_LFO_GAIN_SHIFT 12
-
-/* sine table is always a power of 2 - saves cycles in inner loop */
-#define SINE_TABLE_SIZE_IN_BITS 11
-#define SINE_TABLE_SIZE 2048
-
-/* operator structure for FM engine */
-typedef struct
-{
- EAS_U32 phase; /* current waveform phase */
- EAS_U16 gain; /* current internal gain */
- EAS_U16 outputGain; /* current output gain */
-} S_FM_ENG_OPER;
-
-typedef struct
-{
- S_FM_ENG_OPER oper[4]; /* operator data */
- EAS_I16 op1Out; /* op1 output for feedback loop */
- EAS_I16 op3Out; /* op3 output for feedback loop */
- EAS_U16 voiceGain; /* LFO + channel parameters */
-#if (NUM_OUTPUT_CHANNELS == 2)
- EAS_U16 gainLeft; /* left gain multiplier */
- EAS_U16 gainRight; /* right gain multiplier */
-#endif
- EAS_U8 flags; /* mode bits and noise waveform flags */
- EAS_U8 feedback; /* feedback for Op1 and Op3 */
-} S_FM_ENG_VOICE;
-
-typedef struct
-{
- EAS_U16 gain[4]; /* initial operator gain value */
- EAS_U16 outputGain[4]; /* initial operator output gain value */
- EAS_U16 voiceGain; /* initial voice gain */
- EAS_U8 flags; /* mode bits and noise waveform flags */
- EAS_U8 feedback; /* feedback for Op1 and Op3 */
-#if (NUM_OUTPUT_CHANNELS == 2)
- EAS_I8 pan; /* pan value +/-64 */
-#endif
-} S_FM_VOICE_CONFIG;
-
-typedef struct
-{
- EAS_U16 gain[4]; /* new operator gain value */
- EAS_I16 pitch[4]; /* new pitch value */
- EAS_U16 voiceGain; /* new voice gain */
-} S_FM_VOICE_FRAME;
-
-/* bit definitions for S_FM_ENG_VOICE.flags */
-#define FLAG_FM_ENG_VOICE_OP1_NOISE 0x10 /* operator 1 source is PRNG */
-#define FLAG_FM_ENG_VOICE_OP2_NOISE 0x20 /* operator 2 source is PRNG */
-#define FLAG_FM_ENG_VOICE_OP3_NOISE 0x40 /* operator 3 source is PRNG */
-#define FLAG_FM_ENG_VOICE_OP4_NOISE 0x80 /* operator 4 source is PRNG */
-
-#ifdef FM_OFFBOARD
-extern EAS_BOOL FM_StartFrame (EAS_FRAME_BUFFER_HANDLE pFrameBuffer);
-extern EAS_BOOL FM_EndFrame (EAS_FRAME_BUFFER_HANDLE pFrameBuffe, EAS_I32 *pMixBuffer, EAS_I16 masterGain);
-#endif
-
-/* FM engine prototypes */
-extern void FM_ConfigVoice (EAS_I32 voiceNum, S_FM_VOICE_CONFIG *vCfg, EAS_FRAME_BUFFER_HANDLE pFrameBuffer);
-extern void FM_ProcessVoice (EAS_I32 voiceNum, S_FM_VOICE_FRAME *pFrame, EAS_I32 numSamplesToAdd, EAS_PCM *pTempBuffer, EAS_PCM *pBuffer, EAS_I32 *pMixBuffer, EAS_FRAME_BUFFER_HANDLE pFrameBuffer);
-
-#endif
-/* #ifndef _FMENGINE_H */
-
+ *
+ *----------------------------------------------------------------------------
+ * Revision Control:
+ * $Revision: 664 $
+ * $Date: 2007-04-25 13:11:22 -0700 (Wed, 25 Apr 2007) $
+ *----------------------------------------------------------------------------
+*/
+
+/* sentinel */
+#ifndef _FMENGINE_H
+#define _FMENGINE_H
+
+/* check for split architecture */
+#if defined (EAS_SPLIT_HYBRID_SYNTH) || defined(EAS_SPLIT_FM_SYNTH)
+#define FM_OFFBOARD
+#endif
+
+/* output level to mix buffer (3 = -24dB) */
+#define FM_GAIN_SHIFT 3
+#define FM_MONO_GAIN_SHIFT 9
+
+/* voice output level for stereo 15 = +6dB */
+#define FM_STEREO_PRE_GAIN_SHIFT 11
+#define FM_STEREO_POST_GAIN_SHIFT 10
+
+/* modulator input level shift (21 = -30dB) */
+#define FM_MODULATOR_INPUT_SHIFT 21
+
+/* feedback control level shift (7 = 0dB) */
+#define FM_FEEDBACK_SHIFT 7
+
+/* synth final output level */
+#define SYNTH_POST_GAIN_SHIFT 14
+
+/* LFO modulation to gain control */
+#define FM_LFO_GAIN_SHIFT 12
+
+/* sine table is always a power of 2 - saves cycles in inner loop */
+#define SINE_TABLE_SIZE_IN_BITS 11
+#define SINE_TABLE_SIZE 2048
+
+/* operator structure for FM engine */
+typedef struct
+{
+ EAS_U32 phase; /* current waveform phase */
+ EAS_U16 gain; /* current internal gain */
+ EAS_U16 outputGain; /* current output gain */
+} S_FM_ENG_OPER;
+
+typedef struct
+{
+ S_FM_ENG_OPER oper[4]; /* operator data */
+ EAS_I16 op1Out; /* op1 output for feedback loop */
+ EAS_I16 op3Out; /* op3 output for feedback loop */
+ EAS_U16 voiceGain; /* LFO + channel parameters */
+#if (NUM_OUTPUT_CHANNELS == 2)
+ EAS_U16 gainLeft; /* left gain multiplier */
+ EAS_U16 gainRight; /* right gain multiplier */
+#endif
+ EAS_U8 flags; /* mode bits and noise waveform flags */
+ EAS_U8 feedback; /* feedback for Op1 and Op3 */
+} S_FM_ENG_VOICE;
+
+typedef struct
+{
+ EAS_U16 gain[4]; /* initial operator gain value */
+ EAS_U16 outputGain[4]; /* initial operator output gain value */
+ EAS_U16 voiceGain; /* initial voice gain */
+ EAS_U8 flags; /* mode bits and noise waveform flags */
+ EAS_U8 feedback; /* feedback for Op1 and Op3 */
+#if (NUM_OUTPUT_CHANNELS == 2)
+ EAS_I8 pan; /* pan value +/-64 */
+#endif
+} S_FM_VOICE_CONFIG;
+
+typedef struct
+{
+ EAS_U16 gain[4]; /* new operator gain value */
+ EAS_I16 pitch[4]; /* new pitch value */
+ EAS_U16 voiceGain; /* new voice gain */
+} S_FM_VOICE_FRAME;
+
+/* bit definitions for S_FM_ENG_VOICE.flags */
+#define FLAG_FM_ENG_VOICE_OP1_NOISE 0x10 /* operator 1 source is PRNG */
+#define FLAG_FM_ENG_VOICE_OP2_NOISE 0x20 /* operator 2 source is PRNG */
+#define FLAG_FM_ENG_VOICE_OP3_NOISE 0x40 /* operator 3 source is PRNG */
+#define FLAG_FM_ENG_VOICE_OP4_NOISE 0x80 /* operator 4 source is PRNG */
+
+#ifdef FM_OFFBOARD
+extern EAS_BOOL FM_StartFrame (EAS_FRAME_BUFFER_HANDLE pFrameBuffer);
+extern EAS_BOOL FM_EndFrame (EAS_FRAME_BUFFER_HANDLE pFrameBuffe, EAS_I32 *pMixBuffer, EAS_I16 masterGain);
+#endif
+
+/* FM engine prototypes */
+extern void FM_ConfigVoice (EAS_I32 voiceNum, S_FM_VOICE_CONFIG *vCfg, EAS_FRAME_BUFFER_HANDLE pFrameBuffer);
+extern void FM_ProcessVoice (EAS_I32 voiceNum, S_FM_VOICE_FRAME *pFrame, EAS_I32 numSamplesToAdd, EAS_PCM *pTempBuffer, EAS_PCM *pBuffer, EAS_I32 *pMixBuffer, EAS_FRAME_BUFFER_HANDLE pFrameBuffer);
+
+#endif
+/* #ifndef _FMENGINE_H */
+
diff --git a/arm-fm-22k/lib_src/eas_fmsndlib.c b/arm-fm-22k/lib_src/eas_fmsndlib.c
index bdd063c..dcde967 100644
--- a/arm-fm-22k/lib_src/eas_fmsndlib.c
+++ b/arm-fm-22k/lib_src/eas_fmsndlib.c
@@ -1,8 +1,8 @@
-/********************************************************************
- *
- * fmsndlib.c
- *
- * (c) Copyright 2005 Sonic Network, Inc. All Rights Reserved
+/********************************************************************
+ *
+ * fmsndlib.c
+ *
+ * (c) Copyright 2005 Sonic Network, Inc. All Rights Reserved
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -15,1660 +15,1660 @@
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
- *
- * Source: C:\Sonic\Source\Gen3.3\FMSynth\GMdblib-3.fml
- ********************************************************************/
-
-
-#include "eas_data.h"
-
-/* begin region data */
-/*lint -e{651} lint complains about unnecessary brackets */
-const S_FM_REGION regions[] =
-{
-
- /* Region 0 */
- {
- 0x8005, 0, 127, 0, 255, 8, 0,
- 514, 239, 47, 97, 0, 184, 3,
- 1, 244, 89, 114, 0, 248, 2,
- 3370, 244, 49, 76, 40, 192, 2,
- -1, 227, 97, 51, 160, 212, 2
- },
-
- /* Region 1 */
- {
- 0x8005, 0, 127, 160, 255, 8, 0,
- 2514, 223, 95, 72, 0, 176, 3,
- 1, 244, 73, 145, 0, 244, 2,
- 3600, 245, 81, 198, 40, 192, 2,
- 3, 246, 81, 163, 108, 212, 2
- },
-
- /* Region 2 */
- {
- 0x8005, 0, 127, 160, 255, 119, 0,
- 0, 216, 79, 72, 0, 216, 2,
- 2, 244, 73, 145, 0, 244, 2,
- 3370, 247, 33, 182, 60, 204, 2,
- 1200, 246, 65, 163, 108, 204, 2
- },
-
- /* Region 3 */
- {
- 0x8005, 0, 127, 160, 255, 1, 0,
- 3369, 248, 65, 71, 40, 208, 2,
- -3, 245, 88, 113, 0, 244, 2,
- 2784, 225, 65, 133, 80, 192, 2,
- 3, 241, 81, 113, 80, 216, 2
- },
-
- /* Region 4 */
- {
- 0x8002, 0, 127, 0, 255, 128, 0,
- 0, 229, 155, 183, 0, 228, 2,
- -3, 243, 90, 81, 0, 244, 2,
- 4800, 248, 109, 180, 36, 192, 2,
- 3, 245, 90, 85, 16, 244, 2
- },
-
- /* Region 5 */
- {
- 0x8002, 0, 127, 9, 96, 192, 0,
- 1200, 229, 157, 180, 0, 216, 2,
- -3, 244, 90, 81, 0, 244, 2,
- 1902, 255, 111, 182, 80, 208, 2,
- 3, 246, 92, 83, 0, 244, 2
- },
-
- /* Region 6 */
- {
- 0x8002, 0, 127, 0, 255, 154, 0,
- 3102, 244, 63, 102, 228, 228, 2,
- 1200, 247, 93, 97, 0, 236, 2,
- 1902, 255, 63, 98, 156, 220, 2,
- 1200, 244, 92, 98, 0, 236, 2
- },
-
- /* Region 7 */
- {
- 0x8005, 0, 127, 0, 255, 202, 0,
- 0, 251, 131, 19, 216, 220, 2,
- 1201, 247, 62, 113, 0, 240, 2,
- 0, 243, 154, 36, 240, 224, 2,
- 2784, 250, 61, 36, 240, 208, 2
- },
-
- /* Region 8 */
- {
- 0x8001, 0, 127, 0, 255, 80, 0,
- -1, 213, 191, 183, 0, 204, 2,
- 1, 245, 154, 129, 0, 244, 2,
- 3831, 252, 159, 100, 0, 200, 2,
- 1197, 246, 91, 182, 0, 244, 2
- },
-
- /* Region 9 */
- {
- 0x8002, 0, 127, 48, 80, 21, 0,
- 2982, 255, 43, 96, 0, 196, 3,
- 3, 247, 71, 130, 0, 244, 2,
- 3358, 253, 40, 98, 144, 208, 2,
- -2, 246, 70, 130, 0, 236, 2
- },
-
- /* Region 10 */
- {
- 0x8002, 0, 127, 48, 80, 26, 0,
- 3096, 249, 72, 100, 0, 208, 2,
- 2185, 249, 102, 130, 0, 240, 2,
- 3386, 247, 66, 100, 144, 212, 2,
- -2, 247, 102, 130, 0, 240, 2
- },
-
- /* Region 11 */
- {
- 0x8002, 0, 127, 92, 67, 21, 0,
- 2982, 255, 27, 146, 0, 200, 3,
- 3, 246, 68, 146, 0, 240, 2,
- 3358, 250, 149, 116, 144, 208, 2,
- -3, 245, 68, 146, 0, 240, 0
- },
-
- /* Region 12 */
- {
- 0x8002, 0, 127, 0, 67, 0, 0,
- 1500, 239, 60, 151, 0, 220, 2,
- 0, 247, 76, 146, 0, 240, 2,
- 2398, 234, 156, 151, 0, 212, 2,
- 0, 246, 105, 146, 0, 244, 2
- },
-
- /* Region 13 */
- {
- 0x8002, 0, 127, 0, 67, 0, 0,
- 2500, 255, 60, 151, 0, 220, 2,
- 0, 249, 92, 146, 0, 244, 2,
- 3369, 250, 156, 151, 0, 196, 2,
- 0, 248, 89, 146, 0, 244, 2
- },
-
- /* Region 14 */
- {
- 0x8005, 0, 127, 160, 255, 0, 0,
- 2300, 229, 112, 49, 0, 208, 2,
- -3, 247, 67, 50, 0, 248, 2,
- 1074, 255, 41, 49, 0, 196, 2,
- 686, 240, 97, 18, 0, 196, 2
- },
-
- /* Region 15 */
- {
- 0x8005, 0, 127, 160, 255, 219, 0,
- 3369, 255, 65, 70, 40, 216, 2,
- 1, 246, 72, 113, 0, 240, 2,
- 1902, 225, 33, 129, 80, 204, 2,
- 2400, 225, 97, 113, 80, 200, 2
- },
-
- /* Region 16 */
- {
- 0x8003, 0, 127, 32, 48, 151, 0,
- 1201, 215, 35, 66, 252, 208, 0,
- -9581, 254, 63, 177, 240, 240, 3,
- 1902, 248, 47, 64, 112, 244, 2,
- 0, 247, 35, 66, 208, 212, 2
- },
-
- /* Region 17 */
- {
- 0x8001, 0, 127, 0, 255, 153, 0,
- 1, 252, 31, 3, 244, 196, 2,
- -1, 208, 31, 4, 248, 244, 2,
- 1205, 209, 31, 4, 248, 236, 2,
- 1899, 250, 31, 32, 0, 240, 2
- },
-
- /* Region 18 */
- {
- 0x8002, 0, 127, 32, 49, 201, 0,
- 1, 220, 47, 3, 244, 220, 0,
- -10000, 208, 63, 1, 248, 240, 3,
- 1586, 255, 47, 3, 188, 216, 2,
- -1, 202, 63, 32, 80, 232, 2
- },
-
- /* Region 19 */
- {
- 0x8001, 0, 127, 0, 143, 29, 0,
- -1200, 223, 64, 0, 252, 216, 2,
- 1200, 96, 41, 35, 248, 240, 2,
- 1200, 143, 41, 64, 252, 224, 2,
- 3102, 161, 41, 96, 248, 216, 2
- },
-
- /* Region 20 */
- {
- 0x8002, 0, 127, 0, 143, 34, 0,
- -1200, 133, 79, 1, 252, 212, 2,
- 1201, 112, 46, 34, 248, 232, 2,
- 0, 116, 79, 65, 252, 200, 2,
- 1900, 161, 46, 98, 248, 232, 2
- },
-
- /* Region 21 */
- {
- 0x8002, 0, 127, 0, 143, 187, 0,
- 1202, 80, 74, 1, 252, 216, 2,
- 2402, 112, 46, 34, 248, 232, 2,
- 0, 99, 78, 97, 184, 216, 2,
- 1899, 81, 46, 98, 236, 232, 2
- },
-
- /* Region 22 */
- {
- 0x8005, 0, 127, 22, 141, 34, 0,
- 2787, 176, 79, 4, 252, 208, 2,
- 2785, 144, 45, 34, 248, 236, 2,
- 3369, 83, 77, 100, 184, 172, 2,
- 1902, 102, 45, 100, 172, 212, 0
- },
-
- /* Region 23 */
- {
- 0x8002, 0, 127, 0, 143, 135, 0,
- 1900, 112, 79, 3, 252, 220, 2,
- 2400, 128, 45, 34, 248, 232, 2,
- 1200, 115, 77, 98, 184, 220, 2,
- 1904, 97, 45, 98, 236, 232, 2
- },
-
- /* Region 24 */
- {
- 0x8005, 0, 127, 0, 255, 157, 0,
- 1200, 244, 54, 4, 20, 200, 2,
- 0, 245, 92, 130, 0, 244, 2,
- 3802, 247, 68, 21, 0, 196, 2,
- 1, 245, 43, 114, 0, 204, 2
- },
-
- /* Region 25 */
- {
- 0x8005, 0, 127, 0, 128, 83, 0,
- 0, 244, 51, 4, 200, 204, 0,
- 0, 247, 108, 129, 0, 248, 0,
- 2786, 243, 31, 70, 200, 220, 0,
- 1902, 246, 44, 113, 12, 188, 0
- },
-
- /* Region 26 */
- {
- 0x8005, 0, 127, 0, 128, 61, 0,
- 0, 246, 51, 97, 76, 204, 0,
- 0, 244, 60, 97, 0, 240, 0,
- 1786, 255, 31, 64, 0, 180, 0,
- 1200, 247, 60, 97, 12, 204, 0
- },
-
- /* Region 27 */
- {
- 0x8005, 0, 127, 0, 128, 153, 0,
- -2, 243, 53, 99, 96, 200, 0,
- 0, 243, 60, 97, 0, 240, 0,
- 3983, 247, 63, 100, 24, 204, 0,
- 2, 242, 53, 99, 52, 212, 0
- },
-
- /* Region 28 */
- {
- 0x8005, 0, 127, 0, 128, 205, 0,
- -2, 244, 47, 97, 20, 208, 0,
- 0, 252, 75, 193, 0, 248, 0,
- 0, 254, 63, 98, 132, 224, 0,
- 2786, 251, 63, 98, 52, 192, 0
- },
-
- /* Region 29 */
- {
- 0x8005, 0, 127, 0, 128, 221, 0,
- -1, 208, 191, 99, 220, 224, 0,
- 1200, 243, 92, 97, 0, 244, 0,
- 3984, 212, 11, 96, 168, 196, 0,
- 1, 242, 127, 98, 108, 204, 0
- },
-
- /* Region 30 */
- {
- 0x8005, 0, 127, 0, 128, 174, 0,
- -3, 212, 207, 99, 0, 228, 0,
- 1902, 241, 108, 97, 0, 248, 0,
- 3805, 212, 59, 98, 0, 220, 0,
- 1902, 146, 107, 98, 144, 196, 0
- },
-
- /* Region 31 */
- {
- 0x8009, 0, 127, 0, 255, 128, 0,
- 1206, 239, 43, 69, 0, 216, 2,
- 4, 254, 42, 66, 0, 244, 2,
- 702, 88, 55, 66, 0, 204, 2,
- -4, 71, 55, 66, 0, 240, 2
- },
-
- /* Region 32 */
- {
- 0x8005, 0, 127, 0, 255, 85, 0,
- 500, 239, 95, 82, 0, 184, 3,
- 0, 248, 73, 132, 0, 252, 2,
- 2786, 203, 59, 130, 0, 176, 2,
- 0, 216, 42, 100, 0, 208, 2
- },
-
- /* Region 33 */
- {
- 0x8005, 0, 127, 0, 128, 73, 0,
- 1, 229, 54, 131, 160, 208, 0,
- -1, 244, 62, 97, 0, 248, 0,
- 3986, 227, 127, 69, 140, 184, 0,
- 1201, 249, 92, 114, 0, 204, 0
- },
-
- /* Region 34 */
- {
- 0x8005, 0, 127, 0, 128, 73, 0,
- 1, 225, 54, 100, 200, 212, 0,
- -1, 244, 94, 97, 0, 248, 0,
- 3986, 249, 127, 88, 112, 188, 0,
- 1201, 249, 92, 85, 52, 208, 0
- },
-
- /* Region 35 */
- {
- 0x8005, 0, 127, 0, 128, 188, 0,
- -3, 198, 92, 179, 28, 212, 0,
- 0, 243, 90, 145, 0, 248, 0,
- 1901, 215, 95, 69, 28, 196, 0,
- 3, 84, 108, 196, 32, 208, 0
- },
-
- /* Region 36 */
- {
- 0x8005, 0, 127, 0, 136, 6, 0,
- 0, 226, 99, 36, 224, 216, 0,
- 1902, 248, 78, 33, 0, 252, 0,
- 3369, 239, 250, 33, 0, 204, 0,
- 0, 230, 253, 33, 0, 208, 0
- },
-
- /* Region 37 */
- {
- 0x8005, 0, 127, 0, 136, 195, 0,
- 0, 245, 99, 36, 152, 208, 0,
- 1200, 248, 78, 33, 0, 252, 0,
- 3369, 246, 250, 33, 0, 216, 0,
- 0, 246, 61, 33, 0, 180, 0
- },
-
- /* Region 38 */
- {
- 0x8002, 0, 127, 0, 133, 221, 0,
- 1, 244, 67, 35, 80, 220, 0,
- 3, 246, 94, 33, 0, 244, 0,
- -1, 245, 70, 35, 80, 236, 2,
- -3, 246, 63, 33, 0, 236, 2
- },
-
- /* Region 39 */
- {
- 0x8002, 0, 127, 0, 133, 220, 0,
- 0, 114, 51, 34, 132, 208, 0,
- 3, 214, 62, 33, 0, 248, 0,
- 0, 85, 54, 34, 44, 224, 2,
- -3, 214, 63, 33, 0, 236, 2
- },
-
- /* Region 40 */
- {
- 0x8005, 0, 127, 48, 142, 187, 0,
- -1, 33, 22, 33, 200, 208, 0,
- 0, 81, 105, 33, 220, 240, 0,
- 2786, 245, 19, 50, 208, 192, 0,
- 1, 245, 21, 82, 200, 220, 0
- },
-
- /* Region 41 */
- {
- 0x8005, 0, 127, 48, 126, 103, 0,
- -1, 193, 22, 33, 228, 212, 0,
- 0, 81, 105, 33, 220, 244, 0,
- 0, 245, 19, 50, 216, 228, 0,
- 1200, 245, 19, 82, 200, 188, 0
- },
-
- /* Region 42 */
- {
- 0x8005, 0, 127, 16, 126, 202, 0,
- -1, 49, 24, 41, 200, 212, 0,
- 0, 81, 71, 49, 220, 244, 0,
- 3371, 243, 19, 36, 232, 192, 0,
- 1, 242, 24, 36, 220, 212, 0
- },
-
- /* Region 43 */
- {
- 0x8005, 0, 127, 16, 124, 205, 0,
- 0, 129, 24, 49, 208, 200, 0,
- 0, 67, 102, 81, 224, 244, 0,
- 3804, 246, 23, 36, 160, 196, 0,
- 1200, 244, 24, 35, 208, 200, 0
- },
-
- /* Region 44 */
- {
- 0x8005, 0, 127, 48, 144, 208, 0,
- -3, 209, 22, 33, 200, 204, 2,
- 0, 81, 89, 33, 220, 240, 2,
- -5000, 208, 6, 33, 244, 188, 3,
- 3, 97, 89, 33, 224, 200, 0
- },
-
- /* Region 45 */
- {
- 0x8005, 0, 127, 0, 255, 186, 0,
- 500, 223, 95, 0, 0, 192, 3,
- 0, 247, 89, 100, 0, 248, 2,
- 3369, 255, 59, 168, 0, 212, 2,
- 0, 216, 42, 97, 0, 212, 2
- },
-
- /* Region 46 */
- {
- 0x8002, 0, 127, 0, 255, 221, 0,
- 1206, 235, 70, 69, 0, 216, 2,
- 4, 248, 84, 66, 0, 244, 2,
- 1902, 247, 52, 137, 80, 216, 2,
- -4, 245, 84, 131, 0, 240, 2
- },
-
- /* Region 47 */
- {
- 0x8005, 0, 127, 0, 255, 105, 0,
- 387, 231, 115, 34, 4, 216, 2,
- 0, 248, 37, 65, 0, 252, 2,
- 3308, 248, 117, 34, 8, 200, 2,
- 1900, 213, 82, 50, 0, 192, 2
- },
-
- /* Region 48 */
- {
- 0x8002, 0, 127, 32, 160, 221, 0,
- -7, 209, 22, 33, 200, 204, 2,
- -7, 81, 73, 33, 220, 244, 0,
- 7, 209, 22, 33, 200, 208, 0,
- 7, 97, 73, 33, 224, 244, 2
- },
-
- /* Region 49 */
- {
- 0x8002, 0, 127, 64, 128, 189, 0,
- -2, 209, 54, 32, 224, 216, 2,
- -7726, 97, 105, 33, 220, 240, 3,
- 1902, 209, 54, 34, 216, 208, 0,
- 2, 81, 105, 33, 224, 236, 0
- },
-
- /* Region 50 */
- {
- 0x8002, 0, 127, 80, 144, 206, 0,
- -3, 179, 38, 33, 160, 220, 2,
- -7726, 81, 69, 34, 220, 244, 3,
- 3, 193, 38, 33, 240, 212, 0,
- -8000, 65, 69, 34, 224, 236, 3
- },
-
- /* Region 51 */
- {
- 0x8005, 0, 127, 96, 128, 204, 0,
- -3, 97, 38, 33, 180, 216, 0,
- 0, 81, 69, 34, 220, 240, 2,
- 3369, 145, 38, 33, 240, 196, 2,
- -13190, 65, 69, 34, 240, 200, 3
- },
-
- /* Region 52 */
- {
- 0x8002, 0, 127, 64, 128, 108, 0,
- -3, 193, 37, 35, 236, 208, 0,
- 2394, 97, 90, 36, 224, 232, 2,
- 3, 65, 40, 35, 236, 204, 2,
- 1203, 97, 89, 33, 224, 240, 0
- },
-
- /* Region 53 */
- {
- 0x8005, 0, 127, 128, 128, 122, 0,
- 0, 193, 21, 34, 236, 188, 0,
- 3, 97, 74, 36, 224, 248, 2,
- 1906, 251, 24, 32, 96, 192, 3,
- 1200, 97, 73, 32, 224, 184, 0
- },
-
- /* Region 54 */
- {
- 0x8002, 0, 127, 64, 133, 135, 0,
- 0, 194, 25, 35, 120, 200, 2,
- 0, 97, 75, 36, 224, 240, 0,
- 2906, 254, 28, 48, 0, 184, 3,
- 0, 216, 75, 80, 204, 240, 2
- },
-
- /* Region 55 */
- {
- 0x8009, 0, 127, 208, 64, 255, 0,
- 475, 249, 16, 32, 252, 240, 2,
- 702, 248, 71, 32, 0, 244, 2,
- 1136, 232, 27, 32, 216, 248, 0,
- 0, 249, 23, 48, 0, 248, 2
- },
-
- /* Region 56 */
- {
- 0x8005, 0, 127, 0, 132, 233, 0,
- 0, 195, 95, 64, 240, 208, 0,
- 0, 225, 94, 64, 248, 240, 0,
- 0, 254, 127, 0, 4, 196, 4,
- 1902, 228, 95, 1, 248, 200, 0
- },
-
- /* Region 57 */
- {
- 0x8005, 0, 127, 16, 140, 238, 0,
- 0, 163, 90, 67, 228, 208, 0,
- 0, 209, 77, 65, 248, 240, 0,
- 1969, 173, 58, 65, 0, 176, 0,
- 0, 210, 61, 52, 204, 220, 0
- },
-
- /* Region 58 */
- {
- 0x8005, 0, 127, 16, 140, 222, 0,
- 0, 119, 74, 67, 160, 212, 0,
- 0, 146, 61, 65, 248, 244, 0,
- 1900, 137, 58, 65, 100, 196, 0,
- 0, 119, 61, 52, 120, 200, 0
- },
-
- /* Region 59 */
- {
- 0x8005, 0, 127, 16, 135, 219, 0,
- 0, 176, 79, 69, 240, 216, 0,
- 0, 193, 79, 64, 248, 236, 0,
- 0, 178, 123, 54, 92, 228, 0,
- 3369, 212, 95, 38, 144, 212, 0
- },
-
- /* Region 60 */
- {
- 0x8002, 0, 127, 0, 119, 203, 0,
- 2, 65, 77, 66, 228, 204, 0,
- 2, 161, 74, 64, 240, 240, 0,
- -2, 85, 60, 66, 180, 216, 2,
- -2, 162, 74, 64, 220, 240, 2
- },
-
- /* Region 61 */
- {
- 0x8002, 0, 127, 16, 154, 237, 0,
- 0, 179, 42, 64, 216, 208, 0,
- 0, 209, 61, 64, 248, 244, 0,
- -1200, 226, 55, 65, 244, 220, 2,
- 1902, 162, 62, 52, 204, 236, 2
- },
-
- /* Region 62 */
- {
- 0x8002, 0, 127, 48, 119, 221, 0,
- 2, 119, 79, 64, 208, 212, 0,
- 2, 209, 110, 64, 248, 236, 0,
- -2, 84, 79, 64, 136, 212, 2,
- -2, 209, 110, 64, 240, 240, 2
- },
-
- /* Region 63 */
- {
- 0x8002, 0, 127, 32, 135, 221, 0,
- 2, 165, 79, 64, 152, 216, 0,
- 2, 225, 110, 64, 248, 236, 0,
- -2, 132, 79, 64, 72, 224, 2,
- -2, 241, 110, 64, 252, 236, 2
- },
-
- /* Region 64 */
- {
- 0x8005, 0, 127, 17, 127, 190, 0,
- 0, 209, 60, 67, 244, 208, 0,
- 1200, 145, 94, 65, 248, 244, 2,
- 3369, 197, 47, 4, 128, 192, 0,
- 1902, 167, 94, 6, 200, 200, 0
- },
-
- /* Region 65 */
- {
- 0x8005, 0, 127, 17, 143, 190, 0,
- 0, 209, 60, 67, 244, 216, 0,
- 1902, 145, 62, 65, 248, 240, 2,
- 3369, 197, 47, 4, 128, 196, 0,
- 2400, 167, 94, 6, 200, 212, 2
- },
-
- /* Region 66 */
- {
- 0x8005, 0, 127, 17, 143, 190, 0,
- 0, 209, 60, 67, 244, 208, 0,
- 1902, 145, 62, 65, 248, 240, 2,
- 3369, 197, 47, 4, 128, 192, 0,
- 1902, 167, 94, 6, 200, 216, 2
- },
-
- /* Region 67 */
- {
- 0x8005, 0, 127, 17, 125, 190, 0,
- 0, 114, 109, 67, 244, 224, 0,
- 1902, 166, 93, 97, 200, 240, 0,
- 2786, 165, 95, 52, 160, 200, 0,
- 2400, 173, 78, 54, 240, 212, 2
- },
-
- /* Region 68 */
- {
- 0x8002, 0, 127, 16, 140, 205, 0,
- 0, 211, 55, 66, 244, 208, 0,
- 1902, 193, 93, 65, 248, 240, 0,
- 0, 204, 47, 4, 244, 216, 0,
- 3600, 183, 95, 6, 160, 232, 0
- },
-
- /* Region 69 */
- {
- 0x8002, 0, 127, 16, 126, 222, 0,
- 0, 243, 36, 66, 172, 200, 0,
- 1200, 193, 110, 67, 248, 244, 0,
- 0, 215, 33, 2, 232, 212, 0,
- 3369, 178, 63, 6, 184, 240, 0
- },
-
- /* Region 70 */
- {
- 0x8002, 0, 127, 16, 140, 221, 0,
- 1200, 213, 61, 66, 136, 200, 0,
- 1902, 193, 93, 68, 248, 240, 0,
- 0, 197, 47, 2, 228, 216, 0,
- 3369, 183, 95, 2, 160, 236, 0
- },
-
- /* Region 71 */
- {
- 0x8002, 0, 127, 16, 124, 201, 0,
- 1200, 195, 55, 68, 240, 208, 0,
- 0, 209, 76, 65, 248, 236, 0,
- 1902, 147, 47, 19, 208, 212, 0,
- 0, 183, 79, 22, 156, 228, 0
- },
-
- /* Region 72 */
- {
- 0x8005, 0, 127, 32, 110, 234, 0,
- 500, 237, 60, 68, 0, 192, 1,
- 1, 161, 93, 65, 248, 240, 2,
- 3365, 154, 47, 16, 48, 180, 6,
- 1200, 165, 92, 52, 160, 212, 2
- },
-
- /* Region 73 */
- {
- 0x8005, 0, 127, 32, 142, 200, 0,
- 0, 193, 60, 68, 248, 200, 0,
- 1, 129, 61, 65, 248, 240, 2,
- 3365, 154, 47, 16, 68, 184, 6,
- 1200, 169, 92, 52, 160, 204, 2
- },
-
- /* Region 74 */
- {
- 0x8003, 0, 127, 32, 135, 36, 0,
- 1199, 165, 79, 66, 152, 192, 2,
- -3, 145, 110, 64, 248, 240, 2,
- 0, 199, 79, 66, 44, 236, 2,
- 2986, 136, 110, 67, 100, 196, 2
- },
-
- /* Region 75 */
- {
- 0x8005, 0, 127, 32, 190, 71, 0,
- 868, 202, 140, 16, 24, 188, 2,
- 0, 176, 77, 65, 248, 240, 2,
- 3750, 169, 127, 16, 36, 228, 6,
- 2400, 195, 60, 17, 232, 172, 2
- },
-
- /* Region 76 */
- {
- 0x8005, 0, 127, 224, 16, 123, 0,
- 275, 202, 14, 2, 44, 196, 2,
- 0, 165, 89, 65, 56, 244, 2,
- 0, 255, 12, 2, 64, 216, 6,
- 963, 169, 14, 4, 40, 196, 2
- },
-
- /* Region 77 */
- {
- 0x8012, 0, 127, 192, 128, 100, 0,
- 1500, 202, 79, 68, 76, 204, 2,
- -2, 97, 26, 64, 248, 232, 2,
- 1588, 202, 223, 69, 4, 220, 0,
- 3, 188, 121, 67, 48, 252, 2
- },
-
- /* Region 78 */
- {
- 0x8002, 0, 127, 112, 140, 205, 0,
- 0, 68, 47, 66, 60, 176, 2,
- -2, 113, 94, 64, 248, 236, 0,
- 5000, 121, 47, 64, 32, 168, 7,
- 3, 136, 94, 64, 0, 236, 0
- },
-
- /* Region 79 */
- {
- 0x8003, 0, 127, 32, 135, 33, 0,
- 1199, 197, 79, 66, 152, 184, 2,
- 0, 161, 110, 64, 248, 240, 2,
- 0, 199, 79, 66, 44, 236, 2,
- 2400, 255, 110, 65, 36, 208, 6
- },
-
- /* Region 80 */
- {
- 0x8002, 0, 127, 0, 192, 170, 0,
- 1199, 192, 77, 33, 200, 212, 0,
- 0, 209, 107, 33, 232, 240, 0,
- 1201, 80, 77, 33, 200, 212, 0,
- 0, 241, 107, 33, 232, 240, 0
- },
-
- /* Region 81 */
- {
- 0x8002, 0, 127, 0, 192, 221, 0,
- -1, 192, 45, 33, 200, 212, 0,
- -1, 209, 107, 33, 232, 244, 0,
- 1, 80, 45, 33, 200, 212, 0,
- 1, 241, 107, 33, 232, 244, 0
- },
-
- /* Region 82 */
- {
- 0x8005, 0, 127, 0, 112, 255, 0,
- 4750, 221, 45, 34, 48, 172, 4,
- -10000, 161, 107, 33, 200, 244, 3,
- 2204, 137, 45, 37, 64, 184, 0,
- -2, 211, 107, 33, 160, 208, 0
- },
-
- /* Region 83 */
- {
- 0x8005, 0, 127, 16, 127, 238, 0,
- 2, 248, 45, 32, 204, 208, 0,
- -9500, 241, 107, 33, 200, 240, 3,
- 3369, 186, 45, 38, 24, 208, 0,
- -2, 211, 107, 32, 220, 212, 0
- },
-
- /* Region 84 */
- {
- 0x8005, 0, 127, 0, 128, 221, 0,
- -1, 192, 191, 99, 220, 216, 0,
- 1200, 243, 92, 97, 0, 244, 0,
- 3984, 200, 11, 96, 168, 192, 0,
- 1, 194, 127, 98, 108, 200, 0
- },
-
- /* Region 85 */
- {
- 0x8002, 0, 127, 128, 128, 111, 0,
- 1, 194, 25, 35, 120, 204, 2,
- -9750, 193, 107, 36, 224, 244, 3,
- 3906, 255, 28, 50, 12, 188, 3,
- -1, 216, 107, 80, 204, 240, 2
- },
-
- /* Region 86 */
- {
- 0x8002, 0, 127, 32, 134, 222, 0,
- 0, 195, 52, 33, 200, 208, 0,
- 0, 177, 90, 33, 232, 240, 2,
- 702, 195, 52, 33, 200, 208, 2,
- 702, 177, 90, 34, 232, 240, 2
- },
-
- /* Region 87 */
- {
- 0x8002, 0, 127, 32, 134, 205, 0,
- 0, 198, 75, 36, 120, 220, 2,
- 0, 225, 78, 52, 40, 244, 2,
- 0, 246, 47, 32, 220, 208, 2,
- 1902, 241, 124, 32, 240, 236, 2
- },
-
- /* Region 88 */
- {
- 0x8003, 0, 127, 32, 120, 14, 0,
- 3600, 244, 67, 34, 88, 208, 0,
- 3, 194, 84, 33, 84, 240, 2,
- -3, 194, 84, 33, 172, 236, 2,
- 902, 254, 114, 34, 0, 224, 3
- },
-
- /* Region 89 */
- {
- 0x8002, 0, 127, 64, 169, 170, 0,
- -3, 83, 69, 34, 184, 212, 0,
- -7500, 50, 69, 33, 176, 244, 3,
- 3, 81, 69, 34, 212, 212, 2,
- -8500, 66, 69, 33, 176, 244, 3
- },
-
- /* Region 90 */
- {
- 0x8002, 0, 127, 64, 120, 221, 0,
- -2, 82, 69, 34, 244, 216, 0,
- 0, 145, 102, 33, 228, 240, 0,
- 2, 81, 69, 34, 244, 208, 2,
- 0, 145, 102, 33, 224, 240, 2
- },
-
- /* Region 91 */
- {
- 0x8003, 0, 127, 32, 138, 14, 0,
- 2400, 148, 67, 34, 176, 200, 0,
- 3, 194, 85, 33, 220, 236, 2,
- -3, 194, 69, 33, 220, 236, 2,
- 1905, 254, 114, 34, 48, 224, 2
- },
-
- /* Region 92 */
- {
- 0x8002, 0, 127, 82, 67, 71, 0,
- 2982, 228, 22, 146, 88, 192, 3,
- 3, 102, 84, 146, 196, 240, 2,
- 3358, 50, 149, 116, 144, 208, 2,
- -3, 85, 84, 146, 120, 240, 0
- },
-
- /* Region 93 */
- {
- 0x8005, 0, 127, 48, 126, 219, 0,
- -3, 49, 19, 33, 120, 200, 0,
- 0, 81, 70, 33, 220, 240, 0,
- 3804, 242, 18, 50, 200, 200, 0,
- 1203, 82, 19, 82, 200, 176, 0
- },
-
- /* Region 94 */
- {
- 0x8003, 0, 127, 32, 138, 13, 0,
- 2786, 116, 67, 34, 204, 184, 0,
- 1902, 114, 69, 33, 192, 232, 2,
- -3, 178, 69, 33, 188, 232, 2,
- 3804, 254, 82, 34, 164, 228, 2
- },
-
- /* Region 95 */
- {
- 0x8002, 0, 127, 48, 135, 238, 0,
- -2, 34, 85, 34, 184, 224, 0,
- 1, 113, 70, 33, 228, 236, 0,
- 2, 19, 85, 34, 156, 224, 2,
- -1, 129, 70, 33, 224, 236, 2
- },
-
- /* Region 96 */
- {
- 0x8012, 0, 127, 240, 112, 221, 0,
- 3369, 213, 69, 32, 0, 204, 0,
- 0, 193, 70, 33, 112, 232, 2,
- 0, 145, 69, 34, 244, 208, 2,
- -9000, 145, 70, 33, 224, 236, 3
- },
-
- /* Region 97 */
- {
- 0x8002, 0, 127, 96, 122, 168, 0,
- -1, 99, 51, 33, 200, 208, 0,
- -8500, 81, 83, 33, 232, 240, 3,
- 702, 99, 52, 33, 200, 208, 2,
- -9500, 65, 83, 34, 224, 240, 3
- },
-
- /* Region 98 */
- {
- 0x8002, 0, 127, 0, 67, 0, 0,
- 1500, 217, 55, 151, 20, 224, 2,
- 3, 231, 70, 146, 88, 220, 2,
- 2369, 115, 148, 151, 32, 196, 2,
- -3, 118, 36, 146, 64, 244, 2
- },
-
- /* Region 99 */
- {
- 0x8002, 0, 127, 64, 169, 204, 0,
- -3, 228, 69, 34, 148, 220, 0,
- -7448, 243, 69, 33, 200, 240, 3,
- 3, 81, 68, 34, 212, 212, 2,
- -8526, 65, 68, 33, 196, 240, 3
- },
-
- /* Region 100 */
- {
- 0x8002, 0, 127, 64, 119, 187, 0,
- 2786, 228, 22, 146, 176, 192, 0,
- 3, 102, 68, 146, 196, 236, 2,
- 3369, 178, 149, 116, 176, 208, 2,
- -3, 231, 68, 146, 120, 240, 0
- },
-
- /* Region 101 */
- {
- 0x8002, 0, 127, 240, 144, 239, 0,
- -2, 49, 69, 34, 236, 208, 2,
- -9000, 113, 102, 33, 228, 236, 3,
- 2400, 149, 69, 34, 12, 216, 1,
- 0, 145, 102, 33, 224, 236, 2
- },
-
- /* Region 102 */
- {
- 0x8012, 0, 127, 241, 176, 6, 0,
- 1200, 247, 49, 64, 252, 204, 0,
- 3804, 246, 101, 32, 0, 232, 2,
- 1902, 247, 32, 32, 112, 188, 2,
- 0, 228, 84, 32, 0, 240, 2
- },
-
- /* Region 103 */
- {
- 0x8005, 0, 127, 64, 101, 221, 0,
- 1, 194, 68, 97, 196, 200, 2,
- -10001, 247, 100, 114, 176, 240, 3,
- 3370, 213, 33, 70, 52, 200, 2,
- -1, 178, 68, 49, 208, 212, 0
- },
-
- /* Region 104 */
- {
- 0x8002, 0, 127, 0, 255, 203, 0,
- -3, 245, 82, 99, 200, 232, 2,
- 2787, 244, 84, 96, 0, 236, 2,
- 1198, 133, 81, 100, 196, 220, 2,
- 1902, 147, 67, 80, 0, 232, 2
- },
-
- /* Region 105 */
- {
- 0x8005, 0, 127, 0, 255, 140, 0,
- 500, 255, 137, 179, 0, 200, 3,
- 1902, 248, 90, 160, 0, 244, 2,
- 3804, 245, 57, 35, 164, 204, 2,
- 0, 245, 38, 51, 196, 208, 2
- },
-
- /* Region 106 */
- {
- 0x8005, 0, 127, 0, 255, 72, 0,
- 1000, 238, 57, 65, 0, 188, 3,
- 1902, 247, 103, 112, 0, 244, 2,
- 2786, 250, 36, 81, 68, 212, 2,
- 0, 249, 50, 49, 172, 204, 2
- },
-
- /* Region 107 */
- {
- 0x8005, 0, 127, 16, 119, 72, 0,
- 1500, 255, 89, 65, 0, 196, 3,
- 2790, 246, 39, 112, 0, 240, 0,
- 1905, 246, 36, 81, 168, 208, 0,
- 0, 249, 114, 49, 172, 212, 0
- },
-
- /* Region 108 */
- {
- 0x8005, 0, 127, 0, 255, 237, 0,
- 1902, 254, 89, 65, 0, 212, 2,
- 0, 248, 87, 112, 0, 240, 2,
- 3369, 231, 62, 81, 0, 208, 2,
- 3, 245, 118, 49, 96, 196, 2
- },
-
- /* Region 109 */
- {
- 0x8002, 0, 127, 16, 188, 205, 0,
- -2, 179, 47, 50, 244, 224, 2,
- 1900, 145, 94, 49, 248, 232, 2,
- 3, 210, 46, 2, 244, 208, 2,
- 2789, 133, 93, 4, 180, 244, 2
- },
-
- /* Region 110 */
- {
- 0x8005, 0, 127, 48, 135, 220, 0,
- 1901, 162, 25, 35, 144, 208, 0,
- 0, 113, 105, 65, 220, 240, 0,
- 3369, 233, 88, 51, 120, 212, 0,
- 0, 229, 24, 84, 200, 208, 0
- },
-
- /* Region 111 */
- {
- 0x8002, 0, 127, 112, 32, 190, 0,
- 0, 53, 79, 66, 152, 212, 2,
- 1200, 53, 75, 64, 136, 244, 2,
- 500, 149, 60, 66, 16, 208, 2,
- 1902, 200, 78, 64, 0, 248, 0
- },
-
- /* Region 112 */
- {
- 0x8005, 0, 127, 0, 144, 130, 0,
- 2514, 255, 68, 53, 0, 204, 2,
- 2400, 247, 133, 48, 0, 240, 2,
- 4151, 243, 67, 50, 0, 212, 2,
- 3369, 243, 66, 56, 0, 204, 2
- },
-
- /* Region 113 */
- {
- 0x8005, 0, 127, 0, 255, 0, 0,
- 514, 253, 79, 51, 0, 196, 3,
- 1905, 252, 89, 51, 0, 244, 2,
- 4349, 245, 35, 51, 0, 208, 2,
- 1205, 247, 34, 51, 0, 208, 2
- },
-
- /* Region 114 */
- {
- 0x8005, 0, 127, 0, 255, 0, 0,
- 514, 221, 69, 35, 0, 204, 3,
- 0, 250, 86, 115, 0, 252, 2,
- 1884, 244, 116, 51, 0, 200, 2,
- 1208, 210, 35, 51, 0, 208, 2
- },
-
- /* Region 115 */
- {
- 0x8005, 0, 127, 0, 255, 16, 0,
- 514, 222, 85, 163, 0, 192, 3,
- 0, 254, 108, 163, 0, 252, 2,
- 3800, 255, 143, 160, 0, 176, 2,
- 1200, 250, 105, 163, 0, 212, 2
- },
-
- /* Region 116 */
- {
- 0x8005, 0, 127, 0, 255, 16, 0,
- 1514, 249, 101, 163, 0, 204, 3,
- -1200, 249, 87, 160, 0, 252, 2,
- 0, 235, 143, 160, 0, 204, 2,
- 1200, 234, 73, 163, 0, 204, 2
- },
-
- /* Region 117 */
- {
- 0x8005, 0, 127, 0, 255, 16, 0,
- 500, 239, 101, 160, 0, 204, 3,
- -1195, 248, 104, 160, 0, 252, 2,
- 1898, 252, 72, 163, 0, 216, 2,
- 1239, 248, 87, 163, 0, 196, 2
- },
-
- /* Region 118 */
- {
- 0x8005, 0, 127, 0, 255, 255, 0,
- 500, 255, 98, 160, 0, 196, 3,
- -1, 249, 105, 160, 0, 252, 2,
- 1907, 250, 71, 160, 0, 252, 2,
- 1182, 249, 87, 161, 0, 192, 2
- },
-
- /* Region 119 */
- {
- 0x8005, 0, 127, 0, 0, 100, 0,
- 600, 32, 15, 0, 252, 224, 6,
- 0, 47, 111, 65, 0, 244, 2,
- 1826, 16, 47, 0, 252, 216, 2,
- 3551, 240, 47, 0, 252, 212, 2
- },
-
- /* Region 120 */
- {
- 0x8014, 0, 127, 240, 128, 235, 0,
- 1228, 161, 47, 17, 196, 200, 3,
- 3000, 123, 75, 17, 0, 240, 2,
- 7022, 72, 43, 17, 0, 216, 0,
- 4000, 150, 79, 17, 48, 196, 3
- },
-
- /* Region 121 */
- {
- 0x8005, 0, 127, 224, 16, 86, 0,
- 275, 251, 6, 0, 36, 200, 2,
- 0, 101, 104, 65, 56, 240, 2,
- 0, 240, 6, 0, 252, 208, 6,
- 1000, 195, 8, 0, 248, 200, 2
- },
-
- /* Region 122 */
- {
- 0x8002, 0, 127, 0, 0, 185, 0,
- 600, 35, 66, 17, 72, 224, 4,
- -13000, 81, 67, 17, 228, 244, 2,
- 702, 97, 38, 17, 212, 196, 6,
- -14000, 81, 65, 17, 224, 244, 3
- },
-
- /* Region 123 */
- {
- 0x8012, 0, 127, 240, 112, 237, 0,
- -6528, 153, 127, 16, 0, 252, 3,
- 1200, 105, 109, 16, 0, 216, 2,
- -6022, 179, 139, 17, 0, 248, 3,
- 2000, 104, 79, 17, 0, 240, 0
- },
-
- /* Region 124 */
- {
- 0x8012, 0, 127, 240, 240, 16, 0,
- 1914, 240, 64, 160, 240, 208, 2,
- 1200, 240, 73, 163, 240, 244, 0,
- 1900, 240, 64, 160, 240, 148, 2,
- 4151, 240, 73, 163, 240, 244, 0
- },
-
- /* Region 125 */
- {
- 0x8002, 0, 127, 240, 56, 235, 0,
- -5522, 97, 32, 17, 196, 240, 3,
- 0, 84, 75, 17, 180, 248, 3,
- 702, 65, 38, 17, 224, 212, 6,
- -4000, 161, 73, 17, 224, 252, 1
- },
-
- /* Region 126 */
- {
- 0x8015, 0, 127, 240, 248, 37, 0,
- 1050, 243, 0, 0, 252, 224, 7,
- 2000, 49, 68, 0, 224, 236, 3,
- 350, 240, 0, 0, 252, 216, 1,
- 700, 240, 0, 0, 252, 212, 3
- },
-
- /* Region 127 */
- {
- 0x8015, 0, 127, 240, 248, 37, 0,
- 1050, 245, 85, 0, 0, 244, 7,
- -5000, 247, 71, 0, 0, 252, 3,
- 350, 240, 0, 0, 0, 164, 0,
- 700, 32, 0, 0, 0, 252, 2
- },
-
- /* Region 128 */
- {
- 0x0005, 35, 35, 0, 255, 103, 0,
- 3, 215, 68, 65, 0, 204, 2,
- -1700, 249, 95, 177, 0, 252, 2,
- 5374, 236, 144, 204, 0, 176, 3,
- 114, 253, 144, 179, 0, 200, 3
- },
-
- /* Region 129 */
- {
- 0x0005, 36, 36, 0, 255, 103, 0,
- 3, 219, 68, 65, 0, 204, 2,
- -1700, 251, 95, 177, 0, 252, 2,
- 5374, 255, 144, 204, 0, 176, 3,
- 114, 255, 144, 179, 0, 208, 3
- },
-
- /* Region 130 */
- {
- 0x001a, 37, 37, 240, 128, 216, 0,
- 2780, 255, 16, 0, 112, 200, 3,
- 3800, 255, 32, 0, 0, 240, 3,
- 2501, 251, 48, 0, 48, 240, 3,
- 2751, 254, 48, 0, 0, 244, 3
- },
-
- /* Region 131 */
- {
- 0x000d, 38, 38, 0, 255, 190, 0,
- -2000, 239, 48, 128, 0, 236, 3,
- -2400, 254, 92, 128, 0, 252, 2,
- 3374, 255, 33, 192, 240, 244, 2,
- 1000, 255, 49, 176, 240, 204, 2
- },
-
- /* Region 132 */
- {
- 0x001a, 39, 39, 240, 128, 254, -10,
- 5780, 186, 16, 0, 112, 240, 3,
- 3800, 254, 32, 0, 0, 248, 3,
- 5780, 234, 16, 0, 112, 240, 3,
- 4829, 254, 32, 0, 0, 252, 3
- },
-
- /* Region 133 */
- {
- 0x000d, 40, 40, 0, 255, 203, 0,
- 0, 254, 74, 128, 0, 176, 3,
- -600, 252, 73, 128, 0, 252, 3,
- 3368, 251, 80, 192, 0, 244, 3,
- 1200, 254, 64, 176, 0, 208, 3
- },
-
- /* Region 134 */
- {
- 0x000d, 41, 41, 208, 16, 187, -30,
- -600, 247, 128, 0, 0, 204, 1,
- -890, 248, 88, 0, 0, 252, 3,
- 1068, 250, 182, 0, 0, 200, 3,
- -100, 249, 116, 0, 0, 208, 3
- },
-
- /* Region 135 */
- {
- 0x0005, 42, 42, 160, 255, 126, 20,
- 3514, 247, 23, 72, 0, 212, 3,
- 400, 255, 94, 177, 0, 232, 2,
- 2347, 250, 47, 0, 196, 184, 6,
- 4388, 248, 26, 0, 136, 224, 2
- },
-
- /* Region 136 */
- {
- 0x000d, 43, 43, 208, 16, 187, -20,
- -500, 247, 128, 0, 0, 204, 1,
- -690, 249, 88, 0, 0, 252, 3,
- 1068, 254, 182, 0, 0, 200, 3,
- 0, 249, 116, 0, 0, 208, 3
- },
-
- /* Region 137 */
- {
- 0x0005, 44, 44, 160, 255, 126, 20,
- 3514, 151, 20, 72, 0, 244, 3,
- 400, 223, 92, 177, 0, 240, 2,
- 2347, 134, 34, 0, 176, 208, 6,
- 4388, 200, 21, 0, 100, 220, 2
- },
-
- /* Region 138 */
- {
- 0x000d, 45, 45, 208, 16, 187, -10,
- -350, 246, 128, 0, 0, 204, 1,
- -590, 249, 88, 0, 0, 252, 3,
- 2368, 254, 182, 0, 0, 196, 3,
- 500, 249, 116, 0, 0, 208, 3
- },
-
- /* Region 139 */
- {
- 0x0005, 46, 46, 160, 255, 126, 20,
- 3510, 147, 51, 72, 0, 236, 3,
- 400, 219, 90, 177, 0, 240, 2,
- 2347, 134, 66, 0, 176, 224, 6,
- 4388, 200, 84, 0, 100, 212, 2
- },
-
- /* Region 140 */
- {
- 0x000d, 47, 47, 176, 32, 187, 10,
- 0, 247, 128, 0, 0, 204, 1,
- -280, 249, 88, 0, 0, 252, 3,
- 2968, 255, 182, 0, 0, 200, 3,
- 700, 250, 116, 0, 0, 204, 3
- },
-
- /* Region 141 */
- {
- 0x000d, 48, 48, 0, 255, 187, 20,
- 10, 247, 128, 0, 0, 204, 3,
- -130, 249, 88, 0, 0, 252, 3,
- 3068, 255, 182, 0, 0, 188, 3,
- 800, 250, 116, 0, 0, 204, 3
- },
-
- /* Region 142 */
- {
- 0x000d, 49, 49, 160, 255, 215, 20,
- 3986, 18, 6, 8, 0, 252, 2,
- 0, 247, 70, 1, 0, 240, 2,
- 5354, 242, 48, 0, 252, 216, 2,
- 3868, 193, 48, 0, 212, 208, 2
- },
-
- /* Region 143 */
- {
- 0x000d, 50, 50, 0, 255, 201, 30,
- 200, 247, 128, 0, 0, 208, 3,
- 20, 249, 88, 0, 0, 252, 3,
- 3368, 255, 182, 0, 0, 200, 3,
- 1100, 250, 116, 0, 0, 204, 3
- },
-
- /* Region 144 */
- {
- 0x000d, 51, 51, 160, 255, 97, -20,
- 3831, 240, 39, 0, 232, 224, 3,
- 1258, 246, 102, 0, 0, 232, 3,
- 4323, 242, 32, 0, 0, 216, 3,
- 868, 243, 64, 0, 0, 204, 3
- },
-
- /* Region 145 */
- {
- 0x000d, 52, 52, 112, 128, 234, -20,
- 725, 228, 32, 0, 0, 208, 1,
- 400, 248, 86, 0, 0, 248, 3,
- 2003, 53, 32, 0, 0, 236, 3,
- 100, 209, 32, 0, 0, 212, 1
- },
-
- /* Region 146 */
- {
- 0x000d, 53, 53, 160, 255, 97, -20,
- 3831, 240, 39, 0, 232, 224, 3,
- 1258, 246, 102, 0, 0, 232, 3,
- 4323, 242, 32, 0, 0, 224, 3,
- 868, 243, 64, 0, 0, 196, 3
- },
-
- /* Region 147 */
- {
- 0x001d, 54, 54, 240, 240, 242, 10,
- -1, 245, 71, 1, 24, 236, 0,
- 1200, 218, 102, 1, 0, 236, 2,
- 1354, 255, 48, 0, 0, 208, 2,
- 5868, 209, 48, 0, 160, 212, 0
- },
-
- /* Region 148 */
- {
- 0x000d, 55, 55, 48, 32, 234, -10,
- 725, 228, 32, 0, 0, 208, 3,
- 900, 249, 86, 0, 0, 240, 3,
- 2303, 69, 32, 0, 0, 236, 1,
- 400, 177, 32, 0, 0, 212, 3
- },
-
- /* Region 149 */
- {
- 0x000d, 56, 56, 0, 255, 149, 20,
- 414, 254, 123, 48, 0, 204, 3,
- 1986, 252, 118, 48, 0, 244, 3,
- 4383, 242, 67, 48, 0, 200, 3,
- 4205, 243, 81, 48, 0, 204, 3
- },
-
- /* Region 150 */
- {
- 0x000d, 57, 57, 48, 32, 234, -20,
- 526, 210, 32, 0, 0, 200, 3,
- 719, 246, 86, 0, 0, 240, 3,
- 1303, 48, 32, 0, 0, 236, 1,
- 202, 98, 32, 0, 0, 212, 3
- },
-
- /* Region 151 */
- {
- 0x001d, 58, 58, 240, 240, 204, -40,
- 5650, 247, 16, 0, 84, 220, 1,
- 3800, 248, 32, 0, 0, 248, 3,
- 1780, 252, 16, 0, 0, 152, 3,
- 6825, 245, 32, 0, 0, 208, 1
- },
-
- /* Region 152 */
- {
- 0x000d, 59, 59, 144, 0, 108, -20,
- 3531, 240, 103, 0, 232, 220, 3,
- 1058, 246, 102, 0, 0, 232, 3,
- 5331, 242, 64, 0, 0, 220, 3,
- 1968, 243, 64, 0, 0, 204, 1
- },
-
- /* Region 153 */
- {
- 0x000d, 60, 60, 192, 64, 155, 40,
- 700, 214, 84, 0, 0, 208, 1,
- 950, 253, 76, 0, 0, 248, 3,
- 2803, 255, 127, 0, 0, 200, 3,
- 750, 255, 89, 0, 0, 204, 3
- },
-
- /* Region 154 */
- {
- 0x000d, 61, 61, 224, 48, 91, 40,
- 400, 229, 68, 0, 0, 204, 1,
- 700, 251, 76, 0, 0, 248, 3,
- 1803, 255, 95, 0, 0, 196, 3,
- 450, 255, 89, 0, 0, 208, 3
- },
-
- /* Region 155 */
- {
- 0x000d, 62, 62, 240, 32, 191, 25,
- 214, 237, 69, 0, 0, 204, 1,
- 400, 252, 78, 0, 0, 248, 3,
- 2830, 255, 95, 0, 0, 208, 3,
- 2500, 255, 25, 0, 0, 192, 3
- },
-
- /* Region 156 */
- {
- 0x000d, 63, 63, 240, 32, 91, 25,
- 400, 229, 68, 0, 0, 188, 1,
- -100, 250, 76, 0, 0, 248, 3,
- 1803, 254, 95, 0, 0, 200, 3,
- 450, 238, 89, 0, 0, 200, 3
- },
-
- /* Region 157 */
- {
- 0x000d, 64, 64, 240, 16, 91, 20,
- 300, 210, 68, 0, 0, 196, 1,
- -400, 250, 76, 0, 0, 248, 3,
- 1803, 254, 95, 0, 0, 200, 3,
- 550, 238, 89, 0, 0, 200, 3
- },
-
- /* Region 158 */
- {
- 0x001c, 65, 65, 240, 128, 223, 20,
- 1780, 234, 16, 0, 112, 208, 3,
- 800, 251, 32, 0, 0, 248, 3,
- 5501, 231, 48, 0, 48, 200, 3,
- 2751, 232, 48, 0, 0, 220, 3
- },
-
- /* Region 159 */
- {
- 0x001c, 66, 66, 240, 128, 223, 20,
- 1580, 234, 16, 0, 112, 208, 3,
- 600, 250, 32, 0, 0, 248, 3,
- 5201, 231, 48, 0, 48, 200, 3,
- 2510, 232, 48, 0, 0, 220, 3
- },
-
- /* Region 160 */
- {
- 0x000d, 67, 67, 0, 255, 0, -35,
- 1514, 255, 63, 51, 0, 184, 3,
- 4830, 251, 73, 51, 0, 252, 3,
- 4349, 245, 67, 51, 0, 212, 3,
- 5267, 246, 65, 51, 0, 200, 3
- },
-
- /* Region 161 */
- {
- 0x000d, 68, 68, 0, 255, 0, -35,
- 1514, 255, 63, 51, 0, 196, 3,
- 4905, 251, 73, 51, 0, 252, 3,
- 4349, 245, 67, 51, 0, 196, 3,
- 5214, 246, 65, 51, 0, 208, 3
- },
-
- /* Region 162 */
- {
- 0x000a, 69, 69, 240, 240, 243, -35,
- 10000, 160, 68, 0, 0, 200, 3,
- 7000, 156, 140, 0, 0, 228, 3,
- 1586, 176, 16, 0, 0, 228, 7,
- 8000, 140, 80, 0, 0, 236, 3
- },
-
- /* Region 163 */
- {
- 0x001a, 70, 70, 240, 240, 227, -38,
- 500, 240, 52, 0, 0, 220, 1,
- 8000, 188, 124, 0, 0, 228, 3,
- 1586, 240, 16, 0, 0, 224, 7,
- 8000, 203, 80, 0, 0, 228, 3
- },
-
- /* Region 164 */
- {
- 0x0004, 71, 71, 226, 240, 181, 35,
- 7253, 224, 32, 48, 0, 184, 3,
- 3594, 224, 79, 48, 0, 248, 1,
- 220, 97, 19, 48, 156, 152, 3,
- 5243, 172, 16, 48, 92, 204, 1
- },
-
- /* Region 165 */
- {
- 0x0004, 72, 72, 240, 241, 181, 35,
- 6253, 134, 32, 48, 0, 184, 3,
- 3994, 176, 76, 48, 160, 248, 1,
- 22, 183, 19, 48, 156, 172, 3,
- 1243, 160, 16, 48, 240, 188, 3
- },
-
- /* Region 166 */
- {
- 0x001a, 73, 73, 240, 224, 155, 30,
- -2145, 240, 70, 0, 0, 252, 3,
- 600, 109, 111, 0, 0, 240, 3,
- -1800, 240, 71, 0, 0, 248, 3,
- 200, 173, 111, 0, 0, 240, 3
- },
-
- /* Region 167 */
- {
- 0x0012, 74, 74, 240, 224, 119, 30,
- -2545, 240, 70, 0, 252, 252, 3,
- 0, 153, 111, 0, 0, 240, 3,
- -2400, 240, 71, 0, 252, 252, 3,
- 100, 137, 111, 0, 0, 240, 3
- },
-
- /* Region 168 */
- {
- 0x001a, 75, 75, 240, 128, 240, 20,
- 3780, 255, 16, 0, 252, 188, 2,
- 800, 255, 64, 0, 0, 248, 2,
- 2501, 255, 48, 0, 252, 208, 0,
- 751, 255, 48, 0, 0, 236, 2
- },
-
- /* Region 169 */
- {
- 0x000d, 76, 76, 0, 255, 68, 35,
- 1100, 239, 69, 0, 0, 184, 3,
- 2600, 255, 76, 0, 0, 252, 3,
- 5000, 255, 111, 0, 0, 204, 3,
- 3400, 254, 73, 0, 0, 184, 3
- },
-
- /* Region 170 */
- {
- 0x000d, 77, 77, 0, 255, 68, 35,
- 914, 239, 69, 0, 0, 180, 3,
- 1801, 254, 76, 0, 0, 252, 3,
- 4800, 255, 111, 0, 0, 192, 3,
- 3200, 254, 73, 0, 0, 192, 3
- },
-
- /* Region 171 */
- {
- 0x000d, 78, 78, 240, 32, 197, -20,
- 1200, 216, 86, 0, 0, 180, 1,
- 1800, 189, 127, 0, 0, 244, 3,
- 2700, 156, 102, 0, 0, 196, 1,
- 700, 109, 104, 0, 0, 196, 1
- },
-
- /* Region 172 */
- {
- 0x000d, 79, 79, 240, 32, 197, -20,
- 1200, 216, 86, 0, 0, 196, 1,
- 2200, 171, 127, 0, 0, 244, 3,
- 2700, 145, 102, 0, 0, 192, 1,
- 700, 106, 104, 0, 0, 192, 1
- },
-
- /* Region 173 */
- {
- 0x000d, 80, 80, 0, 255, 0, -40,
- 3514, 254, 79, 51, 0, 196, 3,
- 5905, 252, 73, 51, 0, 248, 3,
- 6348, 245, 35, 51, 0, 176, 3,
- 2203, 244, 33, 51, 0, 216, 3
- },
-
- /* Region 174 */
- {
- 0x800d, 81, 81, 0, 255, 0, -40,
- 3514, 255, 79, 51, 0, 192, 3,
- 5905, 246, 73, 51, 0, 252, 3,
- 6348, 241, 35, 51, 0, 180, 3,
- 2203, 242, 33, 51, 0, 212, 3
- }
-};
-
-
-/*----------------------------------------------------------------------------
- * Programs
- *----------------------------------------------------------------------------
-*/
-const S_PROGRAM programs[] =
-{
- { 7864320, 128 } /* program 0 */
-}; /* end Programs */
-
-/*----------------------------------------------------------------------------
- * Banks
- *----------------------------------------------------------------------------
-*/
-const S_BANK banks[] =
-{
- { /* bank 0 */
- 30976,
- {
- 0, 1, 2, 3, 4, 5, 6, 7,
- 8, 9, 10, 11, 12, 13, 14, 15,
- 16, 17, 18, 19, 20, 21, 22, 23,
- 24, 25, 26, 27, 28, 29, 30, 31,
- 32, 33, 34, 35, 36, 37, 38, 39,
- 40, 41, 42, 43, 44, 45, 46, 47,
- 48, 49, 50, 51, 52, 53, 54, 55,
- 56, 57, 58, 59, 60, 61, 62, 63,
- 64, 65, 66, 67, 68, 69, 70, 71,
- 72, 73, 74, 75, 76, 77, 78, 79,
- 80, 81, 82, 83, 84, 85, 86, 87,
- 88, 89, 90, 91, 92, 93, 94, 95,
- 96, 97, 98, 99, 100, 101, 102, 103,
- 104, 105, 106, 107, 108, 109, 110, 111,
- 112, 113, 114, 115, 116, 117, 118, 119,
- 120, 121, 122, 123, 124, 125, 126, 127
- }
- }
-}; /* end Banks */
-
-/*----------------------------------------------------------------------------
- * S_EAS
- *----------------------------------------------------------------------------
-*/
-const S_EAS easSoundLib =
-{
- 0x01534145,
- 0x00105622,
-
- banks,
- programs,
-
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
-
- regions,
-
- 1,
- 1,
-
- 0,
- 0,
- 0,
-
- 175
-}; /* end S_EAS */
-/* end sound library */
+ *
+ * Source: C:\Sonic\Source\Gen3.3\FMSynth\GMdblib-3.fml
+ ********************************************************************/
+
+
+#include "eas_data.h"
+
+/* begin region data */
+/*lint -e{651} lint complains about unnecessary brackets */
+const S_FM_REGION regions[] =
+{
+
+ /* Region 0 */
+ {
+ 0x8005, 0, 127, 0, 255, 8, 0,
+ 514, 239, 47, 97, 0, 184, 3,
+ 1, 244, 89, 114, 0, 248, 2,
+ 3370, 244, 49, 76, 40, 192, 2,
+ -1, 227, 97, 51, 160, 212, 2
+ },
+
+ /* Region 1 */
+ {
+ 0x8005, 0, 127, 160, 255, 8, 0,
+ 2514, 223, 95, 72, 0, 176, 3,
+ 1, 244, 73, 145, 0, 244, 2,
+ 3600, 245, 81, 198, 40, 192, 2,
+ 3, 246, 81, 163, 108, 212, 2
+ },
+
+ /* Region 2 */
+ {
+ 0x8005, 0, 127, 160, 255, 119, 0,
+ 0, 216, 79, 72, 0, 216, 2,
+ 2, 244, 73, 145, 0, 244, 2,
+ 3370, 247, 33, 182, 60, 204, 2,
+ 1200, 246, 65, 163, 108, 204, 2
+ },
+
+ /* Region 3 */
+ {
+ 0x8005, 0, 127, 160, 255, 1, 0,
+ 3369, 248, 65, 71, 40, 208, 2,
+ -3, 245, 88, 113, 0, 244, 2,
+ 2784, 225, 65, 133, 80, 192, 2,
+ 3, 241, 81, 113, 80, 216, 2
+ },
+
+ /* Region 4 */
+ {
+ 0x8002, 0, 127, 0, 255, 128, 0,
+ 0, 229, 155, 183, 0, 228, 2,
+ -3, 243, 90, 81, 0, 244, 2,
+ 4800, 248, 109, 180, 36, 192, 2,
+ 3, 245, 90, 85, 16, 244, 2
+ },
+
+ /* Region 5 */
+ {
+ 0x8002, 0, 127, 9, 96, 192, 0,
+ 1200, 229, 157, 180, 0, 216, 2,
+ -3, 244, 90, 81, 0, 244, 2,
+ 1902, 255, 111, 182, 80, 208, 2,
+ 3, 246, 92, 83, 0, 244, 2
+ },
+
+ /* Region 6 */
+ {
+ 0x8002, 0, 127, 0, 255, 154, 0,
+ 3102, 244, 63, 102, 228, 228, 2,
+ 1200, 247, 93, 97, 0, 236, 2,
+ 1902, 255, 63, 98, 156, 220, 2,
+ 1200, 244, 92, 98, 0, 236, 2
+ },
+
+ /* Region 7 */
+ {
+ 0x8005, 0, 127, 0, 255, 202, 0,
+ 0, 251, 131, 19, 216, 220, 2,
+ 1201, 247, 62, 113, 0, 240, 2,
+ 0, 243, 154, 36, 240, 224, 2,
+ 2784, 250, 61, 36, 240, 208, 2
+ },
+
+ /* Region 8 */
+ {
+ 0x8001, 0, 127, 0, 255, 80, 0,
+ -1, 213, 191, 183, 0, 204, 2,
+ 1, 245, 154, 129, 0, 244, 2,
+ 3831, 252, 159, 100, 0, 200, 2,
+ 1197, 246, 91, 182, 0, 244, 2
+ },
+
+ /* Region 9 */
+ {
+ 0x8002, 0, 127, 48, 80, 21, 0,
+ 2982, 255, 43, 96, 0, 196, 3,
+ 3, 247, 71, 130, 0, 244, 2,
+ 3358, 253, 40, 98, 144, 208, 2,
+ -2, 246, 70, 130, 0, 236, 2
+ },
+
+ /* Region 10 */
+ {
+ 0x8002, 0, 127, 48, 80, 26, 0,
+ 3096, 249, 72, 100, 0, 208, 2,
+ 2185, 249, 102, 130, 0, 240, 2,
+ 3386, 247, 66, 100, 144, 212, 2,
+ -2, 247, 102, 130, 0, 240, 2
+ },
+
+ /* Region 11 */
+ {
+ 0x8002, 0, 127, 92, 67, 21, 0,
+ 2982, 255, 27, 146, 0, 200, 3,
+ 3, 246, 68, 146, 0, 240, 2,
+ 3358, 250, 149, 116, 144, 208, 2,
+ -3, 245, 68, 146, 0, 240, 0
+ },
+
+ /* Region 12 */
+ {
+ 0x8002, 0, 127, 0, 67, 0, 0,
+ 1500, 239, 60, 151, 0, 220, 2,
+ 0, 247, 76, 146, 0, 240, 2,
+ 2398, 234, 156, 151, 0, 212, 2,
+ 0, 246, 105, 146, 0, 244, 2
+ },
+
+ /* Region 13 */
+ {
+ 0x8002, 0, 127, 0, 67, 0, 0,
+ 2500, 255, 60, 151, 0, 220, 2,
+ 0, 249, 92, 146, 0, 244, 2,
+ 3369, 250, 156, 151, 0, 196, 2,
+ 0, 248, 89, 146, 0, 244, 2
+ },
+
+ /* Region 14 */
+ {
+ 0x8005, 0, 127, 160, 255, 0, 0,
+ 2300, 229, 112, 49, 0, 208, 2,
+ -3, 247, 67, 50, 0, 248, 2,
+ 1074, 255, 41, 49, 0, 196, 2,
+ 686, 240, 97, 18, 0, 196, 2
+ },
+
+ /* Region 15 */
+ {
+ 0x8005, 0, 127, 160, 255, 219, 0,
+ 3369, 255, 65, 70, 40, 216, 2,
+ 1, 246, 72, 113, 0, 240, 2,
+ 1902, 225, 33, 129, 80, 204, 2,
+ 2400, 225, 97, 113, 80, 200, 2
+ },
+
+ /* Region 16 */
+ {
+ 0x8003, 0, 127, 32, 48, 151, 0,
+ 1201, 215, 35, 66, 252, 208, 0,
+ -9581, 254, 63, 177, 240, 240, 3,
+ 1902, 248, 47, 64, 112, 244, 2,
+ 0, 247, 35, 66, 208, 212, 2
+ },
+
+ /* Region 17 */
+ {
+ 0x8001, 0, 127, 0, 255, 153, 0,
+ 1, 252, 31, 3, 244, 196, 2,
+ -1, 208, 31, 4, 248, 244, 2,
+ 1205, 209, 31, 4, 248, 236, 2,
+ 1899, 250, 31, 32, 0, 240, 2
+ },
+
+ /* Region 18 */
+ {
+ 0x8002, 0, 127, 32, 49, 201, 0,
+ 1, 220, 47, 3, 244, 220, 0,
+ -10000, 208, 63, 1, 248, 240, 3,
+ 1586, 255, 47, 3, 188, 216, 2,
+ -1, 202, 63, 32, 80, 232, 2
+ },
+
+ /* Region 19 */
+ {
+ 0x8001, 0, 127, 0, 143, 29, 0,
+ -1200, 223, 64, 0, 252, 216, 2,
+ 1200, 96, 41, 35, 248, 240, 2,
+ 1200, 143, 41, 64, 252, 224, 2,
+ 3102, 161, 41, 96, 248, 216, 2
+ },
+
+ /* Region 20 */
+ {
+ 0x8002, 0, 127, 0, 143, 34, 0,
+ -1200, 133, 79, 1, 252, 212, 2,
+ 1201, 112, 46, 34, 248, 232, 2,
+ 0, 116, 79, 65, 252, 200, 2,
+ 1900, 161, 46, 98, 248, 232, 2
+ },
+
+ /* Region 21 */
+ {
+ 0x8002, 0, 127, 0, 143, 187, 0,
+ 1202, 80, 74, 1, 252, 216, 2,
+ 2402, 112, 46, 34, 248, 232, 2,
+ 0, 99, 78, 97, 184, 216, 2,
+ 1899, 81, 46, 98, 236, 232, 2
+ },
+
+ /* Region 22 */
+ {
+ 0x8005, 0, 127, 22, 141, 34, 0,
+ 2787, 176, 79, 4, 252, 208, 2,
+ 2785, 144, 45, 34, 248, 236, 2,
+ 3369, 83, 77, 100, 184, 172, 2,
+ 1902, 102, 45, 100, 172, 212, 0
+ },
+
+ /* Region 23 */
+ {
+ 0x8002, 0, 127, 0, 143, 135, 0,
+ 1900, 112, 79, 3, 252, 220, 2,
+ 2400, 128, 45, 34, 248, 232, 2,
+ 1200, 115, 77, 98, 184, 220, 2,
+ 1904, 97, 45, 98, 236, 232, 2
+ },
+
+ /* Region 24 */
+ {
+ 0x8005, 0, 127, 0, 255, 157, 0,
+ 1200, 244, 54, 4, 20, 200, 2,
+ 0, 245, 92, 130, 0, 244, 2,
+ 3802, 247, 68, 21, 0, 196, 2,
+ 1, 245, 43, 114, 0, 204, 2
+ },
+
+ /* Region 25 */
+ {
+ 0x8005, 0, 127, 0, 128, 83, 0,
+ 0, 244, 51, 4, 200, 204, 0,
+ 0, 247, 108, 129, 0, 248, 0,
+ 2786, 243, 31, 70, 200, 220, 0,
+ 1902, 246, 44, 113, 12, 188, 0
+ },
+
+ /* Region 26 */
+ {
+ 0x8005, 0, 127, 0, 128, 61, 0,
+ 0, 246, 51, 97, 76, 204, 0,
+ 0, 244, 60, 97, 0, 240, 0,
+ 1786, 255, 31, 64, 0, 180, 0,
+ 1200, 247, 60, 97, 12, 204, 0
+ },
+
+ /* Region 27 */
+ {
+ 0x8005, 0, 127, 0, 128, 153, 0,
+ -2, 243, 53, 99, 96, 200, 0,
+ 0, 243, 60, 97, 0, 240, 0,
+ 3983, 247, 63, 100, 24, 204, 0,
+ 2, 242, 53, 99, 52, 212, 0
+ },
+
+ /* Region 28 */
+ {
+ 0x8005, 0, 127, 0, 128, 205, 0,
+ -2, 244, 47, 97, 20, 208, 0,
+ 0, 252, 75, 193, 0, 248, 0,
+ 0, 254, 63, 98, 132, 224, 0,
+ 2786, 251, 63, 98, 52, 192, 0
+ },
+
+ /* Region 29 */
+ {
+ 0x8005, 0, 127, 0, 128, 221, 0,
+ -1, 208, 191, 99, 220, 224, 0,
+ 1200, 243, 92, 97, 0, 244, 0,
+ 3984, 212, 11, 96, 168, 196, 0,
+ 1, 242, 127, 98, 108, 204, 0
+ },
+
+ /* Region 30 */
+ {
+ 0x8005, 0, 127, 0, 128, 174, 0,
+ -3, 212, 207, 99, 0, 228, 0,
+ 1902, 241, 108, 97, 0, 248, 0,
+ 3805, 212, 59, 98, 0, 220, 0,
+ 1902, 146, 107, 98, 144, 196, 0
+ },
+
+ /* Region 31 */
+ {
+ 0x8009, 0, 127, 0, 255, 128, 0,
+ 1206, 239, 43, 69, 0, 216, 2,
+ 4, 254, 42, 66, 0, 244, 2,
+ 702, 88, 55, 66, 0, 204, 2,
+ -4, 71, 55, 66, 0, 240, 2
+ },
+
+ /* Region 32 */
+ {
+ 0x8005, 0, 127, 0, 255, 85, 0,
+ 500, 239, 95, 82, 0, 184, 3,
+ 0, 248, 73, 132, 0, 252, 2,
+ 2786, 203, 59, 130, 0, 176, 2,
+ 0, 216, 42, 100, 0, 208, 2
+ },
+
+ /* Region 33 */
+ {
+ 0x8005, 0, 127, 0, 128, 73, 0,
+ 1, 229, 54, 131, 160, 208, 0,
+ -1, 244, 62, 97, 0, 248, 0,
+ 3986, 227, 127, 69, 140, 184, 0,
+ 1201, 249, 92, 114, 0, 204, 0
+ },
+
+ /* Region 34 */
+ {
+ 0x8005, 0, 127, 0, 128, 73, 0,
+ 1, 225, 54, 100, 200, 212, 0,
+ -1, 244, 94, 97, 0, 248, 0,
+ 3986, 249, 127, 88, 112, 188, 0,
+ 1201, 249, 92, 85, 52, 208, 0
+ },
+
+ /* Region 35 */
+ {
+ 0x8005, 0, 127, 0, 128, 188, 0,
+ -3, 198, 92, 179, 28, 212, 0,
+ 0, 243, 90, 145, 0, 248, 0,
+ 1901, 215, 95, 69, 28, 196, 0,
+ 3, 84, 108, 196, 32, 208, 0
+ },
+
+ /* Region 36 */
+ {
+ 0x8005, 0, 127, 0, 136, 6, 0,
+ 0, 226, 99, 36, 224, 216, 0,
+ 1902, 248, 78, 33, 0, 252, 0,
+ 3369, 239, 250, 33, 0, 204, 0,
+ 0, 230, 253, 33, 0, 208, 0
+ },
+
+ /* Region 37 */
+ {
+ 0x8005, 0, 127, 0, 136, 195, 0,
+ 0, 245, 99, 36, 152, 208, 0,
+ 1200, 248, 78, 33, 0, 252, 0,
+ 3369, 246, 250, 33, 0, 216, 0,
+ 0, 246, 61, 33, 0, 180, 0
+ },
+
+ /* Region 38 */
+ {
+ 0x8002, 0, 127, 0, 133, 221, 0,
+ 1, 244, 67, 35, 80, 220, 0,
+ 3, 246, 94, 33, 0, 244, 0,
+ -1, 245, 70, 35, 80, 236, 2,
+ -3, 246, 63, 33, 0, 236, 2
+ },
+
+ /* Region 39 */
+ {
+ 0x8002, 0, 127, 0, 133, 220, 0,
+ 0, 114, 51, 34, 132, 208, 0,
+ 3, 214, 62, 33, 0, 248, 0,
+ 0, 85, 54, 34, 44, 224, 2,
+ -3, 214, 63, 33, 0, 236, 2
+ },
+
+ /* Region 40 */
+ {
+ 0x8005, 0, 127, 48, 142, 187, 0,
+ -1, 33, 22, 33, 200, 208, 0,
+ 0, 81, 105, 33, 220, 240, 0,
+ 2786, 245, 19, 50, 208, 192, 0,
+ 1, 245, 21, 82, 200, 220, 0
+ },
+
+ /* Region 41 */
+ {
+ 0x8005, 0, 127, 48, 126, 103, 0,
+ -1, 193, 22, 33, 228, 212, 0,
+ 0, 81, 105, 33, 220, 244, 0,
+ 0, 245, 19, 50, 216, 228, 0,
+ 1200, 245, 19, 82, 200, 188, 0
+ },
+
+ /* Region 42 */
+ {
+ 0x8005, 0, 127, 16, 126, 202, 0,
+ -1, 49, 24, 41, 200, 212, 0,
+ 0, 81, 71, 49, 220, 244, 0,
+ 3371, 243, 19, 36, 232, 192, 0,
+ 1, 242, 24, 36, 220, 212, 0
+ },
+
+ /* Region 43 */
+ {
+ 0x8005, 0, 127, 16, 124, 205, 0,
+ 0, 129, 24, 49, 208, 200, 0,
+ 0, 67, 102, 81, 224, 244, 0,
+ 3804, 246, 23, 36, 160, 196, 0,
+ 1200, 244, 24, 35, 208, 200, 0
+ },
+
+ /* Region 44 */
+ {
+ 0x8005, 0, 127, 48, 144, 208, 0,
+ -3, 209, 22, 33, 200, 204, 2,
+ 0, 81, 89, 33, 220, 240, 2,
+ -5000, 208, 6, 33, 244, 188, 3,
+ 3, 97, 89, 33, 224, 200, 0
+ },
+
+ /* Region 45 */
+ {
+ 0x8005, 0, 127, 0, 255, 186, 0,
+ 500, 223, 95, 0, 0, 192, 3,
+ 0, 247, 89, 100, 0, 248, 2,
+ 3369, 255, 59, 168, 0, 212, 2,
+ 0, 216, 42, 97, 0, 212, 2
+ },
+
+ /* Region 46 */
+ {
+ 0x8002, 0, 127, 0, 255, 221, 0,
+ 1206, 235, 70, 69, 0, 216, 2,
+ 4, 248, 84, 66, 0, 244, 2,
+ 1902, 247, 52, 137, 80, 216, 2,
+ -4, 245, 84, 131, 0, 240, 2
+ },
+
+ /* Region 47 */
+ {
+ 0x8005, 0, 127, 0, 255, 105, 0,
+ 387, 231, 115, 34, 4, 216, 2,
+ 0, 248, 37, 65, 0, 252, 2,
+ 3308, 248, 117, 34, 8, 200, 2,
+ 1900, 213, 82, 50, 0, 192, 2
+ },
+
+ /* Region 48 */
+ {
+ 0x8002, 0, 127, 32, 160, 221, 0,
+ -7, 209, 22, 33, 200, 204, 2,
+ -7, 81, 73, 33, 220, 244, 0,
+ 7, 209, 22, 33, 200, 208, 0,
+ 7, 97, 73, 33, 224, 244, 2
+ },
+
+ /* Region 49 */
+ {
+ 0x8002, 0, 127, 64, 128, 189, 0,
+ -2, 209, 54, 32, 224, 216, 2,
+ -7726, 97, 105, 33, 220, 240, 3,
+ 1902, 209, 54, 34, 216, 208, 0,
+ 2, 81, 105, 33, 224, 236, 0
+ },
+
+ /* Region 50 */
+ {
+ 0x8002, 0, 127, 80, 144, 206, 0,
+ -3, 179, 38, 33, 160, 220, 2,
+ -7726, 81, 69, 34, 220, 244, 3,
+ 3, 193, 38, 33, 240, 212, 0,
+ -8000, 65, 69, 34, 224, 236, 3
+ },
+
+ /* Region 51 */
+ {
+ 0x8005, 0, 127, 96, 128, 204, 0,
+ -3, 97, 38, 33, 180, 216, 0,
+ 0, 81, 69, 34, 220, 240, 2,
+ 3369, 145, 38, 33, 240, 196, 2,
+ -13190, 65, 69, 34, 240, 200, 3
+ },
+
+ /* Region 52 */
+ {
+ 0x8002, 0, 127, 64, 128, 108, 0,
+ -3, 193, 37, 35, 236, 208, 0,
+ 2394, 97, 90, 36, 224, 232, 2,
+ 3, 65, 40, 35, 236, 204, 2,
+ 1203, 97, 89, 33, 224, 240, 0
+ },
+
+ /* Region 53 */
+ {
+ 0x8005, 0, 127, 128, 128, 122, 0,
+ 0, 193, 21, 34, 236, 188, 0,
+ 3, 97, 74, 36, 224, 248, 2,
+ 1906, 251, 24, 32, 96, 192, 3,
+ 1200, 97, 73, 32, 224, 184, 0
+ },
+
+ /* Region 54 */
+ {
+ 0x8002, 0, 127, 64, 133, 135, 0,
+ 0, 194, 25, 35, 120, 200, 2,
+ 0, 97, 75, 36, 224, 240, 0,
+ 2906, 254, 28, 48, 0, 184, 3,
+ 0, 216, 75, 80, 204, 240, 2
+ },
+
+ /* Region 55 */
+ {
+ 0x8009, 0, 127, 208, 64, 255, 0,
+ 475, 249, 16, 32, 252, 240, 2,
+ 702, 248, 71, 32, 0, 244, 2,
+ 1136, 232, 27, 32, 216, 248, 0,
+ 0, 249, 23, 48, 0, 248, 2
+ },
+
+ /* Region 56 */
+ {
+ 0x8005, 0, 127, 0, 132, 233, 0,
+ 0, 195, 95, 64, 240, 208, 0,
+ 0, 225, 94, 64, 248, 240, 0,
+ 0, 254, 127, 0, 4, 196, 4,
+ 1902, 228, 95, 1, 248, 200, 0
+ },
+
+ /* Region 57 */
+ {
+ 0x8005, 0, 127, 16, 140, 238, 0,
+ 0, 163, 90, 67, 228, 208, 0,
+ 0, 209, 77, 65, 248, 240, 0,
+ 1969, 173, 58, 65, 0, 176, 0,
+ 0, 210, 61, 52, 204, 220, 0
+ },
+
+ /* Region 58 */
+ {
+ 0x8005, 0, 127, 16, 140, 222, 0,
+ 0, 119, 74, 67, 160, 212, 0,
+ 0, 146, 61, 65, 248, 244, 0,
+ 1900, 137, 58, 65, 100, 196, 0,
+ 0, 119, 61, 52, 120, 200, 0
+ },
+
+ /* Region 59 */
+ {
+ 0x8005, 0, 127, 16, 135, 219, 0,
+ 0, 176, 79, 69, 240, 216, 0,
+ 0, 193, 79, 64, 248, 236, 0,
+ 0, 178, 123, 54, 92, 228, 0,
+ 3369, 212, 95, 38, 144, 212, 0
+ },
+
+ /* Region 60 */
+ {
+ 0x8002, 0, 127, 0, 119, 203, 0,
+ 2, 65, 77, 66, 228, 204, 0,
+ 2, 161, 74, 64, 240, 240, 0,
+ -2, 85, 60, 66, 180, 216, 2,
+ -2, 162, 74, 64, 220, 240, 2
+ },
+
+ /* Region 61 */
+ {
+ 0x8002, 0, 127, 16, 154, 237, 0,
+ 0, 179, 42, 64, 216, 208, 0,
+ 0, 209, 61, 64, 248, 244, 0,
+ -1200, 226, 55, 65, 244, 220, 2,
+ 1902, 162, 62, 52, 204, 236, 2
+ },
+
+ /* Region 62 */
+ {
+ 0x8002, 0, 127, 48, 119, 221, 0,
+ 2, 119, 79, 64, 208, 212, 0,
+ 2, 209, 110, 64, 248, 236, 0,
+ -2, 84, 79, 64, 136, 212, 2,
+ -2, 209, 110, 64, 240, 240, 2
+ },
+
+ /* Region 63 */
+ {
+ 0x8002, 0, 127, 32, 135, 221, 0,
+ 2, 165, 79, 64, 152, 216, 0,
+ 2, 225, 110, 64, 248, 236, 0,
+ -2, 132, 79, 64, 72, 224, 2,
+ -2, 241, 110, 64, 252, 236, 2
+ },
+
+ /* Region 64 */
+ {
+ 0x8005, 0, 127, 17, 127, 190, 0,
+ 0, 209, 60, 67, 244, 208, 0,
+ 1200, 145, 94, 65, 248, 244, 2,
+ 3369, 197, 47, 4, 128, 192, 0,
+ 1902, 167, 94, 6, 200, 200, 0
+ },
+
+ /* Region 65 */
+ {
+ 0x8005, 0, 127, 17, 143, 190, 0,
+ 0, 209, 60, 67, 244, 216, 0,
+ 1902, 145, 62, 65, 248, 240, 2,
+ 3369, 197, 47, 4, 128, 196, 0,
+ 2400, 167, 94, 6, 200, 212, 2
+ },
+
+ /* Region 66 */
+ {
+ 0x8005, 0, 127, 17, 143, 190, 0,
+ 0, 209, 60, 67, 244, 208, 0,
+ 1902, 145, 62, 65, 248, 240, 2,
+ 3369, 197, 47, 4, 128, 192, 0,
+ 1902, 167, 94, 6, 200, 216, 2
+ },
+
+ /* Region 67 */
+ {
+ 0x8005, 0, 127, 17, 125, 190, 0,
+ 0, 114, 109, 67, 244, 224, 0,
+ 1902, 166, 93, 97, 200, 240, 0,
+ 2786, 165, 95, 52, 160, 200, 0,
+ 2400, 173, 78, 54, 240, 212, 2
+ },
+
+ /* Region 68 */
+ {
+ 0x8002, 0, 127, 16, 140, 205, 0,
+ 0, 211, 55, 66, 244, 208, 0,
+ 1902, 193, 93, 65, 248, 240, 0,
+ 0, 204, 47, 4, 244, 216, 0,
+ 3600, 183, 95, 6, 160, 232, 0
+ },
+
+ /* Region 69 */
+ {
+ 0x8002, 0, 127, 16, 126, 222, 0,
+ 0, 243, 36, 66, 172, 200, 0,
+ 1200, 193, 110, 67, 248, 244, 0,
+ 0, 215, 33, 2, 232, 212, 0,
+ 3369, 178, 63, 6, 184, 240, 0
+ },
+
+ /* Region 70 */
+ {
+ 0x8002, 0, 127, 16, 140, 221, 0,
+ 1200, 213, 61, 66, 136, 200, 0,
+ 1902, 193, 93, 68, 248, 240, 0,
+ 0, 197, 47, 2, 228, 216, 0,
+ 3369, 183, 95, 2, 160, 236, 0
+ },
+
+ /* Region 71 */
+ {
+ 0x8002, 0, 127, 16, 124, 201, 0,
+ 1200, 195, 55, 68, 240, 208, 0,
+ 0, 209, 76, 65, 248, 236, 0,
+ 1902, 147, 47, 19, 208, 212, 0,
+ 0, 183, 79, 22, 156, 228, 0
+ },
+
+ /* Region 72 */
+ {
+ 0x8005, 0, 127, 32, 110, 234, 0,
+ 500, 237, 60, 68, 0, 192, 1,
+ 1, 161, 93, 65, 248, 240, 2,
+ 3365, 154, 47, 16, 48, 180, 6,
+ 1200, 165, 92, 52, 160, 212, 2
+ },
+
+ /* Region 73 */
+ {
+ 0x8005, 0, 127, 32, 142, 200, 0,
+ 0, 193, 60, 68, 248, 200, 0,
+ 1, 129, 61, 65, 248, 240, 2,
+ 3365, 154, 47, 16, 68, 184, 6,
+ 1200, 169, 92, 52, 160, 204, 2
+ },
+
+ /* Region 74 */
+ {
+ 0x8003, 0, 127, 32, 135, 36, 0,
+ 1199, 165, 79, 66, 152, 192, 2,
+ -3, 145, 110, 64, 248, 240, 2,
+ 0, 199, 79, 66, 44, 236, 2,
+ 2986, 136, 110, 67, 100, 196, 2
+ },
+
+ /* Region 75 */
+ {
+ 0x8005, 0, 127, 32, 190, 71, 0,
+ 868, 202, 140, 16, 24, 188, 2,
+ 0, 176, 77, 65, 248, 240, 2,
+ 3750, 169, 127, 16, 36, 228, 6,
+ 2400, 195, 60, 17, 232, 172, 2
+ },
+
+ /* Region 76 */
+ {
+ 0x8005, 0, 127, 224, 16, 123, 0,
+ 275, 202, 14, 2, 44, 196, 2,
+ 0, 165, 89, 65, 56, 244, 2,
+ 0, 255, 12, 2, 64, 216, 6,
+ 963, 169, 14, 4, 40, 196, 2
+ },
+
+ /* Region 77 */
+ {
+ 0x8012, 0, 127, 192, 128, 100, 0,
+ 1500, 202, 79, 68, 76, 204, 2,
+ -2, 97, 26, 64, 248, 232, 2,
+ 1588, 202, 223, 69, 4, 220, 0,
+ 3, 188, 121, 67, 48, 252, 2
+ },
+
+ /* Region 78 */
+ {
+ 0x8002, 0, 127, 112, 140, 205, 0,
+ 0, 68, 47, 66, 60, 176, 2,
+ -2, 113, 94, 64, 248, 236, 0,
+ 5000, 121, 47, 64, 32, 168, 7,
+ 3, 136, 94, 64, 0, 236, 0
+ },
+
+ /* Region 79 */
+ {
+ 0x8003, 0, 127, 32, 135, 33, 0,
+ 1199, 197, 79, 66, 152, 184, 2,
+ 0, 161, 110, 64, 248, 240, 2,
+ 0, 199, 79, 66, 44, 236, 2,
+ 2400, 255, 110, 65, 36, 208, 6
+ },
+
+ /* Region 80 */
+ {
+ 0x8002, 0, 127, 0, 192, 170, 0,
+ 1199, 192, 77, 33, 200, 212, 0,
+ 0, 209, 107, 33, 232, 240, 0,
+ 1201, 80, 77, 33, 200, 212, 0,
+ 0, 241, 107, 33, 232, 240, 0
+ },
+
+ /* Region 81 */
+ {
+ 0x8002, 0, 127, 0, 192, 221, 0,
+ -1, 192, 45, 33, 200, 212, 0,
+ -1, 209, 107, 33, 232, 244, 0,
+ 1, 80, 45, 33, 200, 212, 0,
+ 1, 241, 107, 33, 232, 244, 0
+ },
+
+ /* Region 82 */
+ {
+ 0x8005, 0, 127, 0, 112, 255, 0,
+ 4750, 221, 45, 34, 48, 172, 4,
+ -10000, 161, 107, 33, 200, 244, 3,
+ 2204, 137, 45, 37, 64, 184, 0,
+ -2, 211, 107, 33, 160, 208, 0
+ },
+
+ /* Region 83 */
+ {
+ 0x8005, 0, 127, 16, 127, 238, 0,
+ 2, 248, 45, 32, 204, 208, 0,
+ -9500, 241, 107, 33, 200, 240, 3,
+ 3369, 186, 45, 38, 24, 208, 0,
+ -2, 211, 107, 32, 220, 212, 0
+ },
+
+ /* Region 84 */
+ {
+ 0x8005, 0, 127, 0, 128, 221, 0,
+ -1, 192, 191, 99, 220, 216, 0,
+ 1200, 243, 92, 97, 0, 244, 0,
+ 3984, 200, 11, 96, 168, 192, 0,
+ 1, 194, 127, 98, 108, 200, 0
+ },
+
+ /* Region 85 */
+ {
+ 0x8002, 0, 127, 128, 128, 111, 0,
+ 1, 194, 25, 35, 120, 204, 2,
+ -9750, 193, 107, 36, 224, 244, 3,
+ 3906, 255, 28, 50, 12, 188, 3,
+ -1, 216, 107, 80, 204, 240, 2
+ },
+
+ /* Region 86 */
+ {
+ 0x8002, 0, 127, 32, 134, 222, 0,
+ 0, 195, 52, 33, 200, 208, 0,
+ 0, 177, 90, 33, 232, 240, 2,
+ 702, 195, 52, 33, 200, 208, 2,
+ 702, 177, 90, 34, 232, 240, 2
+ },
+
+ /* Region 87 */
+ {
+ 0x8002, 0, 127, 32, 134, 205, 0,
+ 0, 198, 75, 36, 120, 220, 2,
+ 0, 225, 78, 52, 40, 244, 2,
+ 0, 246, 47, 32, 220, 208, 2,
+ 1902, 241, 124, 32, 240, 236, 2
+ },
+
+ /* Region 88 */
+ {
+ 0x8003, 0, 127, 32, 120, 14, 0,
+ 3600, 244, 67, 34, 88, 208, 0,
+ 3, 194, 84, 33, 84, 240, 2,
+ -3, 194, 84, 33, 172, 236, 2,
+ 902, 254, 114, 34, 0, 224, 3
+ },
+
+ /* Region 89 */
+ {
+ 0x8002, 0, 127, 64, 169, 170, 0,
+ -3, 83, 69, 34, 184, 212, 0,
+ -7500, 50, 69, 33, 176, 244, 3,
+ 3, 81, 69, 34, 212, 212, 2,
+ -8500, 66, 69, 33, 176, 244, 3
+ },
+
+ /* Region 90 */
+ {
+ 0x8002, 0, 127, 64, 120, 221, 0,
+ -2, 82, 69, 34, 244, 216, 0,
+ 0, 145, 102, 33, 228, 240, 0,
+ 2, 81, 69, 34, 244, 208, 2,
+ 0, 145, 102, 33, 224, 240, 2
+ },
+
+ /* Region 91 */
+ {
+ 0x8003, 0, 127, 32, 138, 14, 0,
+ 2400, 148, 67, 34, 176, 200, 0,
+ 3, 194, 85, 33, 220, 236, 2,
+ -3, 194, 69, 33, 220, 236, 2,
+ 1905, 254, 114, 34, 48, 224, 2
+ },
+
+ /* Region 92 */
+ {
+ 0x8002, 0, 127, 82, 67, 71, 0,
+ 2982, 228, 22, 146, 88, 192, 3,
+ 3, 102, 84, 146, 196, 240, 2,
+ 3358, 50, 149, 116, 144, 208, 2,
+ -3, 85, 84, 146, 120, 240, 0
+ },
+
+ /* Region 93 */
+ {
+ 0x8005, 0, 127, 48, 126, 219, 0,
+ -3, 49, 19, 33, 120, 200, 0,
+ 0, 81, 70, 33, 220, 240, 0,
+ 3804, 242, 18, 50, 200, 200, 0,
+ 1203, 82, 19, 82, 200, 176, 0
+ },
+
+ /* Region 94 */
+ {
+ 0x8003, 0, 127, 32, 138, 13, 0,
+ 2786, 116, 67, 34, 204, 184, 0,
+ 1902, 114, 69, 33, 192, 232, 2,
+ -3, 178, 69, 33, 188, 232, 2,
+ 3804, 254, 82, 34, 164, 228, 2
+ },
+
+ /* Region 95 */
+ {
+ 0x8002, 0, 127, 48, 135, 238, 0,
+ -2, 34, 85, 34, 184, 224, 0,
+ 1, 113, 70, 33, 228, 236, 0,
+ 2, 19, 85, 34, 156, 224, 2,
+ -1, 129, 70, 33, 224, 236, 2
+ },
+
+ /* Region 96 */
+ {
+ 0x8012, 0, 127, 240, 112, 221, 0,
+ 3369, 213, 69, 32, 0, 204, 0,
+ 0, 193, 70, 33, 112, 232, 2,
+ 0, 145, 69, 34, 244, 208, 2,
+ -9000, 145, 70, 33, 224, 236, 3
+ },
+
+ /* Region 97 */
+ {
+ 0x8002, 0, 127, 96, 122, 168, 0,
+ -1, 99, 51, 33, 200, 208, 0,
+ -8500, 81, 83, 33, 232, 240, 3,
+ 702, 99, 52, 33, 200, 208, 2,
+ -9500, 65, 83, 34, 224, 240, 3
+ },
+
+ /* Region 98 */
+ {
+ 0x8002, 0, 127, 0, 67, 0, 0,
+ 1500, 217, 55, 151, 20, 224, 2,
+ 3, 231, 70, 146, 88, 220, 2,
+ 2369, 115, 148, 151, 32, 196, 2,
+ -3, 118, 36, 146, 64, 244, 2
+ },
+
+ /* Region 99 */
+ {
+ 0x8002, 0, 127, 64, 169, 204, 0,
+ -3, 228, 69, 34, 148, 220, 0,
+ -7448, 243, 69, 33, 200, 240, 3,
+ 3, 81, 68, 34, 212, 212, 2,
+ -8526, 65, 68, 33, 196, 240, 3
+ },
+
+ /* Region 100 */
+ {
+ 0x8002, 0, 127, 64, 119, 187, 0,
+ 2786, 228, 22, 146, 176, 192, 0,
+ 3, 102, 68, 146, 196, 236, 2,
+ 3369, 178, 149, 116, 176, 208, 2,
+ -3, 231, 68, 146, 120, 240, 0
+ },
+
+ /* Region 101 */
+ {
+ 0x8002, 0, 127, 240, 144, 239, 0,
+ -2, 49, 69, 34, 236, 208, 2,
+ -9000, 113, 102, 33, 228, 236, 3,
+ 2400, 149, 69, 34, 12, 216, 1,
+ 0, 145, 102, 33, 224, 236, 2
+ },
+
+ /* Region 102 */
+ {
+ 0x8012, 0, 127, 241, 176, 6, 0,
+ 1200, 247, 49, 64, 252, 204, 0,
+ 3804, 246, 101, 32, 0, 232, 2,
+ 1902, 247, 32, 32, 112, 188, 2,
+ 0, 228, 84, 32, 0, 240, 2
+ },
+
+ /* Region 103 */
+ {
+ 0x8005, 0, 127, 64, 101, 221, 0,
+ 1, 194, 68, 97, 196, 200, 2,
+ -10001, 247, 100, 114, 176, 240, 3,
+ 3370, 213, 33, 70, 52, 200, 2,
+ -1, 178, 68, 49, 208, 212, 0
+ },
+
+ /* Region 104 */
+ {
+ 0x8002, 0, 127, 0, 255, 203, 0,
+ -3, 245, 82, 99, 200, 232, 2,
+ 2787, 244, 84, 96, 0, 236, 2,
+ 1198, 133, 81, 100, 196, 220, 2,
+ 1902, 147, 67, 80, 0, 232, 2
+ },
+
+ /* Region 105 */
+ {
+ 0x8005, 0, 127, 0, 255, 140, 0,
+ 500, 255, 137, 179, 0, 200, 3,
+ 1902, 248, 90, 160, 0, 244, 2,
+ 3804, 245, 57, 35, 164, 204, 2,
+ 0, 245, 38, 51, 196, 208, 2
+ },
+
+ /* Region 106 */
+ {
+ 0x8005, 0, 127, 0, 255, 72, 0,
+ 1000, 238, 57, 65, 0, 188, 3,
+ 1902, 247, 103, 112, 0, 244, 2,
+ 2786, 250, 36, 81, 68, 212, 2,
+ 0, 249, 50, 49, 172, 204, 2
+ },
+
+ /* Region 107 */
+ {
+ 0x8005, 0, 127, 16, 119, 72, 0,
+ 1500, 255, 89, 65, 0, 196, 3,
+ 2790, 246, 39, 112, 0, 240, 0,
+ 1905, 246, 36, 81, 168, 208, 0,
+ 0, 249, 114, 49, 172, 212, 0
+ },
+
+ /* Region 108 */
+ {
+ 0x8005, 0, 127, 0, 255, 237, 0,
+ 1902, 254, 89, 65, 0, 212, 2,
+ 0, 248, 87, 112, 0, 240, 2,
+ 3369, 231, 62, 81, 0, 208, 2,
+ 3, 245, 118, 49, 96, 196, 2
+ },
+
+ /* Region 109 */
+ {
+ 0x8002, 0, 127, 16, 188, 205, 0,
+ -2, 179, 47, 50, 244, 224, 2,
+ 1900, 145, 94, 49, 248, 232, 2,
+ 3, 210, 46, 2, 244, 208, 2,
+ 2789, 133, 93, 4, 180, 244, 2
+ },
+
+ /* Region 110 */
+ {
+ 0x8005, 0, 127, 48, 135, 220, 0,
+ 1901, 162, 25, 35, 144, 208, 0,
+ 0, 113, 105, 65, 220, 240, 0,
+ 3369, 233, 88, 51, 120, 212, 0,
+ 0, 229, 24, 84, 200, 208, 0
+ },
+
+ /* Region 111 */
+ {
+ 0x8002, 0, 127, 112, 32, 190, 0,
+ 0, 53, 79, 66, 152, 212, 2,
+ 1200, 53, 75, 64, 136, 244, 2,
+ 500, 149, 60, 66, 16, 208, 2,
+ 1902, 200, 78, 64, 0, 248, 0
+ },
+
+ /* Region 112 */
+ {
+ 0x8005, 0, 127, 0, 144, 130, 0,
+ 2514, 255, 68, 53, 0, 204, 2,
+ 2400, 247, 133, 48, 0, 240, 2,
+ 4151, 243, 67, 50, 0, 212, 2,
+ 3369, 243, 66, 56, 0, 204, 2
+ },
+
+ /* Region 113 */
+ {
+ 0x8005, 0, 127, 0, 255, 0, 0,
+ 514, 253, 79, 51, 0, 196, 3,
+ 1905, 252, 89, 51, 0, 244, 2,
+ 4349, 245, 35, 51, 0, 208, 2,
+ 1205, 247, 34, 51, 0, 208, 2
+ },
+
+ /* Region 114 */
+ {
+ 0x8005, 0, 127, 0, 255, 0, 0,
+ 514, 221, 69, 35, 0, 204, 3,
+ 0, 250, 86, 115, 0, 252, 2,
+ 1884, 244, 116, 51, 0, 200, 2,
+ 1208, 210, 35, 51, 0, 208, 2
+ },
+
+ /* Region 115 */
+ {
+ 0x8005, 0, 127, 0, 255, 16, 0,
+ 514, 222, 85, 163, 0, 192, 3,
+ 0, 254, 108, 163, 0, 252, 2,
+ 3800, 255, 143, 160, 0, 176, 2,
+ 1200, 250, 105, 163, 0, 212, 2
+ },
+
+ /* Region 116 */
+ {
+ 0x8005, 0, 127, 0, 255, 16, 0,
+ 1514, 249, 101, 163, 0, 204, 3,
+ -1200, 249, 87, 160, 0, 252, 2,
+ 0, 235, 143, 160, 0, 204, 2,
+ 1200, 234, 73, 163, 0, 204, 2
+ },
+
+ /* Region 117 */
+ {
+ 0x8005, 0, 127, 0, 255, 16, 0,
+ 500, 239, 101, 160, 0, 204, 3,
+ -1195, 248, 104, 160, 0, 252, 2,
+ 1898, 252, 72, 163, 0, 216, 2,
+ 1239, 248, 87, 163, 0, 196, 2
+ },
+
+ /* Region 118 */
+ {
+ 0x8005, 0, 127, 0, 255, 255, 0,
+ 500, 255, 98, 160, 0, 196, 3,
+ -1, 249, 105, 160, 0, 252, 2,
+ 1907, 250, 71, 160, 0, 252, 2,
+ 1182, 249, 87, 161, 0, 192, 2
+ },
+
+ /* Region 119 */
+ {
+ 0x8005, 0, 127, 0, 0, 100, 0,
+ 600, 32, 15, 0, 252, 224, 6,
+ 0, 47, 111, 65, 0, 244, 2,
+ 1826, 16, 47, 0, 252, 216, 2,
+ 3551, 240, 47, 0, 252, 212, 2
+ },
+
+ /* Region 120 */
+ {
+ 0x8014, 0, 127, 240, 128, 235, 0,
+ 1228, 161, 47, 17, 196, 200, 3,
+ 3000, 123, 75, 17, 0, 240, 2,
+ 7022, 72, 43, 17, 0, 216, 0,
+ 4000, 150, 79, 17, 48, 196, 3
+ },
+
+ /* Region 121 */
+ {
+ 0x8005, 0, 127, 224, 16, 86, 0,
+ 275, 251, 6, 0, 36, 200, 2,
+ 0, 101, 104, 65, 56, 240, 2,
+ 0, 240, 6, 0, 252, 208, 6,
+ 1000, 195, 8, 0, 248, 200, 2
+ },
+
+ /* Region 122 */
+ {
+ 0x8002, 0, 127, 0, 0, 185, 0,
+ 600, 35, 66, 17, 72, 224, 4,
+ -13000, 81, 67, 17, 228, 244, 2,
+ 702, 97, 38, 17, 212, 196, 6,
+ -14000, 81, 65, 17, 224, 244, 3
+ },
+
+ /* Region 123 */
+ {
+ 0x8012, 0, 127, 240, 112, 237, 0,
+ -6528, 153, 127, 16, 0, 252, 3,
+ 1200, 105, 109, 16, 0, 216, 2,
+ -6022, 179, 139, 17, 0, 248, 3,
+ 2000, 104, 79, 17, 0, 240, 0
+ },
+
+ /* Region 124 */
+ {
+ 0x8012, 0, 127, 240, 240, 16, 0,
+ 1914, 240, 64, 160, 240, 208, 2,
+ 1200, 240, 73, 163, 240, 244, 0,
+ 1900, 240, 64, 160, 240, 148, 2,
+ 4151, 240, 73, 163, 240, 244, 0
+ },
+
+ /* Region 125 */
+ {
+ 0x8002, 0, 127, 240, 56, 235, 0,
+ -5522, 97, 32, 17, 196, 240, 3,
+ 0, 84, 75, 17, 180, 248, 3,
+ 702, 65, 38, 17, 224, 212, 6,
+ -4000, 161, 73, 17, 224, 252, 1
+ },
+
+ /* Region 126 */
+ {
+ 0x8015, 0, 127, 240, 248, 37, 0,
+ 1050, 243, 0, 0, 252, 224, 7,
+ 2000, 49, 68, 0, 224, 236, 3,
+ 350, 240, 0, 0, 252, 216, 1,
+ 700, 240, 0, 0, 252, 212, 3
+ },
+
+ /* Region 127 */
+ {
+ 0x8015, 0, 127, 240, 248, 37, 0,
+ 1050, 245, 85, 0, 0, 244, 7,
+ -5000, 247, 71, 0, 0, 252, 3,
+ 350, 240, 0, 0, 0, 164, 0,
+ 700, 32, 0, 0, 0, 252, 2
+ },
+
+ /* Region 128 */
+ {
+ 0x0005, 35, 35, 0, 255, 103, 0,
+ 3, 215, 68, 65, 0, 204, 2,
+ -1700, 249, 95, 177, 0, 252, 2,
+ 5374, 236, 144, 204, 0, 176, 3,
+ 114, 253, 144, 179, 0, 200, 3
+ },
+
+ /* Region 129 */
+ {
+ 0x0005, 36, 36, 0, 255, 103, 0,
+ 3, 219, 68, 65, 0, 204, 2,
+ -1700, 251, 95, 177, 0, 252, 2,
+ 5374, 255, 144, 204, 0, 176, 3,
+ 114, 255, 144, 179, 0, 208, 3
+ },
+
+ /* Region 130 */
+ {
+ 0x001a, 37, 37, 240, 128, 216, 0,
+ 2780, 255, 16, 0, 112, 200, 3,
+ 3800, 255, 32, 0, 0, 240, 3,
+ 2501, 251, 48, 0, 48, 240, 3,
+ 2751, 254, 48, 0, 0, 244, 3
+ },
+
+ /* Region 131 */
+ {
+ 0x000d, 38, 38, 0, 255, 190, 0,
+ -2000, 239, 48, 128, 0, 236, 3,
+ -2400, 254, 92, 128, 0, 252, 2,
+ 3374, 255, 33, 192, 240, 244, 2,
+ 1000, 255, 49, 176, 240, 204, 2
+ },
+
+ /* Region 132 */
+ {
+ 0x001a, 39, 39, 240, 128, 254, -10,
+ 5780, 186, 16, 0, 112, 240, 3,
+ 3800, 254, 32, 0, 0, 248, 3,
+ 5780, 234, 16, 0, 112, 240, 3,
+ 4829, 254, 32, 0, 0, 252, 3
+ },
+
+ /* Region 133 */
+ {
+ 0x000d, 40, 40, 0, 255, 203, 0,
+ 0, 254, 74, 128, 0, 176, 3,
+ -600, 252, 73, 128, 0, 252, 3,
+ 3368, 251, 80, 192, 0, 244, 3,
+ 1200, 254, 64, 176, 0, 208, 3
+ },
+
+ /* Region 134 */
+ {
+ 0x000d, 41, 41, 208, 16, 187, -30,
+ -600, 247, 128, 0, 0, 204, 1,
+ -890, 248, 88, 0, 0, 252, 3,
+ 1068, 250, 182, 0, 0, 200, 3,
+ -100, 249, 116, 0, 0, 208, 3
+ },
+
+ /* Region 135 */
+ {
+ 0x0005, 42, 42, 160, 255, 126, 20,
+ 3514, 247, 23, 72, 0, 212, 3,
+ 400, 255, 94, 177, 0, 232, 2,
+ 2347, 250, 47, 0, 196, 184, 6,
+ 4388, 248, 26, 0, 136, 224, 2
+ },
+
+ /* Region 136 */
+ {
+ 0x000d, 43, 43, 208, 16, 187, -20,
+ -500, 247, 128, 0, 0, 204, 1,
+ -690, 249, 88, 0, 0, 252, 3,
+ 1068, 254, 182, 0, 0, 200, 3,
+ 0, 249, 116, 0, 0, 208, 3
+ },
+
+ /* Region 137 */
+ {
+ 0x0005, 44, 44, 160, 255, 126, 20,
+ 3514, 151, 20, 72, 0, 244, 3,
+ 400, 223, 92, 177, 0, 240, 2,
+ 2347, 134, 34, 0, 176, 208, 6,
+ 4388, 200, 21, 0, 100, 220, 2
+ },
+
+ /* Region 138 */
+ {
+ 0x000d, 45, 45, 208, 16, 187, -10,
+ -350, 246, 128, 0, 0, 204, 1,
+ -590, 249, 88, 0, 0, 252, 3,
+ 2368, 254, 182, 0, 0, 196, 3,
+ 500, 249, 116, 0, 0, 208, 3
+ },
+
+ /* Region 139 */
+ {
+ 0x0005, 46, 46, 160, 255, 126, 20,
+ 3510, 147, 51, 72, 0, 236, 3,
+ 400, 219, 90, 177, 0, 240, 2,
+ 2347, 134, 66, 0, 176, 224, 6,
+ 4388, 200, 84, 0, 100, 212, 2
+ },
+
+ /* Region 140 */
+ {
+ 0x000d, 47, 47, 176, 32, 187, 10,
+ 0, 247, 128, 0, 0, 204, 1,
+ -280, 249, 88, 0, 0, 252, 3,
+ 2968, 255, 182, 0, 0, 200, 3,
+ 700, 250, 116, 0, 0, 204, 3
+ },
+
+ /* Region 141 */
+ {
+ 0x000d, 48, 48, 0, 255, 187, 20,
+ 10, 247, 128, 0, 0, 204, 3,
+ -130, 249, 88, 0, 0, 252, 3,
+ 3068, 255, 182, 0, 0, 188, 3,
+ 800, 250, 116, 0, 0, 204, 3
+ },
+
+ /* Region 142 */
+ {
+ 0x000d, 49, 49, 160, 255, 215, 20,
+ 3986, 18, 6, 8, 0, 252, 2,
+ 0, 247, 70, 1, 0, 240, 2,
+ 5354, 242, 48, 0, 252, 216, 2,
+ 3868, 193, 48, 0, 212, 208, 2
+ },
+
+ /* Region 143 */
+ {
+ 0x000d, 50, 50, 0, 255, 201, 30,
+ 200, 247, 128, 0, 0, 208, 3,
+ 20, 249, 88, 0, 0, 252, 3,
+ 3368, 255, 182, 0, 0, 200, 3,
+ 1100, 250, 116, 0, 0, 204, 3
+ },
+
+ /* Region 144 */
+ {
+ 0x000d, 51, 51, 160, 255, 97, -20,
+ 3831, 240, 39, 0, 232, 224, 3,
+ 1258, 246, 102, 0, 0, 232, 3,
+ 4323, 242, 32, 0, 0, 216, 3,
+ 868, 243, 64, 0, 0, 204, 3
+ },
+
+ /* Region 145 */
+ {
+ 0x000d, 52, 52, 112, 128, 234, -20,
+ 725, 228, 32, 0, 0, 208, 1,
+ 400, 248, 86, 0, 0, 248, 3,
+ 2003, 53, 32, 0, 0, 236, 3,
+ 100, 209, 32, 0, 0, 212, 1
+ },
+
+ /* Region 146 */
+ {
+ 0x000d, 53, 53, 160, 255, 97, -20,
+ 3831, 240, 39, 0, 232, 224, 3,
+ 1258, 246, 102, 0, 0, 232, 3,
+ 4323, 242, 32, 0, 0, 224, 3,
+ 868, 243, 64, 0, 0, 196, 3
+ },
+
+ /* Region 147 */
+ {
+ 0x001d, 54, 54, 240, 240, 242, 10,
+ -1, 245, 71, 1, 24, 236, 0,
+ 1200, 218, 102, 1, 0, 236, 2,
+ 1354, 255, 48, 0, 0, 208, 2,
+ 5868, 209, 48, 0, 160, 212, 0
+ },
+
+ /* Region 148 */
+ {
+ 0x000d, 55, 55, 48, 32, 234, -10,
+ 725, 228, 32, 0, 0, 208, 3,
+ 900, 249, 86, 0, 0, 240, 3,
+ 2303, 69, 32, 0, 0, 236, 1,
+ 400, 177, 32, 0, 0, 212, 3
+ },
+
+ /* Region 149 */
+ {
+ 0x000d, 56, 56, 0, 255, 149, 20,
+ 414, 254, 123, 48, 0, 204, 3,
+ 1986, 252, 118, 48, 0, 244, 3,
+ 4383, 242, 67, 48, 0, 200, 3,
+ 4205, 243, 81, 48, 0, 204, 3
+ },
+
+ /* Region 150 */
+ {
+ 0x000d, 57, 57, 48, 32, 234, -20,
+ 526, 210, 32, 0, 0, 200, 3,
+ 719, 246, 86, 0, 0, 240, 3,
+ 1303, 48, 32, 0, 0, 236, 1,
+ 202, 98, 32, 0, 0, 212, 3
+ },
+
+ /* Region 151 */
+ {
+ 0x001d, 58, 58, 240, 240, 204, -40,
+ 5650, 247, 16, 0, 84, 220, 1,
+ 3800, 248, 32, 0, 0, 248, 3,
+ 1780, 252, 16, 0, 0, 152, 3,
+ 6825, 245, 32, 0, 0, 208, 1
+ },
+
+ /* Region 152 */
+ {
+ 0x000d, 59, 59, 144, 0, 108, -20,
+ 3531, 240, 103, 0, 232, 220, 3,
+ 1058, 246, 102, 0, 0, 232, 3,
+ 5331, 242, 64, 0, 0, 220, 3,
+ 1968, 243, 64, 0, 0, 204, 1
+ },
+
+ /* Region 153 */
+ {
+ 0x000d, 60, 60, 192, 64, 155, 40,
+ 700, 214, 84, 0, 0, 208, 1,
+ 950, 253, 76, 0, 0, 248, 3,
+ 2803, 255, 127, 0, 0, 200, 3,
+ 750, 255, 89, 0, 0, 204, 3
+ },
+
+ /* Region 154 */
+ {
+ 0x000d, 61, 61, 224, 48, 91, 40,
+ 400, 229, 68, 0, 0, 204, 1,
+ 700, 251, 76, 0, 0, 248, 3,
+ 1803, 255, 95, 0, 0, 196, 3,
+ 450, 255, 89, 0, 0, 208, 3
+ },
+
+ /* Region 155 */
+ {
+ 0x000d, 62, 62, 240, 32, 191, 25,
+ 214, 237, 69, 0, 0, 204, 1,
+ 400, 252, 78, 0, 0, 248, 3,
+ 2830, 255, 95, 0, 0, 208, 3,
+ 2500, 255, 25, 0, 0, 192, 3
+ },
+
+ /* Region 156 */
+ {
+ 0x000d, 63, 63, 240, 32, 91, 25,
+ 400, 229, 68, 0, 0, 188, 1,
+ -100, 250, 76, 0, 0, 248, 3,
+ 1803, 254, 95, 0, 0, 200, 3,
+ 450, 238, 89, 0, 0, 200, 3
+ },
+
+ /* Region 157 */
+ {
+ 0x000d, 64, 64, 240, 16, 91, 20,
+ 300, 210, 68, 0, 0, 196, 1,
+ -400, 250, 76, 0, 0, 248, 3,
+ 1803, 254, 95, 0, 0, 200, 3,
+ 550, 238, 89, 0, 0, 200, 3
+ },
+
+ /* Region 158 */
+ {
+ 0x001c, 65, 65, 240, 128, 223, 20,
+ 1780, 234, 16, 0, 112, 208, 3,
+ 800, 251, 32, 0, 0, 248, 3,
+ 5501, 231, 48, 0, 48, 200, 3,
+ 2751, 232, 48, 0, 0, 220, 3
+ },
+
+ /* Region 159 */
+ {
+ 0x001c, 66, 66, 240, 128, 223, 20,
+ 1580, 234, 16, 0, 112, 208, 3,
+ 600, 250, 32, 0, 0, 248, 3,
+ 5201, 231, 48, 0, 48, 200, 3,
+ 2510, 232, 48, 0, 0, 220, 3
+ },
+
+ /* Region 160 */
+ {
+ 0x000d, 67, 67, 0, 255, 0, -35,
+ 1514, 255, 63, 51, 0, 184, 3,
+ 4830, 251, 73, 51, 0, 252, 3,
+ 4349, 245, 67, 51, 0, 212, 3,
+ 5267, 246, 65, 51, 0, 200, 3
+ },
+
+ /* Region 161 */
+ {
+ 0x000d, 68, 68, 0, 255, 0, -35,
+ 1514, 255, 63, 51, 0, 196, 3,
+ 4905, 251, 73, 51, 0, 252, 3,
+ 4349, 245, 67, 51, 0, 196, 3,
+ 5214, 246, 65, 51, 0, 208, 3
+ },
+
+ /* Region 162 */
+ {
+ 0x000a, 69, 69, 240, 240, 243, -35,
+ 10000, 160, 68, 0, 0, 200, 3,
+ 7000, 156, 140, 0, 0, 228, 3,
+ 1586, 176, 16, 0, 0, 228, 7,
+ 8000, 140, 80, 0, 0, 236, 3
+ },
+
+ /* Region 163 */
+ {
+ 0x001a, 70, 70, 240, 240, 227, -38,
+ 500, 240, 52, 0, 0, 220, 1,
+ 8000, 188, 124, 0, 0, 228, 3,
+ 1586, 240, 16, 0, 0, 224, 7,
+ 8000, 203, 80, 0, 0, 228, 3
+ },
+
+ /* Region 164 */
+ {
+ 0x0004, 71, 71, 226, 240, 181, 35,
+ 7253, 224, 32, 48, 0, 184, 3,
+ 3594, 224, 79, 48, 0, 248, 1,
+ 220, 97, 19, 48, 156, 152, 3,
+ 5243, 172, 16, 48, 92, 204, 1
+ },
+
+ /* Region 165 */
+ {
+ 0x0004, 72, 72, 240, 241, 181, 35,
+ 6253, 134, 32, 48, 0, 184, 3,
+ 3994, 176, 76, 48, 160, 248, 1,
+ 22, 183, 19, 48, 156, 172, 3,
+ 1243, 160, 16, 48, 240, 188, 3
+ },
+
+ /* Region 166 */
+ {
+ 0x001a, 73, 73, 240, 224, 155, 30,
+ -2145, 240, 70, 0, 0, 252, 3,
+ 600, 109, 111, 0, 0, 240, 3,
+ -1800, 240, 71, 0, 0, 248, 3,
+ 200, 173, 111, 0, 0, 240, 3
+ },
+
+ /* Region 167 */
+ {
+ 0x0012, 74, 74, 240, 224, 119, 30,
+ -2545, 240, 70, 0, 252, 252, 3,
+ 0, 153, 111, 0, 0, 240, 3,
+ -2400, 240, 71, 0, 252, 252, 3,
+ 100, 137, 111, 0, 0, 240, 3
+ },
+
+ /* Region 168 */
+ {
+ 0x001a, 75, 75, 240, 128, 240, 20,
+ 3780, 255, 16, 0, 252, 188, 2,
+ 800, 255, 64, 0, 0, 248, 2,
+ 2501, 255, 48, 0, 252, 208, 0,
+ 751, 255, 48, 0, 0, 236, 2
+ },
+
+ /* Region 169 */
+ {
+ 0x000d, 76, 76, 0, 255, 68, 35,
+ 1100, 239, 69, 0, 0, 184, 3,
+ 2600, 255, 76, 0, 0, 252, 3,
+ 5000, 255, 111, 0, 0, 204, 3,
+ 3400, 254, 73, 0, 0, 184, 3
+ },
+
+ /* Region 170 */
+ {
+ 0x000d, 77, 77, 0, 255, 68, 35,
+ 914, 239, 69, 0, 0, 180, 3,
+ 1801, 254, 76, 0, 0, 252, 3,
+ 4800, 255, 111, 0, 0, 192, 3,
+ 3200, 254, 73, 0, 0, 192, 3
+ },
+
+ /* Region 171 */
+ {
+ 0x000d, 78, 78, 240, 32, 197, -20,
+ 1200, 216, 86, 0, 0, 180, 1,
+ 1800, 189, 127, 0, 0, 244, 3,
+ 2700, 156, 102, 0, 0, 196, 1,
+ 700, 109, 104, 0, 0, 196, 1
+ },
+
+ /* Region 172 */
+ {
+ 0x000d, 79, 79, 240, 32, 197, -20,
+ 1200, 216, 86, 0, 0, 196, 1,
+ 2200, 171, 127, 0, 0, 244, 3,
+ 2700, 145, 102, 0, 0, 192, 1,
+ 700, 106, 104, 0, 0, 192, 1
+ },
+
+ /* Region 173 */
+ {
+ 0x000d, 80, 80, 0, 255, 0, -40,
+ 3514, 254, 79, 51, 0, 196, 3,
+ 5905, 252, 73, 51, 0, 248, 3,
+ 6348, 245, 35, 51, 0, 176, 3,
+ 2203, 244, 33, 51, 0, 216, 3
+ },
+
+ /* Region 174 */
+ {
+ 0x800d, 81, 81, 0, 255, 0, -40,
+ 3514, 255, 79, 51, 0, 192, 3,
+ 5905, 246, 73, 51, 0, 252, 3,
+ 6348, 241, 35, 51, 0, 180, 3,
+ 2203, 242, 33, 51, 0, 212, 3
+ }
+};
+
+
+/*----------------------------------------------------------------------------
+ * Programs
+ *----------------------------------------------------------------------------
+*/
+const S_PROGRAM programs[] =
+{
+ { 7864320, 128 } /* program 0 */
+}; /* end Programs */
+
+/*----------------------------------------------------------------------------
+ * Banks
+ *----------------------------------------------------------------------------
+*/
+const S_BANK banks[] =
+{
+ { /* bank 0 */
+ 30976,
+ {
+ 0, 1, 2, 3, 4, 5, 6, 7,
+ 8, 9, 10, 11, 12, 13, 14, 15,
+ 16, 17, 18, 19, 20, 21, 22, 23,
+ 24, 25, 26, 27, 28, 29, 30, 31,
+ 32, 33, 34, 35, 36, 37, 38, 39,
+ 40, 41, 42, 43, 44, 45, 46, 47,
+ 48, 49, 50, 51, 52, 53, 54, 55,
+ 56, 57, 58, 59, 60, 61, 62, 63,
+ 64, 65, 66, 67, 68, 69, 70, 71,
+ 72, 73, 74, 75, 76, 77, 78, 79,
+ 80, 81, 82, 83, 84, 85, 86, 87,
+ 88, 89, 90, 91, 92, 93, 94, 95,
+ 96, 97, 98, 99, 100, 101, 102, 103,
+ 104, 105, 106, 107, 108, 109, 110, 111,
+ 112, 113, 114, 115, 116, 117, 118, 119,
+ 120, 121, 122, 123, 124, 125, 126, 127
+ }
+ }
+}; /* end Banks */
+
+/*----------------------------------------------------------------------------
+ * S_EAS
+ *----------------------------------------------------------------------------
+*/
+const S_EAS easSoundLib =
+{
+ 0x01534145,
+ 0x00105622,
+
+ banks,
+ programs,
+
+ NULL,
+ NULL,
+ NULL,
+ NULL,
+ NULL,
+
+ regions,
+
+ 1,
+ 1,
+
+ 0,
+ 0,
+ 0,
+
+ 175
+}; /* end S_EAS */
+/* end sound library */
diff --git a/arm-fm-22k/lib_src/eas_fmsynth.c b/arm-fm-22k/lib_src/eas_fmsynth.c
index 83f0087..629506a 100644
--- a/arm-fm-22k/lib_src/eas_fmsynth.c
+++ b/arm-fm-22k/lib_src/eas_fmsynth.c
@@ -1,12 +1,12 @@
-/*----------------------------------------------------------------------------
- *
- * File:
- * fmsynth.c
- *
- * Contents and purpose:
- * Implements the high-level FM synthesizer functions.
- *
- * Copyright Sonic Network Inc. 2004
+/*----------------------------------------------------------------------------
+ *
+ * File:
+ * fmsynth.c
+ *
+ * Contents and purpose:
+ * Implements the high-level FM synthesizer functions.
+ *
+ * Copyright Sonic Network Inc. 2004
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -19,892 +19,892 @@
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
- *
- *----------------------------------------------------------------------------
- * Revision Control:
- * $Revision: 795 $
- * $Date: 2007-08-01 00:14:45 -0700 (Wed, 01 Aug 2007) $
- *----------------------------------------------------------------------------
-*/
-
-// includes
-#include "eas_host.h"
-#include "eas_report.h"
-
-#include "eas_data.h"
-#include "eas_synth_protos.h"
-#include "eas_audioconst.h"
-#include "eas_fmengine.h"
-#include "eas_math.h"
-
-/* option sanity check */
-#ifdef _REVERB
-#error "No reverb for FM synthesizer"
-#endif
-#ifdef _CHORUS
-#error "No chorus for FM synthesizer"
-#endif
-
-/*
- * WARNING: These macros can cause unwanted side effects. Use them
- * with care. For example, min(x++,y++) will cause either x or y to be
- * incremented twice.
- */
-#define min(a,b) ((a) < (b) ? (a) : (b))
-#define max(a,b) ((a) > (b) ? (a) : (b))
-
-/* pivot point for keyboard scalars */
-#define EG_SCALE_PIVOT_POINT 64
-#define KEY_SCALE_PIVOT_POINT 36
-
-/* This number is the negative of the frequency of the note (in cents) of
- * the sine wave played at unity. The number can be calculated as follows:
- *
- * MAGIC_NUMBER = 1200 * log(base2) (SINE_TABLE_SIZE * 8.175798916 / SAMPLE_RATE)
- *
- * 8.17578 is a reference to the frequency of MIDI note 0
- */
-#if defined (_SAMPLE_RATE_8000)
-#define MAGIC_NUMBER 1279
-#elif defined (_SAMPLE_RATE_16000)
-#define MAGIC_NUMBER 79
-#elif defined (_SAMPLE_RATE_20000)
-#define MAGIC_NUMBER -308
-#elif defined (_SAMPLE_RATE_22050)
-#define MAGIC_NUMBER -477
-#elif defined (_SAMPLE_RATE_24000)
-#define MAGIC_NUMBER -623
-#elif defined (_SAMPLE_RATE_32000)
-#define MAGIC_NUMBER -1121
-#elif defined (_SAMPLE_RATE_44100)
-#define MAGIC_NUMBER -1677
-#elif defined (_SAMPLE_RATE_48000)
-#define MAGIC_NUMBER -1823
-#endif
-
-/* externs */
-extern const EAS_I16 fmControlTable[128];
-extern const EAS_U16 fmRateTable[256];
-extern const EAS_U16 fmAttackTable[16];
-extern const EAS_U8 fmDecayTable[16];
-extern const EAS_U8 fmReleaseTable[16];
-extern const EAS_U8 fmScaleTable[16];
-
-/* local prototypes */
-/*lint -esym(715, pVoiceMgr) standard synthesizer interface - pVoiceMgr not used */
-static EAS_RESULT FM_Initialize (S_VOICE_MGR *pVoiceMgr) { return EAS_SUCCESS; }
-static EAS_RESULT FM_StartVoice (S_VOICE_MGR *pVoiceMgr, S_SYNTH *pSynth, S_SYNTH_VOICE *pVoice, EAS_I32 voiceNum, EAS_U16 regionIndex);
-static EAS_BOOL FM_UpdateVoice (S_VOICE_MGR *pVoiceMgr, S_SYNTH *pSynth, S_SYNTH_VOICE *pVoice, EAS_I32 voiceNum, EAS_I32 *pMixBuffer, EAS_I32 numSamples);
-static void FM_ReleaseVoice (S_VOICE_MGR *pVoiceMgr, S_SYNTH *pSynth, S_SYNTH_VOICE *pVoice, EAS_I32 voiceNum);
-static void FM_MuteVoice (S_VOICE_MGR *pVoiceMgr, S_SYNTH *pSynth, S_SYNTH_VOICE *pVoice, EAS_I32 voiceNum);
-static void FM_SustainPedal (S_VOICE_MGR *pVoiceMgr, S_SYNTH *pSynth, S_SYNTH_VOICE *pVoice, S_SYNTH_CHANNEL *pChannel, EAS_I32 voiceNum);
-static void FM_UpdateChannel (S_VOICE_MGR *pVoiceMgr, S_SYNTH *pSynth, EAS_U8 channel);
-
-
-/*----------------------------------------------------------------------------
- * Synthesizer interface
- *----------------------------------------------------------------------------
-*/
-const S_SYNTH_INTERFACE fmSynth =
-{
- FM_Initialize,
- FM_StartVoice,
- FM_UpdateVoice,
- FM_ReleaseVoice,
- FM_MuteVoice,
- FM_SustainPedal,
- FM_UpdateChannel
-};
-
-#ifdef FM_OFFBOARD
-const S_FRAME_INTERFACE fmFrameInterface =
-{
- FM_StartFrame,
- FM_EndFrame
-};
-#endif
-
-/*----------------------------------------------------------------------------
- * inline functions
- *----------------------------------------------------------------------------
- */
-EAS_INLINE S_FM_VOICE *GetFMVoicePtr (S_VOICE_MGR *pVoiceMgr, EAS_INT voiceNum)
-{
- return &pVoiceMgr->fmVoices[voiceNum];
-}
-EAS_INLINE S_SYNTH_CHANNEL *GetChannelPtr (S_SYNTH *pSynth, S_SYNTH_VOICE *pVoice)
-{
- return &pSynth->channels[pVoice->channel & 15];
-}
-EAS_INLINE const S_FM_REGION *GetFMRegionPtr (S_SYNTH *pSynth, S_SYNTH_VOICE *pVoice)
-{
-#ifdef _SECONDARY_SYNTH
- return &pSynth->pEAS->pFMRegions[pVoice->regionIndex & REGION_INDEX_MASK];
-#else
- return &pSynth->pEAS->pFMRegions[pVoice->regionIndex];
-#endif
-}
-
-/*----------------------------------------------------------------------------
- * FM_SynthIsOutputOperator
- *----------------------------------------------------------------------------
- * Purpose:
- * Returns true if the operator is a direct output and not muted
- *
- * Inputs:
- *
- * Outputs:
- * Returns boolean
- *----------------------------------------------------------------------------
-*/
-static EAS_BOOL FM_SynthIsOutputOperator (const S_FM_REGION *pRegion, EAS_INT operIndex)
-{
-
- /* see if voice is muted */
- if ((pRegion->oper[operIndex].gain & 0xfc) == 0)
- return 0;
-
- /* check based on mode */
- switch (pRegion->region.keyGroupAndFlags & 7)
- {
-
- /* mode 0 - all operators are external */
- case 0:
- return EAS_TRUE;
-
- /* mode 1 - operators 1-3 are external */
- case 1:
- if (operIndex != 0)
- return EAS_TRUE;
- break;
-
- /* mode 2 - operators 1 & 3 are external */
- case 2:
- if ((operIndex == 1) || (operIndex == 3))
- return EAS_TRUE;
- break;
-
- /* mode 2 - operators 1 & 2 are external */
- case 3:
- if ((operIndex == 1) || (operIndex == 2))
- return EAS_TRUE;
- break;
-
- /* modes 4 & 5 - operator 1 is external */
- case 4:
- case 5:
- if (operIndex == 1)
- return EAS_TRUE;
- break;
-
- default:
- { /* dpp: EAS_ReportEx(_EAS_SEVERITY_FATAL,"Invalid voice mode: %d",
- pRegion->region.keyGroupAndFlags & 7); */ }
- }
-
- return EAS_FALSE;
-}
-
-/*----------------------------------------------------------------------------
- * FM_CalcEGRate()
- *----------------------------------------------------------------------------
- * Purpose:
- *
- * Inputs:
- * nKeyNumber - MIDI note
- * nLogRate - logarithmic scale rate from patch data
- * nKeyScale - key scaling factor for this EG
- *
- * Outputs:
- * 16-bit linear multiplier
- *----------------------------------------------------------------------------
-*/
-
-static EAS_U16 FM_CalcEGRate (EAS_U8 nKeyNumber, EAS_U8 nLogRate, EAS_U8 nEGScale)
-{
- EAS_I32 temp;
-
- /* incorporate key scaling on release rate */
- temp = (EAS_I32) nLogRate << 7;
- temp += ((EAS_I32) nKeyNumber - EG_SCALE_PIVOT_POINT) * (EAS_I32) nEGScale;
-
- /* saturate */
- temp = max(temp, 0);
- temp = min(temp, 32767);
-
- /* look up in rate table */
- /*lint -e{704} use shift for performance */
- return fmRateTable[temp >> 8];
-}
-
-/*----------------------------------------------------------------------------
- * FM_ReleaseVoice()
- *----------------------------------------------------------------------------
- * Purpose:
- * The selected voice is being released.
- *
- * Inputs:
- * psEASData - pointer to S_EAS_DATA
- * pVoice - pointer to voice to release
- *
- * Outputs:
- * None
- *----------------------------------------------------------------------------
-*/
-static void FM_ReleaseVoice (S_VOICE_MGR *pVoiceMgr, S_SYNTH *pSynth, S_SYNTH_VOICE *pVoice, EAS_I32 voiceNum)
-{
- EAS_INT operIndex;
- const S_FM_REGION *pRegion;
- S_FM_VOICE *pFMVoice;
-
- /* check to see if voice responds to NOTE-OFF's */
- pRegion = GetFMRegionPtr(pSynth, pVoice);
- if (pRegion->region.keyGroupAndFlags & REGION_FLAG_ONE_SHOT)
- return;
-
- /* set all envelopes to release state */
- pFMVoice = GetFMVoicePtr(pVoiceMgr, voiceNum);
- for (operIndex = 0; operIndex < 4; operIndex++)
- {
- pFMVoice->oper[operIndex].envState = eFMEnvelopeStateRelease;
-
- /* incorporate key scaling on release rate */
- pFMVoice->oper[operIndex].envRate = FM_CalcEGRate(
- pVoice->note,
- fmReleaseTable[pRegion->oper[operIndex].velocityRelease & 0x0f],
- fmScaleTable[pRegion->oper[operIndex].egKeyScale >> 4]);
- } /* end for (operIndex = 0; operIndex < 4; operIndex++) */
-}
-
-/*----------------------------------------------------------------------------
- * FM_MuteVoice()
- *----------------------------------------------------------------------------
- * Purpose:
- * The selected voice is being muted.
- *
- * Inputs:
- * pVoice - pointer to voice to release
- *
- * Outputs:
- * None
- *----------------------------------------------------------------------------
-*/
-/*lint -esym(715, pSynth) standard interface, pVoiceMgr not used */
-static void FM_MuteVoice (S_VOICE_MGR *pVoiceMgr, S_SYNTH *pSynth, S_SYNTH_VOICE *pVoice, EAS_I32 voiceNum)
-{
- S_FM_VOICE *pFMVoice;
-
- /* clear deferred action flags */
- pVoice->voiceFlags &=
- ~(VOICE_FLAG_DEFER_MIDI_NOTE_OFF |
- VOICE_FLAG_SUSTAIN_PEDAL_DEFER_NOTE_OFF |
- VOICE_FLAG_DEFER_MUTE);
-
- /* set all envelopes to muted state */
- pFMVoice = GetFMVoicePtr(pVoiceMgr, voiceNum);
- pFMVoice->oper[0].envState = eFMEnvelopeStateMuted;
- pFMVoice->oper[1].envState = eFMEnvelopeStateMuted;
- pFMVoice->oper[2].envState = eFMEnvelopeStateMuted;
- pFMVoice->oper[3].envState = eFMEnvelopeStateMuted;
-}
-
-/*----------------------------------------------------------------------------
- * FM_SustainPedal()
- *----------------------------------------------------------------------------
- * Purpose:
- * The selected voice is held due to sustain pedal
- *
- * Inputs:
- * pVoice - pointer to voice to sustain
- *
- * Outputs:
- * None
- *----------------------------------------------------------------------------
-*/
-/*lint -esym(715, pChannel) standard interface, pVoiceMgr not used */
-static void FM_SustainPedal (S_VOICE_MGR *pVoiceMgr, S_SYNTH *pSynth, S_SYNTH_VOICE *pVoice, S_SYNTH_CHANNEL *pChannel, EAS_I32 voiceNum)
-{
- const S_FM_REGION *pRegion;
- S_FM_VOICE *pFMVoice;
- EAS_INT operIndex;
-
- pRegion = GetFMRegionPtr(pSynth, pVoice);
- pFMVoice = GetFMVoicePtr(pVoiceMgr, voiceNum);
-
- /* check to see if any envelopes are above the sustain level */
- for (operIndex = 0; operIndex < 4; operIndex++)
- {
-
- /* if level control or envelope gain is zero, skip this envelope */
- if (((pRegion->oper[operIndex].gain & 0xfc) == 0) ||
- (pFMVoice->oper[operIndex].envGain == 0))
- {
- continue;
- }
-
- /* if the envelope gain is above the sustain level, we need to catch this voice */
- if (pFMVoice->oper[operIndex].envGain >= ((EAS_U16) (pRegion->oper[operIndex].sustain & 0xfc) << 7))
- {
-
- /* reset envelope to decay state */
- pFMVoice->oper[operIndex].envState = eFMEnvelopeStateDecay;
-
- pFMVoice->oper[operIndex].envRate = FM_CalcEGRate(
- pVoice->note,
- fmDecayTable[pRegion->oper[operIndex].attackDecay & 0x0f],
- fmScaleTable[pRegion->oper[operIndex].egKeyScale >> 4]);
-
- /* set voice to decay state */
- pVoice->voiceState = eVoiceStatePlay;
-
- /* set sustain flag */
- pVoice->voiceFlags |= VOICE_FLAG_SUSTAIN_PEDAL_DEFER_NOTE_OFF;
- }
- } /* end for (operIndex = 0; operIndex < 4; operIndex++) */
-}
-
-/*----------------------------------------------------------------------------
- * FM_StartVoice()
- *----------------------------------------------------------------------------
- * Purpose:
- * Assign the region for the given instrument using the midi key number
- * and the RPN2 (coarse tuning) value. By using RPN2 as part of the
- * region selection process, we reduce the amount a given sample has
- * to be transposed by selecting the closest recorded root instead.
- *
- * This routine is the second half of SynthAssignRegion().
- * If the region was successfully found by SynthFindRegionIndex(),
- * then assign the region's parameters to the voice.
- *
- * Setup and initialize the following voice parameters:
- * m_nRegionIndex
- *
- * Inputs:
- * pVoice - ptr to the voice we have assigned for this channel
- * nRegionIndex - index of the region
- * psEASData - pointer to overall EAS data structure
- *
- * Outputs:
- * success - could find and assign the region for this voice's note otherwise
- * failure - could not find nor assign the region for this voice's note
- *
- * Side Effects:
- * psSynthObject->m_sVoice[].m_nRegionIndex is assigned
- * psSynthObject->m_sVoice[] parameters are assigned
- *----------------------------------------------------------------------------
-*/
-static EAS_RESULT FM_StartVoice (S_VOICE_MGR *pVoiceMgr, S_SYNTH *pSynth, S_SYNTH_VOICE *pVoice, EAS_I32 voiceNum, EAS_U16 regionIndex)
-{
- S_FM_VOICE *pFMVoice;
- S_SYNTH_CHANNEL *pChannel;
- const S_FM_REGION *pRegion;
- EAS_I32 temp;
- EAS_INT operIndex;
-
- /* establish pointers to data */
- pVoice->regionIndex = regionIndex;
- pFMVoice = GetFMVoicePtr(pVoiceMgr, voiceNum);
- pChannel = GetChannelPtr(pSynth, pVoice);
- pRegion = GetFMRegionPtr(pSynth, pVoice);
-
- /* update static channel parameters */
- if (pChannel->channelFlags & CHANNEL_FLAG_UPDATE_CHANNEL_PARAMETERS)
- FM_UpdateChannel(pVoiceMgr, pSynth, pVoice->channel & 15);
-
- /* init the LFO */
- pFMVoice->lfoValue = 0;
- pFMVoice->lfoPhase = 0;
- pFMVoice->lfoDelay = (EAS_U16) (fmScaleTable[pRegion->lfoFreqDelay & 0x0f] >> 1);
-
-#if (NUM_OUTPUT_CHANNELS == 2)
- /* calculate pan gain values only if stereo output */
- /* set up panning only at note start */
- temp = (EAS_I32) pChannel->pan - 64;
- temp += (EAS_I32) pRegion->pan;
- if (temp < -64)
- temp = -64;
- if (temp > 64)
- temp = 64;
- pFMVoice->pan = (EAS_I8) temp;
-#endif /* #if (NUM_OUTPUT_CHANNELS == 2) */
-
- /* no samples have been synthesized for this note yet */
- pVoice->voiceFlags = VOICE_FLAG_NO_SAMPLES_SYNTHESIZED_YET;
-
- /* initialize gain value for anti-zipper filter */
- pFMVoice->voiceGain = (EAS_I16) EAS_LogToLinear16(pChannel->staticGain);
- pFMVoice->voiceGain = (EAS_I16) FMUL_15x15(pFMVoice->voiceGain, pSynth->masterVolume);
-
- /* initialize the operators */
- for (operIndex = 0; operIndex < 4; operIndex++)
- {
-
- /* establish operator output gain level */
- /*lint -e{701} <use shift for performance> */
- pFMVoice->oper[operIndex].outputGain = EAS_LogToLinear16(((EAS_I16) (pRegion->oper[operIndex].gain & 0xfc) - 0xfc) << 7);
-
- /* check for linear velocity flag */
- /*lint -e{703} <use shift for performance> */
- if (pRegion->oper[operIndex].flags & FM_OPER_FLAG_LINEAR_VELOCITY)
- temp = (EAS_I32) (pVoice->velocity - 127) << 5;
- else
- temp = (EAS_I32) fmControlTable[pVoice->velocity];
-
- /* scale velocity */
- /*lint -e{704} use shift for performance */
- temp = (temp * (EAS_I32)(pRegion->oper[operIndex].velocityRelease & 0xf0)) >> 7;
-
- /* include key scalar */
- temp -= ((EAS_I32) pVoice->note - KEY_SCALE_PIVOT_POINT) * (EAS_I32) fmScaleTable[pRegion->oper[operIndex].egKeyScale & 0x0f];
-
- /* saturate */
- temp = min(temp, 0);
- temp = max(temp, -32768);
-
- /* save static gain parameters */
- pFMVoice->oper[operIndex].baseGain = (EAS_I16) EAS_LogToLinear16(temp);
-
- /* incorporate key scaling on decay rate */
- pFMVoice->oper[operIndex].envRate = FM_CalcEGRate(
- pVoice->note,
- fmDecayTable[pRegion->oper[operIndex].attackDecay & 0x0f],
- fmScaleTable[pRegion->oper[operIndex].egKeyScale >> 4]);
-
- /* if zero attack time, max out envelope and jump to decay state */
- if ((pRegion->oper[operIndex].attackDecay & 0xf0) == 0xf0)
- {
-
- /* start out envelope at max */
- pFMVoice->oper[operIndex].envGain = 0x7fff;
-
- /* set envelope to decay state */
- pFMVoice->oper[operIndex].envState = eFMEnvelopeStateDecay;
- }
-
- /* start envelope at zero and start in attack state */
- else
- {
- pFMVoice->oper[operIndex].envGain = 0;
- pFMVoice->oper[operIndex].envState = eFMEnvelopeStateAttack;
- }
- }
-
- return EAS_SUCCESS;
-}
-
-/*----------------------------------------------------------------------------
- * FM_UpdateChannel()
- *----------------------------------------------------------------------------
- * Purpose:
- * Calculate and assign static channel parameters
- * These values only need to be updated if one of the controller values
- * for this channel changes.
- * Called when CHANNEL_FLAG_UPDATE_CHANNEL_PARAMETERS flag is set.
- *
- * Inputs:
- * nChannel - channel to update
- * psEASData - pointer to overall EAS data structure
- *
- * Outputs:
- *
- * Side Effects:
- * - the given channel's static gain and static pitch are updated
- *----------------------------------------------------------------------------
-*/
-/*lint -esym(715, pVoiceMgr) standard interface, pVoiceMgr not used */
-static void FM_UpdateChannel (S_VOICE_MGR *pVoiceMgr, S_SYNTH *pSynth, EAS_U8 channel)
-{
- S_SYNTH_CHANNEL *pChannel;
- EAS_I32 temp;
-
- pChannel = &pSynth->channels[channel];
-
- /* convert CC7 volume controller to log scale */
- temp = fmControlTable[pChannel->volume];
-
- /* incorporate CC11 expression controller */
- temp += fmControlTable[pChannel->expression];
-
- /* saturate */
- pChannel->staticGain = (EAS_I16) max(temp,-32768);
-
- /* calculate pitch bend */
- /*lint -e{703} <avoid multiply for performance>*/
- temp = (((EAS_I32)(pChannel->pitchBend) << 2) - 32768);
-
- temp = FMUL_15x15(temp, pChannel->pitchBendSensitivity);
-
- /* include "magic number" compensation for sample rate and lookup table size */
- temp += MAGIC_NUMBER;
-
- /* if this is not a drum channel, then add in the per-channel tuning */
- if (!(pChannel->channelFlags & CHANNEL_FLAG_RHYTHM_CHANNEL))
- temp += (pChannel->finePitch + (pChannel->coarsePitch * 100));
-
- /* save static pitch */
- pChannel->staticPitch = temp;
-
- /* Calculate LFO modulation depth */
- /* mod wheel to LFO depth */
- temp = FMUL_15x15(DEFAULT_LFO_MOD_WHEEL_TO_PITCH_CENTS,
- pChannel->modWheel << (NUM_EG1_FRAC_BITS -7));
-
- /* channel pressure to LFO depth */
- pChannel->lfoAmt = (EAS_I16) (temp +
- FMUL_15x15(DEFAULT_LFO_CHANNEL_PRESSURE_TO_PITCH_CENTS,
- pChannel->channelPressure << (NUM_EG1_FRAC_BITS -7)));
-
- /* clear update flag */
- pChannel->channelFlags &= ~CHANNEL_FLAG_UPDATE_CHANNEL_PARAMETERS;
- return;
-}
-
-/*----------------------------------------------------------------------------
- * FM_UpdateLFO()
- *----------------------------------------------------------------------------
- * Purpose:
- * Calculate the LFO for the given voice
- *
- * Inputs:
- * pVoice - ptr to the voice whose LFO we want to update
- * psEASData - pointer to overall EAS data structure - used for debug only
- *
- * Outputs:
- *
- * Side Effects:
- * - updates LFO values for the given voice
- *----------------------------------------------------------------------------
-*/
-static void FM_UpdateLFO (S_FM_VOICE *pFMVoice, const S_FM_REGION *pRegion)
-{
-
- /* increment the LFO phase if the delay time has elapsed */
- if (!pFMVoice->lfoDelay)
- {
- /*lint -e{701} <use shift for performance> */
- pFMVoice->lfoPhase = pFMVoice->lfoPhase + (EAS_U16) (-fmControlTable[((15 - (pRegion->lfoFreqDelay >> 4)) << 3) + 4]);
-
- /* square wave LFO? */
- if (pRegion->region.keyGroupAndFlags & REGION_FLAG_SQUARE_WAVE)
- pFMVoice->lfoValue = (EAS_I16)(pFMVoice->lfoPhase & 0x8000 ? -32767 : 32767);
-
- /* trick to get a triangle wave out of a sawtooth */
- else
- {
- pFMVoice->lfoValue = (EAS_I16) (pFMVoice->lfoPhase << 1);
- /*lint -e{502} <shortcut to turn sawtooth into sine wave> */
- if ((pFMVoice->lfoPhase > 0x3fff) && (pFMVoice->lfoPhase < 0xC000))
- pFMVoice->lfoValue = ~pFMVoice->lfoValue;
- }
- }
-
- /* still in delay */
- else
- pFMVoice->lfoDelay--;
-
- return;
-}
-
-/*----------------------------------------------------------------------------
- * FM_UpdateEG()
- *----------------------------------------------------------------------------
- * Purpose:
- * Calculate the synthesis parameters for an operator to be used during
- * the next buffer
- *
- * Inputs:
- * pVoice - pointer to the voice being updated
- * psEASData - pointer to overall EAS data structure
- *
- * Outputs:
- *
- * Side Effects:
- *
- *----------------------------------------------------------------------------
-*/
-static EAS_BOOL FM_UpdateEG (S_SYNTH_VOICE *pVoice, S_OPERATOR *pOper, const S_FM_OPER *pOperData, EAS_BOOL oneShot)
-{
- EAS_U32 temp;
- EAS_BOOL done;
-
- /* set flag assuming the envelope is not done */
- done = EAS_FALSE;
-
- /* take appropriate action based on state */
- switch (pOper->envState)
- {
-
- case eFMEnvelopeStateAttack:
-
- /* the envelope is linear during the attack, so add the value */
- temp = pOper->envGain + fmAttackTable[pOperData->attackDecay >> 4];
-
- /* check for end of attack */
- if (temp >= 0x7fff)
- {
- pOper->envGain = 0x7fff;
- pOper->envState = eFMEnvelopeStateDecay;
- }
- else
- pOper->envGain = (EAS_U16) temp;
- break;
-
- case eFMEnvelopeStateDecay:
-
- /* decay is exponential, multiply by decay rate */
- pOper->envGain = (EAS_U16) FMUL_15x15(pOper->envGain, pOper->envRate);
-
- /* check for sustain level reached */
- temp = (EAS_U32) (pOperData->sustain & 0xfc) << 7;
- if (pOper->envGain <= (EAS_U16) temp)
- {
- /* if this is a one-shot patch, go directly to release phase */
- if (oneShot)
- {
- pOper->envRate = FM_CalcEGRate(
- pVoice->note,
- fmReleaseTable[pOperData->velocityRelease & 0x0f],
- fmScaleTable[pOperData->egKeyScale >> 4]);
- pOper->envState = eFMEnvelopeStateRelease;
- }
-
- /* normal sustaining type */
- else
- {
- pOper->envGain = (EAS_U16) temp;
- pOper->envState = eFMEnvelopeStateSustain;
- }
- }
- break;
-
- case eFMEnvelopeStateSustain:
- pOper->envGain = (EAS_U16)((EAS_U16)(pOperData->sustain & 0xfc) << 7);
- break;
-
- case eFMEnvelopeStateRelease:
-
- /* release is exponential, multiply by release rate */
- pOper->envGain = (EAS_U16) FMUL_15x15(pOper->envGain, pOper->envRate);
-
- /* fully released */
- if (pOper->envGain == 0)
- {
- pOper->envGain = 0;
- pOper->envState = eFMEnvelopeStateMuted;
- done = EAS_TRUE;
- }
- break;
-
- case eFMEnvelopeStateMuted:
- pOper->envGain = 0;
- done = EAS_TRUE;
- break;
- default:
- { /* dpp: EAS_ReportEx(_EAS_SEVERITY_FATAL,"Invalid operator state: %d", pOper->envState); */ }
- } /* end switch (pOper->m_eState) */
-
- return done;
-}
-
-/*----------------------------------------------------------------------------
- * FM_UpdateDynamic()
- *----------------------------------------------------------------------------
- * Purpose:
- * Calculate the synthesis parameters for this voice that will be used to
- * synthesize the next buffer
- *
- * Inputs:
- * pVoice - pointer to the voice being updated
- * psEASData - pointer to overall EAS data structure
- *
- * Outputs:
- * Returns EAS_TRUE if voice will be fully ramped to zero at the end of
- * the next synthesized buffer.
- *
- * Side Effects:
- *
- *----------------------------------------------------------------------------
-*/
-static EAS_BOOL FM_UpdateDynamic (S_SYNTH_VOICE *pVoice, S_FM_VOICE *pFMVoice, const S_FM_REGION *pRegion, S_SYNTH_CHANNEL *pChannel)
-{
- EAS_I32 temp;
- EAS_I32 pitch;
- EAS_I32 lfoPitch;
- EAS_INT operIndex;
- EAS_BOOL done;
-
- /* increment LFO phase */
- FM_UpdateLFO(pFMVoice, pRegion);
-
- /* base pitch in cents */
- pitch = pVoice->note * 100;
-
- /* LFO amount includes LFO depth from programming + channel dynamics */
- temp = (fmScaleTable[pRegion->vibTrem >> 4] >> 1) + pChannel->lfoAmt;
-
- /* multiply by LFO output to get final pitch modulation */
- lfoPitch = FMUL_15x15(pFMVoice->lfoValue, temp);
-
- /* flag to indicate this voice is done */
- done = EAS_TRUE;
-
- /* iterate through operators to establish parameters */
- for (operIndex = 0; operIndex < 4; operIndex++)
- {
- EAS_BOOL bTemp;
-
- /* set base phase increment for each operator */
- temp = pRegion->oper[operIndex].tuning +
- pChannel->staticPitch;
-
- /* add vibrato effect unless it is disabled for this operator */
- if ((pRegion->oper[operIndex].flags & FM_OPER_FLAG_NO_VIBRATO) == 0)
- temp += lfoPitch;
-
- /* if note is monotonic, bias to MIDI note 60 */
- if (pRegion->oper[operIndex].flags & FM_OPER_FLAG_MONOTONE)
- temp += 6000;
- else
- temp += pitch;
- pFMVoice->oper[operIndex].pitch = (EAS_I16) temp;
-
- /* calculate envelope, returns true if done */
- bTemp = FM_UpdateEG(pVoice, &pFMVoice->oper[operIndex], &pRegion->oper[operIndex], pRegion->region.keyGroupAndFlags & REGION_FLAG_ONE_SHOT);
-
- /* check if all output envelopes have completed */
- if (FM_SynthIsOutputOperator(pRegion, operIndex))
- done = done && bTemp;
- }
-
- return done;
-}
-
-/*----------------------------------------------------------------------------
- * FM_UpdateVoice()
- *----------------------------------------------------------------------------
- * Purpose:
- * Synthesize a block of samples for the given voice.
- *
- * Inputs:
- * psEASData - pointer to overall EAS data structure
- *
- * Outputs:
- * number of samples actually written to buffer
- *
- * Side Effects:
- * - samples are added to the presently free buffer
- *
- *----------------------------------------------------------------------------
-*/
-static EAS_BOOL FM_UpdateVoice (S_VOICE_MGR *pVoiceMgr, S_SYNTH *pSynth, S_SYNTH_VOICE *pVoice, EAS_I32 voiceNum, EAS_I32 *pMixBuffer, EAS_I32 numSamples)
-{
- S_SYNTH_CHANNEL *pChannel;
- const S_FM_REGION *pRegion;
- S_FM_VOICE *pFMVoice;
- S_FM_VOICE_CONFIG vCfg;
- S_FM_VOICE_FRAME vFrame;
- EAS_I32 temp;
- EAS_INT oper;
- EAS_U16 voiceGainTarget;
- EAS_BOOL done;
-
- /* setup some pointers */
- pChannel = GetChannelPtr(pSynth, pVoice);
- pRegion = GetFMRegionPtr(pSynth, pVoice);
- pFMVoice = GetFMVoicePtr(pVoiceMgr, voiceNum);
-
- /* if the voice is just starting, get the voice configuration data */
- if (pVoice->voiceFlags & VOICE_FLAG_NO_SAMPLES_SYNTHESIZED_YET)
- {
-
- /* split architecture may limit the number of voice starts */
-#ifdef MAX_VOICE_STARTS
- if (pVoiceMgr->numVoiceStarts == MAX_VOICE_STARTS)
- return EAS_FALSE;
- pVoiceMgr->numVoiceStarts++;
-#endif
-
- /* get initial parameters */
- vCfg.feedback = pRegion->feedback;
- vCfg.voiceGain = (EAS_U16) pFMVoice->voiceGain;
-
-#if (NUM_OUTPUT_CHANNELS == 2)
- vCfg.pan = pFMVoice->pan;
-#endif
-
- /* get voice mode */
- vCfg.flags = pRegion->region.keyGroupAndFlags & 7;
-
- /* get operator parameters */
- for (oper = 0; oper < 4; oper++)
- {
- /* calculate initial gain */
- vCfg.gain[oper] = (EAS_U16) FMUL_15x15(pFMVoice->oper[oper].baseGain, pFMVoice->oper[oper].envGain);
- vCfg.outputGain[oper] = pFMVoice->oper[oper].outputGain;
-
- /* copy noise waveform flag */
- if (pRegion->oper[oper].flags & FM_OPER_FLAG_NOISE)
- vCfg.flags |= (EAS_U8) (FLAG_FM_ENG_VOICE_OP1_NOISE << oper);
- }
-
-#ifdef FM_OFFBOARD
- FM_ConfigVoice(voiceNum, &vCfg, pVoiceMgr->pFrameBuffer);
-#else
- FM_ConfigVoice(voiceNum, &vCfg, NULL);
-#endif
-
- /* clear startup flag */
- pVoice->voiceFlags &= ~VOICE_FLAG_NO_SAMPLES_SYNTHESIZED_YET;
- }
-
- /* calculate new synthesis parameters */
- done = FM_UpdateDynamic(pVoice, pFMVoice, pRegion, pChannel);
-
- /* calculate LFO gain modulation */
- /*lint -e{702} <use shift for performance> */
- temp = ((fmScaleTable[pRegion->vibTrem & 0x0f] >> 1) * pFMVoice->lfoValue) >> FM_LFO_GAIN_SHIFT;
-
- /* include channel gain */
- temp += pChannel->staticGain;
-
- /* -32768 or lower is infinite attenuation */
- if (temp < -32767)
- voiceGainTarget = 0;
-
- /* translate to linear gain multiplier */
- else
- voiceGainTarget = EAS_LogToLinear16(temp);
-
- /* include synth master volume */
- voiceGainTarget = (EAS_U16) FMUL_15x15(voiceGainTarget, pSynth->masterVolume);
-
- /* save target values for this frame */
- vFrame.voiceGain = voiceGainTarget;
-
- /* assume voice output is zero */
- pVoice->gain = 0;
-
- /* save operator targets for this frame */
- for (oper = 0; oper < 4; oper++)
- {
- vFrame.gain[oper] = (EAS_U16) FMUL_15x15(pFMVoice->oper[oper].baseGain, pFMVoice->oper[oper].envGain);
- vFrame.pitch[oper] = pFMVoice->oper[oper].pitch;
-
- /* use the highest output envelope level as the gain for the voice stealing algorithm */
- if (FM_SynthIsOutputOperator(pRegion, oper))
- pVoice->gain = max(pVoice->gain, (EAS_I16) vFrame.gain[oper]);
- }
-
- /* consider voice gain multiplier in calculating gain for stealing algorithm */
- pVoice->gain = (EAS_I16) FMUL_15x15(voiceGainTarget, pVoice->gain);
-
- /* synthesize samples */
-#ifdef FM_OFFBOARD
- FM_ProcessVoice(voiceNum, &vFrame, numSamples, pVoiceMgr->operMixBuffer, pVoiceMgr->voiceBuffer, pMixBuffer, pVoiceMgr->pFrameBuffer);
-#else
- FM_ProcessVoice(voiceNum, &vFrame, numSamples, pVoiceMgr->operMixBuffer, pVoiceMgr->voiceBuffer, pMixBuffer, NULL);
-#endif
-
- return done;
-}
-
+ *
+ *----------------------------------------------------------------------------
+ * Revision Control:
+ * $Revision: 795 $
+ * $Date: 2007-08-01 00:14:45 -0700 (Wed, 01 Aug 2007) $
+ *----------------------------------------------------------------------------
+*/
+
+// includes
+#include "eas_host.h"
+#include "eas_report.h"
+
+#include "eas_data.h"
+#include "eas_synth_protos.h"
+#include "eas_audioconst.h"
+#include "eas_fmengine.h"
+#include "eas_math.h"
+
+/* option sanity check */
+#ifdef _REVERB
+#error "No reverb for FM synthesizer"
+#endif
+#ifdef _CHORUS
+#error "No chorus for FM synthesizer"
+#endif
+
+/*
+ * WARNING: These macros can cause unwanted side effects. Use them
+ * with care. For example, min(x++,y++) will cause either x or y to be
+ * incremented twice.
+ */
+#define min(a,b) ((a) < (b) ? (a) : (b))
+#define max(a,b) ((a) > (b) ? (a) : (b))
+
+/* pivot point for keyboard scalars */
+#define EG_SCALE_PIVOT_POINT 64
+#define KEY_SCALE_PIVOT_POINT 36
+
+/* This number is the negative of the frequency of the note (in cents) of
+ * the sine wave played at unity. The number can be calculated as follows:
+ *
+ * MAGIC_NUMBER = 1200 * log(base2) (SINE_TABLE_SIZE * 8.175798916 / SAMPLE_RATE)
+ *
+ * 8.17578 is a reference to the frequency of MIDI note 0
+ */
+#if defined (_SAMPLE_RATE_8000)
+#define MAGIC_NUMBER 1279
+#elif defined (_SAMPLE_RATE_16000)
+#define MAGIC_NUMBER 79
+#elif defined (_SAMPLE_RATE_20000)
+#define MAGIC_NUMBER -308
+#elif defined (_SAMPLE_RATE_22050)
+#define MAGIC_NUMBER -477
+#elif defined (_SAMPLE_RATE_24000)
+#define MAGIC_NUMBER -623
+#elif defined (_SAMPLE_RATE_32000)
+#define MAGIC_NUMBER -1121
+#elif defined (_SAMPLE_RATE_44100)
+#define MAGIC_NUMBER -1677
+#elif defined (_SAMPLE_RATE_48000)
+#define MAGIC_NUMBER -1823
+#endif
+
+/* externs */
+extern const EAS_I16 fmControlTable[128];
+extern const EAS_U16 fmRateTable[256];
+extern const EAS_U16 fmAttackTable[16];
+extern const EAS_U8 fmDecayTable[16];
+extern const EAS_U8 fmReleaseTable[16];
+extern const EAS_U8 fmScaleTable[16];
+
+/* local prototypes */
+/*lint -esym(715, pVoiceMgr) standard synthesizer interface - pVoiceMgr not used */
+static EAS_RESULT FM_Initialize (S_VOICE_MGR *pVoiceMgr) { return EAS_SUCCESS; }
+static EAS_RESULT FM_StartVoice (S_VOICE_MGR *pVoiceMgr, S_SYNTH *pSynth, S_SYNTH_VOICE *pVoice, EAS_I32 voiceNum, EAS_U16 regionIndex);
+static EAS_BOOL FM_UpdateVoice (S_VOICE_MGR *pVoiceMgr, S_SYNTH *pSynth, S_SYNTH_VOICE *pVoice, EAS_I32 voiceNum, EAS_I32 *pMixBuffer, EAS_I32 numSamples);
+static void FM_ReleaseVoice (S_VOICE_MGR *pVoiceMgr, S_SYNTH *pSynth, S_SYNTH_VOICE *pVoice, EAS_I32 voiceNum);
+static void FM_MuteVoice (S_VOICE_MGR *pVoiceMgr, S_SYNTH *pSynth, S_SYNTH_VOICE *pVoice, EAS_I32 voiceNum);
+static void FM_SustainPedal (S_VOICE_MGR *pVoiceMgr, S_SYNTH *pSynth, S_SYNTH_VOICE *pVoice, S_SYNTH_CHANNEL *pChannel, EAS_I32 voiceNum);
+static void FM_UpdateChannel (S_VOICE_MGR *pVoiceMgr, S_SYNTH *pSynth, EAS_U8 channel);
+
+
+/*----------------------------------------------------------------------------
+ * Synthesizer interface
+ *----------------------------------------------------------------------------
+*/
+const S_SYNTH_INTERFACE fmSynth =
+{
+ FM_Initialize,
+ FM_StartVoice,
+ FM_UpdateVoice,
+ FM_ReleaseVoice,
+ FM_MuteVoice,
+ FM_SustainPedal,
+ FM_UpdateChannel
+};
+
+#ifdef FM_OFFBOARD
+const S_FRAME_INTERFACE fmFrameInterface =
+{
+ FM_StartFrame,
+ FM_EndFrame
+};
+#endif
+
+/*----------------------------------------------------------------------------
+ * inline functions
+ *----------------------------------------------------------------------------
+ */
+EAS_INLINE S_FM_VOICE *GetFMVoicePtr (S_VOICE_MGR *pVoiceMgr, EAS_INT voiceNum)
+{
+ return &pVoiceMgr->fmVoices[voiceNum];
+}
+EAS_INLINE S_SYNTH_CHANNEL *GetChannelPtr (S_SYNTH *pSynth, S_SYNTH_VOICE *pVoice)
+{
+ return &pSynth->channels[pVoice->channel & 15];
+}
+EAS_INLINE const S_FM_REGION *GetFMRegionPtr (S_SYNTH *pSynth, S_SYNTH_VOICE *pVoice)
+{
+#ifdef _SECONDARY_SYNTH
+ return &pSynth->pEAS->pFMRegions[pVoice->regionIndex & REGION_INDEX_MASK];
+#else
+ return &pSynth->pEAS->pFMRegions[pVoice->regionIndex];
+#endif
+}
+
+/*----------------------------------------------------------------------------
+ * FM_SynthIsOutputOperator
+ *----------------------------------------------------------------------------
+ * Purpose:
+ * Returns true if the operator is a direct output and not muted
+ *
+ * Inputs:
+ *
+ * Outputs:
+ * Returns boolean
+ *----------------------------------------------------------------------------
+*/
+static EAS_BOOL FM_SynthIsOutputOperator (const S_FM_REGION *pRegion, EAS_INT operIndex)
+{
+
+ /* see if voice is muted */
+ if ((pRegion->oper[operIndex].gain & 0xfc) == 0)
+ return 0;
+
+ /* check based on mode */
+ switch (pRegion->region.keyGroupAndFlags & 7)
+ {
+
+ /* mode 0 - all operators are external */
+ case 0:
+ return EAS_TRUE;
+
+ /* mode 1 - operators 1-3 are external */
+ case 1:
+ if (operIndex != 0)
+ return EAS_TRUE;
+ break;
+
+ /* mode 2 - operators 1 & 3 are external */
+ case 2:
+ if ((operIndex == 1) || (operIndex == 3))
+ return EAS_TRUE;
+ break;
+
+ /* mode 2 - operators 1 & 2 are external */
+ case 3:
+ if ((operIndex == 1) || (operIndex == 2))
+ return EAS_TRUE;
+ break;
+
+ /* modes 4 & 5 - operator 1 is external */
+ case 4:
+ case 5:
+ if (operIndex == 1)
+ return EAS_TRUE;
+ break;
+
+ default:
+ { /* dpp: EAS_ReportEx(_EAS_SEVERITY_FATAL,"Invalid voice mode: %d",
+ pRegion->region.keyGroupAndFlags & 7); */ }
+ }
+
+ return EAS_FALSE;
+}
+
+/*----------------------------------------------------------------------------
+ * FM_CalcEGRate()
+ *----------------------------------------------------------------------------
+ * Purpose:
+ *
+ * Inputs:
+ * nKeyNumber - MIDI note
+ * nLogRate - logarithmic scale rate from patch data
+ * nKeyScale - key scaling factor for this EG
+ *
+ * Outputs:
+ * 16-bit linear multiplier
+ *----------------------------------------------------------------------------
+*/
+
+static EAS_U16 FM_CalcEGRate (EAS_U8 nKeyNumber, EAS_U8 nLogRate, EAS_U8 nEGScale)
+{
+ EAS_I32 temp;
+
+ /* incorporate key scaling on release rate */
+ temp = (EAS_I32) nLogRate << 7;
+ temp += ((EAS_I32) nKeyNumber - EG_SCALE_PIVOT_POINT) * (EAS_I32) nEGScale;
+
+ /* saturate */
+ temp = max(temp, 0);
+ temp = min(temp, 32767);
+
+ /* look up in rate table */
+ /*lint -e{704} use shift for performance */
+ return fmRateTable[temp >> 8];
+}
+
+/*----------------------------------------------------------------------------
+ * FM_ReleaseVoice()
+ *----------------------------------------------------------------------------
+ * Purpose:
+ * The selected voice is being released.
+ *
+ * Inputs:
+ * psEASData - pointer to S_EAS_DATA
+ * pVoice - pointer to voice to release
+ *
+ * Outputs:
+ * None
+ *----------------------------------------------------------------------------
+*/
+static void FM_ReleaseVoice (S_VOICE_MGR *pVoiceMgr, S_SYNTH *pSynth, S_SYNTH_VOICE *pVoice, EAS_I32 voiceNum)
+{
+ EAS_INT operIndex;
+ const S_FM_REGION *pRegion;
+ S_FM_VOICE *pFMVoice;
+
+ /* check to see if voice responds to NOTE-OFF's */
+ pRegion = GetFMRegionPtr(pSynth, pVoice);
+ if (pRegion->region.keyGroupAndFlags & REGION_FLAG_ONE_SHOT)
+ return;
+
+ /* set all envelopes to release state */
+ pFMVoice = GetFMVoicePtr(pVoiceMgr, voiceNum);
+ for (operIndex = 0; operIndex < 4; operIndex++)
+ {
+ pFMVoice->oper[operIndex].envState = eFMEnvelopeStateRelease;
+
+ /* incorporate key scaling on release rate */
+ pFMVoice->oper[operIndex].envRate = FM_CalcEGRate(
+ pVoice->note,
+ fmReleaseTable[pRegion->oper[operIndex].velocityRelease & 0x0f],
+ fmScaleTable[pRegion->oper[operIndex].egKeyScale >> 4]);
+ } /* end for (operIndex = 0; operIndex < 4; operIndex++) */
+}
+
+/*----------------------------------------------------------------------------
+ * FM_MuteVoice()
+ *----------------------------------------------------------------------------
+ * Purpose:
+ * The selected voice is being muted.
+ *
+ * Inputs:
+ * pVoice - pointer to voice to release
+ *
+ * Outputs:
+ * None
+ *----------------------------------------------------------------------------
+*/
+/*lint -esym(715, pSynth) standard interface, pVoiceMgr not used */
+static void FM_MuteVoice (S_VOICE_MGR *pVoiceMgr, S_SYNTH *pSynth, S_SYNTH_VOICE *pVoice, EAS_I32 voiceNum)
+{
+ S_FM_VOICE *pFMVoice;
+
+ /* clear deferred action flags */
+ pVoice->voiceFlags &=
+ ~(VOICE_FLAG_DEFER_MIDI_NOTE_OFF |
+ VOICE_FLAG_SUSTAIN_PEDAL_DEFER_NOTE_OFF |
+ VOICE_FLAG_DEFER_MUTE);
+
+ /* set all envelopes to muted state */
+ pFMVoice = GetFMVoicePtr(pVoiceMgr, voiceNum);
+ pFMVoice->oper[0].envState = eFMEnvelopeStateMuted;
+ pFMVoice->oper[1].envState = eFMEnvelopeStateMuted;
+ pFMVoice->oper[2].envState = eFMEnvelopeStateMuted;
+ pFMVoice->oper[3].envState = eFMEnvelopeStateMuted;
+}
+
+/*----------------------------------------------------------------------------
+ * FM_SustainPedal()
+ *----------------------------------------------------------------------------
+ * Purpose:
+ * The selected voice is held due to sustain pedal
+ *
+ * Inputs:
+ * pVoice - pointer to voice to sustain
+ *
+ * Outputs:
+ * None
+ *----------------------------------------------------------------------------
+*/
+/*lint -esym(715, pChannel) standard interface, pVoiceMgr not used */
+static void FM_SustainPedal (S_VOICE_MGR *pVoiceMgr, S_SYNTH *pSynth, S_SYNTH_VOICE *pVoice, S_SYNTH_CHANNEL *pChannel, EAS_I32 voiceNum)
+{
+ const S_FM_REGION *pRegion;
+ S_FM_VOICE *pFMVoice;
+ EAS_INT operIndex;
+
+ pRegion = GetFMRegionPtr(pSynth, pVoice);
+ pFMVoice = GetFMVoicePtr(pVoiceMgr, voiceNum);
+
+ /* check to see if any envelopes are above the sustain level */
+ for (operIndex = 0; operIndex < 4; operIndex++)
+ {
+
+ /* if level control or envelope gain is zero, skip this envelope */
+ if (((pRegion->oper[operIndex].gain & 0xfc) == 0) ||
+ (pFMVoice->oper[operIndex].envGain == 0))
+ {
+ continue;
+ }
+
+ /* if the envelope gain is above the sustain level, we need to catch this voice */
+ if (pFMVoice->oper[operIndex].envGain >= ((EAS_U16) (pRegion->oper[operIndex].sustain & 0xfc) << 7))
+ {
+
+ /* reset envelope to decay state */
+ pFMVoice->oper[operIndex].envState = eFMEnvelopeStateDecay;
+
+ pFMVoice->oper[operIndex].envRate = FM_CalcEGRate(
+ pVoice->note,
+ fmDecayTable[pRegion->oper[operIndex].attackDecay & 0x0f],
+ fmScaleTable[pRegion->oper[operIndex].egKeyScale >> 4]);
+
+ /* set voice to decay state */
+ pVoice->voiceState = eVoiceStatePlay;
+
+ /* set sustain flag */
+ pVoice->voiceFlags |= VOICE_FLAG_SUSTAIN_PEDAL_DEFER_NOTE_OFF;
+ }
+ } /* end for (operIndex = 0; operIndex < 4; operIndex++) */
+}
+
+/*----------------------------------------------------------------------------
+ * FM_StartVoice()
+ *----------------------------------------------------------------------------
+ * Purpose:
+ * Assign the region for the given instrument using the midi key number
+ * and the RPN2 (coarse tuning) value. By using RPN2 as part of the
+ * region selection process, we reduce the amount a given sample has
+ * to be transposed by selecting the closest recorded root instead.
+ *
+ * This routine is the second half of SynthAssignRegion().
+ * If the region was successfully found by SynthFindRegionIndex(),
+ * then assign the region's parameters to the voice.
+ *
+ * Setup and initialize the following voice parameters:
+ * m_nRegionIndex
+ *
+ * Inputs:
+ * pVoice - ptr to the voice we have assigned for this channel
+ * nRegionIndex - index of the region
+ * psEASData - pointer to overall EAS data structure
+ *
+ * Outputs:
+ * success - could find and assign the region for this voice's note otherwise
+ * failure - could not find nor assign the region for this voice's note
+ *
+ * Side Effects:
+ * psSynthObject->m_sVoice[].m_nRegionIndex is assigned
+ * psSynthObject->m_sVoice[] parameters are assigned
+ *----------------------------------------------------------------------------
+*/
+static EAS_RESULT FM_StartVoice (S_VOICE_MGR *pVoiceMgr, S_SYNTH *pSynth, S_SYNTH_VOICE *pVoice, EAS_I32 voiceNum, EAS_U16 regionIndex)
+{
+ S_FM_VOICE *pFMVoice;
+ S_SYNTH_CHANNEL *pChannel;
+ const S_FM_REGION *pRegion;
+ EAS_I32 temp;
+ EAS_INT operIndex;
+
+ /* establish pointers to data */
+ pVoice->regionIndex = regionIndex;
+ pFMVoice = GetFMVoicePtr(pVoiceMgr, voiceNum);
+ pChannel = GetChannelPtr(pSynth, pVoice);
+ pRegion = GetFMRegionPtr(pSynth, pVoice);
+
+ /* update static channel parameters */
+ if (pChannel->channelFlags & CHANNEL_FLAG_UPDATE_CHANNEL_PARAMETERS)
+ FM_UpdateChannel(pVoiceMgr, pSynth, pVoice->channel & 15);
+
+ /* init the LFO */
+ pFMVoice->lfoValue = 0;
+ pFMVoice->lfoPhase = 0;
+ pFMVoice->lfoDelay = (EAS_U16) (fmScaleTable[pRegion->lfoFreqDelay & 0x0f] >> 1);
+
+#if (NUM_OUTPUT_CHANNELS == 2)
+ /* calculate pan gain values only if stereo output */
+ /* set up panning only at note start */
+ temp = (EAS_I32) pChannel->pan - 64;
+ temp += (EAS_I32) pRegion->pan;
+ if (temp < -64)
+ temp = -64;
+ if (temp > 64)
+ temp = 64;
+ pFMVoice->pan = (EAS_I8) temp;
+#endif /* #if (NUM_OUTPUT_CHANNELS == 2) */
+
+ /* no samples have been synthesized for this note yet */
+ pVoice->voiceFlags = VOICE_FLAG_NO_SAMPLES_SYNTHESIZED_YET;
+
+ /* initialize gain value for anti-zipper filter */
+ pFMVoice->voiceGain = (EAS_I16) EAS_LogToLinear16(pChannel->staticGain);
+ pFMVoice->voiceGain = (EAS_I16) FMUL_15x15(pFMVoice->voiceGain, pSynth->masterVolume);
+
+ /* initialize the operators */
+ for (operIndex = 0; operIndex < 4; operIndex++)
+ {
+
+ /* establish operator output gain level */
+ /*lint -e{701} <use shift for performance> */
+ pFMVoice->oper[operIndex].outputGain = EAS_LogToLinear16(((EAS_I16) (pRegion->oper[operIndex].gain & 0xfc) - 0xfc) << 7);
+
+ /* check for linear velocity flag */
+ /*lint -e{703} <use shift for performance> */
+ if (pRegion->oper[operIndex].flags & FM_OPER_FLAG_LINEAR_VELOCITY)
+ temp = (EAS_I32) (pVoice->velocity - 127) << 5;
+ else
+ temp = (EAS_I32) fmControlTable[pVoice->velocity];
+
+ /* scale velocity */
+ /*lint -e{704} use shift for performance */
+ temp = (temp * (EAS_I32)(pRegion->oper[operIndex].velocityRelease & 0xf0)) >> 7;
+
+ /* include key scalar */
+ temp -= ((EAS_I32) pVoice->note - KEY_SCALE_PIVOT_POINT) * (EAS_I32) fmScaleTable[pRegion->oper[operIndex].egKeyScale & 0x0f];
+
+ /* saturate */
+ temp = min(temp, 0);
+ temp = max(temp, -32768);
+
+ /* save static gain parameters */
+ pFMVoice->oper[operIndex].baseGain = (EAS_I16) EAS_LogToLinear16(temp);
+
+ /* incorporate key scaling on decay rate */
+ pFMVoice->oper[operIndex].envRate = FM_CalcEGRate(
+ pVoice->note,
+ fmDecayTable[pRegion->oper[operIndex].attackDecay & 0x0f],
+ fmScaleTable[pRegion->oper[operIndex].egKeyScale >> 4]);
+
+ /* if zero attack time, max