joybox 1.0.0 → 1.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- data/.travis.yml +3 -0
- data/Gemfile +2 -2
- data/Gemfile.lock +4 -4
- data/README.md +66 -22
- data/Rakefile +22 -4
- data/app/ios/app_delegate.rb +48 -0
- data/app/osx/app_delegate.rb +26 -0
- data/app/osx/layers/game_layer.rb +5 -0
- data/app/osx/menu.rb +51 -0
- data/command/command/image.rb +26 -0
- data/command/command/string.rb +15 -0
- data/command/command/template.rb +59 -0
- data/command/command/tmx.rb +75 -0
- data/command/joybox_generate_command.rb +64 -110
- data/command/joybox_retina_command.rb +87 -0
- data/command/{joybox/templates → templates}/layer.erb +0 -0
- data/command/{joybox/templates → templates}/layer_spec.erb +0 -0
- data/command/{joybox/templates → templates}/scene.erb +0 -0
- data/command/{joybox/templates → templates}/scene_spec.erb +0 -0
- data/command/{joybox/templates → templates}/sprite.erb +0 -0
- data/command/{joybox/templates → templates}/sprite_spec.erb +0 -0
- data/ext/extconf.rb +34 -0
- data/joybox.gemspec +103 -50
- data/lib/joybox.rb +2 -0
- data/lib/joybox/joybox-ios.rb +18 -3
- data/lib/joybox/joybox-osx.rb +18 -2
- data/lib/joybox/version.rb +1 -1
- data/motion/joybox-ios/common/cg_point.rb +46 -16
- data/motion/joybox-ios/common/device.rb +56 -0
- data/motion/joybox-ios/common/ui_touch.rb +0 -2
- data/motion/joybox-ios/configuration/configuration.rb +10 -40
- data/motion/joybox-ios/configuration/file_utils.rb +0 -4
- data/motion/joybox-ios/configuration/gl_view.rb +14 -20
- data/motion/joybox-ios/configuration/texture_2d.rb +0 -4
- data/motion/joybox-ios/core/layer.rb +2 -8
- data/motion/joybox-ios/debug/proxy_view.rb +5 -5
- data/motion/joybox-ios/debug/{node.rb → repl.rb} +25 -19
- data/motion/joybox-ios/director.rb +15 -4
- data/motion/joybox-osx/common/ats_point.rb +45 -15
- data/motion/joybox-osx/common/device.rb +30 -0
- data/motion/joybox-osx/common/ns_event.rb +0 -1
- data/motion/joybox-osx/configuration/configuration.rb +6 -26
- data/motion/joybox-osx/configuration/gl_view.rb +16 -14
- data/motion/joybox-osx/core/layer.rb +45 -26
- data/motion/joybox-osx/debug/proxy_view.rb +5 -5
- data/motion/joybox-osx/debug/{node.rb → repl.rb} +13 -7
- data/motion/joybox-osx/director.rb +4 -3
- data/motion/joybox/actions/animate.rb +0 -1
- data/motion/joybox/actions/bezier.rb +2 -9
- data/motion/joybox/actions/blink.rb +1 -4
- data/motion/joybox/actions/callback.rb +19 -0
- data/motion/joybox/actions/d3/flip.rb +27 -0
- data/motion/joybox/actions/d3/jump.rb +30 -0
- data/motion/joybox/actions/d3/lens.rb +30 -0
- data/motion/joybox/actions/d3/shake.rb +32 -0
- data/motion/joybox/actions/d3/shatter.rb +30 -0
- data/motion/joybox/actions/d3/wave.rb +33 -0
- data/motion/joybox/actions/delay.rb +19 -0
- data/motion/joybox/actions/ease.rb +3 -21
- data/motion/joybox/actions/fade.rb +30 -6
- data/motion/joybox/actions/jump.rb +0 -5
- data/motion/joybox/actions/liquid.rb +28 -0
- data/motion/joybox/actions/move.rb +2 -9
- data/motion/joybox/actions/place.rb +0 -2
- data/motion/joybox/actions/repeat.rb +0 -2
- data/motion/joybox/actions/rotate.rb +2 -9
- data/motion/joybox/actions/scale.rb +2 -9
- data/motion/joybox/actions/sequence.rb +0 -1
- data/motion/joybox/actions/shuffle.rb +26 -0
- data/motion/joybox/actions/skew.rb +2 -11
- data/motion/joybox/actions/spawn.rb +0 -1
- data/motion/joybox/actions/split.rb +24 -0
- data/motion/joybox/actions/tint.rb +0 -5
- data/motion/joybox/actions/turn.rb +24 -0
- data/motion/joybox/actions/twirl.rb +30 -0
- data/motion/joybox/actions/visibility.rb +21 -0
- data/motion/joybox/actions/wave.rb +32 -0
- data/motion/joybox/animations/animation.rb +7 -11
- data/motion/joybox/audio/audio.rb +31 -0
- data/motion/joybox/audio/audio_effect.rb +69 -0
- data/motion/joybox/audio/background_audio.rb +77 -0
- data/motion/joybox/common/{gc_size.rb → cg_size.rb} +13 -12
- data/motion/joybox/common/color.rb +4 -13
- data/motion/joybox/common/initialize.rb +11 -0
- data/motion/joybox/common/ns_array.rb +15 -0
- data/motion/joybox/common/ns_string.rb +7 -0
- data/motion/joybox/common/numeric.rb +13 -4
- data/motion/joybox/common/screen.rb +4 -12
- data/motion/joybox/configuration/debug.rb +29 -0
- data/motion/joybox/core/layer.rb +0 -24
- data/motion/joybox/core/layer_color.rb +47 -0
- data/motion/joybox/core/node.rb +18 -8
- data/motion/joybox/core/scene.rb +0 -5
- data/motion/joybox/core/sprite.rb +43 -25
- data/motion/joybox/core/sprite_batch.rb +15 -6
- data/motion/joybox/core/sprite_frame_cache.rb +9 -58
- data/motion/joybox/debug/physics.rb +40 -0
- data/motion/joybox/debug/physics_draw.rb +191 -0
- data/motion/joybox/joybox.rb +9 -1
- data/motion/joybox/macros.rb +13 -13
- data/motion/joybox/physics/aabb.rb +28 -0
- data/motion/joybox/physics/body.rb +163 -68
- data/motion/joybox/physics/chain_shape.rb +71 -0
- data/motion/joybox/physics/circle_shape.rb +31 -0
- data/motion/joybox/physics/edge_shape.rb +37 -0
- data/motion/joybox/physics/filter.rb +17 -0
- data/motion/joybox/physics/fixture.rb +52 -0
- data/motion/joybox/physics/mass_data.rb +19 -0
- data/motion/joybox/physics/physics_sprite.rb +50 -16
- data/motion/joybox/physics/polygon_shape.rb +54 -0
- data/motion/joybox/physics/profile.rb +14 -0
- data/motion/joybox/physics/ray_cast_input.rb +30 -0
- data/motion/joybox/physics/ray_cast_output.rb +17 -0
- data/motion/joybox/physics/shape.rb +61 -0
- data/motion/joybox/physics/transform.rb +17 -0
- data/motion/joybox/physics/world.rb +101 -30
- data/motion/joybox/tmx/object_layer.rb +12 -0
- data/motion/joybox/tmx/tile_layer.rb +74 -0
- data/motion/joybox/tmx/tile_map.rb +112 -0
- data/motion/joybox/tmx/tile_set.rb +26 -0
- data/motion/joybox/tmx/tmx.rb +16 -0
- data/motion/joybox/ui/label.rb +44 -16
- data/motion/joybox/ui/menu.rb +7 -9
- data/motion/joybox/ui/menu_image.rb +11 -8
- data/motion/joybox/ui/menu_label.rb +14 -13
- data/resources/Default-568h@2x.png +0 -0
- data/resources/animation_frames-hd.plist +126 -0
- data/resources/animation_frames-ipadhd.plist +126 -0
- data/resources/animation_frames.plist +126 -0
- data/resources/animation_sprite_sheet-hd.png +0 -0
- data/resources/animation_sprite_sheet-ipadhd.png +0 -0
- data/resources/animation_sprite_sheet.png +0 -0
- data/resources/fps_images-hd.png +0 -0
- data/resources/fps_images-ipadhd.png +0 -0
- data/resources/fps_images.png +0 -0
- data/resources/sprite.png +0 -0
- data/resources/sprite_inverted.png +0 -0
- data/resources/sprite_sheet.png +0 -0
- data/spec/motion/joybox-ios/common/screen_spec.rb +21 -0
- data/spec/{main_spec.rb → motion/joybox-ios/main_spec.rb} +6 -2
- data/spec/motion/joybox-ios/ui/label_spec.rb +20 -0
- data/spec/motion/joybox-ios/ui/menu_label_spec.rb +15 -0
- data/spec/motion/joybox-ios/ui/menu_spec.rb +87 -0
- data/spec/motion/joybox-osx/common/screen_spec.rb +21 -0
- data/spec/motion/joybox-osx/main_spec.rb +13 -0
- data/spec/motion/joybox-osx/ui/label_spec.rb +18 -0
- data/spec/motion/joybox-osx/ui/menu_label_spec.rb +13 -0
- data/spec/motion/joybox-osx/ui/menu_spec.rb +87 -0
- data/spec/motion/joybox/actions/actions_spec.rb +11 -0
- data/spec/motion/joybox/actions/bezier_spec.rb +37 -0
- data/spec/motion/joybox/actions/blink_spec.rb +16 -0
- data/spec/motion/joybox/actions/fade_spec.rb +49 -0
- data/spec/motion/joybox/actions/jump_spec.rb +37 -0
- data/spec/motion/joybox/actions/move_spec.rb +37 -0
- data/spec/motion/joybox/actions/place_spec.rb +12 -0
- data/spec/motion/joybox/actions/rotate_spec.rb +35 -0
- data/spec/motion/joybox/actions/scale_spec.rb +43 -0
- data/spec/motion/joybox/actions/skew_spec.rb +43 -0
- data/spec/motion/joybox/common/cg_size_spec.rb +29 -0
- data/spec/motion/joybox/common/color_spec.rb +31 -0
- data/spec/motion/joybox/common/ns_string_spec.rb +8 -0
- data/spec/motion/joybox/common/numeric_spec.rb +13 -0
- data/spec/motion/joybox/core/node_spec.rb +36 -0
- data/spec/motion/joybox/core/sprite_batch_spec.rb +34 -0
- data/spec/motion/joybox/core/sprite_frame_cache_spec.rb +111 -0
- data/spec/motion/joybox/core/sprite_spec.rb +121 -0
- data/spec/motion/joybox/macros_spec.rb +280 -0
- data/spec/motion/joybox/physics/aabb_spec.rb +17 -0
- data/spec/motion/joybox/physics/body_spec.rb +318 -0
- data/spec/motion/joybox/physics/chain_shape_spec.rb +80 -0
- data/spec/motion/joybox/physics/circle_shape_spec.rb +63 -0
- data/spec/motion/joybox/physics/edge_shape_spec.rb +48 -0
- data/spec/motion/joybox/physics/fixture_spec.rb +106 -0
- data/spec/motion/joybox/physics/mass_data_spec.rb +13 -0
- data/spec/motion/joybox/physics/physics_sprite_spec.rb +50 -0
- data/spec/motion/joybox/physics/polygon_shape_spec.rb +92 -0
- data/spec/motion/joybox/physics/ray_cast_input_spec.rb +17 -0
- data/spec/motion/joybox/physics/ray_cast_output_spec.rb +13 -0
- data/spec/motion/joybox/physics/shape_spec.rb +50 -0
- data/spec/motion/joybox/physics/transform_spec.rb +13 -0
- data/spec/motion/joybox/physics/world_spec.rb +228 -0
- data/spec/motion/joybox/ui/label_spec.rb +53 -0
- data/spec/motion/joybox/ui/menu_image_spec.rb +51 -0
- data/spec/motion/joybox/ui/menu_label_spec.rb +68 -0
- data/spec/motion/joybox/ui/menu_spec.rb +26 -0
- data/spec/spec_helpers/cg_point.rb +5 -0
- data/spec/spec_helpers/cg_point_spec.rb +14 -0
- data/template/joybox-ios-example-repl/files/.gitignore +16 -0
- data/template/joybox-ios/files/.gitignore +16 -0
- data/template/joybox-osx-example-repl/files/.gitignore +16 -0
- data/template/joybox-osx/files/.gitignore +16 -0
- data/vendor/vendor-ios/box_2d/box_2d.bridgesupport +1201 -85
- data/vendor/vendor-ios/box_2d/box_2d_include/B2DAABB.h +21 -0
- data/vendor/vendor-ios/box_2d/box_2d_include/B2DBody.h +58 -13
- data/vendor/vendor-ios/box_2d/box_2d_include/B2DBodyDef.h +44 -0
- data/vendor/vendor-ios/box_2d/box_2d_include/B2DBodyTypes.h +20 -0
- data/vendor/vendor-ios/box_2d/box_2d_include/B2DChainShape.h +29 -0
- data/vendor/vendor-ios/box_2d/box_2d_include/B2DCircleShape.h +7 -0
- data/vendor/vendor-ios/box_2d/box_2d_include/B2DColor.h +23 -0
- data/vendor/vendor-ios/box_2d/box_2d_include/B2DContactFilter.h +24 -0
- data/vendor/vendor-ios/box_2d/box_2d_include/B2DContactListener.h +1 -1
- data/vendor/vendor-ios/box_2d/box_2d_include/B2DDestructionListener.h +24 -0
- data/vendor/vendor-ios/box_2d/box_2d_include/B2DDraw.h +54 -0
- data/vendor/vendor-ios/box_2d/box_2d_include/B2DEdgeShape.h +13 -2
- data/vendor/vendor-ios/box_2d/box_2d_include/B2DFilter.h +23 -0
- data/vendor/vendor-ios/box_2d/box_2d_include/B2DFixture.h +47 -0
- data/vendor/vendor-ios/box_2d/box_2d_include/B2DFixtureDef.h +29 -0
- data/vendor/vendor-ios/box_2d/box_2d_include/B2DMassData.h +23 -0
- data/vendor/vendor-ios/box_2d/box_2d_include/B2DPolygonShape.h +14 -1
- data/vendor/vendor-ios/box_2d/box_2d_include/B2DProfile.h +31 -0
- data/vendor/vendor-ios/box_2d/box_2d_include/B2DQueryCallback.h +24 -0
- data/vendor/vendor-ios/box_2d/box_2d_include/B2DRayCastCallback.h +24 -0
- data/vendor/vendor-ios/box_2d/box_2d_include/B2DRayCastInput.h +23 -0
- data/vendor/vendor-ios/box_2d/box_2d_include/B2DRayCastOutput.h +21 -0
- data/vendor/vendor-ios/box_2d/box_2d_include/B2DShape.h +23 -3
- data/vendor/vendor-ios/box_2d/box_2d_include/B2DShapeTypes.h +22 -0
- data/vendor/vendor-ios/box_2d/box_2d_include/B2DTransform.h +21 -0
- data/vendor/vendor-ios/box_2d/box_2d_include/B2DWorld.h +40 -19
- data/vendor/vendor-ios/box_2d/libBox2D.a +0 -0
- data/vendor/vendor-ios/cocos_2d/cocos_2d.bridgesupport +808 -1578
- data/vendor/vendor-ios/cocos_2d/cocos_2d_include/CCActionEase.h +47 -0
- data/vendor/vendor-ios/cocos_2d/cocos_2d_include/CCFontDefinition.h +85 -0
- data/vendor/vendor-ios/cocos_2d/cocos_2d_include/CCLabelTTF.h +54 -6
- data/vendor/vendor-ios/cocos_2d/cocos_2d_include/CCMenuItem.h +1 -0
- data/vendor/vendor-ios/cocos_2d/cocos_2d_include/CCTMXLayer.h +2 -2
- data/vendor/vendor-ios/cocos_2d/cocos_2d_include/CCTexture2D.h +4 -0
- data/vendor/vendor-ios/cocos_2d/cocos_2d_include/ccTypes.h +51 -1
- data/vendor/vendor-ios/cocos_2d/libcocos2d.a +0 -0
- data/vendor/vendor-ios/cocos_builder_reader/cocos_builder_reader.bridgesupport +510 -0
- data/vendor/vendor-ios/cocos_builder_reader/cocos_builder_reader_include/CCBAnimationManager.h +149 -0
- data/vendor/vendor-ios/cocos_builder_reader/cocos_builder_reader_include/CCBKeyframe.h +40 -0
- data/vendor/vendor-ios/cocos_builder_reader/cocos_builder_reader_include/CCBReader.h +176 -0
- data/vendor/vendor-ios/cocos_builder_reader/cocos_builder_reader_include/CCBSequence.h +49 -0
- data/vendor/vendor-ios/cocos_builder_reader/cocos_builder_reader_include/CCBSequenceProperty.h +38 -0
- data/vendor/vendor-ios/cocos_builder_reader/cocos_builder_reader_include/CCNode+CCBRelativePositioning.h +65 -0
- data/vendor/vendor-ios/cocos_builder_reader/libCocosBuilderReader.a +0 -0
- data/vendor/vendor-ios/cocos_denshion/cocos_denshion.bridgesupport +1001 -0
- data/vendor/vendor-ios/cocos_denshion/cocos_denshion_include/CDAudioManager.h +243 -0
- data/vendor/vendor-ios/cocos_denshion/cocos_denshion_include/CDConfig.h +60 -0
- data/vendor/vendor-ios/cocos_denshion/cocos_denshion_include/CDOpenALSupport.h +77 -0
- data/vendor/vendor-ios/cocos_denshion/cocos_denshion_include/CDXMacOSXSupport.h +232 -0
- data/vendor/vendor-ios/cocos_denshion/cocos_denshion_include/CDXPropertyModifierAction.h +45 -0
- data/vendor/vendor-ios/cocos_denshion/cocos_denshion_include/CocosDenshion.h +440 -0
- data/vendor/vendor-ios/cocos_denshion/cocos_denshion_include/SimpleAudioEngine.h +90 -0
- data/vendor/vendor-ios/cocos_denshion/libCocosDenshion.a +0 -0
- data/vendor/vendor-ios/kazmath/kazmath.bridgesupport +865 -0
- data/vendor/vendor-ios/kazmath/kazmath_include/GL/mat4stack.h +51 -0
- data/vendor/vendor-ios/kazmath/kazmath_include/GL/matrix.h +58 -0
- data/vendor/vendor-ios/kazmath/kazmath_include/aabb.h +53 -0
- data/vendor/vendor-ios/kazmath/kazmath_include/kazmath.h +39 -0
- data/vendor/vendor-ios/kazmath/kazmath_include/mat3.h +75 -0
- data/vendor/vendor-ios/kazmath/kazmath_include/mat4.h +93 -0
- data/vendor/vendor-ios/kazmath/kazmath_include/neon_matrix_impl.h +41 -0
- data/vendor/vendor-ios/kazmath/kazmath_include/plane.h +70 -0
- data/vendor/vendor-ios/kazmath/kazmath_include/quaternion.h +113 -0
- data/vendor/vendor-ios/kazmath/kazmath_include/ray2.h +50 -0
- data/vendor/vendor-ios/kazmath/kazmath_include/utility.h +74 -0
- data/vendor/vendor-ios/kazmath/kazmath_include/vec2.h +64 -0
- data/vendor/vendor-ios/kazmath/kazmath_include/vec3.h +68 -0
- data/vendor/vendor-ios/kazmath/kazmath_include/vec4.h +68 -0
- data/vendor/vendor-ios/kazmath/libkazmath.a +0 -0
- data/vendor/vendor-osx/box_2d/box_2d.bridgesupport +1199 -83
- data/vendor/vendor-osx/box_2d/box_2d_include/B2DAABB.h +21 -0
- data/vendor/vendor-osx/box_2d/box_2d_include/B2DBody.h +58 -13
- data/vendor/vendor-osx/box_2d/box_2d_include/B2DBodyDef.h +44 -0
- data/vendor/vendor-osx/box_2d/box_2d_include/B2DBodyTypes.h +20 -0
- data/vendor/vendor-osx/box_2d/box_2d_include/B2DChainShape.h +29 -0
- data/vendor/vendor-osx/box_2d/box_2d_include/B2DCircleShape.h +7 -0
- data/vendor/vendor-osx/box_2d/box_2d_include/B2DColor.h +23 -0
- data/vendor/vendor-osx/box_2d/box_2d_include/B2DContactFilter.h +24 -0
- data/vendor/vendor-osx/box_2d/box_2d_include/B2DContactListener.h +1 -1
- data/vendor/vendor-osx/box_2d/box_2d_include/B2DDestructionListener.h +24 -0
- data/vendor/vendor-osx/box_2d/box_2d_include/B2DDraw.h +54 -0
- data/vendor/vendor-osx/box_2d/box_2d_include/B2DEdgeShape.h +13 -2
- data/vendor/vendor-osx/box_2d/box_2d_include/B2DFilter.h +23 -0
- data/vendor/vendor-osx/box_2d/box_2d_include/B2DFixture.h +47 -0
- data/vendor/vendor-osx/box_2d/box_2d_include/B2DFixtureDef.h +29 -0
- data/vendor/vendor-osx/box_2d/box_2d_include/B2DMassData.h +23 -0
- data/vendor/vendor-osx/box_2d/box_2d_include/B2DPolygonShape.h +14 -1
- data/vendor/vendor-osx/box_2d/box_2d_include/B2DProfile.h +31 -0
- data/vendor/vendor-osx/box_2d/box_2d_include/B2DQueryCallback.h +24 -0
- data/vendor/vendor-osx/box_2d/box_2d_include/B2DRayCastCallback.h +24 -0
- data/vendor/vendor-osx/box_2d/box_2d_include/B2DRayCastInput.h +23 -0
- data/vendor/vendor-osx/box_2d/box_2d_include/B2DRayCastOutput.h +21 -0
- data/vendor/vendor-osx/box_2d/box_2d_include/B2DShape.h +23 -3
- data/vendor/vendor-osx/box_2d/box_2d_include/B2DShapeTypes.h +22 -0
- data/vendor/vendor-osx/box_2d/box_2d_include/B2DTransform.h +21 -0
- data/vendor/vendor-osx/box_2d/box_2d_include/B2DWorld.h +40 -19
- data/vendor/vendor-osx/box_2d/libBox2D.a +0 -0
- data/vendor/vendor-osx/cocos_2d/cocos_2d.bridgesupport +2820 -2633
- data/vendor/vendor-osx/cocos_2d/cocos_2d_include/CCActionEase.h +47 -0
- data/vendor/vendor-osx/cocos_2d/cocos_2d_include/CCFontDefinition.h +85 -0
- data/vendor/vendor-osx/cocos_2d/cocos_2d_include/CCLabelTTF.h +54 -6
- data/vendor/vendor-osx/cocos_2d/cocos_2d_include/CCMenuItem.h +1 -0
- data/vendor/vendor-osx/cocos_2d/cocos_2d_include/CCTMXLayer.h +2 -2
- data/vendor/vendor-osx/cocos_2d/cocos_2d_include/CCTexture2D.h +4 -0
- data/vendor/vendor-osx/cocos_2d/cocos_2d_include/Platforms/iOS/CCDirectorIOS.h +111 -0
- data/vendor/vendor-osx/cocos_2d/cocos_2d_include/Platforms/iOS/CCES2Renderer.h +83 -0
- data/vendor/vendor-osx/cocos_2d/cocos_2d_include/Platforms/iOS/CCESRenderer.h +54 -0
- data/vendor/vendor-osx/cocos_2d/cocos_2d_include/Platforms/iOS/CCGLView.h +175 -0
- data/vendor/vendor-osx/cocos_2d/cocos_2d_include/Platforms/iOS/CCTouchDelegateProtocol.h +75 -0
- data/vendor/vendor-osx/cocos_2d/cocos_2d_include/Platforms/iOS/CCTouchDispatcher.h +120 -0
- data/vendor/vendor-osx/cocos_2d/cocos_2d_include/Platforms/iOS/CCTouchHandler.h +93 -0
- data/vendor/vendor-osx/cocos_2d/cocos_2d_include/ccTypes.h +65 -1
- data/vendor/vendor-osx/cocos_2d/libcocos2d.a +0 -0
- data/vendor/vendor-osx/cocos_builder_reader/cocos_builder_reader.bridgesupport +510 -0
- data/vendor/vendor-osx/cocos_builder_reader/cocos_builder_reader_include/CCBAnimationManager.h +149 -0
- data/vendor/vendor-osx/cocos_builder_reader/cocos_builder_reader_include/CCBKeyframe.h +40 -0
- data/vendor/vendor-osx/cocos_builder_reader/cocos_builder_reader_include/CCBReader.h +176 -0
- data/vendor/vendor-osx/cocos_builder_reader/cocos_builder_reader_include/CCBSequence.h +49 -0
- data/vendor/vendor-osx/cocos_builder_reader/cocos_builder_reader_include/CCBSequenceProperty.h +38 -0
- data/vendor/vendor-osx/cocos_builder_reader/cocos_builder_reader_include/CCNode+CCBRelativePositioning.h +65 -0
- data/vendor/vendor-osx/cocos_builder_reader/libCocosBuilderReader.a +0 -0
- data/vendor/vendor-osx/cocos_denshion/cocos_denshion.bridgesupport +1001 -0
- data/vendor/vendor-osx/cocos_denshion/cocos_denshion_include/CDAudioManager.h +243 -0
- data/vendor/vendor-osx/cocos_denshion/cocos_denshion_include/CDConfig.h +60 -0
- data/vendor/vendor-osx/cocos_denshion/cocos_denshion_include/CDOpenALSupport.h +77 -0
- data/vendor/vendor-osx/cocos_denshion/cocos_denshion_include/CDXMacOSXSupport.h +232 -0
- data/vendor/vendor-osx/cocos_denshion/cocos_denshion_include/CDXPropertyModifierAction.h +45 -0
- data/vendor/vendor-osx/cocos_denshion/cocos_denshion_include/CocosDenshion.h +440 -0
- data/vendor/vendor-osx/cocos_denshion/cocos_denshion_include/SimpleAudioEngine.h +90 -0
- data/vendor/vendor-osx/cocos_denshion/libCocosDenshion.a +0 -0
- data/vendor/vendor-osx/kazmath/kazmath.bridgesupport +865 -0
- data/vendor/vendor-osx/kazmath/kazmath_include/GL/mat4stack.h +51 -0
- data/vendor/vendor-osx/kazmath/kazmath_include/GL/matrix.h +58 -0
- data/vendor/vendor-osx/kazmath/kazmath_include/aabb.h +53 -0
- data/vendor/vendor-osx/kazmath/kazmath_include/kazmath.h +39 -0
- data/vendor/vendor-osx/kazmath/kazmath_include/mat3.h +75 -0
- data/vendor/vendor-osx/kazmath/kazmath_include/mat4.h +93 -0
- data/vendor/vendor-osx/kazmath/kazmath_include/neon_matrix_impl.h +41 -0
- data/vendor/vendor-osx/kazmath/kazmath_include/plane.h +70 -0
- data/vendor/vendor-osx/kazmath/kazmath_include/quaternion.h +113 -0
- data/vendor/vendor-osx/kazmath/kazmath_include/ray2.h +50 -0
- data/vendor/vendor-osx/kazmath/kazmath_include/utility.h +74 -0
- data/vendor/vendor-osx/kazmath/kazmath_include/vec2.h +64 -0
- data/vendor/vendor-osx/kazmath/kazmath_include/vec3.h +68 -0
- data/vendor/vendor-osx/kazmath/kazmath_include/vec4.h +68 -0
- data/vendor/vendor-osx/kazmath/libkazmath.a +0 -0
- metadata +353 -57
- checksums.yaml +0 -15
- data/bin/joybox +0 -49
- data/command/joybox/USAGE +0 -24
- data/motion/joybox-ios/configuration/debug.rb +0 -27
- data/motion/joybox-ios/debug/debug.rb +0 -10
- data/motion/joybox-osx/configuration/debug.rb +0 -27
- data/motion/joybox-osx/configuration/sprite_view.rb +0 -91
- data/motion/joybox-osx/debug/debug.rb +0 -10
- data/motion/joybox/core/ns_object.rb +0 -8
- data/spec/lib/joybox/cocos2d/cocos2d_spec.rb +0 -7
- data/spec/lib/joybox/cocos2d/macros_spec.rb +0 -37
- data/vendor/vendor-ios/cocos_2d/cocos_2d_include/cocos2d-ios-exceptions.bridgesupport +0 -39
- data/vendor/vendor-ios/cocos_2d/cocos_2d_include/gen_cocos2d_bridgesupport.sh +0 -17
- data/vendor/vendor-ios/cocos_2d/cocos_2d_include/gen_cocos2d_complement.sh +0 -17
|
@@ -0,0 +1,243 @@
|
|
|
1
|
+
/*
|
|
2
|
+
Copyright (c) 2010 Steve Oldmeadow
|
|
3
|
+
|
|
4
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
5
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
6
|
+
in the Software without restriction, including without limitation the rights
|
|
7
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
8
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
9
|
+
furnished to do so, subject to the following conditions:
|
|
10
|
+
|
|
11
|
+
The above copyright notice and this permission notice shall be included in
|
|
12
|
+
all copies or substantial portions of the Software.
|
|
13
|
+
|
|
14
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
15
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
16
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
17
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
18
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
19
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
|
20
|
+
THE SOFTWARE.
|
|
21
|
+
|
|
22
|
+
$Id$
|
|
23
|
+
*/
|
|
24
|
+
|
|
25
|
+
#import "CocosDenshion.h"
|
|
26
|
+
#if __IPHONE_OS_VERSION_MIN_REQUIRED >= 30000
|
|
27
|
+
#import <AVFoundation/AVFoundation.h>
|
|
28
|
+
#else
|
|
29
|
+
#import "CDXMacOSXSupport.h"
|
|
30
|
+
#endif
|
|
31
|
+
|
|
32
|
+
/** Different modes of the engine */
|
|
33
|
+
typedef enum {
|
|
34
|
+
kAMM_FxOnly, //!Other apps will be able to play audio
|
|
35
|
+
kAMM_FxPlusMusic, //!Only this app will play audio
|
|
36
|
+
kAMM_FxPlusMusicIfNoOtherAudio, //!If another app is playing audio at start up then allow it to continue and don't play music
|
|
37
|
+
kAMM_MediaPlayback, //!This app takes over audio e.g music player app
|
|
38
|
+
kAMM_PlayAndRecord //!App takes over audio and has input and output
|
|
39
|
+
} tAudioManagerMode;
|
|
40
|
+
|
|
41
|
+
/** Possible states of the engine */
|
|
42
|
+
typedef enum {
|
|
43
|
+
kAMStateUninitialised, //!Audio manager has not been initialised - do not use
|
|
44
|
+
kAMStateInitialising, //!Audio manager is in the process of initialising - do not use
|
|
45
|
+
kAMStateInitialised //!Audio manager is initialised - safe to use
|
|
46
|
+
} tAudioManagerState;
|
|
47
|
+
|
|
48
|
+
typedef enum {
|
|
49
|
+
kAMRBDoNothing, //Audio manager will not do anything on resign or becoming active
|
|
50
|
+
kAMRBStopPlay, //Background music is stopped on resign and resumed on become active
|
|
51
|
+
kAMRBStop //Background music is stopped on resign but not resumed - maybe because you want to do this from within your game
|
|
52
|
+
} tAudioManagerResignBehavior;
|
|
53
|
+
|
|
54
|
+
/** Notifications */
|
|
55
|
+
extern NSString * const kCDN_AudioManagerInitialised;
|
|
56
|
+
|
|
57
|
+
@interface CDAsynchInitialiser : NSOperation {}
|
|
58
|
+
@end
|
|
59
|
+
|
|
60
|
+
/** CDAudioManager supports two long audio source channels called left and right*/
|
|
61
|
+
typedef enum {
|
|
62
|
+
kASC_Left = 0,
|
|
63
|
+
kASC_Right = 1
|
|
64
|
+
} tAudioSourceChannel;
|
|
65
|
+
|
|
66
|
+
typedef enum {
|
|
67
|
+
kLAS_Init,
|
|
68
|
+
kLAS_Loaded,
|
|
69
|
+
kLAS_Playing,
|
|
70
|
+
kLAS_Paused,
|
|
71
|
+
kLAS_Stopped,
|
|
72
|
+
} tLongAudioSourceState;
|
|
73
|
+
|
|
74
|
+
@class CDLongAudioSource;
|
|
75
|
+
@protocol CDLongAudioSourceDelegate <NSObject>
|
|
76
|
+
@optional
|
|
77
|
+
/** The audio source completed playing */
|
|
78
|
+
- (void) cdAudioSourceDidFinishPlaying:(CDLongAudioSource *) audioSource;
|
|
79
|
+
/** The file used to load the audio source has changed */
|
|
80
|
+
- (void) cdAudioSourceFileDidChange:(CDLongAudioSource *) audioSource;
|
|
81
|
+
@end
|
|
82
|
+
|
|
83
|
+
/**
|
|
84
|
+
CDLongAudioSource represents an audio source that has a long duration which makes
|
|
85
|
+
it costly to load into memory for playback as an effect using CDSoundEngine. Examples
|
|
86
|
+
include background music and narration tracks. The audio file may or may not be compressed.
|
|
87
|
+
Bear in mind that current iDevices can only use hardware to decode a single compressed
|
|
88
|
+
audio file at a time and playing multiple compressed files will result in a performance drop
|
|
89
|
+
as software decompression will take place.
|
|
90
|
+
@since v0.99
|
|
91
|
+
*/
|
|
92
|
+
@interface CDLongAudioSource : NSObject <AVAudioPlayerDelegate, CDAudioInterruptProtocol>{
|
|
93
|
+
AVAudioPlayer *audioSourcePlayer;
|
|
94
|
+
NSString *audioSourceFilePath;
|
|
95
|
+
NSInteger numberOfLoops;
|
|
96
|
+
float volume;
|
|
97
|
+
id<CDLongAudioSourceDelegate> delegate;
|
|
98
|
+
BOOL mute;
|
|
99
|
+
BOOL enabled_;
|
|
100
|
+
BOOL backgroundMusic;
|
|
101
|
+
@public
|
|
102
|
+
BOOL systemPaused;//Used for auto resign handling
|
|
103
|
+
NSTimeInterval systemPauseLocation;//Used for auto resign handling
|
|
104
|
+
@protected
|
|
105
|
+
tLongAudioSourceState state;
|
|
106
|
+
}
|
|
107
|
+
@property (readonly) AVAudioPlayer *audioSourcePlayer;
|
|
108
|
+
@property (readonly) NSString *audioSourceFilePath;
|
|
109
|
+
@property (readwrite, nonatomic) NSInteger numberOfLoops;
|
|
110
|
+
@property (readwrite, nonatomic) float volume;
|
|
111
|
+
@property (assign) id<CDLongAudioSourceDelegate> delegate;
|
|
112
|
+
/* This long audio source functions as background music */
|
|
113
|
+
@property (readwrite, nonatomic) BOOL backgroundMusic;
|
|
114
|
+
|
|
115
|
+
/** Loads the file into the audio source */
|
|
116
|
+
-(void) load:(NSString*) filePath;
|
|
117
|
+
/** Plays the audio source */
|
|
118
|
+
-(void) play;
|
|
119
|
+
/** Stops playing the audio soruce */
|
|
120
|
+
-(void) stop;
|
|
121
|
+
/** Pauses the audio source */
|
|
122
|
+
-(void) pause;
|
|
123
|
+
/** Rewinds the audio source */
|
|
124
|
+
-(void) rewind;
|
|
125
|
+
/** Resumes playing the audio source if it was paused */
|
|
126
|
+
-(void) resume;
|
|
127
|
+
/** Returns whether or not the audio source is playing */
|
|
128
|
+
-(BOOL) isPlaying;
|
|
129
|
+
|
|
130
|
+
@end
|
|
131
|
+
|
|
132
|
+
/**
|
|
133
|
+
CDAudioManager manages audio requirements for a game. It provides access to a CDSoundEngine object
|
|
134
|
+
for playing sound effects. It provides access to two CDLongAudioSource object (left and right channel)
|
|
135
|
+
for playing long duration audio such as background music and narration tracks. Additionally it manages
|
|
136
|
+
the audio session to take care of things like audio session interruption and interacting with the audio
|
|
137
|
+
of other apps that are running on the device.
|
|
138
|
+
|
|
139
|
+
Requirements:
|
|
140
|
+
- Firmware: OS 2.2 or greater
|
|
141
|
+
- Files: CDAudioManager.*, CocosDenshion.*
|
|
142
|
+
- Frameworks: OpenAL, AudioToolbox, AVFoundation
|
|
143
|
+
@since v0.8
|
|
144
|
+
*/
|
|
145
|
+
@interface CDAudioManager : NSObject <CDLongAudioSourceDelegate, CDAudioInterruptProtocol, AVAudioSessionDelegate> {
|
|
146
|
+
CDSoundEngine *soundEngine;
|
|
147
|
+
CDLongAudioSource *backgroundMusic;
|
|
148
|
+
NSMutableArray *audioSourceChannels;
|
|
149
|
+
NSString* _audioSessionCategory;
|
|
150
|
+
BOOL _audioWasPlayingAtStartup;
|
|
151
|
+
tAudioManagerMode _mode;
|
|
152
|
+
SEL backgroundMusicCompletionSelector;
|
|
153
|
+
id backgroundMusicCompletionListener;
|
|
154
|
+
BOOL willPlayBackgroundMusic;
|
|
155
|
+
BOOL _mute;
|
|
156
|
+
BOOL _resigned;
|
|
157
|
+
BOOL _interrupted;
|
|
158
|
+
BOOL _audioSessionActive;
|
|
159
|
+
BOOL enabled_;
|
|
160
|
+
|
|
161
|
+
//For handling resign/become active
|
|
162
|
+
BOOL _isObservingAppEvents;
|
|
163
|
+
tAudioManagerResignBehavior _resignBehavior;
|
|
164
|
+
}
|
|
165
|
+
|
|
166
|
+
@property (readonly) CDSoundEngine *soundEngine;
|
|
167
|
+
@property (readonly) CDLongAudioSource *backgroundMusic;
|
|
168
|
+
@property (readonly) BOOL willPlayBackgroundMusic;
|
|
169
|
+
|
|
170
|
+
/** Returns the shared singleton */
|
|
171
|
+
+ (CDAudioManager *) sharedManager;
|
|
172
|
+
+ (tAudioManagerState) sharedManagerState;
|
|
173
|
+
/** Configures the shared singleton with a mode*/
|
|
174
|
+
+ (void) configure: (tAudioManagerMode) mode;
|
|
175
|
+
/** Initializes the engine asynchronously with a mode */
|
|
176
|
+
+ (void) initAsynchronously: (tAudioManagerMode) mode;
|
|
177
|
+
/** Initializes the engine synchronously with a mode, channel definition and a total number of channels */
|
|
178
|
+
- (id) init: (tAudioManagerMode) mode;
|
|
179
|
+
-(void) audioSessionInterrupted;
|
|
180
|
+
-(void) audioSessionResumed;
|
|
181
|
+
-(void) setResignBehavior:(tAudioManagerResignBehavior) resignBehavior autoHandle:(BOOL) autoHandle;
|
|
182
|
+
/** Returns true is audio is muted at a hardware level e.g user has ringer switch set to off */
|
|
183
|
+
-(BOOL) isDeviceMuted;
|
|
184
|
+
/** Returns true if another app is playing audio such as the iPod music player */
|
|
185
|
+
-(BOOL) isOtherAudioPlaying;
|
|
186
|
+
/** Sets the way the audio manager interacts with the operating system such as whether it shares output with other apps or obeys the mute switch */
|
|
187
|
+
-(void) setMode:(tAudioManagerMode) mode;
|
|
188
|
+
/** Shuts down the shared audio manager instance so that it can be reinitialised */
|
|
189
|
+
+(void) end;
|
|
190
|
+
|
|
191
|
+
/** Call if you want to use built in resign behavior but need to do some additional audio processing on resign active. */
|
|
192
|
+
- (void) applicationWillResignActive;
|
|
193
|
+
/** Call if you want to use built in resign behavior but need to do some additional audio processing on become active. */
|
|
194
|
+
- (void) applicationDidBecomeActive;
|
|
195
|
+
|
|
196
|
+
//New AVAudioPlayer API
|
|
197
|
+
/** Loads the data from the specified file path to the channel's audio source */
|
|
198
|
+
-(CDLongAudioSource*) audioSourceLoad:(NSString*) filePath channel:(tAudioSourceChannel) channel;
|
|
199
|
+
/** Retrieves the audio source for the specified channel */
|
|
200
|
+
-(CDLongAudioSource*) audioSourceForChannel:(tAudioSourceChannel) channel;
|
|
201
|
+
|
|
202
|
+
//Legacy AVAudioPlayer API
|
|
203
|
+
/** Plays music in background. The music can be looped or not
|
|
204
|
+
It is recommended to use .aac files as background music since they are decoded by the device (hardware).
|
|
205
|
+
*/
|
|
206
|
+
-(void) playBackgroundMusic:(NSString*) filePath loop:(BOOL) loop;
|
|
207
|
+
/** Preloads a background music */
|
|
208
|
+
-(void) preloadBackgroundMusic:(NSString*) filePath;
|
|
209
|
+
/** Stops playing the background music */
|
|
210
|
+
-(void) stopBackgroundMusic;
|
|
211
|
+
/** Pauses the background music */
|
|
212
|
+
-(void) pauseBackgroundMusic;
|
|
213
|
+
/** Rewinds the background music */
|
|
214
|
+
-(void) rewindBackgroundMusic;
|
|
215
|
+
/** Resumes playing the background music */
|
|
216
|
+
-(void) resumeBackgroundMusic;
|
|
217
|
+
/** Returns whether or not the background music is playing */
|
|
218
|
+
-(BOOL) isBackgroundMusicPlaying;
|
|
219
|
+
|
|
220
|
+
-(void) setBackgroundMusicCompletionListener:(id) listener selector:(SEL) selector;
|
|
221
|
+
|
|
222
|
+
@end
|
|
223
|
+
|
|
224
|
+
/** Fader for long audio source objects */
|
|
225
|
+
@interface CDLongAudioSourceFader : CDPropertyModifier{}
|
|
226
|
+
@end
|
|
227
|
+
|
|
228
|
+
static const int kCDNoBuffer = -1;
|
|
229
|
+
|
|
230
|
+
/** Allows buffers to be associated with file names */
|
|
231
|
+
@interface CDBufferManager:NSObject{
|
|
232
|
+
NSMutableDictionary* loadedBuffers;
|
|
233
|
+
NSMutableArray *freedBuffers;
|
|
234
|
+
CDSoundEngine *soundEngine;
|
|
235
|
+
int nextBufferId;
|
|
236
|
+
}
|
|
237
|
+
|
|
238
|
+
-(id) initWithEngine:(CDSoundEngine *) theSoundEngine;
|
|
239
|
+
-(int) bufferForFile:(NSString*) filePath create:(BOOL) create;
|
|
240
|
+
-(void) releaseBufferForFile:(NSString *) filePath;
|
|
241
|
+
|
|
242
|
+
@end
|
|
243
|
+
|
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
/*
|
|
2
|
+
Copyright (c) 2010 Steve Oldmeadow
|
|
3
|
+
|
|
4
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
5
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
6
|
+
in the Software without restriction, including without limitation the rights
|
|
7
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
8
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
9
|
+
furnished to do so, subject to the following conditions:
|
|
10
|
+
|
|
11
|
+
The above copyright notice and this permission notice shall be included in
|
|
12
|
+
all copies or substantial portions of the Software.
|
|
13
|
+
|
|
14
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
15
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
16
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
17
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
18
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
19
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
|
20
|
+
THE SOFTWARE.
|
|
21
|
+
|
|
22
|
+
$Id$
|
|
23
|
+
*/
|
|
24
|
+
#define COCOSDENSHION_VERSION "Aphex.rc"
|
|
25
|
+
|
|
26
|
+
|
|
27
|
+
/**
|
|
28
|
+
If enabled code useful for debugging such as parameter check assertions will be performed.
|
|
29
|
+
If you experience any problems you should enable this and test your code with a debug build.
|
|
30
|
+
*/
|
|
31
|
+
//#define CD_DEBUG 1
|
|
32
|
+
|
|
33
|
+
/**
|
|
34
|
+
The total number of sounds/buffers that can be loaded assuming memory is sufficient
|
|
35
|
+
*/
|
|
36
|
+
//Number of buffers slots that will be initially created
|
|
37
|
+
#define CD_BUFFERS_START 64
|
|
38
|
+
//Number of buffers that will be added
|
|
39
|
+
#define CD_BUFFERS_INCREMENT 16
|
|
40
|
+
|
|
41
|
+
/**
|
|
42
|
+
If enabled, OpenAL code will use static buffers. When static buffers are used the audio
|
|
43
|
+
data is managed outside of OpenAL, this eliminates a memcpy operation which leads to
|
|
44
|
+
higher performance when loading sounds.
|
|
45
|
+
|
|
46
|
+
However, the downside is that when the audio data is freed you must
|
|
47
|
+
be certain that it is no longer being accessed otherwise your app will crash. Testing on OS 2.2.1
|
|
48
|
+
and 3.1.2 has shown that this may occur if a buffer is being used by a source with state = AL_PLAYING
|
|
49
|
+
when the buffer is deleted. If the data is freed too quickly after the source is stopped then
|
|
50
|
+
a crash will occur. The implemented workaround is that when static buffers are used the unloadBuffer code will wait for
|
|
51
|
+
any playing sources to finish playing before the associated buffer and data are deleted, however, this delay may negate any
|
|
52
|
+
performance gains that are achieved during loading.
|
|
53
|
+
|
|
54
|
+
Performance tests on a 1st gen iPod running OS 2.2.1 loading the CocosDenshionDemo sounds were ~0.14 seconds without
|
|
55
|
+
static buffers and ~0.12 seconds when using static buffers.
|
|
56
|
+
|
|
57
|
+
*/
|
|
58
|
+
//#define CD_USE_STATIC_BUFFERS 1
|
|
59
|
+
|
|
60
|
+
|
|
@@ -0,0 +1,77 @@
|
|
|
1
|
+
/*
|
|
2
|
+
|
|
3
|
+
Disclaimer: IMPORTANT: This Apple software is supplied to you by
|
|
4
|
+
Apple Inc. ("Apple") in consideration of your agreement to the
|
|
5
|
+
following terms, and your use, installation, modification or
|
|
6
|
+
redistribution of this Apple software constitutes acceptance of these
|
|
7
|
+
terms. If you do not agree with these terms, please do not use,
|
|
8
|
+
install, modify or redistribute this Apple software.
|
|
9
|
+
|
|
10
|
+
In consideration of your agreement to abide by the following terms, and
|
|
11
|
+
subject to these terms, Apple grants you a personal, non-exclusive
|
|
12
|
+
license, under Apple's copyrights in this original Apple software (the
|
|
13
|
+
"Apple Software"), to use, reproduce, modify and redistribute the Apple
|
|
14
|
+
Software, with or without modifications, in source and/or binary forms;
|
|
15
|
+
provided that if you redistribute the Apple Software in its entirety and
|
|
16
|
+
without modifications, you must retain this notice and the following
|
|
17
|
+
text and disclaimers in all such redistributions of the Apple Software.
|
|
18
|
+
Neither the name, trademarks, service marks or logos of Apple Inc.
|
|
19
|
+
may be used to endorse or promote products derived from the Apple
|
|
20
|
+
Software without specific prior written permission from Apple. Except
|
|
21
|
+
as expressly stated in this notice, no other rights or licenses, express
|
|
22
|
+
or implied, are granted by Apple herein, including but not limited to
|
|
23
|
+
any patent rights that may be infringed by your derivative works or by
|
|
24
|
+
other works in which the Apple Software may be incorporated.
|
|
25
|
+
|
|
26
|
+
The Apple Software is provided by Apple on an "AS IS" basis. APPLE
|
|
27
|
+
MAKES NO WARRANTIES, EXPRESS OR IMPLIED, INCLUDING WITHOUT LIMITATION
|
|
28
|
+
THE IMPLIED WARRANTIES OF NON-INFRINGEMENT, MERCHANTABILITY AND FITNESS
|
|
29
|
+
FOR A PARTICULAR PURPOSE, REGARDING THE APPLE SOFTWARE OR ITS USE AND
|
|
30
|
+
OPERATION ALONE OR IN COMBINATION WITH YOUR PRODUCTS.
|
|
31
|
+
|
|
32
|
+
IN NO EVENT SHALL APPLE BE LIABLE FOR ANY SPECIAL, INDIRECT, INCIDENTAL
|
|
33
|
+
OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
|
|
34
|
+
SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
|
|
35
|
+
INTERRUPTION) ARISING IN ANY WAY OUT OF THE USE, REPRODUCTION,
|
|
36
|
+
MODIFICATION AND/OR DISTRIBUTION OF THE APPLE SOFTWARE, HOWEVER CAUSED
|
|
37
|
+
AND WHETHER UNDER THEORY OF CONTRACT, TORT (INCLUDING NEGLIGENCE),
|
|
38
|
+
STRICT LIABILITY OR OTHERWISE, EVEN IF APPLE HAS BEEN ADVISED OF THE
|
|
39
|
+
POSSIBILITY OF SUCH DAMAGE.
|
|
40
|
+
|
|
41
|
+
Copyright (C) 2009 Apple Inc. All Rights Reserved.
|
|
42
|
+
|
|
43
|
+
$Id$
|
|
44
|
+
*/
|
|
45
|
+
|
|
46
|
+
/*
|
|
47
|
+
This file contains code from version 1.1 and 1.4 of MyOpenALSupport.h taken from Apple's oalTouch version.
|
|
48
|
+
The 1.4 version code is used for loading IMA4 files, however, this code causes very noticeable clicking
|
|
49
|
+
when used to load wave files that are looped so the 1.1 version code is used specifically for loading
|
|
50
|
+
wav files.
|
|
51
|
+
*/
|
|
52
|
+
|
|
53
|
+
#ifndef __CD_OPENAL_H
|
|
54
|
+
#define __CD_OPENAL_H
|
|
55
|
+
|
|
56
|
+
#ifdef __cplusplus
|
|
57
|
+
extern "C" {
|
|
58
|
+
#endif
|
|
59
|
+
|
|
60
|
+
|
|
61
|
+
#import <OpenAL/al.h>
|
|
62
|
+
#import <OpenAL/alc.h>
|
|
63
|
+
#import <CoreFoundation/CFURL.h>
|
|
64
|
+
|
|
65
|
+
|
|
66
|
+
//Taken from oalTouch MyOpenALSupport 1.1
|
|
67
|
+
void* CDloadWaveAudioData(CFURLRef inFileURL, ALsizei *outDataSize, ALenum *outDataFormat, ALsizei* outSampleRate);
|
|
68
|
+
void* CDloadCafAudioData(CFURLRef inFileURL, ALsizei *outDataSize, ALenum *outDataFormat, ALsizei* outSampleRate);
|
|
69
|
+
void* CDGetOpenALAudioData(CFURLRef inFileURL, ALsizei *outDataSize, ALenum *outDataFormat, ALsizei* outSampleRate);
|
|
70
|
+
|
|
71
|
+
#ifdef __cplusplus
|
|
72
|
+
}
|
|
73
|
+
#endif
|
|
74
|
+
|
|
75
|
+
#endif
|
|
76
|
+
|
|
77
|
+
|
|
@@ -0,0 +1,232 @@
|
|
|
1
|
+
/*
|
|
2
|
+
Copyright (c) 2010 Steve Oldmeadow
|
|
3
|
+
|
|
4
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
5
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
6
|
+
in the Software without restriction, including without limitation the rights
|
|
7
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
8
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
9
|
+
furnished to do so, subject to the following conditions:
|
|
10
|
+
|
|
11
|
+
The above copyright notice and this permission notice shall be included in
|
|
12
|
+
all copies or substantial portions of the Software.
|
|
13
|
+
|
|
14
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
15
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
16
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
17
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
18
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
19
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
|
20
|
+
THE SOFTWARE.
|
|
21
|
+
|
|
22
|
+
$Id$
|
|
23
|
+
*/
|
|
24
|
+
|
|
25
|
+
/**
|
|
26
|
+
A set of proxy classes to allow iOS audio code to run on MacOS X. AVAudioPlayer is implemented using NSSound.
|
|
27
|
+
AVAudioSession is a "do nothing" class as it isn't really relevant on MacOS X.
|
|
28
|
+
|
|
29
|
+
Limitations:
|
|
30
|
+
AVAudioPlayer numberOfLoops not correctly supported. Looping is either on or off, can not specify a specific number of loops.
|
|
31
|
+
AVAudioPlayer panning not supported.
|
|
32
|
+
AVAudioPlayer metering not supported.
|
|
33
|
+
AVAudioSession nothing is supported, not applicable to MacOS X.
|
|
34
|
+
*/
|
|
35
|
+
|
|
36
|
+
#import <Availability.h>
|
|
37
|
+
#ifdef __IPHONE_OS_VERSION_MAX_ALLOWED
|
|
38
|
+
#elif defined(__MAC_OS_X_VERSION_MAX_ALLOWED)
|
|
39
|
+
|
|
40
|
+
#import <Foundation/Foundation.h>
|
|
41
|
+
#import <AppKit/NSSound.h>
|
|
42
|
+
|
|
43
|
+
enum AudioSessionProperties {
|
|
44
|
+
kAudioSessionProperty_OtherAudioIsPlaying,
|
|
45
|
+
kAudioSessionProperty_AudioRoute
|
|
46
|
+
};
|
|
47
|
+
|
|
48
|
+
extern OSStatus AudioSessionGetProperty(UInt32 inID, UInt32 *ioDataSize, void *outData);
|
|
49
|
+
|
|
50
|
+
/**
|
|
51
|
+
Based on AVAudioPlayer.h header in AVFoundation headers
|
|
52
|
+
*/
|
|
53
|
+
@class NSData, NSURL, NSError, NSDictionary;
|
|
54
|
+
@protocol AVAudioPlayerDelegate;
|
|
55
|
+
|
|
56
|
+
/* This class is available with iPhone 2.2 or later */
|
|
57
|
+
@interface AVAudioPlayer : NSObject <NSSoundDelegate> {
|
|
58
|
+
|
|
59
|
+
// properties
|
|
60
|
+
id<AVAudioPlayerDelegate> delegate;
|
|
61
|
+
NSUInteger numberOfChannels;
|
|
62
|
+
BOOL playing;
|
|
63
|
+
NSTimeInterval duration;
|
|
64
|
+
NSURL *url;
|
|
65
|
+
NSData *data;
|
|
66
|
+
float pan;
|
|
67
|
+
float volume;
|
|
68
|
+
NSTimeInterval currentTime;
|
|
69
|
+
NSTimeInterval deviceCurrentTime;
|
|
70
|
+
NSInteger numberOfLoops;
|
|
71
|
+
BOOL meteringEnabled;
|
|
72
|
+
|
|
73
|
+
|
|
74
|
+
@private
|
|
75
|
+
NSSound* _player;
|
|
76
|
+
}
|
|
77
|
+
|
|
78
|
+
/* For all of these init calls, if a return value of nil is given you can check outError to see what the problem was.
|
|
79
|
+
If not nil, then the object is usable for playing
|
|
80
|
+
*/
|
|
81
|
+
|
|
82
|
+
/* all data must be in the form of an audio file understood by CoreAudio */
|
|
83
|
+
- (id)initWithContentsOfURL:(NSURL *)theUrl error:(NSError **)outError;
|
|
84
|
+
- (id)initWithData:(NSData *)theData error:(NSError **)outError;
|
|
85
|
+
|
|
86
|
+
/* transport control */
|
|
87
|
+
/* methods that return BOOL return YES on success and NO on failure. */
|
|
88
|
+
- (BOOL)prepareToPlay; /* get ready to play the sound. happens automatically on play. */
|
|
89
|
+
- (BOOL)play; /* sound is played asynchronously. */
|
|
90
|
+
- (BOOL)playAtTime:(NSTimeInterval) time; /* play a sound some time in the future. time should be greater than deviceCurrentTime. */
|
|
91
|
+
- (void)pause; /* pauses playback, but remains ready to play. */
|
|
92
|
+
- (void)stop; /* stops playback. no longer ready to play. */
|
|
93
|
+
|
|
94
|
+
/* properties */
|
|
95
|
+
|
|
96
|
+
@property(readonly, getter=isPlaying) BOOL playing;
|
|
97
|
+
|
|
98
|
+
@property(readonly) NSUInteger numberOfChannels;
|
|
99
|
+
@property(readonly) NSTimeInterval duration; /* the duration of the sound. */
|
|
100
|
+
|
|
101
|
+
@property(assign) id<AVAudioPlayerDelegate> delegate; /* the delegate will be sent playerDidFinishPlaying */
|
|
102
|
+
|
|
103
|
+
/* one of these three properties will be non-nil based on the init... method used */
|
|
104
|
+
@property(readonly) NSURL *url; /* returns nil if object was not created with a URL */
|
|
105
|
+
@property(readonly) NSData *data; /* returns nil if object was not created with a data object */
|
|
106
|
+
@property float pan; /* set panning. -1.0 is left, 0.0 is center, 1.0 is right. */
|
|
107
|
+
@property float volume; /* The volume for the sound. The nominal range is from 0.0 to 1.0. */
|
|
108
|
+
|
|
109
|
+
/* If the sound is playing, currentTime is the offset into the sound of the current playback position.
|
|
110
|
+
If the sound is not playing, currentTime is the offset into the sound where playing would start. */
|
|
111
|
+
@property NSTimeInterval currentTime;
|
|
112
|
+
|
|
113
|
+
/* returns the current time associated with the output device */
|
|
114
|
+
@property(readonly) NSTimeInterval deviceCurrentTime;
|
|
115
|
+
|
|
116
|
+
/* "numberOfLoops" is the number of times that the sound will return to the beginning upon reaching the end.
|
|
117
|
+
A value of zero means to play the sound just once.
|
|
118
|
+
A value of one will result in playing the sound twice, and so on..
|
|
119
|
+
Any negative number will loop indefinitely until stopped.
|
|
120
|
+
*/
|
|
121
|
+
@property NSInteger numberOfLoops;
|
|
122
|
+
|
|
123
|
+
/* metering */
|
|
124
|
+
|
|
125
|
+
@property(getter=isMeteringEnabled) BOOL meteringEnabled; /* turns level metering on or off. default is off. */
|
|
126
|
+
|
|
127
|
+
- (void)updateMeters; /* call to refresh meter values */
|
|
128
|
+
- (float)peakPowerForChannel:(NSUInteger)channelNumber; /* returns peak power in decibels for a given channel */
|
|
129
|
+
- (float)averagePowerForChannel:(NSUInteger)channelNumber; /* returns average power in decibels for a given channel */
|
|
130
|
+
|
|
131
|
+
@end
|
|
132
|
+
|
|
133
|
+
/* A protocol for delegates of AVAudioPlayer */
|
|
134
|
+
@protocol AVAudioPlayerDelegate <NSObject>
|
|
135
|
+
@optional
|
|
136
|
+
/* audioPlayerDidFinishPlaying:successfully: is called when a sound has finished playing. This method is NOT called if the player is stopped due to an interruption. */
|
|
137
|
+
- (void)audioPlayerDidFinishPlaying:(AVAudioPlayer *)player successfully:(BOOL)flag;
|
|
138
|
+
|
|
139
|
+
/* if an error occurs while decoding it will be reported to the delegate. */
|
|
140
|
+
- (void)audioPlayerDecodeErrorDidOccur:(AVAudioPlayer *)player error:(NSError *)error;
|
|
141
|
+
|
|
142
|
+
/* audioPlayerBeginInterruption: is called when the audio session has been interrupted while the player was playing. The player will have been paused. */
|
|
143
|
+
- (void)audioPlayerBeginInterruption:(AVAudioPlayer *)player;
|
|
144
|
+
|
|
145
|
+
/* audioPlayerEndInterruption:withFlags: is called when the audio session interruption has ended and this player had been interrupted while playing. */
|
|
146
|
+
/* Currently the only flag is AVAudioSessionInterruptionFlags_ShouldResume. */
|
|
147
|
+
- (void)audioPlayerEndInterruption:(AVAudioPlayer *)player withFlags:(NSUInteger)flags;
|
|
148
|
+
|
|
149
|
+
/* audioPlayerEndInterruption: is called when the preferred method, audioPlayerEndInterruption:withFlags:, is not implemented. */
|
|
150
|
+
- (void)audioPlayerEndInterruption:(AVAudioPlayer *)player;
|
|
151
|
+
@end
|
|
152
|
+
|
|
153
|
+
|
|
154
|
+
/**
|
|
155
|
+
Taken from AVAudioSession.h header in AVFoundation headers
|
|
156
|
+
*/
|
|
157
|
+
|
|
158
|
+
/* This protocol is available with iPhone 3.0 or later */
|
|
159
|
+
@protocol AVAudioSessionDelegate;
|
|
160
|
+
@class NSError, NSString;
|
|
161
|
+
|
|
162
|
+
/* values for the category property */
|
|
163
|
+
extern NSString *const AVAudioSessionCategoryAmbient;
|
|
164
|
+
extern NSString *const AVAudioSessionCategorySoloAmbient;
|
|
165
|
+
extern NSString *const AVAudioSessionCategoryPlayback;
|
|
166
|
+
extern NSString *const AVAudioSessionCategoryRecord;
|
|
167
|
+
extern NSString *const AVAudioSessionCategoryPlayAndRecord;
|
|
168
|
+
extern NSString *const AVAudioSessionCategoryAudioProcessing;
|
|
169
|
+
|
|
170
|
+
enum {
|
|
171
|
+
AVAudioSessionInterruptionFlags_ShouldResume = 1
|
|
172
|
+
};
|
|
173
|
+
|
|
174
|
+
enum {
|
|
175
|
+
AVAudioSessionSetActiveFlags_NotifyOthersOnDeactivation = 1
|
|
176
|
+
};
|
|
177
|
+
|
|
178
|
+
@interface AVAudioSession : NSObject {
|
|
179
|
+
|
|
180
|
+
// properties
|
|
181
|
+
NSString* category;
|
|
182
|
+
double preferredHardwareSampleRate;
|
|
183
|
+
NSTimeInterval preferredIOBufferDuration;
|
|
184
|
+
|
|
185
|
+
BOOL inputIsAvailable;
|
|
186
|
+
double currentHardwareSampleRate;
|
|
187
|
+
NSInteger currentHardwareInputNumberOfChannels;
|
|
188
|
+
NSInteger currentHardwareOutputNumberOfChannels;
|
|
189
|
+
id<AVAudioSessionDelegate> delegate;
|
|
190
|
+
|
|
191
|
+
@private
|
|
192
|
+
__strong void *_impl;
|
|
193
|
+
}
|
|
194
|
+
|
|
195
|
+
/* returns singleton instance */
|
|
196
|
+
+ (id)sharedInstance;
|
|
197
|
+
|
|
198
|
+
@property(assign) id<AVAudioSessionDelegate> delegate;
|
|
199
|
+
|
|
200
|
+
- (BOOL)setActive:(BOOL)beActive error:(NSError**)outError;
|
|
201
|
+
- (BOOL)setActive:(BOOL)beActive withFlags:(NSInteger)flags error:(NSError**)outError;
|
|
202
|
+
|
|
203
|
+
- (BOOL)setCategory:(NSString*)theCategory error:(NSError**)outError;
|
|
204
|
+
- (BOOL)setPreferredHardwareSampleRate:(double)sampleRate error:(NSError**)outError;
|
|
205
|
+
- (BOOL)setPreferredIOBufferDuration:(NSTimeInterval)duration error:(NSError**)outError;
|
|
206
|
+
|
|
207
|
+
@property(readonly) NSString* category;
|
|
208
|
+
@property(readonly) double preferredHardwareSampleRate;
|
|
209
|
+
@property(readonly) NSTimeInterval preferredIOBufferDuration;
|
|
210
|
+
|
|
211
|
+
@property(readonly) BOOL inputIsAvailable;
|
|
212
|
+
@property(readonly) double currentHardwareSampleRate;
|
|
213
|
+
@property(readonly) NSInteger currentHardwareInputNumberOfChannels;
|
|
214
|
+
@property(readonly) NSInteger currentHardwareOutputNumberOfChannels;
|
|
215
|
+
|
|
216
|
+
@end
|
|
217
|
+
|
|
218
|
+
|
|
219
|
+
/* A protocol for delegates of AVAudioSession */
|
|
220
|
+
@protocol AVAudioSessionDelegate <NSObject>
|
|
221
|
+
@optional
|
|
222
|
+
|
|
223
|
+
- (void)beginInterruption;
|
|
224
|
+
|
|
225
|
+
- (void)endInterruptionWithFlags:(NSUInteger)flags;
|
|
226
|
+
|
|
227
|
+
- (void)endInterruption; /* endInterruptionWithFlags: will be called instead if implemented. */
|
|
228
|
+
|
|
229
|
+
- (void)inputIsAvailableChanged:(BOOL)isInputAvailable;
|
|
230
|
+
@end
|
|
231
|
+
|
|
232
|
+
#endif
|