From c7398d66cba7dda9498317708233ebf816dabbea Mon Sep 17 00:00:00 2001 From: yenatch Date: Fri, 6 Jan 2017 23:12:47 -0500 Subject: Dump the cries and rewrite aif2pcm. (#156) --- Makefile | 7 +- sound/direct_sound_data.inc | 1788 +++++++++++-------------- sound/direct_sound_samples/845AE14.aif | Bin 1281 -> 1269 bytes sound/direct_sound_samples/845B2B4.aif | Bin 1876 -> 1864 bytes sound/direct_sound_samples/845B9A8.aif | Bin 2290 -> 2278 bytes sound/direct_sound_samples/845C238.aif | Bin 2263 -> 2251 bytes sound/direct_sound_samples/845CAB0.aif | Bin 4256 -> 4256 bytes sound/direct_sound_samples/845DAF0.aif | Bin 1139 -> 1127 bytes sound/direct_sound_samples/845ED34.aif | Bin 4086 -> 4086 bytes sound/direct_sound_samples/845FCC8.aif | Bin 2326 -> 2314 bytes sound/direct_sound_samples/8460E60.aif | Bin 3979 -> 3979 bytes sound/direct_sound_samples/8461D8C.aif | Bin 1402 -> 1390 bytes sound/direct_sound_samples/84622A4.aif | Bin 1578 -> 1566 bytes sound/direct_sound_samples/8488F44.aif | Bin 6593 -> 6581 bytes sound/direct_sound_samples/848A8A4.aif | Bin 5414 -> 5402 bytes sound/direct_sound_samples/8492D10.aif | Bin 4210 -> 4198 bytes sound/direct_sound_samples/8639898.aif | Bin 1729 -> 1717 bytes sound/direct_sound_samples/863A3DC.aif | Bin 2479 -> 2467 bytes sound/direct_sound_samples/863AD2C.aif | Bin 2770 -> 2758 bytes sound/direct_sound_samples/863BABC.aif | Bin 3305 -> 3293 bytes sound/direct_sound_samples/863C744.aif | Bin 1666 -> 1654 bytes sound/direct_sound_samples/863D0EC.aif | Bin 3651 -> 3639 bytes sound/direct_sound_samples/863DED0.aif | Bin 2513 -> 2501 bytes sound/direct_sound_samples/863EBDC.aif | Bin 2067 -> 2055 bytes sound/direct_sound_samples/863F390.aif | Bin 3515 -> 3503 bytes sound/direct_sound_samples/8640330.aif | Bin 3743 -> 3731 bytes sound/direct_sound_samples/8641170.aif | Bin 2483 -> 2471 bytes sound/direct_sound_samples/8641E18.aif | Bin 1683 -> 1671 bytes sound/direct_sound_samples/864244C.aif | Bin 3275 -> 3263 bytes sound/direct_sound_samples/8643650.aif | Bin 2915 -> 2903 bytes sound/direct_sound_samples/8644154.aif | Bin 1637 -> 1625 bytes sound/direct_sound_samples/8644950.aif | Bin 2499 -> 2487 bytes sound/direct_sound_samples/86452B4.aif | Bin 4075 -> 4063 bytes sound/direct_sound_samples/8646878.aif | Bin 2867 -> 2855 bytes sound/direct_sound_samples/864734C.aif | Bin 4006 -> 3994 bytes sound/direct_sound_samples/8648808.aif | Bin 3755 -> 3743 bytes sound/direct_sound_samples/8649654.aif | Bin 3943 -> 3931 bytes sound/direct_sound_samples/864B030.aif | Bin 3059 -> 3047 bytes sound/direct_sound_samples/864BBC4.aif | Bin 2615 -> 2603 bytes sound/direct_sound_samples/864CBDC.aif | Bin 2879 -> 2867 bytes sound/direct_sound_samples/864D6BC.aif | Bin 1692 -> 1680 bytes sound/direct_sound_samples/864E410.aif | Bin 2459 -> 2447 bytes sound/direct_sound_samples/864ED4C.aif | Bin 2075 -> 2063 bytes sound/direct_sound_samples/864FA6C.aif | Bin 3539 -> 3527 bytes sound/direct_sound_samples/86507E0.aif | Bin 1245 -> 1233 bytes sound/direct_sound_samples/8651148.aif | Bin 2087 -> 2075 bytes sound/direct_sound_samples/8651910.aif | Bin 3165 -> 3153 bytes sound/direct_sound_samples/8652884.aif | Bin 2075 -> 2063 bytes sound/direct_sound_samples/8653040.aif | Bin 3267 -> 3255 bytes sound/direct_sound_samples/8654170.aif | Bin 2831 -> 2819 bytes sound/direct_sound_samples/cry_abra.aif | Bin 0 -> 11680 bytes sound/direct_sound_samples/cry_absol.aif | Bin 0 -> 5276 bytes sound/direct_sound_samples/cry_aerodactyl.aif | Bin 0 -> 12162 bytes sound/direct_sound_samples/cry_aggron.aif | Bin 0 -> 12797 bytes sound/direct_sound_samples/cry_aipom.aif | Bin 0 -> 7078 bytes sound/direct_sound_samples/cry_alakazam.aif | Bin 0 -> 15761 bytes sound/direct_sound_samples/cry_altaria.aif | Bin 0 -> 5585 bytes sound/direct_sound_samples/cry_ampharos.aif | Bin 0 -> 8262 bytes sound/direct_sound_samples/cry_anorith.aif | Bin 0 -> 5882 bytes sound/direct_sound_samples/cry_arbok.aif | Bin 0 -> 9669 bytes sound/direct_sound_samples/cry_arcanine.aif | Bin 0 -> 8623 bytes sound/direct_sound_samples/cry_ariados.aif | Bin 0 -> 6190 bytes sound/direct_sound_samples/cry_armaldo.aif | Bin 0 -> 11400 bytes sound/direct_sound_samples/cry_aron.aif | Bin 0 -> 4621 bytes sound/direct_sound_samples/cry_articuno.aif | Bin 0 -> 11813 bytes sound/direct_sound_samples/cry_azumarill.aif | Bin 0 -> 8472 bytes sound/direct_sound_samples/cry_azurill.aif | Bin 0 -> 5233 bytes sound/direct_sound_samples/cry_bagon.aif | Bin 0 -> 3954 bytes sound/direct_sound_samples/cry_baltoy.aif | Bin 0 -> 6284 bytes sound/direct_sound_samples/cry_banette.aif | Bin 0 -> 6354 bytes sound/direct_sound_samples/cry_barboach.aif | Bin 0 -> 4652 bytes sound/direct_sound_samples/cry_bayleef.aif | Bin 0 -> 4435 bytes sound/direct_sound_samples/cry_beautifly.aif | Bin 0 -> 4149 bytes sound/direct_sound_samples/cry_beedrill.aif | Bin 0 -> 9676 bytes sound/direct_sound_samples/cry_beldum.aif | Bin 0 -> 4848 bytes sound/direct_sound_samples/cry_bellossom.aif | Bin 0 -> 7063 bytes sound/direct_sound_samples/cry_bellsprout.aif | Bin 0 -> 3813 bytes sound/direct_sound_samples/cry_blastoise.aif | Bin 0 -> 9642 bytes sound/direct_sound_samples/cry_blaziken.aif | Bin 0 -> 15710 bytes sound/direct_sound_samples/cry_blissey.aif | Bin 0 -> 8299 bytes sound/direct_sound_samples/cry_breloom.aif | Bin 0 -> 6397 bytes sound/direct_sound_samples/cry_bulbasaur.aif | Bin 0 -> 8286 bytes sound/direct_sound_samples/cry_butterfree.aif | Bin 0 -> 5046 bytes sound/direct_sound_samples/cry_cacnea.aif | Bin 0 -> 4508 bytes sound/direct_sound_samples/cry_cacturne.aif | Bin 0 -> 11330 bytes sound/direct_sound_samples/cry_camerupt.aif | Bin 0 -> 11547 bytes sound/direct_sound_samples/cry_carvanha.aif | Bin 0 -> 5068 bytes sound/direct_sound_samples/cry_cascoon.aif | Bin 0 -> 8146 bytes sound/direct_sound_samples/cry_castform.aif | Bin 0 -> 6322 bytes sound/direct_sound_samples/cry_caterpie.aif | Bin 0 -> 4212 bytes sound/direct_sound_samples/cry_celebi.aif | Bin 0 -> 7250 bytes sound/direct_sound_samples/cry_chansey.aif | Bin 0 -> 7411 bytes sound/direct_sound_samples/cry_charizard.aif | Bin 0 -> 9642 bytes sound/direct_sound_samples/cry_charmander.aif | Bin 0 -> 7236 bytes sound/direct_sound_samples/cry_charmeleon.aif | Bin 0 -> 7269 bytes sound/direct_sound_samples/cry_chikorita.aif | Bin 0 -> 2675 bytes sound/direct_sound_samples/cry_chimecho.aif | Bin 0 -> 5060 bytes sound/direct_sound_samples/cry_chinchou.aif | Bin 0 -> 6366 bytes sound/direct_sound_samples/cry_clamperl.aif | Bin 0 -> 9162 bytes sound/direct_sound_samples/cry_claydol.aif | Bin 0 -> 9689 bytes sound/direct_sound_samples/cry_clefable.aif | Bin 0 -> 5314 bytes sound/direct_sound_samples/cry_clefairy.aif | Bin 0 -> 4254 bytes sound/direct_sound_samples/cry_cleffa.aif | Bin 0 -> 3012 bytes sound/direct_sound_samples/cry_cloyster.aif | Bin 0 -> 10374 bytes sound/direct_sound_samples/cry_combusken.aif | Bin 0 -> 14380 bytes sound/direct_sound_samples/cry_corphish.aif | Bin 0 -> 6031 bytes sound/direct_sound_samples/cry_corsola.aif | Bin 0 -> 6460 bytes sound/direct_sound_samples/cry_cradily.aif | Bin 0 -> 14562 bytes sound/direct_sound_samples/cry_crawdaunt.aif | Bin 0 -> 12337 bytes sound/direct_sound_samples/cry_crobat.aif | Bin 0 -> 11582 bytes sound/direct_sound_samples/cry_croconaw.aif | Bin 0 -> 10116 bytes sound/direct_sound_samples/cry_cubone.aif | Bin 0 -> 7579 bytes sound/direct_sound_samples/cry_cyndaquil.aif | Bin 0 -> 3548 bytes sound/direct_sound_samples/cry_delcatty.aif | Bin 0 -> 10538 bytes sound/direct_sound_samples/cry_delibird.aif | Bin 0 -> 8114 bytes sound/direct_sound_samples/cry_deoxys.aif | Bin 0 -> 10409 bytes sound/direct_sound_samples/cry_dewgong.aif | Bin 0 -> 10566 bytes sound/direct_sound_samples/cry_diglett.aif | Bin 0 -> 9718 bytes sound/direct_sound_samples/cry_ditto.aif | Bin 0 -> 5586 bytes sound/direct_sound_samples/cry_dodrio.aif | Bin 0 -> 9733 bytes sound/direct_sound_samples/cry_doduo.aif | Bin 0 -> 9636 bytes sound/direct_sound_samples/cry_donphan.aif | Bin 0 -> 8574 bytes sound/direct_sound_samples/cry_dragonair.aif | Bin 0 -> 8339 bytes sound/direct_sound_samples/cry_dragonite.aif | Bin 0 -> 9522 bytes sound/direct_sound_samples/cry_dratini.aif | Bin 0 -> 5832 bytes sound/direct_sound_samples/cry_drowzee.aif | Bin 0 -> 14514 bytes sound/direct_sound_samples/cry_dugtrio.aif | Bin 0 -> 9707 bytes sound/direct_sound_samples/cry_dunsparce.aif | Bin 0 -> 7946 bytes sound/direct_sound_samples/cry_dusclops.aif | Bin 0 -> 6878 bytes sound/direct_sound_samples/cry_duskull.aif | Bin 0 -> 5330 bytes sound/direct_sound_samples/cry_dustox.aif | Bin 0 -> 6358 bytes sound/direct_sound_samples/cry_eevee.aif | Bin 0 -> 7124 bytes sound/direct_sound_samples/cry_ekans.aif | Bin 0 -> 9646 bytes sound/direct_sound_samples/cry_electabuzz.aif | Bin 0 -> 15401 bytes sound/direct_sound_samples/cry_electrike.aif | Bin 0 -> 6206 bytes sound/direct_sound_samples/cry_electrode.aif | Bin 0 -> 12584 bytes sound/direct_sound_samples/cry_elekid.aif | Bin 0 -> 5305 bytes sound/direct_sound_samples/cry_entei.aif | Bin 0 -> 10218 bytes sound/direct_sound_samples/cry_espeon.aif | Bin 0 -> 9849 bytes sound/direct_sound_samples/cry_exeggcute.aif | Bin 0 -> 9436 bytes sound/direct_sound_samples/cry_exeggutor.aif | Bin 0 -> 15900 bytes sound/direct_sound_samples/cry_exploud.aif | Bin 0 -> 14107 bytes sound/direct_sound_samples/cry_farfetchd.aif | Bin 0 -> 3786 bytes sound/direct_sound_samples/cry_fearow.aif | Bin 0 -> 8623 bytes sound/direct_sound_samples/cry_feebas.aif | Bin 0 -> 3952 bytes sound/direct_sound_samples/cry_feraligatr.aif | Bin 0 -> 12732 bytes sound/direct_sound_samples/cry_flaaffy.aif | Bin 0 -> 6874 bytes sound/direct_sound_samples/cry_flareon.aif | Bin 0 -> 7768 bytes sound/direct_sound_samples/cry_flygon.aif | Bin 0 -> 12994 bytes sound/direct_sound_samples/cry_forretress.aif | Bin 0 -> 10011 bytes sound/direct_sound_samples/cry_furret.aif | Bin 0 -> 3188 bytes sound/direct_sound_samples/cry_gardevoir.aif | Bin 0 -> 12175 bytes sound/direct_sound_samples/cry_gastly.aif | Bin 0 -> 11641 bytes sound/direct_sound_samples/cry_gengar.aif | Bin 0 -> 7392 bytes sound/direct_sound_samples/cry_geodude.aif | Bin 0 -> 11837 bytes sound/direct_sound_samples/cry_girafarig.aif | Bin 0 -> 7367 bytes sound/direct_sound_samples/cry_glalie.aif | Bin 0 -> 10440 bytes sound/direct_sound_samples/cry_gligar.aif | Bin 0 -> 6088 bytes sound/direct_sound_samples/cry_gloom.aif | Bin 0 -> 6267 bytes sound/direct_sound_samples/cry_golbat.aif | Bin 0 -> 9695 bytes sound/direct_sound_samples/cry_goldeen.aif | Bin 0 -> 4957 bytes sound/direct_sound_samples/cry_golduck.aif | Bin 0 -> 5666 bytes sound/direct_sound_samples/cry_golem.aif | Bin 0 -> 7100 bytes sound/direct_sound_samples/cry_gorebyss.aif | Bin 0 -> 11196 bytes sound/direct_sound_samples/cry_granbull.aif | Bin 0 -> 11802 bytes sound/direct_sound_samples/cry_graveler.aif | Bin 0 -> 13921 bytes sound/direct_sound_samples/cry_grimer.aif | Bin 0 -> 5295 bytes sound/direct_sound_samples/cry_groudon.aif | Bin 0 -> 18459 bytes sound/direct_sound_samples/cry_grovyle.aif | Bin 0 -> 10218 bytes sound/direct_sound_samples/cry_growlithe.aif | Bin 0 -> 6716 bytes sound/direct_sound_samples/cry_grumpig.aif | Bin 0 -> 6338 bytes sound/direct_sound_samples/cry_gulpin.aif | Bin 0 -> 4048 bytes sound/direct_sound_samples/cry_gyarados.aif | Bin 0 -> 10099 bytes sound/direct_sound_samples/cry_hariyama.aif | Bin 0 -> 8368 bytes sound/direct_sound_samples/cry_haunter.aif | Bin 0 -> 11734 bytes sound/direct_sound_samples/cry_heracross.aif | Bin 0 -> 9164 bytes sound/direct_sound_samples/cry_hitmonchan.aif | Bin 0 -> 8927 bytes sound/direct_sound_samples/cry_hitmonlee.aif | Bin 0 -> 9339 bytes sound/direct_sound_samples/cry_hitmontop.aif | Bin 0 -> 6956 bytes sound/direct_sound_samples/cry_ho_oh.aif | Bin 0 -> 11280 bytes sound/direct_sound_samples/cry_hoothoot.aif | Bin 0 -> 5478 bytes sound/direct_sound_samples/cry_hoppip.aif | Bin 0 -> 4247 bytes sound/direct_sound_samples/cry_horsea.aif | Bin 0 -> 4774 bytes sound/direct_sound_samples/cry_houndoom.aif | Bin 0 -> 9840 bytes sound/direct_sound_samples/cry_houndour.aif | Bin 0 -> 6353 bytes sound/direct_sound_samples/cry_huntail.aif | Bin 0 -> 7965 bytes sound/direct_sound_samples/cry_hypno.aif | Bin 0 -> 14470 bytes sound/direct_sound_samples/cry_igglybuff.aif | Bin 0 -> 3538 bytes sound/direct_sound_samples/cry_illumise.aif | Bin 0 -> 8556 bytes sound/direct_sound_samples/cry_ivysaur.aif | Bin 0 -> 8290 bytes sound/direct_sound_samples/cry_jigglypuff.aif | Bin 0 -> 2741 bytes sound/direct_sound_samples/cry_jirachi.aif | Bin 0 -> 6779 bytes sound/direct_sound_samples/cry_jolteon.aif | Bin 0 -> 7924 bytes sound/direct_sound_samples/cry_jumpluff.aif | Bin 0 -> 8126 bytes sound/direct_sound_samples/cry_jynx.aif | Bin 0 -> 23627 bytes sound/direct_sound_samples/cry_kabuto.aif | Bin 0 -> 6190 bytes sound/direct_sound_samples/cry_kabutops.aif | Bin 0 -> 6887 bytes sound/direct_sound_samples/cry_kadabra.aif | Bin 0 -> 13428 bytes sound/direct_sound_samples/cry_kakuna.aif | Bin 0 -> 9124 bytes sound/direct_sound_samples/cry_kangaskhan.aif | Bin 0 -> 9354 bytes sound/direct_sound_samples/cry_kecleon.aif | Bin 0 -> 4223 bytes sound/direct_sound_samples/cry_kingdra.aif | Bin 0 -> 6943 bytes sound/direct_sound_samples/cry_kingler.aif | Bin 0 -> 12153 bytes sound/direct_sound_samples/cry_kirlia.aif | Bin 0 -> 6120 bytes sound/direct_sound_samples/cry_koffing.aif | Bin 0 -> 10174 bytes sound/direct_sound_samples/cry_krabby.aif | Bin 0 -> 12133 bytes sound/direct_sound_samples/cry_kyogre.aif | Bin 0 -> 17803 bytes sound/direct_sound_samples/cry_lairon.aif | Bin 0 -> 10412 bytes sound/direct_sound_samples/cry_lanturn.aif | Bin 0 -> 5303 bytes sound/direct_sound_samples/cry_lapras.aif | Bin 0 -> 7428 bytes sound/direct_sound_samples/cry_larvitar.aif | Bin 0 -> 6370 bytes sound/direct_sound_samples/cry_latias.aif | Bin 0 -> 6118 bytes sound/direct_sound_samples/cry_latios.aif | Bin 0 -> 10978 bytes sound/direct_sound_samples/cry_ledian.aif | Bin 0 -> 4235 bytes sound/direct_sound_samples/cry_ledyba.aif | Bin 0 -> 3527 bytes sound/direct_sound_samples/cry_lickitung.aif | Bin 0 -> 7591 bytes sound/direct_sound_samples/cry_lileep.aif | Bin 0 -> 4859 bytes sound/direct_sound_samples/cry_linoone.aif | Bin 0 -> 15268 bytes sound/direct_sound_samples/cry_lombre.aif | Bin 0 -> 7303 bytes sound/direct_sound_samples/cry_lotad.aif | Bin 0 -> 2252 bytes sound/direct_sound_samples/cry_loudred.aif | Bin 0 -> 6602 bytes sound/direct_sound_samples/cry_ludicolo.aif | Bin 0 -> 8418 bytes sound/direct_sound_samples/cry_lugia.aif | Bin 0 -> 18920 bytes sound/direct_sound_samples/cry_lunatone.aif | Bin 0 -> 11977 bytes sound/direct_sound_samples/cry_luvdisc.aif | Bin 0 -> 2477 bytes sound/direct_sound_samples/cry_machamp.aif | Bin 0 -> 8276 bytes sound/direct_sound_samples/cry_machoke.aif | Bin 0 -> 6802 bytes sound/direct_sound_samples/cry_machop.aif | Bin 0 -> 6716 bytes sound/direct_sound_samples/cry_magby.aif | Bin 0 -> 7238 bytes sound/direct_sound_samples/cry_magcargo.aif | Bin 0 -> 10506 bytes sound/direct_sound_samples/cry_magikarp.aif | Bin 0 -> 9513 bytes sound/direct_sound_samples/cry_magmar.aif | Bin 0 -> 7758 bytes sound/direct_sound_samples/cry_magnemite.aif | Bin 0 -> 9631 bytes sound/direct_sound_samples/cry_magneton.aif | Bin 0 -> 11935 bytes sound/direct_sound_samples/cry_makuhita.aif | Bin 0 -> 3724 bytes sound/direct_sound_samples/cry_manectric.aif | Bin 0 -> 10512 bytes sound/direct_sound_samples/cry_mankey.aif | Bin 0 -> 8199 bytes sound/direct_sound_samples/cry_mantine.aif | Bin 0 -> 7905 bytes sound/direct_sound_samples/cry_mareep.aif | Bin 0 -> 3715 bytes sound/direct_sound_samples/cry_marill.aif | Bin 0 -> 6559 bytes sound/direct_sound_samples/cry_marowak.aif | Bin 0 -> 7236 bytes sound/direct_sound_samples/cry_marshtomp.aif | Bin 0 -> 8518 bytes sound/direct_sound_samples/cry_masquerain.aif | Bin 0 -> 9851 bytes sound/direct_sound_samples/cry_mawile.aif | Bin 0 -> 5776 bytes sound/direct_sound_samples/cry_medicham.aif | Bin 0 -> 8266 bytes sound/direct_sound_samples/cry_meditite.aif | Bin 0 -> 4098 bytes sound/direct_sound_samples/cry_meganium.aif | Bin 0 -> 8121 bytes sound/direct_sound_samples/cry_meowth.aif | Bin 0 -> 4816 bytes sound/direct_sound_samples/cry_metagross.aif | Bin 0 -> 19665 bytes sound/direct_sound_samples/cry_metang.aif | Bin 0 -> 9418 bytes sound/direct_sound_samples/cry_metapod.aif | Bin 0 -> 11643 bytes sound/direct_sound_samples/cry_mew.aif | Bin 0 -> 15166 bytes sound/direct_sound_samples/cry_mewtwo.aif | Bin 0 -> 15164 bytes sound/direct_sound_samples/cry_mightyena.aif | Bin 0 -> 9768 bytes sound/direct_sound_samples/cry_milotic.aif | Bin 0 -> 19562 bytes sound/direct_sound_samples/cry_miltank.aif | Bin 0 -> 7444 bytes sound/direct_sound_samples/cry_minun.aif | Bin 0 -> 8025 bytes sound/direct_sound_samples/cry_misdreavus.aif | Bin 0 -> 5837 bytes sound/direct_sound_samples/cry_moltres.aif | Bin 0 -> 11817 bytes sound/direct_sound_samples/cry_mr_mime.aif | Bin 0 -> 9467 bytes sound/direct_sound_samples/cry_mudkip.aif | Bin 0 -> 3796 bytes sound/direct_sound_samples/cry_muk.aif | Bin 0 -> 7394 bytes sound/direct_sound_samples/cry_murkrow.aif | Bin 0 -> 8390 bytes sound/direct_sound_samples/cry_natu.aif | Bin 0 -> 5314 bytes sound/direct_sound_samples/cry_nidoking.aif | Bin 0 -> 12196 bytes sound/direct_sound_samples/cry_nidoqueen.aif | Bin 0 -> 8444 bytes sound/direct_sound_samples/cry_nidoran_f.aif | Bin 0 -> 4878 bytes sound/direct_sound_samples/cry_nidoran_m.aif | Bin 0 -> 5236 bytes sound/direct_sound_samples/cry_nidorina.aif | Bin 0 -> 6414 bytes sound/direct_sound_samples/cry_nidorino.aif | Bin 0 -> 6063 bytes sound/direct_sound_samples/cry_nincada.aif | Bin 0 -> 3264 bytes sound/direct_sound_samples/cry_ninetales.aif | Bin 0 -> 12195 bytes sound/direct_sound_samples/cry_ninjask.aif | Bin 0 -> 6104 bytes sound/direct_sound_samples/cry_noctowl.aif | Bin 0 -> 10584 bytes sound/direct_sound_samples/cry_none.aif | Bin 0 -> 8286 bytes sound/direct_sound_samples/cry_nosepass.aif | Bin 0 -> 6716 bytes sound/direct_sound_samples/cry_numel.aif | Bin 0 -> 4685 bytes sound/direct_sound_samples/cry_nuzleaf.aif | Bin 0 -> 5733 bytes sound/direct_sound_samples/cry_octillery.aif | Bin 0 -> 13105 bytes sound/direct_sound_samples/cry_oddish.aif | Bin 0 -> 7318 bytes sound/direct_sound_samples/cry_omanyte.aif | Bin 0 -> 6693 bytes sound/direct_sound_samples/cry_omastar.aif | Bin 0 -> 6687 bytes sound/direct_sound_samples/cry_onix.aif | Bin 0 -> 12360 bytes sound/direct_sound_samples/cry_paras.aif | Bin 0 -> 13944 bytes sound/direct_sound_samples/cry_parasect.aif | Bin 0 -> 15161 bytes sound/direct_sound_samples/cry_pelipper.aif | Bin 0 -> 5915 bytes sound/direct_sound_samples/cry_persian.aif | Bin 0 -> 9432 bytes sound/direct_sound_samples/cry_phanpy.aif | Bin 0 -> 5684 bytes sound/direct_sound_samples/cry_pichu.aif | Bin 0 -> 3704 bytes sound/direct_sound_samples/cry_pidgeot.aif | Bin 0 -> 8611 bytes sound/direct_sound_samples/cry_pidgeotto.aif | Bin 0 -> 7532 bytes sound/direct_sound_samples/cry_pidgey.aif | Bin 0 -> 2005 bytes sound/direct_sound_samples/cry_pikachu.aif | Bin 0 -> 8336 bytes sound/direct_sound_samples/cry_piloswine.aif | Bin 0 -> 6501 bytes sound/direct_sound_samples/cry_pineco.aif | Bin 0 -> 6710 bytes sound/direct_sound_samples/cry_pinsir.aif | Bin 0 -> 6206 bytes sound/direct_sound_samples/cry_plusle.aif | Bin 0 -> 4525 bytes sound/direct_sound_samples/cry_politoed.aif | Bin 0 -> 9134 bytes sound/direct_sound_samples/cry_poliwag.aif | Bin 0 -> 5583 bytes sound/direct_sound_samples/cry_poliwhirl.aif | Bin 0 -> 3374 bytes sound/direct_sound_samples/cry_poliwrath.aif | Bin 0 -> 5602 bytes sound/direct_sound_samples/cry_ponyta.aif | Bin 0 -> 7544 bytes sound/direct_sound_samples/cry_poochyena.aif | Bin 0 -> 4677 bytes sound/direct_sound_samples/cry_porygon.aif | Bin 0 -> 10022 bytes sound/direct_sound_samples/cry_porygon2.aif | Bin 0 -> 7874 bytes sound/direct_sound_samples/cry_primeape.aif | Bin 0 -> 8106 bytes sound/direct_sound_samples/cry_psyduck.aif | Bin 0 -> 6599 bytes sound/direct_sound_samples/cry_pupitar.aif | Bin 0 -> 4255 bytes sound/direct_sound_samples/cry_quagsire.aif | Bin 0 -> 6704 bytes sound/direct_sound_samples/cry_quilava.aif | Bin 0 -> 5982 bytes sound/direct_sound_samples/cry_qwilfish.aif | Bin 0 -> 5829 bytes sound/direct_sound_samples/cry_raichu.aif | Bin 0 -> 11862 bytes sound/direct_sound_samples/cry_raikou.aif | Bin 0 -> 8724 bytes sound/direct_sound_samples/cry_ralts.aif | Bin 0 -> 5086 bytes sound/direct_sound_samples/cry_rapidash.aif | Bin 0 -> 9312 bytes sound/direct_sound_samples/cry_raticate.aif | Bin 0 -> 4791 bytes sound/direct_sound_samples/cry_rattata.aif | Bin 0 -> 3976 bytes sound/direct_sound_samples/cry_rayquaza.aif | Bin 0 -> 14552 bytes sound/direct_sound_samples/cry_regice.aif | Bin 0 -> 15957 bytes sound/direct_sound_samples/cry_regirock.aif | Bin 0 -> 15882 bytes sound/direct_sound_samples/cry_registeel.aif | Bin 0 -> 11496 bytes sound/direct_sound_samples/cry_relicanth.aif | Bin 0 -> 10092 bytes sound/direct_sound_samples/cry_remoraid.aif | Bin 0 -> 5310 bytes sound/direct_sound_samples/cry_rhydon.aif | Bin 0 -> 10207 bytes sound/direct_sound_samples/cry_rhyhorn.aif | Bin 0 -> 9707 bytes sound/direct_sound_samples/cry_roselia.aif | Bin 0 -> 5402 bytes sound/direct_sound_samples/cry_sableye.aif | Bin 0 -> 5847 bytes sound/direct_sound_samples/cry_salamence.aif | Bin 0 -> 12534 bytes sound/direct_sound_samples/cry_sandshrew.aif | Bin 0 -> 4699 bytes sound/direct_sound_samples/cry_sandslash.aif | Bin 0 -> 6804 bytes sound/direct_sound_samples/cry_sceptile.aif | Bin 0 -> 13032 bytes sound/direct_sound_samples/cry_scizor.aif | Bin 0 -> 11482 bytes sound/direct_sound_samples/cry_scyther.aif | Bin 0 -> 6697 bytes sound/direct_sound_samples/cry_seadra.aif | Bin 0 -> 4248 bytes sound/direct_sound_samples/cry_seaking.aif | Bin 0 -> 9674 bytes sound/direct_sound_samples/cry_sealeo.aif | Bin 0 -> 5949 bytes sound/direct_sound_samples/cry_seedot.aif | Bin 0 -> 4127 bytes sound/direct_sound_samples/cry_seel.aif | Bin 0 -> 8975 bytes sound/direct_sound_samples/cry_sentret.aif | Bin 0 -> 2129 bytes sound/direct_sound_samples/cry_seviper.aif | Bin 0 -> 5840 bytes sound/direct_sound_samples/cry_sharpedo.aif | Bin 0 -> 11509 bytes sound/direct_sound_samples/cry_shedinja.aif | Bin 0 -> 3897 bytes sound/direct_sound_samples/cry_shelgon.aif | Bin 0 -> 10012 bytes sound/direct_sound_samples/cry_shellder.aif | Bin 0 -> 7738 bytes sound/direct_sound_samples/cry_shiftry.aif | Bin 0 -> 9881 bytes sound/direct_sound_samples/cry_shroomish.aif | Bin 0 -> 4457 bytes sound/direct_sound_samples/cry_shuckle.aif | Bin 0 -> 5131 bytes sound/direct_sound_samples/cry_shuppet.aif | Bin 0 -> 4164 bytes sound/direct_sound_samples/cry_silcoon.aif | Bin 0 -> 8095 bytes sound/direct_sound_samples/cry_skarmory.aif | Bin 0 -> 12002 bytes sound/direct_sound_samples/cry_skiploom.aif | Bin 0 -> 6537 bytes sound/direct_sound_samples/cry_skitty.aif | Bin 0 -> 3581 bytes sound/direct_sound_samples/cry_slaking.aif | Bin 0 -> 4990 bytes sound/direct_sound_samples/cry_slakoth.aif | Bin 0 -> 4292 bytes sound/direct_sound_samples/cry_slowbro.aif | Bin 0 -> 6740 bytes sound/direct_sound_samples/cry_slowking.aif | Bin 0 -> 11928 bytes sound/direct_sound_samples/cry_slowpoke.aif | Bin 0 -> 3744 bytes sound/direct_sound_samples/cry_slugma.aif | Bin 0 -> 8556 bytes sound/direct_sound_samples/cry_smeargle.aif | Bin 0 -> 5134 bytes sound/direct_sound_samples/cry_smoochum.aif | Bin 0 -> 5880 bytes sound/direct_sound_samples/cry_sneasel.aif | Bin 0 -> 4606 bytes sound/direct_sound_samples/cry_snorlax.aif | Bin 0 -> 2668 bytes sound/direct_sound_samples/cry_snorunt.aif | Bin 0 -> 8521 bytes sound/direct_sound_samples/cry_snubbull.aif | Bin 0 -> 7241 bytes sound/direct_sound_samples/cry_solrock.aif | Bin 0 -> 8100 bytes sound/direct_sound_samples/cry_spearow.aif | Bin 0 -> 8826 bytes sound/direct_sound_samples/cry_spheal.aif | Bin 0 -> 2901 bytes sound/direct_sound_samples/cry_spinarak.aif | Bin 0 -> 6716 bytes sound/direct_sound_samples/cry_spinda.aif | Bin 0 -> 6236 bytes sound/direct_sound_samples/cry_spoink.aif | Bin 0 -> 3669 bytes sound/direct_sound_samples/cry_squirtle.aif | Bin 0 -> 7242 bytes sound/direct_sound_samples/cry_stantler.aif | Bin 0 -> 11228 bytes sound/direct_sound_samples/cry_starmie.aif | Bin 0 -> 10423 bytes sound/direct_sound_samples/cry_staryu.aif | Bin 0 -> 9954 bytes sound/direct_sound_samples/cry_steelix.aif | Bin 0 -> 19009 bytes sound/direct_sound_samples/cry_sudowoodo.aif | Bin 0 -> 8105 bytes sound/direct_sound_samples/cry_suicune.aif | Bin 0 -> 9146 bytes sound/direct_sound_samples/cry_sunflora.aif | Bin 0 -> 7948 bytes sound/direct_sound_samples/cry_sunkern.aif | Bin 0 -> 4077 bytes sound/direct_sound_samples/cry_surskit.aif | Bin 0 -> 5279 bytes sound/direct_sound_samples/cry_swablu.aif | Bin 0 -> 2844 bytes sound/direct_sound_samples/cry_swalot.aif | Bin 0 -> 8696 bytes sound/direct_sound_samples/cry_swampert.aif | Bin 0 -> 11240 bytes sound/direct_sound_samples/cry_swellow.aif | Bin 0 -> 4544 bytes sound/direct_sound_samples/cry_swinub.aif | Bin 0 -> 6349 bytes sound/direct_sound_samples/cry_taillow.aif | Bin 0 -> 3045 bytes sound/direct_sound_samples/cry_tangela.aif | Bin 0 -> 7571 bytes sound/direct_sound_samples/cry_tauros.aif | Bin 0 -> 9170 bytes sound/direct_sound_samples/cry_teddiursa.aif | Bin 0 -> 8286 bytes sound/direct_sound_samples/cry_tentacool.aif | Bin 0 -> 7981 bytes sound/direct_sound_samples/cry_tentacruel.aif | Bin 0 -> 11478 bytes sound/direct_sound_samples/cry_togepi.aif | Bin 0 -> 5481 bytes sound/direct_sound_samples/cry_togetic.aif | Bin 0 -> 3546 bytes sound/direct_sound_samples/cry_torchic.aif | Bin 0 -> 4861 bytes sound/direct_sound_samples/cry_torkoal.aif | Bin 0 -> 4682 bytes sound/direct_sound_samples/cry_totodile.aif | Bin 0 -> 9172 bytes sound/direct_sound_samples/cry_trapinch.aif | Bin 0 -> 5100 bytes sound/direct_sound_samples/cry_treecko.aif | Bin 0 -> 5856 bytes sound/direct_sound_samples/cry_tropius.aif | Bin 0 -> 16338 bytes sound/direct_sound_samples/cry_typhlosion.aif | Bin 0 -> 18964 bytes sound/direct_sound_samples/cry_tyranitar.aif | Bin 0 -> 11676 bytes sound/direct_sound_samples/cry_tyrogue.aif | Bin 0 -> 8092 bytes sound/direct_sound_samples/cry_umbreon.aif | Bin 0 -> 7766 bytes sound/direct_sound_samples/cry_unown.aif | Bin 0 -> 6596 bytes sound/direct_sound_samples/cry_unused_265.aif | Bin 0 -> 4697 bytes sound/direct_sound_samples/cry_unused_268.aif | Bin 0 -> 8849 bytes sound/direct_sound_samples/cry_ursaring.aif | Bin 0 -> 14882 bytes sound/direct_sound_samples/cry_vaporeon.aif | Bin 0 -> 11038 bytes sound/direct_sound_samples/cry_venomoth.aif | Bin 0 -> 8022 bytes sound/direct_sound_samples/cry_venonat.aif | Bin 0 -> 7766 bytes sound/direct_sound_samples/cry_venusaur.aif | Bin 0 -> 9669 bytes sound/direct_sound_samples/cry_vibrava.aif | Bin 0 -> 7023 bytes sound/direct_sound_samples/cry_victreebel.aif | Bin 0 -> 9650 bytes sound/direct_sound_samples/cry_vigoroth.aif | Bin 0 -> 7189 bytes sound/direct_sound_samples/cry_vileplume.aif | Bin 0 -> 12780 bytes sound/direct_sound_samples/cry_volbeat.aif | Bin 0 -> 5792 bytes sound/direct_sound_samples/cry_voltorb.aif | Bin 0 -> 12366 bytes sound/direct_sound_samples/cry_vulpix.aif | Bin 0 -> 11891 bytes sound/direct_sound_samples/cry_wailmer.aif | Bin 0 -> 14154 bytes sound/direct_sound_samples/cry_wailord.aif | Bin 0 -> 20949 bytes sound/direct_sound_samples/cry_walrein.aif | Bin 0 -> 18087 bytes sound/direct_sound_samples/cry_wartortle.aif | Bin 0 -> 8634 bytes sound/direct_sound_samples/cry_weedle.aif | Bin 0 -> 8144 bytes sound/direct_sound_samples/cry_weepinbell.aif | Bin 0 -> 7330 bytes sound/direct_sound_samples/cry_weezing.aif | Bin 0 -> 10826 bytes sound/direct_sound_samples/cry_whiscash.aif | Bin 0 -> 8499 bytes sound/direct_sound_samples/cry_whismur.aif | Bin 0 -> 4112 bytes sound/direct_sound_samples/cry_wigglytuff.aif | Bin 0 -> 3432 bytes sound/direct_sound_samples/cry_wingull.aif | Bin 0 -> 6152 bytes sound/direct_sound_samples/cry_wobbuffet.aif | Bin 0 -> 10296 bytes sound/direct_sound_samples/cry_wooper.aif | Bin 0 -> 3731 bytes sound/direct_sound_samples/cry_wurmple.aif | Bin 0 -> 4433 bytes sound/direct_sound_samples/cry_wynaut.aif | Bin 0 -> 6953 bytes sound/direct_sound_samples/cry_xatu.aif | Bin 0 -> 7413 bytes sound/direct_sound_samples/cry_yanma.aif | Bin 0 -> 8526 bytes sound/direct_sound_samples/cry_zangoose.aif | Bin 0 -> 4814 bytes sound/direct_sound_samples/cry_zapdos.aif | Bin 0 -> 7745 bytes sound/direct_sound_samples/cry_zigzagoon.aif | Bin 0 -> 5807 bytes sound/direct_sound_samples/cry_zubat.aif | Bin 0 -> 9709 bytes sound/programmable_wave_samples/84553BC.aif | Bin 3170 -> 0 bytes sound/programmable_wave_samples/84553BC.pcm | 1 + sound/programmable_wave_samples/84553CC.aif | Bin 3170 -> 0 bytes sound/programmable_wave_samples/84553CC.pcm | 1 + sound/programmable_wave_samples/84553DC.aif | Bin 3170 -> 0 bytes sound/programmable_wave_samples/84553DC.pcm | 1 + sound/programmable_wave_samples/84553EC.aif | Bin 3170 -> 0 bytes sound/programmable_wave_samples/84553EC.pcm | 1 + sound/programmable_wave_samples/84553FC.aif | Bin 3170 -> 0 bytes sound/programmable_wave_samples/84553FC.pcm | 1 + sound/programmable_wave_samples/845540C.aif | Bin 3170 -> 0 bytes sound/programmable_wave_samples/845540C.pcm | 1 + sound/programmable_wave_samples/845541C.aif | Bin 3170 -> 0 bytes sound/programmable_wave_samples/845541C.pcm | Bin 0 -> 16 bytes sound/programmable_wave_samples/845542C.aif | Bin 3170 -> 0 bytes sound/programmable_wave_samples/845542C.pcm | 1 + sound/programmable_wave_samples/845543C.aif | Bin 3170 -> 0 bytes sound/programmable_wave_samples/845543C.pcm | Bin 0 -> 16 bytes sound/programmable_wave_samples/845544C.aif | Bin 3170 -> 0 bytes sound/programmable_wave_samples/845544C.pcm | 1 + sound/voice_groups.inc | 1552 ++++++++++----------- tools/aif2pcm/main.c | 846 ++++++++---- 461 files changed, 2118 insertions(+), 2083 deletions(-) create mode 100644 sound/direct_sound_samples/cry_abra.aif create mode 100644 sound/direct_sound_samples/cry_absol.aif create mode 100644 sound/direct_sound_samples/cry_aerodactyl.aif create mode 100644 sound/direct_sound_samples/cry_aggron.aif create mode 100644 sound/direct_sound_samples/cry_aipom.aif create mode 100644 sound/direct_sound_samples/cry_alakazam.aif create mode 100644 sound/direct_sound_samples/cry_altaria.aif create mode 100644 sound/direct_sound_samples/cry_ampharos.aif create mode 100644 sound/direct_sound_samples/cry_anorith.aif create mode 100644 sound/direct_sound_samples/cry_arbok.aif create mode 100644 sound/direct_sound_samples/cry_arcanine.aif create mode 100644 sound/direct_sound_samples/cry_ariados.aif create mode 100644 sound/direct_sound_samples/cry_armaldo.aif create mode 100644 sound/direct_sound_samples/cry_aron.aif create mode 100644 sound/direct_sound_samples/cry_articuno.aif create mode 100644 sound/direct_sound_samples/cry_azumarill.aif create mode 100644 sound/direct_sound_samples/cry_azurill.aif create mode 100644 sound/direct_sound_samples/cry_bagon.aif create mode 100644 sound/direct_sound_samples/cry_baltoy.aif create mode 100644 sound/direct_sound_samples/cry_banette.aif create mode 100644 sound/direct_sound_samples/cry_barboach.aif create mode 100644 sound/direct_sound_samples/cry_bayleef.aif create mode 100644 sound/direct_sound_samples/cry_beautifly.aif create mode 100644 sound/direct_sound_samples/cry_beedrill.aif create mode 100644 sound/direct_sound_samples/cry_beldum.aif create mode 100644 sound/direct_sound_samples/cry_bellossom.aif create mode 100644 sound/direct_sound_samples/cry_bellsprout.aif create mode 100644 sound/direct_sound_samples/cry_blastoise.aif create mode 100644 sound/direct_sound_samples/cry_blaziken.aif create mode 100644 sound/direct_sound_samples/cry_blissey.aif create mode 100644 sound/direct_sound_samples/cry_breloom.aif create mode 100644 sound/direct_sound_samples/cry_bulbasaur.aif create mode 100644 sound/direct_sound_samples/cry_butterfree.aif create mode 100644 sound/direct_sound_samples/cry_cacnea.aif create mode 100644 sound/direct_sound_samples/cry_cacturne.aif create mode 100644 sound/direct_sound_samples/cry_camerupt.aif create mode 100644 sound/direct_sound_samples/cry_carvanha.aif create mode 100644 sound/direct_sound_samples/cry_cascoon.aif create mode 100644 sound/direct_sound_samples/cry_castform.aif create mode 100644 sound/direct_sound_samples/cry_caterpie.aif create mode 100644 sound/direct_sound_samples/cry_celebi.aif create mode 100644 sound/direct_sound_samples/cry_chansey.aif create mode 100644 sound/direct_sound_samples/cry_charizard.aif create mode 100644 sound/direct_sound_samples/cry_charmander.aif create mode 100644 sound/direct_sound_samples/cry_charmeleon.aif create mode 100644 sound/direct_sound_samples/cry_chikorita.aif create mode 100644 sound/direct_sound_samples/cry_chimecho.aif create mode 100644 sound/direct_sound_samples/cry_chinchou.aif create mode 100644 sound/direct_sound_samples/cry_clamperl.aif create mode 100644 sound/direct_sound_samples/cry_claydol.aif create mode 100644 sound/direct_sound_samples/cry_clefable.aif create mode 100644 sound/direct_sound_samples/cry_clefairy.aif create mode 100644 sound/direct_sound_samples/cry_cleffa.aif create mode 100644 sound/direct_sound_samples/cry_cloyster.aif create mode 100644 sound/direct_sound_samples/cry_combusken.aif create mode 100644 sound/direct_sound_samples/cry_corphish.aif create mode 100644 sound/direct_sound_samples/cry_corsola.aif create mode 100644 sound/direct_sound_samples/cry_cradily.aif create mode 100644 sound/direct_sound_samples/cry_crawdaunt.aif create mode 100644 sound/direct_sound_samples/cry_crobat.aif create mode 100644 sound/direct_sound_samples/cry_croconaw.aif create mode 100644 sound/direct_sound_samples/cry_cubone.aif create mode 100644 sound/direct_sound_samples/cry_cyndaquil.aif create mode 100644 sound/direct_sound_samples/cry_delcatty.aif create mode 100644 sound/direct_sound_samples/cry_delibird.aif create mode 100644 sound/direct_sound_samples/cry_deoxys.aif create mode 100644 sound/direct_sound_samples/cry_dewgong.aif create mode 100644 sound/direct_sound_samples/cry_diglett.aif create mode 100644 sound/direct_sound_samples/cry_ditto.aif create mode 100644 sound/direct_sound_samples/cry_dodrio.aif create mode 100644 sound/direct_sound_samples/cry_doduo.aif create mode 100644 sound/direct_sound_samples/cry_donphan.aif create mode 100644 sound/direct_sound_samples/cry_dragonair.aif create mode 100644 sound/direct_sound_samples/cry_dragonite.aif create mode 100644 sound/direct_sound_samples/cry_dratini.aif create mode 100644 sound/direct_sound_samples/cry_drowzee.aif create mode 100644 sound/direct_sound_samples/cry_dugtrio.aif create mode 100644 sound/direct_sound_samples/cry_dunsparce.aif create mode 100644 sound/direct_sound_samples/cry_dusclops.aif create mode 100644 sound/direct_sound_samples/cry_duskull.aif create mode 100644 sound/direct_sound_samples/cry_dustox.aif create mode 100644 sound/direct_sound_samples/cry_eevee.aif create mode 100644 sound/direct_sound_samples/cry_ekans.aif create mode 100644 sound/direct_sound_samples/cry_electabuzz.aif create mode 100644 sound/direct_sound_samples/cry_electrike.aif create mode 100644 sound/direct_sound_samples/cry_electrode.aif create mode 100644 sound/direct_sound_samples/cry_elekid.aif create mode 100644 sound/direct_sound_samples/cry_entei.aif create mode 100644 sound/direct_sound_samples/cry_espeon.aif create mode 100644 sound/direct_sound_samples/cry_exeggcute.aif create mode 100644 sound/direct_sound_samples/cry_exeggutor.aif create mode 100644 sound/direct_sound_samples/cry_exploud.aif create mode 100644 sound/direct_sound_samples/cry_farfetchd.aif create mode 100644 sound/direct_sound_samples/cry_fearow.aif create mode 100644 sound/direct_sound_samples/cry_feebas.aif create mode 100644 sound/direct_sound_samples/cry_feraligatr.aif create mode 100644 sound/direct_sound_samples/cry_flaaffy.aif create mode 100644 sound/direct_sound_samples/cry_flareon.aif create mode 100644 sound/direct_sound_samples/cry_flygon.aif create mode 100644 sound/direct_sound_samples/cry_forretress.aif create mode 100644 sound/direct_sound_samples/cry_furret.aif create mode 100644 sound/direct_sound_samples/cry_gardevoir.aif create mode 100644 sound/direct_sound_samples/cry_gastly.aif create mode 100644 sound/direct_sound_samples/cry_gengar.aif create mode 100644 sound/direct_sound_samples/cry_geodude.aif create mode 100644 sound/direct_sound_samples/cry_girafarig.aif create mode 100644 sound/direct_sound_samples/cry_glalie.aif create mode 100644 sound/direct_sound_samples/cry_gligar.aif create mode 100644 sound/direct_sound_samples/cry_gloom.aif create mode 100644 sound/direct_sound_samples/cry_golbat.aif create mode 100644 sound/direct_sound_samples/cry_goldeen.aif create mode 100644 sound/direct_sound_samples/cry_golduck.aif create mode 100644 sound/direct_sound_samples/cry_golem.aif create mode 100644 sound/direct_sound_samples/cry_gorebyss.aif create mode 100644 sound/direct_sound_samples/cry_granbull.aif create mode 100644 sound/direct_sound_samples/cry_graveler.aif create mode 100644 sound/direct_sound_samples/cry_grimer.aif create mode 100644 sound/direct_sound_samples/cry_groudon.aif create mode 100644 sound/direct_sound_samples/cry_grovyle.aif create mode 100644 sound/direct_sound_samples/cry_growlithe.aif create mode 100644 sound/direct_sound_samples/cry_grumpig.aif create mode 100644 sound/direct_sound_samples/cry_gulpin.aif create mode 100644 sound/direct_sound_samples/cry_gyarados.aif create mode 100644 sound/direct_sound_samples/cry_hariyama.aif create mode 100644 sound/direct_sound_samples/cry_haunter.aif create mode 100644 sound/direct_sound_samples/cry_heracross.aif create mode 100644 sound/direct_sound_samples/cry_hitmonchan.aif create mode 100644 sound/direct_sound_samples/cry_hitmonlee.aif create mode 100644 sound/direct_sound_samples/cry_hitmontop.aif create mode 100644 sound/direct_sound_samples/cry_ho_oh.aif create mode 100644 sound/direct_sound_samples/cry_hoothoot.aif create mode 100644 sound/direct_sound_samples/cry_hoppip.aif create mode 100644 sound/direct_sound_samples/cry_horsea.aif create mode 100644 sound/direct_sound_samples/cry_houndoom.aif create mode 100644 sound/direct_sound_samples/cry_houndour.aif create mode 100644 sound/direct_sound_samples/cry_huntail.aif create mode 100644 sound/direct_sound_samples/cry_hypno.aif create mode 100644 sound/direct_sound_samples/cry_igglybuff.aif create mode 100644 sound/direct_sound_samples/cry_illumise.aif create mode 100644 sound/direct_sound_samples/cry_ivysaur.aif create mode 100644 sound/direct_sound_samples/cry_jigglypuff.aif create mode 100644 sound/direct_sound_samples/cry_jirachi.aif create mode 100644 sound/direct_sound_samples/cry_jolteon.aif create mode 100644 sound/direct_sound_samples/cry_jumpluff.aif create mode 100644 sound/direct_sound_samples/cry_jynx.aif create mode 100644 sound/direct_sound_samples/cry_kabuto.aif create mode 100644 sound/direct_sound_samples/cry_kabutops.aif create mode 100644 sound/direct_sound_samples/cry_kadabra.aif create mode 100644 sound/direct_sound_samples/cry_kakuna.aif create mode 100644 sound/direct_sound_samples/cry_kangaskhan.aif create mode 100644 sound/direct_sound_samples/cry_kecleon.aif create mode 100644 sound/direct_sound_samples/cry_kingdra.aif create mode 100644 sound/direct_sound_samples/cry_kingler.aif create mode 100644 sound/direct_sound_samples/cry_kirlia.aif create mode 100644 sound/direct_sound_samples/cry_koffing.aif create mode 100644 sound/direct_sound_samples/cry_krabby.aif create mode 100644 sound/direct_sound_samples/cry_kyogre.aif create mode 100644 sound/direct_sound_samples/cry_lairon.aif create mode 100644 sound/direct_sound_samples/cry_lanturn.aif create mode 100644 sound/direct_sound_samples/cry_lapras.aif create mode 100644 sound/direct_sound_samples/cry_larvitar.aif create mode 100644 sound/direct_sound_samples/cry_latias.aif create mode 100644 sound/direct_sound_samples/cry_latios.aif create mode 100644 sound/direct_sound_samples/cry_ledian.aif create mode 100644 sound/direct_sound_samples/cry_ledyba.aif create mode 100644 sound/direct_sound_samples/cry_lickitung.aif create mode 100644 sound/direct_sound_samples/cry_lileep.aif create mode 100644 sound/direct_sound_samples/cry_linoone.aif create mode 100644 sound/direct_sound_samples/cry_lombre.aif create mode 100644 sound/direct_sound_samples/cry_lotad.aif create mode 100644 sound/direct_sound_samples/cry_loudred.aif create mode 100644 sound/direct_sound_samples/cry_ludicolo.aif create mode 100644 sound/direct_sound_samples/cry_lugia.aif create mode 100644 sound/direct_sound_samples/cry_lunatone.aif create mode 100644 sound/direct_sound_samples/cry_luvdisc.aif create mode 100644 sound/direct_sound_samples/cry_machamp.aif create mode 100644 sound/direct_sound_samples/cry_machoke.aif create mode 100644 sound/direct_sound_samples/cry_machop.aif create mode 100644 sound/direct_sound_samples/cry_magby.aif create mode 100644 sound/direct_sound_samples/cry_magcargo.aif create mode 100644 sound/direct_sound_samples/cry_magikarp.aif create mode 100644 sound/direct_sound_samples/cry_magmar.aif create mode 100644 sound/direct_sound_samples/cry_magnemite.aif create mode 100644 sound/direct_sound_samples/cry_magneton.aif create mode 100644 sound/direct_sound_samples/cry_makuhita.aif create mode 100644 sound/direct_sound_samples/cry_manectric.aif create mode 100644 sound/direct_sound_samples/cry_mankey.aif create mode 100644 sound/direct_sound_samples/cry_mantine.aif create mode 100644 sound/direct_sound_samples/cry_mareep.aif create mode 100644 sound/direct_sound_samples/cry_marill.aif create mode 100644 sound/direct_sound_samples/cry_marowak.aif create mode 100644 sound/direct_sound_samples/cry_marshtomp.aif create mode 100644 sound/direct_sound_samples/cry_masquerain.aif create mode 100644 sound/direct_sound_samples/cry_mawile.aif create mode 100644 sound/direct_sound_samples/cry_medicham.aif create mode 100644 sound/direct_sound_samples/cry_meditite.aif create mode 100644 sound/direct_sound_samples/cry_meganium.aif create mode 100644 sound/direct_sound_samples/cry_meowth.aif create mode 100644 sound/direct_sound_samples/cry_metagross.aif create mode 100644 sound/direct_sound_samples/cry_metang.aif create mode 100644 sound/direct_sound_samples/cry_metapod.aif create mode 100644 sound/direct_sound_samples/cry_mew.aif create mode 100644 sound/direct_sound_samples/cry_mewtwo.aif create mode 100644 sound/direct_sound_samples/cry_mightyena.aif create mode 100644 sound/direct_sound_samples/cry_milotic.aif create mode 100644 sound/direct_sound_samples/cry_miltank.aif create mode 100644 sound/direct_sound_samples/cry_minun.aif create mode 100644 sound/direct_sound_samples/cry_misdreavus.aif create mode 100644 sound/direct_sound_samples/cry_moltres.aif create mode 100644 sound/direct_sound_samples/cry_mr_mime.aif create mode 100644 sound/direct_sound_samples/cry_mudkip.aif create mode 100644 sound/direct_sound_samples/cry_muk.aif create mode 100644 sound/direct_sound_samples/cry_murkrow.aif create mode 100644 sound/direct_sound_samples/cry_natu.aif create mode 100644 sound/direct_sound_samples/cry_nidoking.aif create mode 100644 sound/direct_sound_samples/cry_nidoqueen.aif create mode 100644 sound/direct_sound_samples/cry_nidoran_f.aif create mode 100644 sound/direct_sound_samples/cry_nidoran_m.aif create mode 100644 sound/direct_sound_samples/cry_nidorina.aif create mode 100644 sound/direct_sound_samples/cry_nidorino.aif create mode 100644 sound/direct_sound_samples/cry_nincada.aif create mode 100644 sound/direct_sound_samples/cry_ninetales.aif create mode 100644 sound/direct_sound_samples/cry_ninjask.aif create mode 100644 sound/direct_sound_samples/cry_noctowl.aif create mode 100644 sound/direct_sound_samples/cry_none.aif create mode 100644 sound/direct_sound_samples/cry_nosepass.aif create mode 100644 sound/direct_sound_samples/cry_numel.aif create mode 100644 sound/direct_sound_samples/cry_nuzleaf.aif create mode 100644 sound/direct_sound_samples/cry_octillery.aif create mode 100644 sound/direct_sound_samples/cry_oddish.aif create mode 100644 sound/direct_sound_samples/cry_omanyte.aif create mode 100644 sound/direct_sound_samples/cry_omastar.aif create mode 100644 sound/direct_sound_samples/cry_onix.aif create mode 100644 sound/direct_sound_samples/cry_paras.aif create mode 100644 sound/direct_sound_samples/cry_parasect.aif create mode 100644 sound/direct_sound_samples/cry_pelipper.aif create mode 100644 sound/direct_sound_samples/cry_persian.aif create mode 100644 sound/direct_sound_samples/cry_phanpy.aif create mode 100644 sound/direct_sound_samples/cry_pichu.aif create mode 100644 sound/direct_sound_samples/cry_pidgeot.aif create mode 100644 sound/direct_sound_samples/cry_pidgeotto.aif create mode 100644 sound/direct_sound_samples/cry_pidgey.aif create mode 100644 sound/direct_sound_samples/cry_pikachu.aif create mode 100644 sound/direct_sound_samples/cry_piloswine.aif create mode 100644 sound/direct_sound_samples/cry_pineco.aif create mode 100644 sound/direct_sound_samples/cry_pinsir.aif create mode 100644 sound/direct_sound_samples/cry_plusle.aif create mode 100644 sound/direct_sound_samples/cry_politoed.aif create mode 100644 sound/direct_sound_samples/cry_poliwag.aif create mode 100644 sound/direct_sound_samples/cry_poliwhirl.aif create mode 100644 sound/direct_sound_samples/cry_poliwrath.aif create mode 100644 sound/direct_sound_samples/cry_ponyta.aif create mode 100644 sound/direct_sound_samples/cry_poochyena.aif create mode 100644 sound/direct_sound_samples/cry_porygon.aif create mode 100644 sound/direct_sound_samples/cry_porygon2.aif create mode 100644 sound/direct_sound_samples/cry_primeape.aif create mode 100644 sound/direct_sound_samples/cry_psyduck.aif create mode 100644 sound/direct_sound_samples/cry_pupitar.aif create mode 100644 sound/direct_sound_samples/cry_quagsire.aif create mode 100644 sound/direct_sound_samples/cry_quilava.aif create mode 100644 sound/direct_sound_samples/cry_qwilfish.aif create mode 100644 sound/direct_sound_samples/cry_raichu.aif create mode 100644 sound/direct_sound_samples/cry_raikou.aif create mode 100644 sound/direct_sound_samples/cry_ralts.aif create mode 100644 sound/direct_sound_samples/cry_rapidash.aif create mode 100644 sound/direct_sound_samples/cry_raticate.aif create mode 100644 sound/direct_sound_samples/cry_rattata.aif create mode 100644 sound/direct_sound_samples/cry_rayquaza.aif create mode 100644 sound/direct_sound_samples/cry_regice.aif create mode 100644 sound/direct_sound_samples/cry_regirock.aif create mode 100644 sound/direct_sound_samples/cry_registeel.aif create mode 100644 sound/direct_sound_samples/cry_relicanth.aif create mode 100644 sound/direct_sound_samples/cry_remoraid.aif create mode 100644 sound/direct_sound_samples/cry_rhydon.aif create mode 100644 sound/direct_sound_samples/cry_rhyhorn.aif create mode 100644 sound/direct_sound_samples/cry_roselia.aif create mode 100644 sound/direct_sound_samples/cry_sableye.aif create mode 100644 sound/direct_sound_samples/cry_salamence.aif create mode 100644 sound/direct_sound_samples/cry_sandshrew.aif create mode 100644 sound/direct_sound_samples/cry_sandslash.aif create mode 100644 sound/direct_sound_samples/cry_sceptile.aif create mode 100644 sound/direct_sound_samples/cry_scizor.aif create mode 100644 sound/direct_sound_samples/cry_scyther.aif create mode 100644 sound/direct_sound_samples/cry_seadra.aif create mode 100644 sound/direct_sound_samples/cry_seaking.aif create mode 100644 sound/direct_sound_samples/cry_sealeo.aif create mode 100644 sound/direct_sound_samples/cry_seedot.aif create mode 100644 sound/direct_sound_samples/cry_seel.aif create mode 100644 sound/direct_sound_samples/cry_sentret.aif create mode 100644 sound/direct_sound_samples/cry_seviper.aif create mode 100644 sound/direct_sound_samples/cry_sharpedo.aif create mode 100644 sound/direct_sound_samples/cry_shedinja.aif create mode 100644 sound/direct_sound_samples/cry_shelgon.aif create mode 100644 sound/direct_sound_samples/cry_shellder.aif create mode 100644 sound/direct_sound_samples/cry_shiftry.aif create mode 100644 sound/direct_sound_samples/cry_shroomish.aif create mode 100644 sound/direct_sound_samples/cry_shuckle.aif create mode 100644 sound/direct_sound_samples/cry_shuppet.aif create mode 100644 sound/direct_sound_samples/cry_silcoon.aif create mode 100644 sound/direct_sound_samples/cry_skarmory.aif create mode 100644 sound/direct_sound_samples/cry_skiploom.aif create mode 100644 sound/direct_sound_samples/cry_skitty.aif create mode 100644 sound/direct_sound_samples/cry_slaking.aif create mode 100644 sound/direct_sound_samples/cry_slakoth.aif create mode 100644 sound/direct_sound_samples/cry_slowbro.aif create mode 100644 sound/direct_sound_samples/cry_slowking.aif create mode 100644 sound/direct_sound_samples/cry_slowpoke.aif create mode 100644 sound/direct_sound_samples/cry_slugma.aif create mode 100644 sound/direct_sound_samples/cry_smeargle.aif create mode 100644 sound/direct_sound_samples/cry_smoochum.aif create mode 100644 sound/direct_sound_samples/cry_sneasel.aif create mode 100644 sound/direct_sound_samples/cry_snorlax.aif create mode 100644 sound/direct_sound_samples/cry_snorunt.aif create mode 100644 sound/direct_sound_samples/cry_snubbull.aif create mode 100644 sound/direct_sound_samples/cry_solrock.aif create mode 100644 sound/direct_sound_samples/cry_spearow.aif create mode 100644 sound/direct_sound_samples/cry_spheal.aif create mode 100644 sound/direct_sound_samples/cry_spinarak.aif create mode 100644 sound/direct_sound_samples/cry_spinda.aif create mode 100644 sound/direct_sound_samples/cry_spoink.aif create mode 100644 sound/direct_sound_samples/cry_squirtle.aif create mode 100644 sound/direct_sound_samples/cry_stantler.aif create mode 100644 sound/direct_sound_samples/cry_starmie.aif create mode 100644 sound/direct_sound_samples/cry_staryu.aif create mode 100644 sound/direct_sound_samples/cry_steelix.aif create mode 100644 sound/direct_sound_samples/cry_sudowoodo.aif create mode 100644 sound/direct_sound_samples/cry_suicune.aif create mode 100644 sound/direct_sound_samples/cry_sunflora.aif create mode 100644 sound/direct_sound_samples/cry_sunkern.aif create mode 100644 sound/direct_sound_samples/cry_surskit.aif create mode 100644 sound/direct_sound_samples/cry_swablu.aif create mode 100644 sound/direct_sound_samples/cry_swalot.aif create mode 100644 sound/direct_sound_samples/cry_swampert.aif create mode 100644 sound/direct_sound_samples/cry_swellow.aif create mode 100644 sound/direct_sound_samples/cry_swinub.aif create mode 100644 sound/direct_sound_samples/cry_taillow.aif create mode 100644 sound/direct_sound_samples/cry_tangela.aif create mode 100644 sound/direct_sound_samples/cry_tauros.aif create mode 100644 sound/direct_sound_samples/cry_teddiursa.aif create mode 100644 sound/direct_sound_samples/cry_tentacool.aif create mode 100644 sound/direct_sound_samples/cry_tentacruel.aif create mode 100644 sound/direct_sound_samples/cry_togepi.aif create mode 100644 sound/direct_sound_samples/cry_togetic.aif create mode 100644 sound/direct_sound_samples/cry_torchic.aif create mode 100644 sound/direct_sound_samples/cry_torkoal.aif create mode 100644 sound/direct_sound_samples/cry_totodile.aif create mode 100644 sound/direct_sound_samples/cry_trapinch.aif create mode 100644 sound/direct_sound_samples/cry_treecko.aif create mode 100644 sound/direct_sound_samples/cry_tropius.aif create mode 100644 sound/direct_sound_samples/cry_typhlosion.aif create mode 100644 sound/direct_sound_samples/cry_tyranitar.aif create mode 100644 sound/direct_sound_samples/cry_tyrogue.aif create mode 100644 sound/direct_sound_samples/cry_umbreon.aif create mode 100644 sound/direct_sound_samples/cry_unown.aif create mode 100644 sound/direct_sound_samples/cry_unused_265.aif create mode 100644 sound/direct_sound_samples/cry_unused_268.aif create mode 100644 sound/direct_sound_samples/cry_ursaring.aif create mode 100644 sound/direct_sound_samples/cry_vaporeon.aif create mode 100644 sound/direct_sound_samples/cry_venomoth.aif create mode 100644 sound/direct_sound_samples/cry_venonat.aif create mode 100644 sound/direct_sound_samples/cry_venusaur.aif create mode 100644 sound/direct_sound_samples/cry_vibrava.aif create mode 100644 sound/direct_sound_samples/cry_victreebel.aif create mode 100644 sound/direct_sound_samples/cry_vigoroth.aif create mode 100644 sound/direct_sound_samples/cry_vileplume.aif create mode 100644 sound/direct_sound_samples/cry_volbeat.aif create mode 100644 sound/direct_sound_samples/cry_voltorb.aif create mode 100644 sound/direct_sound_samples/cry_vulpix.aif create mode 100644 sound/direct_sound_samples/cry_wailmer.aif create mode 100644 sound/direct_sound_samples/cry_wailord.aif create mode 100644 sound/direct_sound_samples/cry_walrein.aif create mode 100644 sound/direct_sound_samples/cry_wartortle.aif create mode 100644 sound/direct_sound_samples/cry_weedle.aif create mode 100644 sound/direct_sound_samples/cry_weepinbell.aif create mode 100644 sound/direct_sound_samples/cry_weezing.aif create mode 100644 sound/direct_sound_samples/cry_whiscash.aif create mode 100644 sound/direct_sound_samples/cry_whismur.aif create mode 100644 sound/direct_sound_samples/cry_wigglytuff.aif create mode 100644 sound/direct_sound_samples/cry_wingull.aif create mode 100644 sound/direct_sound_samples/cry_wobbuffet.aif create mode 100644 sound/direct_sound_samples/cry_wooper.aif create mode 100644 sound/direct_sound_samples/cry_wurmple.aif create mode 100644 sound/direct_sound_samples/cry_wynaut.aif create mode 100644 sound/direct_sound_samples/cry_xatu.aif create mode 100644 sound/direct_sound_samples/cry_yanma.aif create mode 100644 sound/direct_sound_samples/cry_zangoose.aif create mode 100644 sound/direct_sound_samples/cry_zapdos.aif create mode 100644 sound/direct_sound_samples/cry_zigzagoon.aif create mode 100644 sound/direct_sound_samples/cry_zubat.aif delete mode 100644 sound/programmable_wave_samples/84553BC.aif create mode 100644 sound/programmable_wave_samples/84553BC.pcm delete mode 100644 sound/programmable_wave_samples/84553CC.aif create mode 100644 sound/programmable_wave_samples/84553CC.pcm delete mode 100644 sound/programmable_wave_samples/84553DC.aif create mode 100644 sound/programmable_wave_samples/84553DC.pcm delete mode 100644 sound/programmable_wave_samples/84553EC.aif create mode 100644 sound/programmable_wave_samples/84553EC.pcm delete mode 100644 sound/programmable_wave_samples/84553FC.aif create mode 100644 sound/programmable_wave_samples/84553FC.pcm delete mode 100644 sound/programmable_wave_samples/845540C.aif create mode 100644 sound/programmable_wave_samples/845540C.pcm delete mode 100644 sound/programmable_wave_samples/845541C.aif create mode 100644 sound/programmable_wave_samples/845541C.pcm delete mode 100644 sound/programmable_wave_samples/845542C.aif create mode 100644 sound/programmable_wave_samples/845542C.pcm delete mode 100644 sound/programmable_wave_samples/845543C.aif create mode 100644 sound/programmable_wave_samples/845543C.pcm delete mode 100644 sound/programmable_wave_samples/845544C.aif create mode 100644 sound/programmable_wave_samples/845544C.pcm diff --git a/Makefile b/Makefile index 11f59093c..dbdf82516 100644 --- a/Makefile +++ b/Makefile @@ -104,7 +104,7 @@ compare_sapphire_rev2: sapphire_rev2 @$(SHA1) sapphire_rev2.sha1 clean: tidy - rm -f sound/programmable_wave_samples/*.bin sound/direct_sound_samples/*.bin sound/**/*.pcm + rm -f sound/programmable_wave_samples/*.bin sound/direct_sound_samples/*.bin rm -f $(SONG_OBJS) find . \( -iname '*.1bpp' -o -iname '*.4bpp' -o -iname '*.8bpp' -o -iname '*.gbapal' -o -iname '*.lz' -o -iname '*.rl' \) -exec rm {} + @@ -126,7 +126,6 @@ include generated.mk include misc.mk %.s: ; -%.bin: ; %.png: ; %.pal: ; %.aif: ; @@ -137,8 +136,8 @@ include misc.mk %.gbapal: %.pal ; $(GFX) $< $@ %.lz: % ; $(GFX) $< $@ %.rl: % ; $(GFX) $< $@ -%.pcm: %.aif ; $(AIF) $< $@ -%.bin: %.aif ; $(AIF) $< $@ +%.bin: %.aif ; $(AIF) $< $@ +sound/direct_sound_samples/cry_%.bin: sound/direct_sound_samples/cry_%.aif ; $(AIF) $< $@ --compress sound/songs/%.s: sound/songs/%.mid cd $(@D) && ../../$(MID) $(length = ftell(f); + fseek(f, 0, SEEK_SET); + bytes->data = malloc(bytes->length); + unsigned long read = fread(bytes->data, bytes->length, 1, f); + fclose(f); + if (read <= 0) + { + FATAL_ERROR("Failed to read data from '%s'!\n", filename); + } + return bytes; +} + +void write_bytearray(const char *filename, struct Bytes *bytes) +{ + FILE *f = fopen(filename, "wb"); + if (!f) + { + FATAL_ERROR("Failed to open '%s' for writing!\n", filename); + } + fwrite(bytes->data, bytes->length, 1, f); + fclose(f); +} - return dot + 1; +void free_bytearray(struct Bytes *bytes) +{ + free(bytes->data); + free(bytes); } -void change_file_extension(char *filename, const char *new_extension) +char *get_file_extension(char *filename) { - char *dot = strrchr(filename, '.'); - if (!dot || dot == filename) + char *index = strrchr(filename, '.'); + if (!index || index == filename) { - FATAL_ERROR("Input file has no file extension.\n"); + return NULL; } + return index + 1; +} - memcpy(dot + 1, new_extension, 3); +char *new_file_extension(char *filename, char *ext) +{ + char *index = strrchr(filename, '.'); + if (!index || index == filename) + { + index = filename + strlen(filename); + } + int length = index - filename; + char *new_filename = malloc(length + 1 + strlen(ext) + 1); + if (new_filename) + { + strcpy(new_filename, filename); + new_filename[length] = '.'; + strcpy(new_filename + length + 1, ext); + } + return new_filename; } -AifData *read_aif(uint8_t * aif_file_data, unsigned long aif_file_data_size) +AifData *read_aif(struct Bytes *aif) { AifData *aif_data = (AifData *)malloc(sizeof(AifData)); + aif_data->has_loop = false; + aif_data->num_samples = 0; unsigned long pos = 0; char chunk_name[5]; chunk_name[4] = '\0'; char chunk_type[5]; chunk_type[4] = '\0'; // Check for FORM Chunk - memcpy(chunk_name, aif_file_data + pos, 4); + memcpy(chunk_name, &aif->data[pos], 4); pos += 4; if (strcmp(chunk_name, "FORM") != 0) { @@ -96,19 +147,19 @@ AifData *read_aif(uint8_t * aif_file_data, unsigned long aif_file_data_size) } // Read size of whole file. - unsigned long whole_chunk_size = aif_file_data[pos++] << 24; - whole_chunk_size |= (aif_file_data[pos++] << 16); - whole_chunk_size |= (aif_file_data[pos++] << 8); - whole_chunk_size |= (uint8_t)aif_file_data[pos++]; + unsigned long whole_chunk_size = aif->data[pos++] << 24; + whole_chunk_size |= (aif->data[pos++] << 16); + whole_chunk_size |= (aif->data[pos++] << 8); + whole_chunk_size |= (uint8_t)aif->data[pos++]; - unsigned long expected_whole_chunk_size = aif_file_data_size - 8; + unsigned long expected_whole_chunk_size = aif->length - 8; if (whole_chunk_size != expected_whole_chunk_size) { FATAL_ERROR("FORM Chunk ckSize '%lu' doesn't match actual size '%lu'!\n", whole_chunk_size, expected_whole_chunk_size); } // Check for AIFF Form Type - memcpy(chunk_type, aif_file_data + pos, 4); + memcpy(chunk_type, &aif->data[pos], 4); pos += 4; if (strcmp(chunk_type, "AIFF") != 0) { @@ -118,44 +169,44 @@ AifData *read_aif(uint8_t * aif_file_data, unsigned long aif_file_data_size) unsigned long num_sample_frames = 0; // Read all the Chunks to populate the AifData struct. - while ((pos + 8) < aif_file_data_size) + while ((pos + 8) < aif->length) { // Read Chunk id - memcpy(chunk_name, aif_file_data + pos, 4); + memcpy(chunk_name, &aif->data[pos], 4); pos += 4; - unsigned long chunk_size = (aif_file_data[pos++] << 24); - chunk_size |= (aif_file_data[pos++] << 16); - chunk_size |= (aif_file_data[pos++] << 8); - chunk_size |= aif_file_data[pos++]; + unsigned long chunk_size = (aif->data[pos++] << 24); + chunk_size |= (aif->data[pos++] << 16); + chunk_size |= (aif->data[pos++] << 8); + chunk_size |= aif->data[pos++]; - if ((pos + chunk_size) > aif_file_data_size) + if ((pos + chunk_size) > aif->length) { FATAL_ERROR("%s chunk at 0x%lx reached end of file before finishing\n", chunk_name, pos); } if (strcmp(chunk_name, "COMM") == 0) { - short num_channels = (aif_file_data[pos++] << 8); - num_channels |= (uint8_t)aif_file_data[pos++]; + short num_channels = (aif->data[pos++] << 8); + num_channels |= (uint8_t)aif->data[pos++]; if (num_channels != 1) { FATAL_ERROR("numChannels (%d) in the COMM Chunk must be 1!\n", num_channels); } - num_sample_frames = (aif_file_data[pos++] << 24); - num_sample_frames |= (aif_file_data[pos++] << 16); - num_sample_frames |= (aif_file_data[pos++] << 8); - num_sample_frames |= (uint8_t)aif_file_data[pos++]; + num_sample_frames = (aif->data[pos++] << 24); + num_sample_frames |= (aif->data[pos++] << 16); + num_sample_frames |= (aif->data[pos++] << 8); + num_sample_frames |= (uint8_t)aif->data[pos++]; - short sample_size = (aif_file_data[pos++] << 8); - sample_size |= (uint8_t)aif_file_data[pos++]; + short sample_size = (aif->data[pos++] << 8); + sample_size |= (uint8_t)aif->data[pos++]; if (sample_size != 8) { FATAL_ERROR("sampleSize (%d) in the COMM Chunk must be 8!\n", sample_size); } - double sample_rate = ieee754_read_extended((uint8_t*)(aif_file_data + pos)); + double sample_rate = ieee754_read_extended((uint8_t*)(aif->data + pos)); pos += 10; aif_data->sample_rate = sample_rate; @@ -167,32 +218,31 @@ AifData *read_aif(uint8_t * aif_file_data, unsigned long aif_file_data_size) } else if (strcmp(chunk_name, "MARK") == 0) { - unsigned short num_markers = (aif_file_data[pos++] << 8); - num_markers |= (uint8_t)aif_file_data[pos++]; - - unsigned long loop_start = 0; + unsigned short num_markers = (aif->data[pos++] << 8); + num_markers |= (uint8_t)aif->data[pos++]; // Read each marker and look for the "START" marker. for (int i = 0; i < num_markers; i++) { - unsigned short marker_id = (aif_file_data[pos++] << 8); - marker_id |= (uint8_t)aif_file_data[pos++]; + unsigned short marker_id = (aif->data[pos++] << 8); + marker_id |= (uint8_t)aif->data[pos++]; - unsigned long marker_position = (aif_file_data[pos++] << 24); - marker_position |= (aif_file_data[pos++] << 16); - marker_position |= (aif_file_data[pos++] << 8); - marker_position |= (uint8_t)aif_file_data[pos++]; + unsigned long marker_position = (aif->data[pos++] << 24); + marker_position |= (aif->data[pos++] << 16); + marker_position |= (aif->data[pos++] << 8); + marker_position |= (uint8_t)aif->data[pos++]; // Marker id is a pascal-style string. - uint8_t marker_name_size = aif_file_data[pos++]; + uint8_t marker_name_size = aif->data[pos++]; char *marker_name = (char *)malloc((marker_name_size + 1) * sizeof(char)); - memcpy(marker_name, aif_file_data + pos, marker_name_size); + memcpy(marker_name, &aif->data[pos], marker_name_size); marker_name[marker_name_size] = '\0'; pos += marker_name_size; if (strcmp(marker_name, "START") == 0) { - loop_start = marker_position; + aif_data->loop_offset = marker_position; + aif_data->has_loop = true; } else if (strcmp(marker_name, "END") == 0) { @@ -201,12 +251,10 @@ AifData *read_aif(uint8_t * aif_file_data, unsigned long aif_file_data_size) free(marker_name); } - - aif_data->loop_offset = loop_start; } else if (strcmp(chunk_name, "INST") == 0) { - uint8_t midi_note = (uint8_t)aif_file_data[pos++]; + uint8_t midi_note = (uint8_t)aif->data[pos++]; aif_data->midi_note = midi_note; @@ -218,15 +266,16 @@ AifData *read_aif(uint8_t * aif_file_data, unsigned long aif_file_data_size) // SKip offset and blockSize pos += 8; - uint8_t *sample_data = (uint8_t *)malloc(num_sample_frames * sizeof(uint8_t)); - memcpy(sample_data, aif_file_data + pos, num_sample_frames); + unsigned long num_samples = chunk_size - 8; + uint8_t *sample_data = (uint8_t *)malloc(num_samples * sizeof(uint8_t)); + memcpy(sample_data, &aif->data[pos], num_samples); aif_data->samples = sample_data; - pos += num_sample_frames; + pos += chunk_size - 8; } else { - // Skip over stuff we unsupported chunks. + // Skip over unsupported chunks. pos += chunk_size; } } @@ -234,368 +283,583 @@ AifData *read_aif(uint8_t * aif_file_data, unsigned long aif_file_data_size) return aif_data; } -// Reads an .aif file and produces a .pcm file containing an array of 8-bit samples. -void aif2pcm(const char *aif_filename) -{ - // Get .pcm filename. - char *pcm_filename = malloc(strlen(aif_filename) + 1); +// This is a table of deltas between sample values in compressed PCM data. +const int8_t gDeltaEncodingTable[] = { + 0, 1, 4, 9, 16, 25, 36, 49, + -64, -49, -36, -25, -16, -9, -4, -1, +}; - if (!pcm_filename) +struct Bytes *delta_decompress(struct Bytes *delta, unsigned int expected_length) +{ + struct Bytes *pcm = malloc(sizeof(struct Bytes)); + pcm->length = expected_length; + pcm->data = malloc(pcm->length + 0x40); + + uint8_t hi, lo; + unsigned int i = 0; + unsigned int j = 0; + int k; + int8_t base; + while (i < delta->length) { - FATAL_ERROR("Failed to allocate space for pcm filename.\n"); + base = (int8_t)delta->data[i++]; + pcm->data[j++] = (uint8_t)base; + if (i >= delta->length) + { + break; + } + if (j >= pcm->length) + { + break; + } + lo = delta->data[i] & 0xf; + base += gDeltaEncodingTable[lo]; + pcm->data[j++] = base; + i++; + if (i >= delta->length) + { + break; + } + if (j >= pcm->length) + { + break; + } + for (k = 0; k < 31; k++) + { + hi = (delta->data[i] >> 4) & 0xf; + base += gDeltaEncodingTable[hi]; + pcm->data[j++] = base; + if (j >= pcm->length) + { + break; + } + lo = delta->data[i] & 0xf; + base += gDeltaEncodingTable[lo]; + pcm->data[j++] = base; + i++; + if (i >= delta->length) + { + break; + } + if (j >= pcm->length) + { + break; + } + } + if (j >= pcm->length) + { + break; + } } - strcpy(pcm_filename, aif_filename); - change_file_extension(pcm_filename, "pcm"); + pcm->length = j; + return pcm; +} - // Get .metadata filename. - char *metadata_filename = malloc(strlen(aif_filename) + 1); +struct Bytes *delta_compress(struct Bytes *pcm) +{ + struct Bytes *delta = malloc(sizeof(struct Bytes)); + // estimate the length so we can malloc + int num_blocks = pcm->length / 64; + delta->length = num_blocks * 33; - if (!metadata_filename) + int extra = pcm->length % 64; + if (extra) + { + delta->length += 1; + extra -= 1; + } + if (extra) { - FATAL_ERROR("Failed to allocate space for metadata filename.\n"); + delta->length += 1; + extra -= 1; + } + if (extra) + { + delta->length += (extra + 1) / 2; } - strcpy(metadata_filename, aif_filename); - change_file_extension(metadata_filename, "bin"); + delta->data = malloc(delta->length + 33); - // Open the given .aif file so we can read its contents. - FILE *aif_file; - aif_file = fopen(aif_filename, "rb"); - if (!aif_file) + uint8_t hi, lo; + unsigned int i = 0; + unsigned int j = 0; + int k; + int l; + int8_t base; + int8_t diff; + while (i < pcm->length) { - FATAL_ERROR("Failed to open '%s' for reading!\n", aif_filename); + base = (int8_t)pcm->data[i++]; + delta->data[j++] = (uint8_t)base; + if (i >= pcm->length) + { + break; + } + hi = 0; + diff = pcm->data[i++] - base; + if (diff > 49) + { + diff = -diff; + } + if (diff < 0) + { + for (l = 8; l < 16; l++) + { + lo = l & 0xf; + if (diff <= gDeltaEncodingTable[l]) break; + } + } + else + { + for (l = 0; l < 8; l++) + { + lo = l & 0xf; + if (diff <= gDeltaEncodingTable[l]) break; + } + } + base += diff; + delta->data[j++] = (hi << 4) | lo; + if (i >= pcm->length) + { + break; + } + for (k = 0; k < 31; k++) + { + diff = pcm->data[i++] - base; + if (diff > 49) diff = -diff; + if (diff < 0) + { + for (l = 8; l < 16; l++) + { + hi = l & 0xf; + if (diff <= gDeltaEncodingTable[l]) break; + } + } + else + { + for (l = 0; l < 8; l++) + { + hi = l & 0xf; + if (diff <= gDeltaEncodingTable[l]) break; + } + } + base += diff; + delta->data[j] = (hi << 4); + if (i >= pcm->length) + { + break; + } + diff = pcm->data[i++] - base; + if (diff > 49) diff = -diff; + if (diff < 0) + { + for (l = 8; l < 16; l++) + { + lo = l & 0xf; + if (diff <= gDeltaEncodingTable[l]) break; + } + } + else + { + for (l = 0; l < 8; l++) + { + lo = l & 0xf; + if (diff <= gDeltaEncodingTable[l]) break; + } + } + base += diff; + delta->data[j++] = (hi << 4) | lo; + if (i >= pcm->length) + { + break; + } + } + if (i >= pcm->length) + { + break; + } } - // Get file length. - fseek(aif_file, 0, SEEK_END); - unsigned long aif_file_length = ftell(aif_file); - fseek(aif_file, 0, SEEK_SET); + delta->length = j; + + return delta; +} - // Create buffer for samples. - uint8_t *aif_file_data = (uint8_t *)malloc(aif_file_length * sizeof(uint8_t)); - if (!aif_file_data) +#define STORE_U32_LE(dest, value) \ +do { \ + *(dest) = (value) & 0xff; \ + *((dest) + 1) = ((value) >> 8) & 0xff; \ + *((dest) + 2) = ((value) >> 16) & 0xff; \ + *((dest) + 3) = ((value) >> 24) & 0xff; \ +} while (0) + +#define LOAD_U32_LE(var, src) \ +do { \ + (var) = *(src); \ + (var) |= (*((src) + 1) << 8); \ + (var) |= (*((src) + 2) << 16); \ + (var) |= (*((src) + 3) << 24); \ +} while (0) + +// Reads an .aif file and produces a .pcm file containing an array of 8-bit samples. +void aif2pcm(const char *aif_filename, const char *pcm_filename, bool compress) +{ + struct Bytes *aif = read_bytearray(aif_filename); + AifData *aif_data = read_aif(aif); + + int header_size = 0x10; + struct Bytes *pcm; + struct Bytes output = {0}; + + if (compress) { - FATAL_ERROR("Failed to allocate buffer for aif file data!\n"); + struct Bytes *input = malloc(sizeof(struct Bytes)); + input->data = aif_data->samples; + input->length = aif_data->num_samples; + pcm = delta_compress(input); + free(input); } - - // Populate buffer from file. - unsigned long read = fread(aif_file_data, aif_file_length, 1, aif_file); - fclose(aif_file); - if (read <= 0) + else { - FATAL_ERROR("Failed to read data from '%s'!\n", aif_filename); + pcm = malloc(sizeof(struct Bytes)); + pcm->data = aif_data->samples; + pcm->length = aif_data->num_samples; } + output.length = header_size + pcm->length; + output.data = malloc(output.length); - AifData *aif_data = read_aif(aif_file_data, aif_file_length); - - // Write the output .pcm file - FILE *pcm_file; - pcm_file = fopen(pcm_filename, "wb"); - fwrite(aif_data->samples, aif_data->num_samples, 1, pcm_file); - fclose(pcm_file); - - // Write the output .bin file containing .aif metadata. - FILE *metadata_file; - metadata_file = fopen(metadata_filename, "wb"); uint32_t pitch_adjust = (uint32_t)(aif_data->sample_rate * 1024); - fwrite(&pitch_adjust, sizeof(uint32_t), 1, metadata_file); - fwrite(&(aif_data->loop_offset), sizeof(uint32_t), 1, metadata_file); + uint32_t loop_offset = (uint32_t)(aif_data->loop_offset); uint32_t adjusted_num_samples = (uint32_t)(aif_data->num_samples - 1); - fwrite(&adjusted_num_samples, sizeof(uint32_t), 1, metadata_file); - fclose(metadata_file); - + uint32_t flags = 0; + if (aif_data->has_loop) flags |= 0x40000000; + if (compress) flags |= 1; + STORE_U32_LE(output.data + 0, flags); + STORE_U32_LE(output.data + 4, pitch_adjust); + STORE_U32_LE(output.data + 8, loop_offset); + STORE_U32_LE(output.data + 12, adjusted_num_samples); + memcpy(&output.data[header_size], pcm->data, pcm->length); + write_bytearray(pcm_filename, &output); + + free(aif->data); + free(aif); + free(pcm); + free(output.data); free(aif_data->samples); free(aif_data); - free(aif_file_data); - free(metadata_filename); - free(pcm_filename); } // Reads a .pcm file containing an array of 8-bit samples and produces an .aif file. // See http://www-mmsp.ece.mcgill.ca/documents/audioformats/aiff/Docs/AIFF-1.3.pdf for .aif file specification. -void pcm2aif(const char *pcm_filename, char base_note, long pitch_adjust, long loop_start) +void pcm2aif(const char *pcm_filename, const char *aif_filename, uint32_t base_note) { - // Get .aif filename. - char *aif_filename = malloc(strlen(pcm_filename) + 1); + struct Bytes *pcm = read_bytearray(pcm_filename); - if (!aif_filename) - { - FATAL_ERROR("Failed to allocate space for aif filename.\n"); - } + AifData *aif_data = malloc(sizeof(AifData)); - strcpy(aif_filename, pcm_filename); - change_file_extension(aif_filename, "aif"); + uint32_t flags; + LOAD_U32_LE(flags, pcm->data + 0); + aif_data->has_loop = flags & 0x40000000; + bool compressed = flags & 1; - // Open the given .pcm file so we can read its 8-bit samples. - FILE *pcm_file; - pcm_file = fopen(pcm_filename, "rb"); - if (!pcm_file) - { - FATAL_ERROR("Failed to open '%s' for reading!\n", pcm_filename); - } + uint32_t pitch_adjust; + LOAD_U32_LE(pitch_adjust, pcm->data + 4); + aif_data->sample_rate = pitch_adjust / 1024.0; - // Get file length. - fseek(pcm_file, 0, SEEK_END); - unsigned long num_samples = ftell(pcm_file); - fseek(pcm_file, 0, SEEK_SET); + LOAD_U32_LE(aif_data->loop_offset, pcm->data + 8); + LOAD_U32_LE(aif_data->num_samples, pcm->data + 12); + aif_data->num_samples += 1; - unsigned long num_samples_extended = num_samples * 1; - - // Create buffer for samples. - signed char *pcm_samples = (signed char *)malloc(num_samples_extended * sizeof(signed char)); - if (!pcm_samples) + if (compressed) { - FATAL_ERROR("Failed to allocate buffer for pcm samples!\n"); + struct Bytes *delta = pcm; + uint8_t *pcm_data = pcm->data; + delta->length -= 0x10; + delta->data += 0x10; + pcm = delta_decompress(delta, aif_data->num_samples); + free(pcm_data); + free(delta); } - - // Populate buffer from file. - unsigned long read = fread(pcm_samples, num_samples, 1, pcm_file); - fclose(pcm_file); - if (read <= 0) + else { - FATAL_ERROR("Failed to read data from '%s'!\n", pcm_filename); + pcm->length -= 0x10; + pcm->data += 0x10; } - // Allocate buffer for output .aif file. - unsigned long aif_file_size = 54 + 60 + num_samples_extended; - char *aif_buffer = (char *)malloc(aif_file_size * sizeof(char)); - if (!aif_buffer) - { - FATAL_ERROR("Failed to allocate buffer for aif file!\n"); - } + aif_data->samples = malloc(pcm->length); + memcpy(aif_data->samples, pcm->data, pcm->length); + + struct Bytes *aif = malloc(sizeof(struct Bytes)); + aif->length = 54 + 60 + aif_data->num_samples; + aif->data = malloc(aif->length); long pos = 0; // First, write the FORM header chunk. // FORM Chunk ckID - aif_buffer[pos++] = 'F'; - aif_buffer[pos++] = 'O'; - aif_buffer[pos++] = 'R'; - aif_buffer[pos++] = 'M'; + aif->data[pos++] = 'F'; + aif->data[pos++] = 'O'; + aif->data[pos++] = 'R'; + aif->data[pos++] = 'M'; // FORM Chunk ckSize - unsigned long data_size = aif_file_size - 8; - aif_buffer[pos++] = ((data_size >> 24) & 0xFF); - aif_buffer[pos++] = ((data_size >> 16) & 0xFF); - aif_buffer[pos++] = ((data_size >> 8) & 0xFF); - aif_buffer[pos++] = (data_size & 0xFF); + unsigned long form_size = pos; + unsigned long data_size = aif->length - 8; + aif->data[pos++] = ((data_size >> 24) & 0xFF); + aif->data[pos++] = ((data_size >> 16) & 0xFF); + aif->data[pos++] = ((data_size >> 8) & 0xFF); + aif->data[pos++] = (data_size & 0xFF); // FORM Chunk formType - aif_buffer[pos++] = 'A'; - aif_buffer[pos++] = 'I'; - aif_buffer[pos++] = 'F'; - aif_buffer[pos++] = 'F'; + aif->data[pos++] = 'A'; + aif->data[pos++] = 'I'; + aif->data[pos++] = 'F'; + aif->data[pos++] = 'F'; // Next, write the Common Chunk // Common Chunk ckID - aif_buffer[pos++] = 'C'; - aif_buffer[pos++] = 'O'; - aif_buffer[pos++] = 'M'; - aif_buffer[pos++] = 'M'; + aif->data[pos++] = 'C'; + aif->data[pos++] = 'O'; + aif->data[pos++] = 'M'; + aif->data[pos++] = 'M'; // Common Chunk ckSize - aif_buffer[pos++] = 0; - aif_buffer[pos++] = 0; - aif_buffer[pos++] = 0; - aif_buffer[pos++] = 18; + aif->data[pos++] = 0; + aif->data[pos++] = 0; + aif->data[pos++] = 0; + aif->data[pos++] = 18; // Common Chunk numChannels - aif_buffer[pos++] = 0; - aif_buffer[pos++] = 1; // 1 channel + aif->data[pos++] = 0; + aif->data[pos++] = 1; // 1 channel // Common Chunk numSampleFrames - aif_buffer[pos++] = ((num_samples_extended >> 24) & 0xFF); - aif_buffer[pos++] = ((num_samples_extended >> 16) & 0xFF); - aif_buffer[pos++] = ((num_samples_extended >> 8) & 0xFF); - aif_buffer[pos++] = (num_samples_extended & 0xFF); + aif->data[pos++] = ((pcm->length >> 24) & 0xFF); + aif->data[pos++] = ((pcm->length >> 16) & 0xFF); + aif->data[pos++] = ((pcm->length >> 8) & 0xFF); + aif->data[pos++] = (pcm->length & 0xFF); // Common Chunk sampleSize - aif_buffer[pos++] = 0; - aif_buffer[pos++] = 8; // 8 bits per sample + aif->data[pos++] = 0; + aif->data[pos++] = 8; // 8 bits per sample // Common Chunk sampleRate - double sample_rate = pitch_adjust / 1024.0; + //double sample_rate = pitch_adjust / 1024.0; uint8_t sample_rate_buffer[10]; - ieee754_write_extended(sample_rate, sample_rate_buffer); + ieee754_write_extended(aif_data->sample_rate, sample_rate_buffer); for (int i = 0; i < 10; i++) { - aif_buffer[pos++] = sample_rate_buffer[i]; + aif->data[pos++] = sample_rate_buffer[i]; } // Marker Chunk ckID - aif_buffer[pos++] = 'M'; - aif_buffer[pos++] = 'A'; - aif_buffer[pos++] = 'R'; - aif_buffer[pos++] = 'K'; + aif->data[pos++] = 'M'; + aif->data[pos++] = 'A'; + aif->data[pos++] = 'R'; + aif->data[pos++] = 'K'; // Marker Chunk ckSize - aif_buffer[pos++] = 0; - aif_buffer[pos++] = 0; - aif_buffer[pos++] = 0; - aif_buffer[pos++] = 24; + aif->data[pos++] = 0; + aif->data[pos++] = 0; + aif->data[pos++] = 0; + aif->data[pos++] = 12 + (aif_data->has_loop ? 12 : 0); // Marker Chunk numMarkers - aif_buffer[pos++] = 0; - aif_buffer[pos++] = 2; - - // Marker loop start - aif_buffer[pos++] = 0; - aif_buffer[pos++] = 1; // id = 1 - - aif_buffer[pos++] = ((loop_start >> 24) & 0xFF); - aif_buffer[pos++] = ((loop_start >> 16) & 0xFF); - aif_buffer[pos++] = ((loop_start >> 8) & 0xFF); - aif_buffer[pos++] = (loop_start & 0xFF); // position + aif->data[pos++] = 0; + aif->data[pos++] = (aif_data->has_loop ? 2 : 1); - aif_buffer[pos++] = 5; // pascal-style string length - aif_buffer[pos++] = 'S'; - aif_buffer[pos++] = 'T'; - aif_buffer[pos++] = 'A'; - aif_buffer[pos++] = 'R'; - aif_buffer[pos++] = 'T'; // markerName + if (aif_data->has_loop) + { + // Marker loop start + aif->data[pos++] = 0; + aif->data[pos++] = 1; // id = 1 + + long loop_start = aif_data->loop_offset; + aif->data[pos++] = ((loop_start >> 24) & 0xFF); + aif->data[pos++] = ((loop_start >> 16) & 0xFF); + aif->data[pos++] = ((loop_start >> 8) & 0xFF); + aif->data[pos++] = (loop_start & 0xFF); // position + + aif->data[pos++] = 5; // pascal-style string length + aif->data[pos++] = 'S'; + aif->data[pos++] = 'T'; + aif->data[pos++] = 'A'; + aif->data[pos++] = 'R'; + aif->data[pos++] = 'T'; // markerName + } // Marker loop end - aif_buffer[pos++] = 0; - aif_buffer[pos++] = 2; // id = 2 + aif->data[pos++] = 0; + aif->data[pos++] = (aif_data->has_loop ? 2 : 1); // id = 2 - long loop_end = num_samples; - aif_buffer[pos++] = ((loop_end >> 24) & 0xFF); - aif_buffer[pos++] = ((loop_end >> 16) & 0xFF); - aif_buffer[pos++] = ((loop_end >> 8) & 0xFF); - aif_buffer[pos++] = (loop_end & 0xFF); // position - - aif_buffer[pos++] = 3; // pascal-style string length - aif_buffer[pos++] = 'E'; - aif_buffer[pos++] = 'N'; - aif_buffer[pos++] = 'D'; + long loop_end = aif_data->num_samples; + aif->data[pos++] = ((loop_end >> 24) & 0xFF); + aif->data[pos++] = ((loop_end >> 16) & 0xFF); + aif->data[pos++] = ((loop_end >> 8) & 0xFF); + aif->data[pos++] = (loop_end & 0xFF); // position + aif->data[pos++] = 3; // pascal-style string length + aif->data[pos++] = 'E'; + aif->data[pos++] = 'N'; + aif->data[pos++] = 'D'; // Instrument Chunk ckID - aif_buffer[pos++] = 'I'; - aif_buffer[pos++] = 'N'; - aif_buffer[pos++] = 'S'; - aif_buffer[pos++] = 'T'; + aif->data[pos++] = 'I'; + aif->data[pos++] = 'N'; + aif->data[pos++] = 'S'; + aif->data[pos++] = 'T'; // Instrument Chunk ckSize - aif_buffer[pos++] = 0; - aif_buffer[pos++] = 0; - aif_buffer[pos++] = 0; - aif_buffer[pos++] = 20; - - aif_buffer[pos++] = base_note; // baseNote - aif_buffer[pos++] = 0; // detune - aif_buffer[pos++] = 0; // lowNote - aif_buffer[pos++] = 127; // highNote - aif_buffer[pos++] = 1; // lowVelocity - aif_buffer[pos++] = 127; // highVelocity - aif_buffer[pos++] = 0; // gain (hi) - aif_buffer[pos++] = 0; // gain (lo) + aif->data[pos++] = 0; + aif->data[pos++] = 0; + aif->data[pos++] = 0; + aif->data[pos++] = 20; + + aif->data[pos++] = base_note; // baseNote + aif->data[pos++] = 0; // detune + aif->data[pos++] = 0; // lowNote + aif->data[pos++] = 127; // highNote + aif->data[pos++] = 1; // lowVelocity + aif->data[pos++] = 127; // highVelocity + aif->data[pos++] = 0; // gain (hi) + aif->data[pos++] = 0; // gain (lo) // Instrument Chunk sustainLoop - aif_buffer[pos++] = 0; - aif_buffer[pos++] = 1; // playMode = ForwardLooping + aif->data[pos++] = 0; + aif->data[pos++] = 1; // playMode = ForwardLooping - aif_buffer[pos++] = 0; - aif_buffer[pos++] = 1; // beginLoop marker id + aif->data[pos++] = 0; + aif->data[pos++] = 1; // beginLoop marker id - aif_buffer[pos++] = 0; - aif_buffer[pos++] = 2; // endLoop marker id + aif->data[pos++] = 0; + aif->data[pos++] = 2; // endLoop marker id // Instrument Chunk releaseLoop - aif_buffer[pos++] = 0; - aif_buffer[pos++] = 1; // playMode = ForwardLooping + aif->data[pos++] = 0; + aif->data[pos++] = 1; // playMode = ForwardLooping - aif_buffer[pos++] = 0; - aif_buffer[pos++] = 1; // beginLoop marker id + aif->data[pos++] = 0; + aif->data[pos++] = 1; // beginLoop marker id - aif_buffer[pos++] = 0; - aif_buffer[pos++] = 2; // endLoop marker id + aif->data[pos++] = 0; + aif->data[pos++] = 2; // endLoop marker id // Finally, write the Sound Data Chunk // Sound Data Chunk ckID - aif_buffer[pos++] = 'S'; - aif_buffer[pos++] = 'S'; - aif_buffer[pos++] = 'N'; - aif_buffer[pos++] = 'D'; + aif->data[pos++] = 'S'; + aif->data[pos++] = 'S'; + aif->data[pos++] = 'N'; + aif->data[pos++] = 'D'; // Sound Data Chunk ckSize - unsigned long sound_data_size = num_samples_extended + 8; - aif_buffer[pos++] = ((sound_data_size >> 24) & 0xFF); - aif_buffer[pos++] = ((sound_data_size >> 16) & 0xFF); - aif_buffer[pos++] = ((sound_data_size >> 8) & 0xFF); - aif_buffer[pos++] = (sound_data_size & 0xFF); + unsigned long sound_data_size = pcm->length + 8; + aif->data[pos++] = ((sound_data_size >> 24) & 0xFF); + aif->data[pos++] = ((sound_data_size >> 16) & 0xFF); + aif->data[pos++] = ((sound_data_size >> 8) & 0xFF); + aif->data[pos++] = (sound_data_size & 0xFF); // Sound Data Chunk offset - aif_buffer[pos++] = 0; - aif_buffer[pos++] = 0; - aif_buffer[pos++] = 0; - aif_buffer[pos++] = 0; + aif->data[pos++] = 0; + aif->data[pos++] = 0; + aif->data[pos++] = 0; + aif->data[pos++] = 0; // Sound Data Chunk blockSize - aif_buffer[pos++] = 0; - aif_buffer[pos++] = 0; - aif_buffer[pos++] = 0; - aif_buffer[pos++] = 0; + aif->data[pos++] = 0; + aif->data[pos++] = 0; + aif->data[pos++] = 0; + aif->data[pos++] = 0; // Sound Data Chunk soundData - for (int i = 0; i < loop_start; i++) + for (unsigned int i = 0; i < aif_data->loop_offset; i++) { - aif_buffer[pos++] = pcm_samples[i]; + aif->data[pos++] = aif_data->samples[i]; } int j = 0; - for (unsigned int i = loop_start; i < num_samples_extended; i++) + for (unsigned int i = aif_data->loop_offset; i < pcm->length; i++) { - int pcm_index = loop_start + (j++ % (num_samples - loop_start - 1)); - aif_buffer[pos++] = pcm_samples[pcm_index]; + int pcm_index = aif_data->loop_offset + (j++ % (pcm->length - aif_data->loop_offset)); + aif->data[pos++] = aif_data->samples[pcm_index]; } - // Write the .aif file contents. - FILE *aif_file; - aif_file = fopen(aif_filename, "wb"); - if (!aif_file) - { - FATAL_ERROR("Failed to open '%s' for writing!\n", aif_filename); - } + aif->length = pos; + + // Go back and rewrite ckSize + data_size = aif->length - 8; + aif->data[form_size + 0] = ((data_size >> 24) & 0xFF); + aif->data[form_size + 1] = ((data_size >> 16) & 0xFF); + aif->data[form_size + 2] = ((data_size >> 8) & 0xFF); + aif->data[form_size + 3] = (data_size & 0xFF); - fwrite(aif_buffer, 1, aif_file_size, aif_file); - fclose(aif_file); + write_bytearray(aif_filename, aif); + + free(aif->data); + free(aif); +} - free(aif_buffer); - free(pcm_samples); - free(aif_filename); +void usage(void) +{ + fprintf(stderr, "Usage: aif2pcm bin_file [aif_file]\n"); + fprintf(stderr, " aif2pcm aif_file [bin_file] [--compress]\n"); } int main(int argc, char **argv) { if (argc < 2) { - FATAL_ERROR("Usage: aif2pcm \n"); + usage(); + exit(1); } - char *input_filename = argv[1]; - char *extension = get_file_extension(input_filename); + char *input_file = argv[1]; + char *extension = get_file_extension(input_file); + char *output_file; + bool compressed = false; + + if (argc > 3) + { + for (int i = 3; i < argc; i++) + { + if (strcmp(argv[i], "--compress") == 0) + { + compressed = true; + } + } + } if (strcmp(extension, "aif") == 0) { - aif2pcm(input_filename); + if (argc >= 3) + { + output_file = argv[2]; + aif2pcm(input_file, output_file, compressed); + } + else + { + output_file = new_file_extension(input_file, "bin"); + aif2pcm(input_file, output_file, compressed); + free(output_file); + } } - else if (strcmp(extension, "pcm") == 0) + else if (strcmp(extension, "bin") == 0) { - if (argc < 5) + if (argc >= 3) { - FATAL_ERROR("Usage: aif2pcm \n"); + output_file = argv[2]; + pcm2aif(input_file, output_file, 60); + } + else + { + output_file = new_file_extension(input_file, "aif"); + pcm2aif(input_file, output_file, 60); + free(output_file); } - - char base_note = atoi(argv[2]); - long pitch_adjust = atol(argv[3]); - long loop_start = atol(argv[4]); - pcm2aif(input_filename, base_note, pitch_adjust, loop_start); } else { - FATAL_ERROR("Input file must be .aif or .pcm: '%s'\n", input_filename); + FATAL_ERROR("Input file must be .aif or .bin: '%s'\n", input_file); } return 0; -- cgit v1.2.3