Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Flod 4.1 Release

  • Loading branch information...
commit c0284cdb1ffab26dd2a61ed0d6c87073d4b8b0be 1 parent 979d123
@photonstorm authored
Showing with 15,889 additions and 2 deletions.
  1. +66 −0 Flod 4.1/demos/Demo1.as
  2. +83 −0 Flod 4.1/demos/Demo2.as
  3. +44 −0 Flod 4.1/demos/Demo3.as
  4. +62 −0 Flod 4.1/demos/Demo4.as
  5. +54 −0 Flod 4.1/demos/Demo5.as
  6. +69 −0 Flod 4.1/demos/Demo6.as
  7. +18 −0 Flod 4.1/license.txt
  8. +28 −0 Flod 4.1/neoart/flip/Huffman.as
  9. +252 −0 Flod 4.1/neoart/flip/Inflater.as
  10. +47 −0 Flod 4.1/neoart/flip/ZipEntry.as
  11. +135 −0 Flod 4.1/neoart/flip/ZipFile.as
  12. +379 −0 Flod 4.1/neoart/flod/FileLoader.as
  13. +208 −0 Flod 4.1/neoart/flod/core/Amiga.as
  14. +92 −0 Flod 4.1/neoart/flod/core/AmigaChannel.as
  15. +73 −0 Flod 4.1/neoart/flod/core/AmigaFilter.as
  16. +72 −0 Flod 4.1/neoart/flod/core/AmigaPlayer.as
  17. +27 −0 Flod 4.1/neoart/flod/core/AmigaRow.as
  18. +30 −0 Flod 4.1/neoart/flod/core/AmigaSample.as
  19. +25 −0 Flod 4.1/neoart/flod/core/AmigaStep.as
  20. +109 −0 Flod 4.1/neoart/flod/core/CoreMixer.as
  21. +157 −0 Flod 4.1/neoart/flod/core/CorePlayer.as
  22. +104 −0 Flod 4.1/neoart/flod/core/SBChannel.as
  23. +59 −0 Flod 4.1/neoart/flod/core/SBPlayer.as
  24. +99 −0 Flod 4.1/neoart/flod/core/SBSample.as
  25. +26 −0 Flod 4.1/neoart/flod/core/Sample.as
  26. +386 −0 Flod 4.1/neoart/flod/core/Soundblaster.as
  27. +456 −0 Flod 4.1/neoart/flod/deltamusic/D1Player.as
  28. +45 −0 Flod 4.1/neoart/flod/deltamusic/D1Sample.as
  29. +78 −0 Flod 4.1/neoart/flod/deltamusic/D1Voice.as
  30. +399 −0 Flod 4.1/neoart/flod/deltamusic/D2Player.as
  31. +36 −0 Flod 4.1/neoart/flod/deltamusic/D2Sample.as
  32. +86 −0 Flod 4.1/neoart/flod/deltamusic/D2Voice.as
  33. +851 −0 Flod 4.1/neoart/flod/digitalmugician/DMPlayer.as
  34. +40 −0 Flod 4.1/neoart/flod/digitalmugician/DMSample.as
  35. +34 −0 Flod 4.1/neoart/flod/digitalmugician/DMSong.as
  36. +72 −0 Flod 4.1/neoart/flod/digitalmugician/DMVoice.as
  37. +33 −0 Flod 4.1/neoart/flod/fasttracker/F2Data.as
  38. +38 −0 Flod 4.1/neoart/flod/fasttracker/F2Envelope.as
  39. +41 −0 Flod 4.1/neoart/flod/fasttracker/F2Instrument.as
  40. +32 −0 Flod 4.1/neoart/flod/fasttracker/F2Pattern.as
  41. +1,297 −0 Flod 4.1/neoart/flod/fasttracker/F2Player.as
  42. +30 −0 Flod 4.1/neoart/flod/fasttracker/F2Point.as
  43. +28 −0 Flod 4.1/neoart/flod/fasttracker/F2Row.as
  44. +27 −0 Flod 4.1/neoart/flod/fasttracker/F2Sample.as
  45. +255 −0 Flod 4.1/neoart/flod/fasttracker/F2Voice.as
  46. +599 −0 Flod 4.1/neoart/flod/fred/FEPlayer.as
  47. +57 −0 Flod 4.1/neoart/flod/fred/FESample.as
  48. +30 −0 Flod 4.1/neoart/flod/fred/FESong.as
  49. +106 −0 Flod 4.1/neoart/flod/fred/FEVoice.as
  50. +615 −0 Flod 4.1/neoart/flod/futurecomposer/FCPlayer.as
  51. +106 −0 Flod 4.1/neoart/flod/futurecomposer/FCVoice.as
  52. +849 −0 Flod 4.1/neoart/flod/hippel/JHPlayer.as
  53. +26 −0 Flod 4.1/neoart/flod/hippel/JHSong.as
  54. +119 −0 Flod 4.1/neoart/flod/hippel/JHVoice.as
  55. +410 −0 Flod 4.1/neoart/flod/hubbard/RHPlayer.as
  56. +30 −0 Flod 4.1/neoart/flod/hubbard/RHSample.as
  57. +25 −0 Flod 4.1/neoart/flod/hubbard/RHSong.as
  58. +65 −0 Flod 4.1/neoart/flod/hubbard/RHVoice.as
  59. +710 −0 Flod 4.1/neoart/flod/sidmon/S1Player.as
  60. +41 −0 Flod 4.1/neoart/flod/sidmon/S1Sample.as
  61. +78 −0 Flod 4.1/neoart/flod/sidmon/S1Voice.as
  62. +45 −0 Flod 4.1/neoart/flod/sidmon/S2Instrument.as
  63. +559 −0 Flod 4.1/neoart/flod/sidmon/S2Player.as
  64. +32 −0 Flod 4.1/neoart/flod/sidmon/S2Sample.as
  65. +25 −0 Flod 4.1/neoart/flod/sidmon/S2Step.as
  66. +82 −0 Flod 4.1/neoart/flod/sidmon/S2Voice.as
  67. +25 −0 Flod 4.1/neoart/flod/sidmon/SMRow.as
  68. +441 −0 Flod 4.1/neoart/flod/soundfx/FXPlayer.as
  69. +65 −0 Flod 4.1/neoart/flod/soundfx/FXVoice.as
  70. +622 −0 Flod 4.1/neoart/flod/soundmon/BPPlayer.as
  71. +49 −0 Flod 4.1/neoart/flod/soundmon/BPSample.as
  72. +25 −0 Flod 4.1/neoart/flod/soundmon/BPStep.as
  73. +95 −0 Flod 4.1/neoart/flod/soundmon/BPVoice.as
  74. +471 −0 Flod 4.1/neoart/flod/trackers/HMPlayer.as
  75. +29 −0 Flod 4.1/neoart/flod/trackers/HMSample.as
  76. +63 −0 Flod 4.1/neoart/flod/trackers/HMVoice.as
  77. +420 −0 Flod 4.1/neoart/flod/trackers/MKPlayer.as
  78. +57 −0 Flod 4.1/neoart/flod/trackers/MKVoice.as
  79. +741 −0 Flod 4.1/neoart/flod/trackers/PTPlayer.as
  80. +25 −0 Flod 4.1/neoart/flod/trackers/PTRow.as
  81. +26 −0 Flod 4.1/neoart/flod/trackers/PTSample.as
  82. +91 −0 Flod 4.1/neoart/flod/trackers/PTVoice.as
  83. +369 −0 Flod 4.1/neoart/flod/trackers/STPlayer.as
  84. +47 −0 Flod 4.1/neoart/flod/trackers/STVoice.as
  85. +794 −0 Flod 4.1/neoart/flod/whittaker/DWPlayer.as
  86. +26 −0 Flod 4.1/neoart/flod/whittaker/DWSample.as
  87. +26 −0 Flod 4.1/neoart/flod/whittaker/DWSong.as
  88. +87 −0 Flod 4.1/neoart/flod/whittaker/DWVoice.as
  89. +74 −0 Flod 4.1/readme.txt
  90. +18 −0 license.txt
  91. +12 −2 readme.md
View
66 Flod 4.1/demos/Demo1.as
@@ -0,0 +1,66 @@
+/*
+ Flod 4.1
+ 2012/04/30
+ Christian Corti
+ Neoart Costa Rica
+
+ Last Update: Flod 4.0 - 2012/03/10
+
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
+ OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
+ LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR
+ IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+
+ This work is licensed under the Creative Commons Attribution-Noncommercial-Share Alike 3.0 Unported License.
+ To view a copy of this license, visit http://creativecommons.org/licenses/by-nc-sa/3.0/ or send a letter to
+ Creative Commons, 171 Second Street, Suite 300, San Francisco, California, 94105, USA.
+
+ ---
+
+ This is a simple demo showing how to use the FileLoader class to play a module, in any of the supported
+ formats, loaded from the client.
+
+*/
+package {
+ import flash.display.*;
+ import flash.events.*;
+ import flash.net.*;
+ import neoart.flod.*;
+ import neoart.flod.core.*;
+
+ public final class Demo1 extends Sprite {
+ private var
+ file : FileReference,
+ loader : FileLoader,
+ player : CorePlayer;
+
+ public function Demo1() {
+ loader = new FileLoader();
+
+ stage.addEventListener(MouseEvent.CLICK, function(e:MouseEvent):void {
+ file = new FileReference();
+ file.addEventListener(Event.CANCEL, cancelHandler);
+ file.addEventListener(Event.SELECT, selectHandler);
+ file.browse();
+ });
+ }
+
+ private function cancelHandler(e:Event):void {
+ file.removeEventListener(Event.CANCEL, cancelHandler);
+ file.removeEventListener(Event.SELECT, selectHandler);
+ }
+
+ private function selectHandler(e:Event):void {
+ cancelHandler(e);
+ if (player) player.stop();
+ file.addEventListener(Event.COMPLETE, completeHandler);
+ file.load();
+ }
+
+ private function completeHandler(e:Event):void {
+ file.removeEventListener(Event.COMPLETE, completeHandler);
+ player = loader.load(file.data);
+ if (player && player.version) player.play();
+ }
+ }
+}
View
83 Flod 4.1/demos/Demo2.as
@@ -0,0 +1,83 @@
+/*
+ Flod 4.1
+ 2012/04/30
+ Christian Corti
+ Neoart Costa Rica
+
+ Last Update: Flod 4.0 - 2012/03/10
+
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
+ OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
+ LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR
+ IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+
+ This work is licensed under the Creative Commons Attribution-Noncommercial-Share Alike 3.0 Unported License.
+ To view a copy of this license, visit http://creativecommons.org/licenses/by-nc-sa/3.0/ or send a letter to
+ Creative Commons, 171 Second Street, Suite 300, San Francisco, California, 94105, USA.
+
+ ---
+
+ This is a simple demo showing how to use a single player to play a module loaded from the client.
+
+ List of available players and include locations:
+
+ D1Player Delta Music 1.0 neoart.flod.deltamusic
+ D2Player Delta Music 2.0 neoart.flod.deltamusic
+ DMPlayer Digital Mugician neoart.flod.digitalmugician
+ F2Player FastTracker II XM neoart.flod.fasttracker
+ FEPlayer FredEd neoart.flod.fred
+ FCPlayer Future Composer neoart.flod.futurecomposer
+ JHPlayer Jochen Hippel neoart.flod.hippel
+ RHPlayer Rob Hubbard neoart.flod.hubbard
+ S1Player SidMON neoart.flod.sidmon
+ S2Player SidMON II neoart.flod.sidmon
+ FXPlayer SoundFX neoart.flod.soundfx
+ BPPlayer SoundMon neoart.flod.soundmon
+ HMPlayer His Master's NoiseTracker neoart.flod.trackers
+ MKPlayer NoiseTracker neoart.flod.trackers
+ PTPlayer ProTracker neoart.flod.trackers
+ STPlayer Ultimate Soundtracker neoart.flod.trackers
+ DWPlayer David Whittaker neoart.flod.whittaker
+*/
+package {
+ import flash.display.*;
+ import flash.events.*;
+ import flash.net.*;
+ import neoart.flod.core.*;
+ import neoart.flod.fasttracker.*;
+
+ public final class Demo2 extends Sprite {
+ private var
+ file : FileReference,
+ player : F2Player;
+
+ public function Demo2() {
+ player = new F2Player();
+
+ stage.addEventListener(MouseEvent.CLICK, function(e:MouseEvent):void {
+ file = new FileReference();
+ file.addEventListener(Event.CANCEL, cancelHandler);
+ file.addEventListener(Event.SELECT, selectHandler);
+ file.browse();
+ });
+ }
+
+ private function cancelHandler(e:Event):void {
+ file.removeEventListener(Event.CANCEL, cancelHandler);
+ file.removeEventListener(Event.SELECT, selectHandler);
+ }
+
+ private function selectHandler(e:Event):void {
+ cancelHandler(e);
+ player.stop();
+ file.addEventListener(Event.COMPLETE, completeHandler);
+ file.load();
+ }
+
+ private function completeHandler(e:Event):void {
+ file.removeEventListener(Event.COMPLETE, completeHandler);
+ player.load(file.data);
+ if (player.version) player.play();
+ }
+ }
+}
View
44 Flod 4.1/demos/Demo3.as
@@ -0,0 +1,44 @@
+/*
+ Flod 4.1
+ 2012/04/30
+ Christian Corti
+ Neoart Costa Rica
+
+ Last Update: Flod 4.0 - 2012/03/10
+
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
+ OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
+ LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR
+ IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+
+ This work is licensed under the Creative Commons Attribution-Noncommercial-Share Alike 3.0 Unported License.
+ To view a copy of this license, visit http://creativecommons.org/licenses/by-nc-sa/3.0/ or send a letter to
+ Creative Commons, 171 Second Street, Suite 300, San Francisco, California, 94105, USA.
+
+ ---
+
+ This is a simple demo showing how to use the FileLoader class to play a module, in any of the supported
+ formats, with an embedded module.
+
+*/
+package {
+ import flash.display.*;
+ import flash.utils.*;
+ import neoart.flod.*;
+ import neoart.flod.core.*;
+
+ public final class Demo3 extends Sprite {
+ [Embed(source="filename.mod", mimeType="application/octet-stream")]
+
+ private var
+ Song : Class,
+ loader : FileLoader,
+ player : CorePlayer;
+
+ public function Demo3() {
+ loader = new FileLoader();
+ player = loader.load(new Song() as ByteArray);
+ if (player && player.version) player.play();
+ }
+ }
+}
View
62 Flod 4.1/demos/Demo4.as
@@ -0,0 +1,62 @@
+/*
+ Flod 4.1
+ 2012/04/30
+ Christian Corti
+ Neoart Costa Rica
+
+ Last Update: Flod 4.0 - 2012/03/10
+
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
+ OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
+ LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR
+ IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+
+ This work is licensed under the Creative Commons Attribution-Noncommercial-Share Alike 3.0 Unported License.
+ To view a copy of this license, visit http://creativecommons.org/licenses/by-nc-sa/3.0/ or send a letter to
+ Creative Commons, 171 Second Street, Suite 300, San Francisco, California, 94105, USA.
+
+ ---
+
+ This is a simple demo showing how to use a single player to play an embedded module.
+
+ List of available players and include locations:
+
+ D1Player Delta Music 1.0 neoart.flod.deltamusic
+ D2Player Delta Music 2.0 neoart.flod.deltamusic
+ DMPlayer Digital Mugician neoart.flod.digitalmugician
+ F2Player FastTracker II XM neoart.flod.fasttracker
+ FEPlayer FredEd neoart.flod.fred
+ FCPlayer Future Composer neoart.flod.futurecomposer
+ JHPlayer Jochen Hippel neoart.flod.hippel
+ RHPlayer Rob Hubbard neoart.flod.hubbard
+ S1Player SidMON neoart.flod.sidmon
+ S2Player SidMON II neoart.flod.sidmon
+ FXPlayer SoundFX neoart.flod.soundfx
+ BPPlayer SoundMon neoart.flod.soundmon
+ HMPlayer His Master's NoiseTracker neoart.flod.trackers
+ MKPlayer NoiseTracker neoart.flod.trackers
+ PTPlayer ProTracker neoart.flod.trackers
+ STPlayer Ultimate Soundtracker neoart.flod.trackers
+ DWPlayer David Whittaker neoart.flod.whittaker
+*/
+package {
+ import flash.display.*;
+ import flash.events.*;
+ import flash.utils.*;
+ import neoart.flod.core.*;
+ import neoart.flod.fred.*;
+
+ public final class Demo4 extends Sprite {
+ [Embed(source="filename.mod", mimeType="application/octet-stream")]
+
+ private var
+ Song : Class,
+ player : FEPlayer;
+
+ public function Demo4() {
+ player = new FEPlayer();
+ player.load(new Song() as ByteArray);
+ if (player.version) player.play();
+ }
+ }
+}
View
54 Flod 4.1/demos/Demo5.as
@@ -0,0 +1,54 @@
+/*
+ Flod 4.1
+ 2012/04/30
+ Christian Corti
+ Neoart Costa Rica
+
+ Last Update: Flod 4.0 - 2012/03/10
+
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
+ OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
+ LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR
+ IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+
+ This work is licensed under the Creative Commons Attribution-Noncommercial-Share Alike 3.0 Unported License.
+ To view a copy of this license, visit http://creativecommons.org/licenses/by-nc-sa/3.0/ or send a letter to
+ Creative Commons, 171 Second Street, Suite 300, San Francisco, California, 94105, USA.
+
+ ---
+
+ This is a simple demo showing how to use the FileLoader class to play a module, in any of the supported
+ formats, loaded from the server.
+
+ Warning: the server must be able to handle the correct file extension, if it can't just rename the file
+ to filename.wav and it should work...
+*/
+package {
+ import flash.display.*;
+ import flash.events.*;
+ import flash.net.*;
+ import neoart.flod.*;
+ import neoart.flod.core.*;
+
+ public final class Demo5 extends Sprite {
+ private var
+ url : URLLoader,
+ loader : FileLoader,
+ player : CorePlayer;
+
+ public function Demo5() {
+ loader = new FileLoader();
+
+ url = new URLLoader();
+ url.dataFormat = URLLoaderDataFormat.BINARY;
+ url.addEventListener(Event.COMPLETE, completeHandler);
+ url.load(new URLRequest("filename.mod"));
+ }
+
+ private function completeHandler(e:Event):void {
+ url.removeEventListener(Event.COMPLETE, completeHandler);
+ player = loader.load(url.data);
+ if (player && player.version) player.play();
+ }
+ }
+}
View
69 Flod 4.1/demos/Demo6.as
@@ -0,0 +1,69 @@
+/*
+ Flod 4.1
+ 2012/04/30
+ Christian Corti
+ Neoart Costa Rica
+
+ Last Update: Flod 4.0 - 2012/03/10
+
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
+ OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
+ LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR
+ IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+
+ This work is licensed under the Creative Commons Attribution-Noncommercial-Share Alike 3.0 Unported License.
+ To view a copy of this license, visit http://creativecommons.org/licenses/by-nc-sa/3.0/ or send a letter to
+ Creative Commons, 171 Second Street, Suite 300, San Francisco, California, 94105, USA.
+
+ ---
+
+ This is a simple demo showing how to use a single player to play a module loaded from the server.
+
+ List of available players and include locations:
+
+ D1Player Delta Music 1.0 neoart.flod.deltamusic
+ D2Player Delta Music 2.0 neoart.flod.deltamusic
+ DMPlayer Digital Mugician neoart.flod.digitalmugician
+ F2Player FastTracker II XM neoart.flod.fasttracker
+ FEPlayer FredEd neoart.flod.fred
+ FCPlayer Future Composer neoart.flod.futurecomposer
+ JHPlayer Jochen Hippel neoart.flod.hippel
+ RHPlayer Rob Hubbard neoart.flod.hubbard
+ S1Player SidMON neoart.flod.sidmon
+ S2Player SidMON II neoart.flod.sidmon
+ FXPlayer SoundFX neoart.flod.soundfx
+ BPPlayer SoundMon neoart.flod.soundmon
+ HMPlayer His Master's NoiseTracker neoart.flod.trackers
+ MKPlayer NoiseTracker neoart.flod.trackers
+ PTPlayer ProTracker neoart.flod.trackers
+ STPlayer Ultimate Soundtracker neoart.flod.trackers
+ DWPlayer David Whittaker neoart.flod.whittaker
+*/
+package {
+ import flash.display.*;
+ import flash.events.*;
+ import flash.net.*;
+ import neoart.flod.core.*;
+ import neoart.flod.sidmon.*;
+
+ public final class Demo6 extends Sprite {
+ private var
+ url : URLLoader,
+ player : S1Player;
+
+ public function Demo6() {
+ player = new S1Player();
+
+ url = new URLLoader();
+ url.dataFormat = URLLoaderDataFormat.BINARY;
+ url.addEventListener(Event.COMPLETE, completeHandler);
+ url.load(new URLRequest("filename.mod"));
+ }
+
+ private function completeHandler(e:Event):void {
+ url.removeEventListener(Event.COMPLETE, completeHandler);
+ player.load(url.data);
+ if (player.version) player.play();
+ }
+ }
+}
View
18 Flod 4.1/license.txt
@@ -0,0 +1,18 @@
+Flod version 4.1
+Flod JS version 2.1
+Flip version 1.2
+
+ 2012/04/30
+ Christian Corti
+ Neoart Costa Rica
+
+ E-Mail: flod@neoartcr.com
+
+This work is licensed under the Creative Commons Attribution-Noncommercial-Share Alike 3.0 Unported License.
+To view a copy of this license, visit http://creativecommons.org/licenses/by-nc-sa/3.0/ or send a letter to
+Creative Commons, 171 Second Street, Suite 300, San Francisco, California, 94105, USA.
+
+Flod is free for non commercial user, to use it in any commercial production I'll ask you to
+mention the proper credits and to make a donation to: chreil@hotmail.com via PayPal, thank you.
+
+Special thanks to Richard Davey, Mathew Nolan and Andreas Argirakis :)
View
28 Flod 4.1/neoart/flip/Huffman.as
@@ -0,0 +1,28 @@
+/*
+ Flip 1.2
+ 2012/03/13
+ Christian Corti
+ Neoart Costa Rica
+
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
+ OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
+ LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR
+ IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+
+ This work is licensed under the Creative Commons Attribution-Noncommercial-Share Alike 3.0 Unported License.
+ To view a copy of this license, visit http://creativecommons.org/licenses/by-nc-sa/3.0/ or send a letter to
+ Creative Commons, 171 Second Street, Suite 300, San Francisco, California, 94105, USA.
+*/
+package neoart.flip {
+
+ public final class Huffman {
+ internal var
+ count : Vector.<int>,
+ symbol : Vector.<int>;
+
+ public function Huffman(length:int) {
+ count = new Vector.<int>(length, true);
+ symbol = new Vector.<int>(length, true);
+ }
+ }
+}
View
252 Flod 4.1/neoart/flip/Inflater.as
@@ -0,0 +1,252 @@
+/*
+ Flip 1.2
+ 2012/03/13
+ Christian Corti
+ Neoart Costa Rica
+
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
+ OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
+ LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR
+ IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+
+ This work is licensed under the Creative Commons Attribution-Noncommercial-Share Alike 3.0 Unported License.
+ To view a copy of this license, visit http://creativecommons.org/licenses/by-nc-sa/3.0/ or send a letter to
+ Creative Commons, 171 Second Street, Suite 300, San Francisco, California, 94105, USA.
+*/
+package neoart.flip {
+ import flash.utils.*;
+
+ public final class Inflater {
+ internal var
+ output : ByteArray;
+ private var
+ inpbuf : ByteArray,
+ inpcnt : int,
+ outcnt : int,
+ bitbuf : int,
+ bitcnt : int,
+ flencode : Huffman,
+ fdiscode : Huffman,
+ dlencode : Huffman,
+ ddiscode : Huffman;
+
+ public function Inflater() {
+ initialize();
+ }
+
+ public function set input(stream:ByteArray):void {
+ inpbuf = stream;
+ output = new ByteArray();
+ inpbuf.endian = output.endian = ZipFile.ENDIAN;
+ inpbuf.position = output.position = 0;
+ inpcnt = outcnt = 0;
+ }
+
+ public function inflate():int {
+ var err:int, last:int, type:int;
+
+ do {
+ last = bits(1);
+ type = bits(2);
+ err = type == 0 ? stored() :
+ type == 1 ? codes(flencode, fdiscode) :
+ type == 2 ? dynamic() : 1;
+
+ if (err) throw new Error(ERROR1, 1);
+ } while (!last);
+
+ return 0;
+ }
+
+ private function bits(need:int):int {
+ var buff:int = bitbuf, inplen:uint = inpbuf.length;
+
+ while (bitcnt < need) {
+ if (inpcnt == inplen) throw new Error(ERROR2, 2);
+ buff |= inpbuf[int(inpcnt++)] << bitcnt;
+ bitcnt += 8;
+ }
+
+ bitbuf = buff >> need;
+ bitcnt -= need;
+ return buff & ((1 << need) - 1);
+ }
+
+ private function codes(lencode:Huffman, discode:Huffman):int {
+ var dis:int, len:int, pos:int, sym:int;
+
+ do {
+ sym = decode(lencode);
+ if (sym < 0) return sym;
+
+ if (sym < 256) {
+ output[int(outcnt++)] = sym;
+ } else if (sym > 256) {
+ sym -= 257;
+ if (sym >= 29) throw new Error(ERROR3, 3);
+ len = LENG[sym] + bits(LEXT[sym]);
+
+ sym = decode(discode);
+ if (sym < 0) return sym;
+ dis = DIST[sym] + bits(DEXT[sym]);
+ if (dis > outcnt) throw new Error(ERROR4, 4);
+
+ pos = outcnt - dis;
+ while (len--) output[int(outcnt++)] = output[int(pos++)];
+ }
+ } while (sym != 256);
+
+ return 0;
+ }
+
+ private function construct(huff:Huffman, length:Vector.<int>, n:int):int {
+ var len:int, left:int = 1, offs:Vector.<int> = new Vector.<int>(16, true), sym:int;
+
+ for (len = 0; len < 16; ++len) huff.count[len] = 0;
+ for (sym = 0; sym < n; ++sym) huff.count[length[sym]]++;
+ if (huff.count[0] == n) return 0;
+
+ for (len = 1; len < 16; ++len) {
+ left <<= 1;
+ left -= huff.count[len];
+ if (left < 0) return left;
+ }
+
+ for (len = 1; len < 15; ++len)
+ offs[int(len + 1)] = offs[len] + huff.count[len];
+
+ for (sym = 0; sym < n; ++sym)
+ if (length[sym] != 0) huff.symbol[int(offs[length[sym]]++)] = sym;
+
+ return left;
+ }
+
+ private function decode(huff:Huffman):int {
+ var buff:int = bitbuf, code:int, count:int, first:int, index:int, inplen:uint = inpbuf.length, left:int = bitcnt, len:int = 1;
+
+ while (1) {
+ while (left--) {
+ code |= buff & 1;
+ buff >>= 1;
+ count = huff.count[len];
+
+ if (code < int(first + count)) {
+ bitbuf = buff;
+ bitcnt = (bitcnt - len) & 7;
+ return huff.symbol[int(index + (code - first))];
+ }
+
+ index += count;
+ first += count;
+ first <<= 1;
+ code <<= 1;
+ ++len;
+ }
+
+ left = 16 - len;
+ if (left == 0) break;
+ if (inpcnt == inplen) throw new Error(ERROR2, 2);
+ buff = inpbuf[int(inpcnt++)];
+ if (left > 8) left = 8;
+ }
+
+ return -9;
+ }
+
+ private function stored():int {
+ var inplen:uint = inpbuf.length, len:int;
+ bitbuf = bitcnt = 0;
+
+ if ((inpcnt + 4) > inplen) throw new Error(ERROR2, 2);
+ len = inpbuf[int(inpcnt++)];
+ len |= inpbuf[int(inpcnt++)] << 8;
+
+ if (inpbuf[int(inpcnt++)] != ( ~len & 0xff) ||
+ inpbuf[int(inpcnt++)] != ((~len >> 8) & 0xff)) throw new Error(ERROR5, 5);
+
+ if ((inpcnt + len) > inplen) throw new Error(ERROR2, 2);
+ while (len--) output[int(outcnt++)] = inpbuf[int(inpcnt++)];
+ return 0;
+ }
+
+ private function initialize():void {
+ var length:Vector.<int> = new Vector.<int>(288, true), sym:int;
+ flencode = new Huffman(288);
+ fdiscode = new Huffman(30);
+
+ for (sym = 0; sym < 144; ++sym) length[sym] = 8;
+ for (; sym < 256; ++sym) length[sym] = 9;
+ for (; sym < 280; ++sym) length[sym] = 7;
+ for (; sym < 288; ++sym) length[sym] = 8;
+ construct(flencode, length, 288);
+
+ for (sym = 0; sym < 30; ++sym) length[sym] = 5;
+ construct(fdiscode, length, 30);
+
+ dlencode = new Huffman(286);
+ ddiscode = new Huffman(30);
+ }
+
+ private function dynamic():int {
+ var err:int, index:int, len:int, length:Vector.<int> = new Vector.<int>(316, true), nlen:int = bits(5) + 257, ndis:int = bits(5) + 1, ncode:int = bits(4) + 4, max:int = nlen + ndis, sym:int;
+
+ if (nlen > 286 || ndis > 30) throw new Error(ERROR6, 6);
+ for (index = 0; index < ncode; ++index) length[ORDER[index]] = bits(3);
+ for (; index < 19; ++index) length[ORDER[index]] = 0;
+
+ err = construct(dlencode, length, 19);
+ if (err) throw new Error(ERROR7, 7);
+ index = 0;
+
+ while (index < max) {
+ sym = decode(dlencode);
+
+ if (sym < 16) {
+ length[int(index++)] = sym;
+ } else {
+ len = 0;
+
+ if (sym == 16) {
+ if (index == 0) throw new Error(ERROR8, 8);
+ len = length[int(index - 1)];
+ sym = 3 + bits(2);
+ } else if (sym == 17) {
+ sym = 3 + bits(3);
+ } else {
+ sym = 11 + bits(7);
+ }
+
+ if ((index + sym) > max) throw new Error(ERROR9, 9);
+ while (sym--) length[int(index++)] = len;
+ }
+ }
+
+ err = construct(dlencode, length, nlen);
+ if (err < 0 || (err > 0 && nlen - dlencode.count[0] != 1)) throw new Error(ERROR10, 10);
+
+ err = construct(ddiscode, length.slice(nlen), ndis);
+ if (err < 0 || (err > 0 && ndis - ddiscode.count[0] != 1)) throw new Error(ERROR11, 11);
+
+ return codes(dlencode, ddiscode);
+ }
+
+ private static const
+ ERROR1 : String = "Invalid block type.",
+ ERROR2 : String = "Available inflate data did not terminate.",
+ ERROR3 : String = "Invalid literal/length or distance code.",
+ ERROR4 : String = "Distance is too far back.",
+ ERROR5 : String = "Stored block length did not match one's complement.",
+ ERROR6 : String = "Too many length or distance codes.",
+ ERROR7 : String = "Code lengths codes incomplete.",
+ ERROR8 : String = "Repeat lengths with no first length.",
+ ERROR9 : String = "Repeat more than specified lengths.",
+ ERROR10 : String = "Invalid literal/length code lengths.",
+ ERROR11 : String = "Invalid distance code lengths.",
+
+ LENG : Vector.<int> = Vector.<int>([3,4,5,6,7,8,9,10,11,13,15,17,19,23,27,31,35,43,51,59,67,83,99,115,131,163,195,227,258]),
+ LEXT : Vector.<int> = Vector.<int>([0,0,0,0,0,0,0,0,1,1,1,1,2,2,2,2,3,3,3,3,4,4,4,4,5,5,5,5,0]),
+ DIST : Vector.<int> = Vector.<int>([1,2,3,4,5,7,9,13,17,25,33,49,65,97,129,193,257,385,513,769,1025,1537,2049,3073,4097,6145,8193,12289,16385,24577]),
+ DEXT : Vector.<int> = Vector.<int>([0,0,0,0,1,1,2,2,3,3,4,4,5,5,6,6,7,7,8,8,9,9,10,10,11,11,12,12,13,13]),
+ ORDER : Vector.<int> = Vector.<int>([16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15]);
+ }
+}
View
47 Flod 4.1/neoart/flip/ZipEntry.as
@@ -0,0 +1,47 @@
+/*
+ Flip 1.2
+ 2012/03/13
+ Christian Corti
+ Neoart Costa Rica
+
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
+ OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
+ LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR
+ IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+
+ This work is licensed under the Creative Commons Attribution-Noncommercial-Share Alike 3.0 Unported License.
+ To view a copy of this license, visit http://creativecommons.org/licenses/by-nc-sa/3.0/ or send a letter to
+ Creative Commons, 171 Second Street, Suite 300, San Francisco, California, 94105, USA.
+*/
+package neoart.flip {
+ import flash.utils.*;
+
+ public final class ZipEntry {
+ public var
+ name : String,
+ extra : ByteArray,
+ version : int,
+ flag : int,
+ method : int,
+ time : uint,
+ crc : uint,
+ compressed : uint,
+ size : uint,
+ offset : uint;
+
+ public function get date():Date {
+ return new Date(
+ ((time >> 25) & 0x7f) + 1980,
+ ((time >> 21) & 0x0f) - 1,
+ (time >> 16) & 0x1f,
+ (time >> 11) & 0x1f,
+ (time >> 5) & 0x3f,
+ (time & 0x1f) << 1
+ );
+ }
+
+ public function get isDirectory():Boolean {
+ return Boolean(name.charAt(name.length - 1) == "/");
+ }
+ }
+}
View
135 Flod 4.1/neoart/flip/ZipFile.as
@@ -0,0 +1,135 @@
+/*
+ Flip 1.2
+ 2012/03/13
+ Christian Corti
+ Neoart Costa Rica
+
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
+ OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
+ LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR
+ IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+
+ This work is licensed under the Creative Commons Attribution-Noncommercial-Share Alike 3.0 Unported License.
+ To view a copy of this license, visit http://creativecommons.org/licenses/by-nc-sa/3.0/ or send a letter to
+ Creative Commons, 171 Second Street, Suite 300, San Francisco, California, 94105, USA.
+*/
+package neoart.flip {
+ import flash.utils.*;
+
+ public final class ZipFile {
+ public static const
+ ENDIAN : String = "littleEndian";
+ public var
+ entries : Vector.<ZipEntry>;
+ private var
+ stream : ByteArray;
+
+ public function ZipFile(stream:ByteArray) {
+ this.stream = stream;
+ this.stream.endian = ENDIAN;
+ parseEnd();
+ }
+
+ public function extract(filename:String):ByteArray {
+ var entry:ZipEntry, i:int, len:int = entries.length;
+ if (!filename) return null;
+
+ for (i = 0; i < len; ++i) {
+ entry = entries[i];
+ if (entry.name == filename) return uncompress(entry);
+ }
+
+ return null;
+ }
+
+ public function uncompress(entry:ZipEntry):ByteArray {
+ var buffer:ByteArray, inflater:Inflater, size:int;
+ if (entry == null) return null;
+
+ stream.position = entry.offset + 28;
+ size = stream.readUnsignedShort();
+ stream.position += (entry.name.length + size);
+
+ buffer = new ByteArray();
+ buffer.endian = ENDIAN;
+ if (entry.compressed > 0) stream.readBytes(buffer, 0, entry.compressed);
+
+ switch (entry.method) {
+ case 0:
+ return buffer;
+ case 8:
+ inflater = new Inflater();
+ inflater.input = buffer;
+ inflater.inflate();
+ return inflater.output;
+ default:
+ throw new Error(ERROR4, 4);
+ break;
+ }
+ }
+
+ private function parseCentral():void {
+ var entry:ZipEntry, i:int, header:ByteArray = new ByteArray, len:int = entries.length, size:int;
+ header.endian = ENDIAN;
+
+ for (i = 0; i < len; ++i) {
+ stream.readBytes(header, 0, 46);
+ header.position = 0;
+ if (header.readUnsignedInt() != 0x02014b50) throw new Error(ERROR2, 2);
+ header.position += 24;
+
+ size = header.readUnsignedShort();
+ if (size == 0) throw new Error(ERROR2, 2);
+ entry = new ZipEntry();
+ entry.name = stream.readUTFBytes(size);
+
+ size = header.readUnsignedShort();
+ if (size > 0) {
+ entry.extra = new ByteArray();
+ stream.readBytes(entry.extra, 0, size);
+ }
+
+ stream.position += header.readUnsignedShort();
+ header.position = 6;
+ entry.version = header.readUnsignedShort();
+
+ entry.flag = header.readUnsignedShort();
+ if ((entry.flag & 1) == 1) throw new Error(ERROR3, 3);
+
+ entry.method = header.readUnsignedShort();
+ entry.time = header.readUnsignedInt();
+ entry.crc = header.readUnsignedInt();
+ entry.compressed = header.readUnsignedInt();
+ entry.size = header.readUnsignedInt();
+
+ header.position = 42;
+ entry.offset = header.readUnsignedInt();
+ entries[i] = entry;
+ }
+ }
+
+ private function parseEnd():void {
+ var i:int = stream.length - 22, l:int = (i - 65536) > 0 ? i - 65536 : 0;
+
+ do {
+ if (stream[i] != 0x50) continue;
+ stream.position = i;
+ if (stream.readUnsignedInt() == 0x06054b50) break;
+ } while (--i > l);
+
+ if (i == l) throw new Error(ERROR1, 1);
+
+ stream.position = i + 10;
+ entries = new Vector.<ZipEntry>(stream.readUnsignedShort(), true);
+ stream.position = i + 16;
+ stream.position = stream.readUnsignedInt();
+ parseCentral();
+ }
+
+ private static const
+ ERROR1 : String = "The archive is either in unknown format or damaged.",
+ ERROR2 : String = "Unexpected end of archive.",
+ ERROR3 : String = "Encrypted archive not supported.",
+ ERROR4 : String = "Compression method not supported.";
+ }
+}
View
379 Flod 4.1/neoart/flod/FileLoader.as
@@ -0,0 +1,379 @@
+/*
+ Flod 4.1
+ 2012/04/30
+ Christian Corti
+ Neoart Costa Rica
+
+ Last Update: Flod 4.1 - 2012/04/16
+
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
+ OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
+ LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR
+ IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+
+ This work is licensed under the Creative Commons Attribution-Noncommercial-Share Alike 3.0 Unported License.
+ To view a copy of this license, visit http://creativecommons.org/licenses/by-nc-sa/3.0/ or send a letter to
+ Creative Commons, 171 Second Street, Suite 300, San Francisco, California, 94105, USA.
+*/
+package neoart.flod {
+ import flash.utils.*;
+ import neoart.flip.*;
+ import neoart.flod.core.*;
+ import neoart.flod.deltamusic.*;
+ import neoart.flod.digitalmugician.*;
+ import neoart.flod.fred.*;
+ import neoart.flod.futurecomposer.*;
+ import neoart.flod.hippel.*;
+ import neoart.flod.hubbard.*;
+ import neoart.flod.sidmon.*;
+ import neoart.flod.soundfx.*;
+ import neoart.flod.soundmon.*;
+ import neoart.flod.trackers.*;
+ import neoart.flod.fasttracker.*;
+ import neoart.flod.whittaker.*;
+
+ public final class FileLoader {
+ private var
+ player : CorePlayer,
+ index : int,
+ amiga : Amiga,
+ mixer : Soundblaster;
+
+ public function FileLoader() {
+ amiga = new Amiga();
+ mixer = new Soundblaster();
+ }
+
+ public function get tracker():String {
+ return (player) ? TRACKERS[index + player.version] : TRACKERS[0];
+ }
+
+ public function load(stream:ByteArray):CorePlayer {
+ var archive:ZipFile, id:String, value:int;
+
+ stream.endian = "littleEndian";
+ stream.position = 0;
+
+ if (stream.readUnsignedInt() == 67324752) {
+ archive = new ZipFile(stream);
+ stream = archive.uncompress(archive.entries[0]);
+ }
+
+ if (!stream) return null;
+
+ if (player && !(player is STPlayer)) {
+ player.load(stream);
+ if (player.version) return player;
+ }
+
+ if (stream.length > 336) {
+ stream.position = 38;
+ id = stream.readMultiByte(20, CorePlayer.ENCODING);
+
+ if (id == "FastTracker v2.00 " ||
+ id == "FastTracker v 2.00 " ||
+ id == "Sk@le Tracker" ||
+ id == "MadTracker 2.0" ||
+ id == "MilkyTracker " ||
+ id == "DigiBooster Pro 2.18" ||
+ id.indexOf("OpenMPT") != -1) {
+
+ player = new F2Player(mixer);
+ player.load(stream);
+
+ if (player.version) {
+ index = FASTTRACKER;
+ return player;
+ }
+ }
+ }
+
+ stream.endian = "bigEndian";
+
+ if (stream.length > 2105) {
+ stream.position = 1080;
+ id = stream.readMultiByte(4, CorePlayer.ENCODING);
+
+ if (id == "M.K." || id == "FLT4") {
+ player = new MKPlayer(amiga);
+ player.load(stream);
+
+ if (player.version) {
+ index = NOISETRACKER;
+ return player;
+ }
+ } else if (id == "FEST") {
+ player = new HMPlayer(amiga);
+ player.load(stream);
+
+ if (player.version) {
+ index = HISMASTER;
+ return player;
+ }
+ }
+ }
+
+ if (stream.length > 2105) {
+ stream.position = 1080;
+ id = stream.readMultiByte(4, CorePlayer.ENCODING);
+
+ if (id == "M.K." || id == "M!K!") {
+ player = new PTPlayer(amiga);
+ player.load(stream);
+
+ if (player.version) {
+ index = PROTRACKER;
+ return player;
+ }
+ }
+ }
+
+ if (stream.length > 1685) {
+ stream.position = 60;
+ id = stream.readMultiByte(4, CorePlayer.ENCODING);
+
+ if (id != "SONG") {
+ stream.position = 124;
+ id = stream.readMultiByte(4, CorePlayer.ENCODING);
+ }
+
+ if (id == "SONG" || id == "SO31") {
+ player = new FXPlayer(amiga);
+ player.load(stream);
+
+ if (player.version) {
+ index = SOUNDFX;
+ return player;
+ }
+ }
+ }
+
+ if (stream.length > 4) {
+ stream.position = 0;
+ id = stream.readMultiByte(4, CorePlayer.ENCODING);
+
+ if (id == "ALL ") {
+ player = new D1Player(amiga);
+ player.load(stream);
+
+ if (player.version) {
+ index = DELTAMUSIC;
+ return player;
+ }
+ }
+ }
+
+ if (stream.length > 3018) {
+ stream.position = 3014;
+ id = stream.readMultiByte(4, CorePlayer.ENCODING);
+
+ if (id == ".FNL") {
+ player = new D2Player(amiga);
+ player.load(stream);
+
+ if (player.version) {
+ index = DELTAMUSIC;
+ return player;
+ }
+ }
+ }
+
+ if (stream.length > 30) {
+ stream.position = 26;
+ id = stream.readMultiByte(3, CorePlayer.ENCODING);
+
+ if (id == "BPS" || id == "V.2" || id == "V.3") {
+ player = new BPPlayer(amiga);
+ player.load(stream);
+
+ if (player.version) {
+ index = BPSOUNDMON;
+ return player;
+ }
+ }
+ }
+
+ if (stream.length > 4) {
+ stream.position = 0;
+ id = stream.readMultiByte(4, CorePlayer.ENCODING);
+
+ if (id == "SMOD" || id == "FC14") {
+ player = new FCPlayer(amiga);
+ player.load(stream);
+
+ if (player.version) {
+ index = FUTURECOMP;
+ return player;
+ }
+ }
+ }
+
+ if (stream.length > 10) {
+ stream.position = 0;
+ id = stream.readMultiByte(9, CorePlayer.ENCODING);
+
+ if (id == " MUGICIAN") {
+ player = new DMPlayer(amiga);
+ player.load(stream);
+
+ if (player.version) {
+ index = DIGITALMUG;
+ return player;
+ }
+ }
+ }
+
+ if (stream.length > 86) {
+ stream.position = 58;
+ id = stream.readMultiByte(28, CorePlayer.ENCODING);
+
+ if (id == "SIDMON II - THE MIDI VERSION") {
+ player = new S2Player(amiga);
+ player.load(stream);
+
+ if (player.version) {
+ index = SIDMON;
+ return player;
+ }
+ }
+ }
+
+ if (stream.length > 2830) {
+ stream.position = 0;
+ value = stream.readUnsignedShort();
+
+ if (value == 0x4efa) {
+ player = new FEPlayer(amiga);
+ player.load(stream);
+
+ if (player.version) {
+ index = FREDED;
+ return player;
+ }
+ }
+ }
+
+ if (stream.length > 5220) {
+ player = new S1Player(amiga);
+ player.load(stream);
+
+ if (player.version) {
+ index = SIDMON;
+ return player;
+ }
+ }
+
+ stream.position = 0;
+ value = stream.readUnsignedShort();
+ stream.position = 0;
+ id = stream.readMultiByte(4, CorePlayer.ENCODING);
+
+ if (id == "COSO" || value == 0x6000 || value == 0x6002 || value == 0x600e || value == 0x6016) {
+ player = new JHPlayer(amiga);
+ player.load(stream);
+
+ if (player.version) {
+ index = HIPPEL;
+ return player;
+ }
+ }
+
+ stream.position = 0;
+ value = stream.readUnsignedShort();
+
+ player = new DWPlayer(amiga);
+ player.load(stream);
+
+ if (player.version) {
+ index = WHITTAKER;
+ return player;
+ }
+
+ stream.position = 0;
+ value = stream.readUnsignedShort();
+
+ if (value == 0x6000) {
+ player = new RHPlayer(amiga);
+ player.load(stream);
+
+ if (player.version) {
+ index = HUBBARD;
+ return player;
+ }
+ }
+
+ if (stream.length > 1625) {
+ player = new STPlayer(amiga);
+ player.load(stream);
+
+ if (player.version) {
+ index = SOUNDTRACKER;
+ return player;
+ }
+ }
+
+ stream.clear();
+ index = 0;
+ return player = null;
+ }
+
+ private static const
+ SOUNDTRACKER = 0,
+ NOISETRACKER = 4,
+ PROTRACKER = 9,
+ HISMASTER = 12,
+ SOUNDFX = 13,
+ BPSOUNDMON = 17,
+ DELTAMUSIC = 20,
+ DIGITALMUG = 22,
+ FUTURECOMP = 24,
+ SIDMON = 26,
+ WHITTAKER = 28,
+ FREDED = 29,
+ HIPPEL = 30,
+ HUBBARD = 32,
+ FASTTRACKER = 33,
+
+ TRACKERS = [
+ "Unknown Format",
+ "Ultimate SoundTracker",
+ "D.O.C. SoundTracker 9",
+ "Master SoundTracker",
+ "D.O.C. SoundTracker 2.0/2.2",
+ "SoundTracker 2.3",
+ "SoundTracker 2.4",
+ "NoiseTracker 1.0",
+ "NoiseTracker 1.1",
+ "NoiseTracker 2.0",
+ "ProTracker 1.0",
+ "ProTracker 1.1/2.1",
+ "ProTracker 1.2/2.0",
+ "His Master's NoiseTracker",
+ "SoundFX 1.0/1.7",
+ "SoundFX 1.8",
+ "SoundFX 1.945",
+ "SoundFX 1.994/2.0",
+ "BP SoundMon V1",
+ "BP SoundMon V2",
+ "BP SoundMon V3",
+ "Delta Music 1.0",
+ "Delta Music 2.0",
+ "Digital Mugician",
+ "Digital Mugician 7 Voices",
+ "Future Composer 1.0/1.3",
+ "Future Composer 1.4",
+ "SidMon 1.0",
+ "SidMon 2.0",
+ "David Whittaker",
+ "FredEd",
+ "Jochen Hippel",
+ "Jochen Hippel COSO",
+ "Rob Hubbard",
+ "FastTracker II",
+ "Sk@leTracker",
+ "MadTracker 2.0",
+ "MilkyTracker",
+ "DigiBooster Pro 2.18",
+ "OpenMPT"];
+ }
+}
View
208 Flod 4.1/neoart/flod/core/Amiga.as
@@ -0,0 +1,208 @@
+/*
+ Flod 4.1
+ 2012/04/30
+ Christian Corti
+ Neoart Costa Rica
+
+ Last Update: Flod 4.1 - 2012/04/09
+
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
+ OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
+ LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR
+ IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+
+ This work is licensed under the Creative Commons Attribution-Noncommercial-Share Alike 3.0 Unported License.
+ To view a copy of this license, visit http://creativecommons.org/licenses/by-nc-sa/3.0/ or send a letter to
+ Creative Commons, 171 Second Street, Suite 300, San Francisco, California, 94105, USA.
+*/
+package neoart.flod.core {
+ import flash.events.*;
+ import flash.utils.*;
+
+ public final class Amiga extends CoreMixer {
+ public static const
+ MODEL_A500 : int = 0,
+ MODEL_A1200 : int = 1;
+ public var
+ filter : AmigaFilter,
+ model : int = MODEL_A1200,
+ memory : Vector.<int>,
+ channels : Vector.<AmigaChannel>,
+ loopPtr : int,
+ loopLen : int = 4;
+ internal var
+ clock : Number = 0.0,
+ master : Number = 0.00390625;
+
+ public function Amiga() {
+ super();
+ bufferSize = 8192;
+ filter = new AmigaFilter();
+ channels = new Vector.<AmigaChannel>(4, true);
+
+ channels[0] = new AmigaChannel(0);
+ channels[0].next = channels[1] = new AmigaChannel(1);
+ channels[1].next = channels[2] = new AmigaChannel(2);
+ channels[2].next = channels[3] = new AmigaChannel(3);
+ }
+
+ public function set volume(value:int):void {
+ if (value > 0) {
+ if (value > 64) value = 64;
+ master = (value / 64) * 0.00390625;
+ } else {
+ master = 0.0;
+ }
+ }
+
+ public function store(stream:ByteArray, len:int, pointer:int = -1):int {
+ var add:int, i:int, pos:int = stream.position, start:int = memory.length, total:int;
+
+ if (pointer > -1) stream.position = pointer;
+ total = stream.position + len;
+
+ if (total >= stream.length) {
+ add = total - stream.length;
+ len = stream.length - stream.position;
+ }
+
+ for (i = start, len += start; i < len; ++i)
+ memory[i] = stream.readByte();
+
+ memory.length += add;
+ if (pointer > -1) stream.position = pos;
+ return start;
+ }
+
+ override internal function initialize():void {
+ super.initialize();
+ wave.clear();
+ filter.initialize();
+
+ if (!memory.fixed) {
+ loopPtr = memory.length;
+ memory.length += loopLen;
+ memory.fixed = true;
+ }
+
+ channels[0].initialize();
+ channels[1].initialize();
+ channels[2].initialize();
+ channels[3].initialize();
+ }
+
+ //js function restore
+ override internal function reset():void {
+ memory = new Vector.<int>();
+ }
+
+ override internal function fast(e:SampleDataEvent):void {
+ var chan:AmigaChannel, data:ByteArray = e.data, i:int, lvol:Number, mixed:int, mixLen:int, mixPos:int, rvol:Number, sample:Sample, size:int = bufferSize, speed:Number, toMix:int, value:Number;
+
+ if (completed) {
+ if (!remains) return;
+ size = remains;
+ }
+
+ while (mixed < size) {
+ if (!samplesLeft) {
+ player.process();
+ samplesLeft = samplesTick;
+
+ if (completed) {
+ size = mixed + samplesTick;
+
+ if (size > bufferSize) {
+ remains = size - bufferSize;
+ size = bufferSize;
+ }
+ }
+ }
+
+ toMix = samplesLeft;
+ if ((mixed + toMix) >= size) toMix = size - mixed;
+ mixLen = mixPos + toMix;
+ chan = channels[0];
+
+ while (chan) {
+ sample = buffer[mixPos];
+
+ if (chan.audena && chan.audper > 60) {
+ if (chan.mute) {
+ chan.ldata = 0.0;
+ chan.rdata = 0.0;
+ }
+
+ speed = chan.audper / clock;
+
+ value = chan.audvol * master;
+ lvol = value * (1 - chan.level);
+ rvol = value * (1 + chan.level);
+
+ for (i = mixPos; i < mixLen; ++i) {
+ if (chan.delay) {
+ chan.delay--;
+ } else if (--chan.timer < 1.0) {
+ if (!chan.mute) {
+ value = memory[chan.audloc] * 0.0078125;
+ chan.ldata = value * lvol;
+ chan.rdata = value * rvol;
+ }
+
+ chan.audloc++;
+ chan.timer += speed;
+
+ if (chan.audloc >= chan.audcnt) {
+ chan.audloc = chan.pointer;
+ chan.audcnt = chan.pointer + chan.length;
+ }
+ }
+
+ sample.l += chan.ldata;
+ sample.r += chan.rdata;
+ sample = sample.next;
+ }
+ } else {
+ for (i = mixPos; i < mixLen; ++i) {
+ sample.l += chan.ldata;
+ sample.r += chan.rdata;
+ sample = sample.next;
+ }
+ }
+ chan = chan.next;
+ }
+
+ mixPos = mixLen;
+ mixed += toMix;
+ samplesLeft -= toMix;
+ }
+
+ sample = buffer[0];
+
+ if (player.record) {
+ for (i = 0; i < size; ++i) {
+ filter.process(model, sample);
+
+ wave.writeShort(int(sample.l * (sample.l < 0 ? 32768 : 32767)));
+ wave.writeShort(int(sample.r * (sample.r < 0 ? 32768 : 32767)));
+
+ data.writeFloat(sample.l);
+ data.writeFloat(sample.r);
+
+ sample.l = sample.r = 0.0;
+ sample = sample.next;
+ }
+ } else {
+ for (i = 0; i < size; ++i) {
+ filter.process(model, sample);
+
+ data.writeFloat(sample.l);
+ data.writeFloat(sample.r);
+
+ sample.l = sample.r = 0.0;
+ sample = sample.next;
+ }
+ }
+ }
+ }
+}
View
92 Flod 4.1/neoart/flod/core/AmigaChannel.as
@@ -0,0 +1,92 @@
+/*
+ Flod 4.1
+ 2012/04/30
+ Christian Corti
+ Neoart Costa Rica
+
+ Last Update: Flod 4.1 - 2012/04/09
+
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
+ OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
+ LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR
+ IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+
+ This work is licensed under the Creative Commons Attribution-Noncommercial-Share Alike 3.0 Unported License.
+ To view a copy of this license, visit http://creativecommons.org/licenses/by-nc-sa/3.0/ or send a letter to
+ Creative Commons, 171 Second Street, Suite 300, San Francisco, California, 94105, USA.
+*/
+package neoart.flod.core {
+
+ public final class AmigaChannel {
+ public var
+ next : AmigaChannel,
+ mute : int,
+ panning : Number = 1.0,
+ delay : int,
+ pointer : int,
+ length : int;
+ internal var
+ audena : int,
+ audcnt : int,
+ audloc : int,
+ audper : int,
+ audvol : int,
+ timer : Number,
+ level : Number,
+ ldata : Number,
+ rdata : Number;
+
+ public function AmigaChannel(index:int) {
+ if ((++index & 2) == 0) panning = -panning;
+ level = panning;
+ }
+
+ public function get enabled():int { return audena; }
+
+ public function set enabled(value:int):void {
+ if (value == audena) return;
+
+ audena = value;
+ audloc = pointer;
+ audcnt = pointer + length;
+
+ timer = 1.0;
+ if (value) delay += 2;
+ }
+
+ public function set period(value:int):void {
+ if (value < 0) value = 0;
+ else if(value > 65535) value = 65535;
+
+ audper = value;
+ }
+
+ public function set volume(value:int):void {
+ if (value < 0) value = 0;
+ else if (value > 64) value = 64;
+
+ audvol = value;
+ }
+
+ public function resetData():void {
+ ldata = 0.0;
+ rdata = 0.0;
+ }
+
+ internal function initialize():void {
+ audena = 0;
+ audcnt = 0;
+ audloc = 0;
+ audper = 50;
+ audvol = 0;
+
+ timer = 0.0;
+ ldata = 0.0;
+ rdata = 0.0;
+
+ delay = 0;
+ pointer = 0;
+ length = 0;
+ }
+ }
+}
View
73 Flod 4.1/neoart/flod/core/AmigaFilter.as
@@ -0,0 +1,73 @@
+/*
+ Flod 4.1
+ 2012/04/30
+ Christian Corti
+ Neoart Costa Rica
+
+ Last Update: Flod 3.0 - 2012/02/08
+
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
+ OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
+ LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR
+ IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+
+ This work is licensed under the Creative Commons Attribution-Noncommercial-Share Alike 3.0 Unported License.
+ To view a copy of this license, visit http://creativecommons.org/licenses/by-nc-sa/3.0/ or send a letter to
+ Creative Commons, 171 Second Street, Suite 300, San Francisco, California, 94105, USA.
+*/
+package neoart.flod.core {
+
+ public final class AmigaFilter {
+ public static const
+ AUTOMATIC : int = 0,
+ FORCE_ON : int = 1,
+ FORCE_OFF : int = -1;
+ public var
+ active : int,
+ forced : int = FORCE_OFF;
+ private var
+ l0 : Number,
+ l1 : Number,
+ l2 : Number,
+ l3 : Number,
+ l4 : Number,
+ r0 : Number,
+ r1 : Number,
+ r2 : Number,
+ r3 : Number,
+ r4 : Number;
+
+ internal function initialize():void {
+ l0 = l1 = l2 = l3 = l4 = 0.0;
+ r0 = r1 = r2 = r3 = r4 = 0.0;
+ }
+
+ internal function process(model:int, sample:Sample):void {
+ var FL:Number = 0.5213345843532200, P0:Number = 0.4860348337215757, P1:Number = 0.9314955486749749, d:Number = 1.0 - P0;
+
+ if (model == 0) {
+ l0 = P0 * sample.l + d * l0 + 1e-18 - 1e-18;
+ r0 = P0 * sample.r + d * r0 + 1e-18 - 1e-18;
+ d = 1 - P1;
+ sample.l = l1 = P1 * l0 + d * l1;
+ sample.r = r1 = P1 * r0 + d * r1;
+ }
+
+ if ((active | forced) > 0) {
+ d = 1 - FL;
+ l2 = FL * sample.l + d * l2 + 1e-18 - 1e-18;
+ r2 = FL * sample.r + d * r2 + 1e-18 - 1e-18;
+ l3 = FL * l2 + d * l3;
+ r3 = FL * r2 + d * r3;
+ sample.l = l4 = FL * l3 + d * l4;
+ sample.r = r4 = FL * r3 + d * r4;
+ }
+
+ if (sample.l > 1.0) sample.l = 1.0;
+ else if (sample.l < -1.0) sample.l = -1.0;
+
+ if (sample.r > 1.0) sample.r = 1.0;
+ else if (sample.r < -1.0) sample.r = -1.0;
+ }
+ }
+}
View
72 Flod 4.1/neoart/flod/core/AmigaPlayer.as
@@ -0,0 +1,72 @@
+/*
+ Flod 4.1
+ 2012/04/30
+ Christian Corti
+ Neoart Costa Rica
+
+ Last Update: Flod 3.0 - 2012/02/08
+
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
+ OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
+ LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR
+ IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+
+ This work is licensed under the Creative Commons Attribution-Noncommercial-Share Alike 3.0 Unported License.
+ To view a copy of this license, visit http://creativecommons.org/licenses/by-nc-sa/3.0/ or send a letter to
+ Creative Commons, 171 Second Street, Suite 300, San Francisco, California, 94105, USA.
+*/
+package neoart.flod.core {
+
+ public class AmigaPlayer extends CorePlayer {
+ public var
+ amiga : Amiga;
+ protected var
+ standard : int;
+
+ public function AmigaPlayer(amiga:Amiga) {
+ this.amiga = amiga || new Amiga();
+ super(this.amiga);
+
+ channels = 4;
+ endian = "bigEndian";
+ ntsc = 0;
+ speed = 6;
+ tempo = 125;
+ }
+
+ override public function set ntsc(value:int):void {
+ standard = value;
+
+ if (value) {
+ amiga.clock = 81.1688208;
+ amiga.samplesTick = 735;
+ } else {
+ amiga.clock = 80.4284580;
+ amiga.samplesTick = 882;
+ }
+ }
+
+ override public function set stereo(value:Number):void {
+ var chan:AmigaChannel = amiga.channels[0];
+
+ if (value < 0.0) value = 0.0;
+ else if (value > 1.0) value = 1.0;
+
+ while (chan) {
+ chan.level = value * chan.panning;
+ chan = chan.next;
+ }
+ }
+
+ override public function set volume(value:Number):void {
+ if (value < 0.0) value = 0.0;
+ else if (value > 1.0) value = 1.0;
+
+ amiga.master = value * 0.00390625;
+ }
+
+ override public function toggle(index:int):void {
+ amiga.channels[index].mute ^= 1;
+ }
+ }
+}
View
27 Flod 4.1/neoart/flod/core/AmigaRow.as
@@ -0,0 +1,27 @@
+/*
+ Flod 4.1
+ 2012/04/30
+ Christian Corti
+ Neoart Costa Rica
+
+ Last Update: Flod 3.0 - 2012/02/08
+
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
+ OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
+ LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR
+ IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+
+ This work is licensed under the Creative Commons Attribution-Noncommercial-Share Alike 3.0 Unported License.
+ To view a copy of this license, visit http://creativecommons.org/licenses/by-nc-sa/3.0/ or send a letter to
+ Creative Commons, 171 Second Street, Suite 300, San Francisco, California, 94105, USA.
+*/
+package neoart.flod.core {
+
+ public class AmigaRow {
+ public var
+ note : int,
+ sample : int,
+ effect : int,
+ param : int;
+ }
+}
View
30 Flod 4.1/neoart/flod/core/AmigaSample.as
@@ -0,0 +1,30 @@
+/*
+ Flod 4.1
+ 2012/04/30
+ Christian Corti
+ Neoart Costa Rica
+
+ Last Update: Flod 3.0 - 2012/02/08
+
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
+ OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
+ LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR
+ IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+
+ This work is licensed under the Creative Commons Attribution-Noncommercial-Share Alike 3.0 Unported License.
+ To view a copy of this license, visit http://creativecommons.org/licenses/by-nc-sa/3.0/ or send a letter to
+ Creative Commons, 171 Second Street, Suite 300, San Francisco, California, 94105, USA.
+*/
+package neoart.flod.core {
+
+ public class AmigaSample {
+ public var
+ name : String = "",
+ length : int,
+ loop : int,
+ repeat : int,
+ volume : int,
+ pointer : int,
+ loopPtr : int;
+ }
+}
View
25 Flod 4.1/neoart/flod/core/AmigaStep.as
@@ -0,0 +1,25 @@
+/*
+ Flod 4.1
+ 2012/04/30
+ Christian Corti
+ Neoart Costa Rica
+
+ Last Update: Flod 3.0 - 2012/02/08
+
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
+ OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
+ LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR
+ IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+
+ This work is licensed under the Creative Commons Attribution-Noncommercial-Share Alike 3.0 Unported License.
+ To view a copy of this license, visit http://creativecommons.org/licenses/by-nc-sa/3.0/ or send a letter to
+ Creative Commons, 171 Second Street, Suite 300, San Francisco, California, 94105, USA.
+*/
+package neoart.flod.core {
+
+ public class AmigaStep {
+ public var
+ pattern : int,
+ transpose : int;
+ }
+}
View
109 Flod 4.1/neoart/flod/core/CoreMixer.as
@@ -0,0 +1,109 @@
+/*
+ Flod 4.1
+ 2012/04/30
+ Christian Corti
+ Neoart Costa Rica
+
+ Last Update: Flod 3.0 - 2012/02/08
+
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
+ OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
+ LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR
+ IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+
+ This work is licensed under the Creative Commons Attribution-Noncommercial-Share Alike 3.0 Unported License.
+ To view a copy of this license, visit http://creativecommons.org/licenses/by-nc-sa/3.0/ or send a letter to
+ Creative Commons, 171 Second Street, Suite 300, San Francisco, California, 94105, USA.
+*/
+package neoart.flod.core {
+ import flash.events.*;
+ import flash.utils.*;
+
+ public class CoreMixer {
+ public var
+ player : CorePlayer,
+ samplesTick : int;
+ protected var
+ buffer : Vector.<Sample>,
+ samplesLeft : int,
+ remains : int,
+ completed : int,
+ wave : ByteArray;
+
+ public function CoreMixer() {
+ wave = new ByteArray();
+ wave.endian = "littleEndian";
+ bufferSize = 8192;
+ }
+
+ public function get bufferSize():int { return buffer.length; }
+ public function set bufferSize(value:int):void {
+ var i:int, len:int;
+ if (value == len || value < 2048) return;
+
+ if (!buffer) {
+ buffer = new Vector.<Sample>(value, true);
+ } else {
+ len = buffer.length;
+ buffer.fixed = false;
+ buffer.length = value;
+ buffer.fixed = true;
+ }
+
+ if (value > len) {
+ buffer[len] = new Sample();
+
+ for (i = ++len; i < value; ++i)
+ buffer[i] = buffer[int(i - 1)].next = new Sample();
+ }
+ }
+
+ public function get complete():int { return completed; }
+ public function set complete(value:int):void {
+ completed = value ^ player.loopSong;
+ }
+
+ //js function reset
+ internal function initialize():void {
+ var sample:Sample = buffer[0];
+
+ samplesLeft = 0;
+ remains = 0;
+ completed = 0;
+
+ while (sample) {
+ sample.l = sample.r = 0.0;
+ sample = sample.next;
+ }
+ }
+
+ //js function restore
+ internal function reset():void { }
+
+ internal function fast(e:SampleDataEvent):void { }
+
+ internal function accurate(e:SampleDataEvent):void { }
+
+ internal function waveform():ByteArray {
+ var file:ByteArray = new ByteArray();
+ file.endian = "littleEndian";
+
+ file.writeUTFBytes("RIFF");
+ file.writeInt(wave.length + 44);
+ file.writeUTFBytes("WAVEfmt ");
+ file.writeInt(16);
+ file.writeShort(1);
+ file.writeShort(2);
+ file.writeInt(44100);
+ file.writeInt(44100 << 2);
+ file.writeShort(4);
+ file.writeShort(16);
+ file.writeUTFBytes("data");
+ file.writeInt(wave.length);
+ file.writeBytes(wave);
+
+ file.position = 0;
+ return file;
+ }
+ }
+}
View
157 Flod 4.1/neoart/flod/core/CorePlayer.as
@@ -0,0 +1,157 @@
+/*
+ Flod 4.1
+ 2012/04/30
+ Christian Corti
+ Neoart Costa Rica
+
+ Last Update: Flod 4.0 - 2012/03/09
+
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
+ OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
+ LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR
+ IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+
+ This work is licensed under the Creative Commons Attribution-Noncommercial-Share Alike 3.0 Unported License.
+ To view a copy of this license, visit http://creativecommons.org/licenses/by-nc-sa/3.0/ or send a letter to
+ Creative Commons, 171 Second Street, Suite 300, San Francisco, California, 94105, USA.
+*/
+package neoart.flod.core {
+ import flash.events.*;
+ import flash.media.*;
+ import flash.utils.*;
+ import neoart.flip.*;
+
+ public class CorePlayer extends EventDispatcher {
+ public static const
+ ENCODING : String = "us-ascii";
+ public var
+ quality : int,
+ record : int,
+ playSong : int,
+ lastSong : int,
+ version : int,
+ variant : int,
+ title : String = "",
+ channels : int,
+ loopSong : int,
+ speed : int,
+ tempo : int;
+ protected var
+ hardware : CoreMixer,
+ sound : Sound,
+ soundChan : SoundChannel,
+ soundPos : Number = 0.0,
+ endian : String,
+ tick : int;
+
+ public function CorePlayer(hardware:CoreMixer) {
+ hardware.player = this;
+ this.hardware = hardware;
+ }
+
+ public function set force(value:int):void {
+ version = 0;
+ }
+
+ public function set ntsc(value:int):void { }
+
+ public function set stereo(value:Number):void { }
+
+ public function set volume(value:Number):void { }
+
+ public function get waveform():ByteArray {
+ return hardware.waveform();
+ }
+
+ public function toggle(index:int):void { }
+
+ public function load(stream:ByteArray):int {
+ var zip:ZipFile;
+ hardware.reset();
+ stream.position = 0;
+
+ version = 0;
+ playSong = 0;
+ lastSong = 0;
+
+ if (stream.readUnsignedInt() == 67324752) {
+ zip = new ZipFile(stream);
+ stream = zip.uncompress(zip.entries[0]);
+ }
+
+ if (stream) {
+ stream.endian = endian;
+ stream.position = 0;
+ loader(stream);
+ if (version) setup();
+ }
+ return version;
+ }
+
+ public function play(processor:Sound = null):int {
+ if (!version) return 0;
+ if (soundPos == 0.0) initialize();
+ sound = processor || new Sound();
+
+ if (quality && (hardware is Soundblaster)) {
+ sound.addEventListener(SampleDataEvent.SAMPLE_DATA, hardware.accurate);
+ } else {
+ sound.addEventListener(SampleDataEvent.SAMPLE_DATA, hardware.fast);
+ }
+
+ soundChan = sound.play(soundPos);
+ soundChan.addEventListener(Event.SOUND_COMPLETE, completeHandler);
+ soundPos = 0.0;
+ return 1;
+ }
+
+ public function pause():void {
+ if (!version || !soundChan) return;
+ soundPos = soundChan.position;
+ removeEvents();
+ }
+
+ public function stop():void {
+ if (!version) return;
+ if (soundChan) removeEvents();
+ soundPos = 0.0;
+ reset();
+ }
+
+ public function process():void { }
+
+ public function fast():void { }
+
+ public function accurate():void { }
+
+ protected function setup():void { }
+
+ //js function reset
+ protected function initialize():void {
+ tick = 0;
+ hardware.initialize();
+ hardware.samplesTick = 110250 / tempo;
+ }
+
+ protected function reset():void { }
+
+ protected function loader(stream:ByteArray):void { }
+
+ private function completeHandler(e:Event):void {
+ stop();
+ dispatchEvent(e);
+ }
+
+ private function removeEvents():void {
+ soundChan.stop();
+ soundChan.removeEventListener(Event.SOUND_COMPLETE, completeHandler);
+ soundChan.dispatchEvent(new Event(Event.SOUND_COMPLETE));
+
+ if (quality) {
+ sound.removeEventListener(SampleDataEvent.SAMPLE_DATA, hardware.accurate);
+ } else {
+ sound.removeEventListener(SampleDataEvent.SAMPLE_DATA, hardware.fast);
+ }
+ }
+ }
+}
View
104 Flod 4.1/neoart/flod/core/SBChannel.as
@@ -0,0 +1,104 @@
+/*
+ Flod 4.1
+ 2012/04/30
+ Christian Corti
+ Neoart Costa Rica
+
+ Last Update: Flod 3.0 - 2012/02/08
+
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
+ OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
+ LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR
+ IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+
+ This work is licensed under the Creative Commons Attribution-Noncommercial-Share Alike 3.0 Unported License.
+ To view a copy of this license, visit http://creativecommons.org/licenses/by-nc-sa/3.0/ or send a letter to
+ Creative Commons, 171 Second Street, Suite 300, San Francisco, California, 94105, USA.
+*/
+package neoart.flod.core {
+
+ public final class SBChannel {
+ public var
+ next : SBChannel,
+ mute : int,
+ enabled : int,
+ sample : SBSample,
+ length : int,
+ index : int,
+ pointer : int,
+ delta : int,
+ fraction : Number,
+ speed : Number,
+ dir : int,
+ oldSample : SBSample,
+ oldLength : int,
+ oldPointer : int,
+ oldFraction : Number,
+ oldSpeed : Number,
+ oldDir : int,
+ volume : Number,
+ lvol : Number,
+ rvol : Number,
+ panning : int,
+ lpan : Number,
+ rpan : Number,
+ ldata : Number,
+ rdata : Number,
+ mixCounter : int,
+ lmixRampU : Number,
+ lmixDeltaU : Number,
+ rmixRampU : Number,
+ rmixDeltaU : Number,
+ lmixRampD : Number,
+ lmixDeltaD : Number,
+ rmixRampD : Number,
+ rmixDeltaD : Number,
+ volCounter : int,
+ lvolDelta : Number,
+ rvolDelta : Number,
+ panCounter : int,
+ lpanDelta : Number,
+ rpanDelta : Number;
+
+ internal function initialize():void {
+ enabled = 0;
+ sample = null;
+ length = 0;
+ index = 0;
+ pointer = 0;
+ delta = 0;
+ fraction = 0.0;
+ speed = 0.0;
+ dir = 0;
+ oldSample = null;
+ oldLength = 0;
+ oldPointer = 0;
+ oldFraction = 0.0;
+ oldSpeed = 0.0;
+ oldDir = 0;
+ volume = 0.0;
+ lvol = 0.0;
+ rvol = 0.0;
+ panning = 128
+ lpan = 0.5;
+ rpan = 0.5;
+ ldata = 0.0;
+ rdata = 0.0;
+ mixCounter = 0;
+ lmixRampU = 0.0;
+ lmixDeltaU = 0.0;
+ rmixRampU = 0.0;
+ rmixDeltaU = 0.0;
+ lmixRampD = 0.0;
+ lmixDeltaD = 0.0;
+ rmixRampD = 0.0;
+ rmixDeltaD = 0.0;
+ volCounter = 0;
+ lvolDelta = 0.0;
+ rvolDelta = 0.0;
+ panCounter = 0;
+ lpanDelta = 0.0;
+ rpanDelta = 0.0;
+ }
+ }
+}
View
59 Flod 4.1/neoart/flod/core/SBPlayer.as
@@ -0,0 +1,59 @@
+/*
+ Flod 4.1
+ 2012/04/30
+ Christian Corti
+ Neoart Costa Rica
+
+ Last Update: Flod 4.1 - 2012/04/21
+
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
+ OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
+ LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR
+ IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+
+ This work is licensed under the Creative Commons Attribution-Noncommercial-Share Alike 3.0 Unported License.
+ To view a copy of this license, visit http://creativecommons.org/licenses/by-nc-sa/3.0/ or send a letter to
+ Creative Commons, 171 Second Street, Suite 300, San Francisco, California, 94105, USA.
+*/
+package neoart.flod.core {
+
+ public class SBPlayer extends CorePlayer {
+ public var
+ mixer : Soundblaster,
+ length : int,
+ restart : int,
+ track : Vector.<int>;
+ protected var
+ timer : int,
+ master : int;
+
+ public function SBPlayer(mixer:Soundblaster = null) {
+ this.mixer = mixer || new Soundblaster();
+ super(this.mixer);
+
+ endian = "littleEndian";
+ quality = 1;
+ }
+
+ override public function set volume(value:Number):void {
+ if (value < 0.0) value = 0.0;
+ else if (value > 1.0) value = 1.0;
+
+ master = value * 64;
+ }
+
+ override public function toggle(index:int):void {
+ mixer.channels[index].mute ^= 1;
+ }
+
+ override protected function setup():void {
+ mixer.setup(channels);
+ }
+
+ override protected function initialize():void {
+ super.initialize();
+ timer = speed;
+ master = 64;
+ }
+ }
+}
View
99 Flod 4.1/neoart/flod/core/SBSample.as
<
@@ -0,0 +1,99 @@
+/*
+ Flod 4.1
+ 2012/04/30
+ Christian Corti
+ Neoart Costa Rica
+
+ Last Update: Flod 3.0 - 2012/02/08
+
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
+ OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
+ LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR
+ IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+
+ This work is licensed under the Creative Commons Attribution-Noncommercial-Share Alike 3.0 Unported License.
+ To view a copy of this license, visit http://creativecommons.org/licenses/by-nc-sa/3.0/ or send a letter to
+ Creative Commons, 171 Second Street, Suite 300, San Francisco, California, 94105, USA.
+*/
+package neoart.flod.core {
+ import flash.utils.*;
+
+ public class SBSample {
+ public var
+ name : String = "",
+ bits : int = 8,
+ volume : int,
+ length : int,
+ data : Vector.<Number>,
+ loopMode : int,
+ loopStart : int,
+ loopLen : int;
+
+ public function store(stream:ByteArray):void {
+ var delta:int, i:int, len:int = length, pos:int, sample:Number, total:int, value:int;
+ if (!loopLen) loopMode = 0;
+ pos = stream.position;
+
+ if (loopMode) {
+ len = loopStart + loopLen;
+ data = new Vector.<Number>(len + 1, true);
+ } else {
+ data = new Vector.<Number>(length + 1, true);
+ }
+
+ if (bits == 8) {
+ total = pos + len;
+
+ if (total > stream.length)
+ len = stream.length - pos;
+
+ for (i = 0; i < len; ++i) {
+ value = stream.readByte() + delta;
+
+ if (value < -128) value += 256;
+ else if (value > 127) value -= 256;
+
+ data[i] = value * 0.0078125;
+ delta = value;
+ }
+ } else {
+ total = pos + (len << 1);
+