code:
############################################################################
#
#   Makefile for building : Box2D_Arm.TMK3
#   Created by TMK3_V2.3, please do not modify.
#
#############################################################################

TO_PROJECT_ROOT = ../../../PRJ_TG3
OUTPUT_FILENAME = libbox2d.so

include $(TO_PROJECT_ROOT)/MakeInclude/Makefile_Base_DynamicLib.ARM
include $(TO_PROJECT_ROOT)/MakeInclude/Makefile_TOPS_Def.ARM

DEFINES += -DCCX_UNDER_WOPHONE
INCLUDE_PATH += -I../ -I../../

CXX_FLAGS += -fvisibility=default

OBJECTS_DIR = ./Debug-ARM
DESTDIR = $(TO_PROJECT_ROOT)/$(BIN_OUTPUT_DIR)
TARGET = $(DESTDIR)/$(OUTPUT_FILENAME)

DEL_FILE = rm -f
MKDIR = mkdir -p

first: all

OBJECTS = \
	$(OBJECTS_DIR)/b2BroadPhase.o \
	$(OBJECTS_DIR)/b2CollideCircle.o \
	$(OBJECTS_DIR)/b2CollidePolygon.o \
	$(OBJECTS_DIR)/b2Collision.o \
	$(OBJECTS_DIR)/b2Distance.o \
	$(OBJECTS_DIR)/b2DynamicTree.o \
	$(OBJECTS_DIR)/b2TimeOfImpact.o \
	$(OBJECTS_DIR)/b2CircleShape.o \
	$(OBJECTS_DIR)/b2PolygonShape.o \
	$(OBJECTS_DIR)/b2BlockAllocator.o \
	$(OBJECTS_DIR)/b2Math.o \
	$(OBJECTS_DIR)/b2Settings.o \
	$(OBJECTS_DIR)/b2StackAllocator.o \
	$(OBJECTS_DIR)/b2Body.o \
	$(OBJECTS_DIR)/b2ContactManager.o \
	$(OBJECTS_DIR)/b2Fixture.o \
	$(OBJECTS_DIR)/b2Island.o \
	$(OBJECTS_DIR)/b2World.o \
	$(OBJECTS_DIR)/b2WorldCallbacks.o \
	$(OBJECTS_DIR)/b2CircleContact.o \
	$(OBJECTS_DIR)/b2Contact.o \
	$(OBJECTS_DIR)/b2ContactSolver.o \
	$(OBJECTS_DIR)/b2PolygonAndCircleContact.o \
	$(OBJECTS_DIR)/b2PolygonContact.o \
	$(OBJECTS_DIR)/b2TOISolver.o \
	$(OBJECTS_DIR)/b2DistanceJoint.o \
	$(OBJECTS_DIR)/b2FrictionJoint.o \
	$(OBJECTS_DIR)/b2GearJoint.o \
	$(OBJECTS_DIR)/b2Joint.o \
	$(OBJECTS_DIR)/b2LineJoint.o \
	$(OBJECTS_DIR)/b2MouseJoint.o \
	$(OBJECTS_DIR)/b2PrismaticJoint.o \
	$(OBJECTS_DIR)/b2PulleyJoint.o \
	$(OBJECTS_DIR)/b2RevoluteJoint.o \
	$(OBJECTS_DIR)/b2WeldJoint.o

ADD_OBJECTS +=

$(OBJECTS_DIR) :
	$(MKDIR) $(OBJECTS_DIR)

$(DESTDIR) :
	$(MKDIR) $(DESTDIR)

all : $(OBJECTS_DIR) $(DESTDIR) $(TARGET)

$(TARGET) : $(OBJECTS)
	$(LINK) $(LINK_FLAGS) -o $(TARGET) $(SYS_OBJECTS) $(OBJECTS) $(ADD_OBJECTS) $(LIBS) $(SYS_LIBS)

clean :
	-$(DEL_FILE) $(OBJECTS)
	-$(DEL_FILE) $(TARGET)

$(OBJECTS_DIR)/b2BroadPhase.o : ../Collision/b2BroadPhase.cpp
	$(CXX) -c $(CXX_FLAGS) $(INCLUDE_PATH) $(LAST_INCLUDE_PATH) -o $(OBJECTS_DIR)/b2BroadPhase.o ../Collision/b2BroadPhase.cpp

$(OBJECTS_DIR)/b2CollideCircle.o : ../Collision/b2CollideCircle.cpp
	$(CXX) -c $(CXX_FLAGS) $(INCLUDE_PATH) $(LAST_INCLUDE_PATH) -o $(OBJECTS_DIR)/b2CollideCircle.o ../Collision/b2CollideCircle.cpp

$(OBJECTS_DIR)/b2CollidePolygon.o : ../Collision/b2CollidePolygon.cpp
	$(CXX) -c $(CXX_FLAGS) $(INCLUDE_PATH) $(LAST_INCLUDE_PATH) -o $(OBJECTS_DIR)/b2CollidePolygon.o ../Collision/b2CollidePolygon.cpp

$(OBJECTS_DIR)/b2Collision.o : ../Collision/b2Collision.cpp
	$(CXX) -c $(CXX_FLAGS) $(INCLUDE_PATH) $(LAST_INCLUDE_PATH) -o $(OBJECTS_DIR)/b2Collision.o ../Collision/b2Collision.cpp

$(OBJECTS_DIR)/b2Distance.o : ../Collision/b2Distance.cpp
	$(CXX) -c $(CXX_FLAGS) $(INCLUDE_PATH) $(LAST_INCLUDE_PATH) -o $(OBJECTS_DIR)/b2Distance.o ../Collision/b2Distance.cpp

$(OBJECTS_DIR)/b2DynamicTree.o : ../Collision/b2DynamicTree.cpp
	$(CXX) -c $(CXX_FLAGS) $(INCLUDE_PATH) $(LAST_INCLUDE_PATH) -o $(OBJECTS_DIR)/b2DynamicTree.o ../Collision/b2DynamicTree.cpp

$(OBJECTS_DIR)/b2TimeOfImpact.o : ../Collision/b2TimeOfImpact.cpp
	$(CXX) -c $(CXX_FLAGS) $(INCLUDE_PATH) $(LAST_INCLUDE_PATH) -o $(OBJECTS_DIR)/b2TimeOfImpact.o ../Collision/b2TimeOfImpact.cpp

$(OBJECTS_DIR)/b2CircleShape.o : ../Collision/Shapes/b2CircleShape.cpp
	$(CXX) -c $(CXX_FLAGS) $(INCLUDE_PATH) $(LAST_INCLUDE_PATH) -o $(OBJECTS_DIR)/b2CircleShape.o ../Collision/Shapes/b2CircleShape.cpp

$(OBJECTS_DIR)/b2PolygonShape.o : ../Collision/Shapes/b2PolygonShape.cpp
	$(CXX) -c $(CXX_FLAGS) $(INCLUDE_PATH) $(LAST_INCLUDE_PATH) -o $(OBJECTS_DIR)/b2PolygonShape.o ../Collision/Shapes/b2PolygonShape.cpp

$(OBJECTS_DIR)/b2BlockAllocator.o : ../Common/b2BlockAllocator.cpp
	$(CXX) -c $(CXX_FLAGS) $(INCLUDE_PATH) $(LAST_INCLUDE_PATH) -o $(OBJECTS_DIR)/b2BlockAllocator.o ../Common/b2BlockAllocator.cpp

$(OBJECTS_DIR)/b2Math.o : ../Common/b2Math.cpp
	$(CXX) -c $(CXX_FLAGS) $(INCLUDE_PATH) $(LAST_INCLUDE_PATH) -o $(OBJECTS_DIR)/b2Math.o ../Common/b2Math.cpp

$(OBJECTS_DIR)/b2Settings.o : ../Common/b2Settings.cpp
	$(CXX) -c $(CXX_FLAGS) $(INCLUDE_PATH) $(LAST_INCLUDE_PATH) -o $(OBJECTS_DIR)/b2Settings.o ../Common/b2Settings.cpp

$(OBJECTS_DIR)/b2StackAllocator.o : ../Common/b2StackAllocator.cpp
	$(CXX) -c $(CXX_FLAGS) $(INCLUDE_PATH) $(LAST_INCLUDE_PATH) -o $(OBJECTS_DIR)/b2StackAllocator.o ../Common/b2StackAllocator.cpp

$(OBJECTS_DIR)/b2Body.o : ../Dynamics/b2Body.cpp
	$(CXX) -c $(CXX_FLAGS) $(INCLUDE_PATH) $(LAST_INCLUDE_PATH) -o $(OBJECTS_DIR)/b2Body.o ../Dynamics/b2Body.cpp

$(OBJECTS_DIR)/b2ContactManager.o : ../Dynamics/b2ContactManager.cpp
	$(CXX) -c $(CXX_FLAGS) $(INCLUDE_PATH) $(LAST_INCLUDE_PATH) -o $(OBJECTS_DIR)/b2ContactManager.o ../Dynamics/b2ContactManager.cpp

$(OBJECTS_DIR)/b2Fixture.o : ../Dynamics/b2Fixture.cpp
	$(CXX) -c $(CXX_FLAGS) $(INCLUDE_PATH) $(LAST_INCLUDE_PATH) -o $(OBJECTS_DIR)/b2Fixture.o ../Dynamics/b2Fixture.cpp

$(OBJECTS_DIR)/b2Island.o : ../Dynamics/b2Island.cpp
	$(CXX) -c $(CXX_FLAGS) $(INCLUDE_PATH) $(LAST_INCLUDE_PATH) -o $(OBJECTS_DIR)/b2Island.o ../Dynamics/b2Island.cpp

$(OBJECTS_DIR)/b2World.o : ../Dynamics/b2World.cpp
	$(CXX) -c $(CXX_FLAGS) $(INCLUDE_PATH) $(LAST_INCLUDE_PATH) -o $(OBJECTS_DIR)/b2World.o ../Dynamics/b2World.cpp

$(OBJECTS_DIR)/b2WorldCallbacks.o : ../Dynamics/b2WorldCallbacks.cpp
	$(CXX) -c $(CXX_FLAGS) $(INCLUDE_PATH) $(LAST_INCLUDE_PATH) -o $(OBJECTS_DIR)/b2WorldCallbacks.o ../Dynamics/b2WorldCallbacks.cpp

$(OBJECTS_DIR)/b2CircleContact.o : ../Dynamics/Contacts/b2CircleContact.cpp
	$(CXX) -c $(CXX_FLAGS) $(INCLUDE_PATH) $(LAST_INCLUDE_PATH) -o $(OBJECTS_DIR)/b2CircleContact.o ../Dynamics/Contacts/b2CircleContact.cpp

$(OBJECTS_DIR)/b2Contact.o : ../Dynamics/Contacts/b2Contact.cpp
	$(CXX) -c $(CXX_FLAGS) $(INCLUDE_PATH) $(LAST_INCLUDE_PATH) -o $(OBJECTS_DIR)/b2Contact.o ../Dynamics/Contacts/b2Contact.cpp

$(OBJECTS_DIR)/b2ContactSolver.o : ../Dynamics/Contacts/b2ContactSolver.cpp
	$(CXX) -c $(CXX_FLAGS) $(INCLUDE_PATH) $(LAST_INCLUDE_PATH) -o $(OBJECTS_DIR)/b2ContactSolver.o ../Dynamics/Contacts/b2ContactSolver.cpp

$(OBJECTS_DIR)/b2PolygonAndCircleContact.o : ../Dynamics/Contacts/b2PolygonAndCircleContact.cpp
	$(CXX) -c $(CXX_FLAGS) $(INCLUDE_PATH) $(LAST_INCLUDE_PATH) -o $(OBJECTS_DIR)/b2PolygonAndCircleContact.o ../Dynamics/Contacts/b2PolygonAndCircleContact.cpp

$(OBJECTS_DIR)/b2PolygonContact.o : ../Dynamics/Contacts/b2PolygonContact.cpp
	$(CXX) -c $(CXX_FLAGS) $(INCLUDE_PATH) $(LAST_INCLUDE_PATH) -o $(OBJECTS_DIR)/b2PolygonContact.o ../Dynamics/Contacts/b2PolygonContact.cpp

$(OBJECTS_DIR)/b2TOISolver.o : ../Dynamics/Contacts/b2TOISolver.cpp
	$(CXX) -c $(CXX_FLAGS) $(INCLUDE_PATH) $(LAST_INCLUDE_PATH) -o $(OBJECTS_DIR)/b2TOISolver.o ../Dynamics/Contacts/b2TOISolver.cpp

$(OBJECTS_DIR)/b2DistanceJoint.o : ../Dynamics/Joints/b2DistanceJoint.cpp
	$(CXX) -c $(CXX_FLAGS) $(INCLUDE_PATH) $(LAST_INCLUDE_PATH) -o $(OBJECTS_DIR)/b2DistanceJoint.o ../Dynamics/Joints/b2DistanceJoint.cpp

$(OBJECTS_DIR)/b2FrictionJoint.o : ../Dynamics/Joints/b2FrictionJoint.cpp
	$(CXX) -c $(CXX_FLAGS) $(INCLUDE_PATH) $(LAST_INCLUDE_PATH) -o $(OBJECTS_DIR)/b2FrictionJoint.o ../Dynamics/Joints/b2FrictionJoint.cpp

$(OBJECTS_DIR)/b2GearJoint.o : ../Dynamics/Joints/b2GearJoint.cpp
	$(CXX) -c $(CXX_FLAGS) $(INCLUDE_PATH) $(LAST_INCLUDE_PATH) -o $(OBJECTS_DIR)/b2GearJoint.o ../Dynamics/Joints/b2GearJoint.cpp

$(OBJECTS_DIR)/b2Joint.o : ../Dynamics/Joints/b2Joint.cpp
	$(CXX) -c $(CXX_FLAGS) $(INCLUDE_PATH) $(LAST_INCLUDE_PATH) -o $(OBJECTS_DIR)/b2Joint.o ../Dynamics/Joints/b2Joint.cpp

$(OBJECTS_DIR)/b2LineJoint.o : ../Dynamics/Joints/b2LineJoint.cpp
	$(CXX) -c $(CXX_FLAGS) $(INCLUDE_PATH) $(LAST_INCLUDE_PATH) -o $(OBJECTS_DIR)/b2LineJoint.o ../Dynamics/Joints/b2LineJoint.cpp

$(OBJECTS_DIR)/b2MouseJoint.o : ../Dynamics/Joints/b2MouseJoint.cpp
	$(CXX) -c $(CXX_FLAGS) $(INCLUDE_PATH) $(LAST_INCLUDE_PATH) -o $(OBJECTS_DIR)/b2MouseJoint.o ../Dynamics/Joints/b2MouseJoint.cpp

$(OBJECTS_DIR)/b2PrismaticJoint.o : ../Dynamics/Joints/b2PrismaticJoint.cpp
	$(CXX) -c $(CXX_FLAGS) $(INCLUDE_PATH) $(LAST_INCLUDE_PATH) -o $(OBJECTS_DIR)/b2PrismaticJoint.o ../Dynamics/Joints/b2PrismaticJoint.cpp

$(OBJECTS_DIR)/b2PulleyJoint.o : ../Dynamics/Joints/b2PulleyJoint.cpp
	$(CXX) -c $(CXX_FLAGS) $(INCLUDE_PATH) $(LAST_INCLUDE_PATH) -o $(OBJECTS_DIR)/b2PulleyJoint.o ../Dynamics/Joints/b2PulleyJoint.cpp

$(OBJECTS_DIR)/b2RevoluteJoint.o : ../Dynamics/Joints/b2RevoluteJoint.cpp
	$(CXX) -c $(CXX_FLAGS) $(INCLUDE_PATH) $(LAST_INCLUDE_PATH) -o $(OBJECTS_DIR)/b2RevoluteJoint.o ../Dynamics/Joints/b2RevoluteJoint.cpp

$(OBJECTS_DIR)/b2WeldJoint.o : ../Dynamics/Joints/b2WeldJoint.cpp
	$(CXX) -c $(CXX_FLAGS) $(INCLUDE_PATH) $(LAST_INCLUDE_PATH) -o $(OBJECTS_DIR)/b2WeldJoint.o ../Dynamics/Joints/b2WeldJoint.cpp


code:
############################################################################
#
#   Makefile for building : Box2D_Arm.TMK3
#   Created by TMK3_V2.3, please do not modify.
#
#############################################################################

TO_PROJECT_ROOT = ../../../PRJ_TG3
OUTPUT_FILENAME = libBox2DStatic.a

include $(TO_PROJECT_ROOT)/MakeInclude/Makefile_Base_StaticLib.ARM
include $(TO_PROJECT_ROOT)/MakeInclude/Makefile_TOPS_Def.ARM

DEFINES += -DCC_UNDER_WOPHONE
INCLUDE_PATH += -I../ -I../../

CXX_FLAGS += -fvisibility=default

OBJECTS_DIR = ./Debug-ARM
DESTDIR = $(TO_PROJECT_ROOT)/$(BIN_OUTPUT_DIR)
TARGET = $(DESTDIR)/$(OUTPUT_FILENAME)

DEL_FILE = rm -f
MKDIR = mkdir -p

first: all

OBJECTS = \
	$(OBJECTS_DIR)/b2BroadPhase.o \
	$(OBJECTS_DIR)/b2CollideCircle.o \
	$(OBJECTS_DIR)/b2CollidePolygon.o \
	$(OBJECTS_DIR)/b2Collision.o \
	$(OBJECTS_DIR)/b2Distance.o \
	$(OBJECTS_DIR)/b2DynamicTree.o \
	$(OBJECTS_DIR)/b2TimeOfImpact.o \
	$(OBJECTS_DIR)/b2CircleShape.o \
	$(OBJECTS_DIR)/b2PolygonShape.o \
	$(OBJECTS_DIR)/b2BlockAllocator.o \
	$(OBJECTS_DIR)/b2Math.o \
	$(OBJECTS_DIR)/b2Settings.o \
	$(OBJECTS_DIR)/b2StackAllocator.o \
	$(OBJECTS_DIR)/b2Body.o \
	$(OBJECTS_DIR)/b2ContactManager.o \
	$(OBJECTS_DIR)/b2Fixture.o \
	$(OBJECTS_DIR)/b2Island.o \
	$(OBJECTS_DIR)/b2World.o \
	$(OBJECTS_DIR)/b2WorldCallbacks.o \
	$(OBJECTS_DIR)/b2CircleContact.o \
	$(OBJECTS_DIR)/b2Contact.o \
	$(OBJECTS_DIR)/b2ContactSolver.o \
	$(OBJECTS_DIR)/b2PolygonAndCircleContact.o \
	$(OBJECTS_DIR)/b2PolygonContact.o \
	$(OBJECTS_DIR)/b2TOISolver.o \
	$(OBJECTS_DIR)/b2DistanceJoint.o \
	$(OBJECTS_DIR)/b2FrictionJoint.o \
	$(OBJECTS_DIR)/b2GearJoint.o \
	$(OBJECTS_DIR)/b2Joint.o \
	$(OBJECTS_DIR)/b2LineJoint.o \
	$(OBJECTS_DIR)/b2MouseJoint.o \
	$(OBJECTS_DIR)/b2PrismaticJoint.o \
	$(OBJECTS_DIR)/b2PulleyJoint.o \
	$(OBJECTS_DIR)/b2RevoluteJoint.o \
	$(OBJECTS_DIR)/b2WeldJoint.o

ADD_OBJECTS +=

$(OBJECTS_DIR) :
	$(MKDIR) $(OBJECTS_DIR)

$(DESTDIR) :
	$(MKDIR) $(DESTDIR)

all : $(OBJECTS_DIR) $(DESTDIR) $(TARGET)

$(TARGET) : $(OBJECTS)
	$(LINK) $(LINK_FLAGS) -o $(TARGET) $(SYS_OBJECTS) $(OBJECTS) $(ADD_OBJECTS) $(LIBS) $(SYS_LIBS)

clean :
	-$(DEL_FILE) $(OBJECTS)
	-$(DEL_FILE) $(TARGET)

$(OBJECTS_DIR)/b2BroadPhase.o : ../Collision/b2BroadPhase.cpp
	$(CXX) -c $(CXX_FLAGS) $(INCLUDE_PATH) $(LAST_INCLUDE_PATH) -o $(OBJECTS_DIR)/b2BroadPhase.o ../Collision/b2BroadPhase.cpp

$(OBJECTS_DIR)/b2CollideCircle.o : ../Collision/b2CollideCircle.cpp
	$(CXX) -c $(CXX_FLAGS) $(INCLUDE_PATH) $(LAST_INCLUDE_PATH) -o $(OBJECTS_DIR)/b2CollideCircle.o ../Collision/b2CollideCircle.cpp

$(OBJECTS_DIR)/b2CollidePolygon.o : ../Collision/b2CollidePolygon.cpp
	$(CXX) -c $(CXX_FLAGS) $(INCLUDE_PATH) $(LAST_INCLUDE_PATH) -o $(OBJECTS_DIR)/b2CollidePolygon.o ../Collision/b2CollidePolygon.cpp

$(OBJECTS_DIR)/b2Collision.o : ../Collision/b2Collision.cpp
	$(CXX) -c $(CXX_FLAGS) $(INCLUDE_PATH) $(LAST_INCLUDE_PATH) -o $(OBJECTS_DIR)/b2Collision.o ../Collision/b2Collision.cpp

$(OBJECTS_DIR)/b2Distance.o : ../Collision/b2Distance.cpp
	$(CXX) -c $(CXX_FLAGS) $(INCLUDE_PATH) $(LAST_INCLUDE_PATH) -o $(OBJECTS_DIR)/b2Distance.o ../Collision/b2Distance.cpp

$(OBJECTS_DIR)/b2DynamicTree.o : ../Collision/b2DynamicTree.cpp
	$(CXX) -c $(CXX_FLAGS) $(INCLUDE_PATH) $(LAST_INCLUDE_PATH) -o $(OBJECTS_DIR)/b2DynamicTree.o ../Collision/b2DynamicTree.cpp

$(OBJECTS_DIR)/b2TimeOfImpact.o : ../Collision/b2TimeOfImpact.cpp
	$(CXX) -c $(CXX_FLAGS) $(INCLUDE_PATH) $(LAST_INCLUDE_PATH) -o $(OBJECTS_DIR)/b2TimeOfImpact.o ../Collision/b2TimeOfImpact.cpp

$(OBJECTS_DIR)/b2CircleShape.o : ../Collision/Shapes/b2CircleShape.cpp
	$(CXX) -c $(CXX_FLAGS) $(INCLUDE_PATH) $(LAST_INCLUDE_PATH) -o $(OBJECTS_DIR)/b2CircleShape.o ../Collision/Shapes/b2CircleShape.cpp

$(OBJECTS_DIR)/b2PolygonShape.o : ../Collision/Shapes/b2PolygonShape.cpp
	$(CXX) -c $(CXX_FLAGS) $(INCLUDE_PATH) $(LAST_INCLUDE_PATH) -o $(OBJECTS_DIR)/b2PolygonShape.o ../Collision/Shapes/b2PolygonShape.cpp

$(OBJECTS_DIR)/b2BlockAllocator.o : ../Common/b2BlockAllocator.cpp
	$(CXX) -c $(CXX_FLAGS) $(INCLUDE_PATH) $(LAST_INCLUDE_PATH) -o $(OBJECTS_DIR)/b2BlockAllocator.o ../Common/b2BlockAllocator.cpp

$(OBJECTS_DIR)/b2Math.o : ../Common/b2Math.cpp
	$(CXX) -c $(CXX_FLAGS) $(INCLUDE_PATH) $(LAST_INCLUDE_PATH) -o $(OBJECTS_DIR)/b2Math.o ../Common/b2Math.cpp

$(OBJECTS_DIR)/b2Settings.o : ../Common/b2Settings.cpp
	$(CXX) -c $(CXX_FLAGS) $(INCLUDE_PATH) $(LAST_INCLUDE_PATH) -o $(OBJECTS_DIR)/b2Settings.o ../Common/b2Settings.cpp

$(OBJECTS_DIR)/b2StackAllocator.o : ../Common/b2StackAllocator.cpp
	$(CXX) -c $(CXX_FLAGS) $(INCLUDE_PATH) $(LAST_INCLUDE_PATH) -o $(OBJECTS_DIR)/b2StackAllocator.o ../Common/b2StackAllocator.cpp

$(OBJECTS_DIR)/b2Body.o : ../Dynamics/b2Body.cpp
	$(CXX) -c $(CXX_FLAGS) $(INCLUDE_PATH) $(LAST_INCLUDE_PATH) -o $(OBJECTS_DIR)/b2Body.o ../Dynamics/b2Body.cpp

$(OBJECTS_DIR)/b2ContactManager.o : ../Dynamics/b2ContactManager.cpp
	$(CXX) -c $(CXX_FLAGS) $(INCLUDE_PATH) $(LAST_INCLUDE_PATH) -o $(OBJECTS_DIR)/b2ContactManager.o ../Dynamics/b2ContactManager.cpp

$(OBJECTS_DIR)/b2Fixture.o : ../Dynamics/b2Fixture.cpp
	$(CXX) -c $(CXX_FLAGS) $(INCLUDE_PATH) $(LAST_INCLUDE_PATH) -o $(OBJECTS_DIR)/b2Fixture.o ../Dynamics/b2Fixture.cpp

$(OBJECTS_DIR)/b2Island.o : ../Dynamics/b2Island.cpp
	$(CXX) -c $(CXX_FLAGS) $(INCLUDE_PATH) $(LAST_INCLUDE_PATH) -o $(OBJECTS_DIR)/b2Island.o ../Dynamics/b2Island.cpp

$(OBJECTS_DIR)/b2World.o : ../Dynamics/b2World.cpp
	$(CXX) -c $(CXX_FLAGS) $(INCLUDE_PATH) $(LAST_INCLUDE_PATH) -o $(OBJECTS_DIR)/b2World.o ../Dynamics/b2World.cpp

$(OBJECTS_DIR)/b2WorldCallbacks.o : ../Dynamics/b2WorldCallbacks.cpp
	$(CXX) -c $(CXX_FLAGS) $(INCLUDE_PATH) $(LAST_INCLUDE_PATH) -o $(OBJECTS_DIR)/b2WorldCallbacks.o ../Dynamics/b2WorldCallbacks.cpp

$(OBJECTS_DIR)/b2CircleContact.o : ../Dynamics/Contacts/b2CircleContact.cpp
	$(CXX) -c $(CXX_FLAGS) $(INCLUDE_PATH) $(LAST_INCLUDE_PATH) -o $(OBJECTS_DIR)/b2CircleContact.o ../Dynamics/Contacts/b2CircleContact.cpp

$(OBJECTS_DIR)/b2Contact.o : ../Dynamics/Contacts/b2Contact.cpp
	$(CXX) -c $(CXX_FLAGS) $(INCLUDE_PATH) $(LAST_INCLUDE_PATH) -o $(OBJECTS_DIR)/b2Contact.o ../Dynamics/Contacts/b2Contact.cpp

$(OBJECTS_DIR)/b2ContactSolver.o : ../Dynamics/Contacts/b2ContactSolver.cpp
	$(CXX) -c $(CXX_FLAGS) $(INCLUDE_PATH) $(LAST_INCLUDE_PATH) -o $(OBJECTS_DIR)/b2ContactSolver.o ../Dynamics/Contacts/b2ContactSolver.cpp

$(OBJECTS_DIR)/b2PolygonAndCircleContact.o : ../Dynamics/Contacts/b2PolygonAndCircleContact.cpp
	$(CXX) -c $(CXX_FLAGS) $(INCLUDE_PATH) $(LAST_INCLUDE_PATH) -o $(OBJECTS_DIR)/b2PolygonAndCircleContact.o ../Dynamics/Contacts/b2PolygonAndCircleContact.cpp

$(OBJECTS_DIR)/b2PolygonContact.o : ../Dynamics/Contacts/b2PolygonContact.cpp
	$(CXX) -c $(CXX_FLAGS) $(INCLUDE_PATH) $(LAST_INCLUDE_PATH) -o $(OBJECTS_DIR)/b2PolygonContact.o ../Dynamics/Contacts/b2PolygonContact.cpp

$(OBJECTS_DIR)/b2TOISolver.o : ../Dynamics/Contacts/b2TOISolver.cpp
	$(CXX) -c $(CXX_FLAGS) $(INCLUDE_PATH) $(LAST_INCLUDE_PATH) -o $(OBJECTS_DIR)/b2TOISolver.o ../Dynamics/Contacts/b2TOISolver.cpp

$(OBJECTS_DIR)/b2DistanceJoint.o : ../Dynamics/Joints/b2DistanceJoint.cpp
	$(CXX) -c $(CXX_FLAGS) $(INCLUDE_PATH) $(LAST_INCLUDE_PATH) -o $(OBJECTS_DIR)/b2DistanceJoint.o ../Dynamics/Joints/b2DistanceJoint.cpp

$(OBJECTS_DIR)/b2FrictionJoint.o : ../Dynamics/Joints/b2FrictionJoint.cpp
	$(CXX) -c $(CXX_FLAGS) $(INCLUDE_PATH) $(LAST_INCLUDE_PATH) -o $(OBJECTS_DIR)/b2FrictionJoint.o ../Dynamics/Joints/b2FrictionJoint.cpp

$(OBJECTS_DIR)/b2GearJoint.o : ../Dynamics/Joints/b2GearJoint.cpp
	$(CXX) -c $(CXX_FLAGS) $(INCLUDE_PATH) $(LAST_INCLUDE_PATH) -o $(OBJECTS_DIR)/b2GearJoint.o ../Dynamics/Joints/b2GearJoint.cpp

$(OBJECTS_DIR)/b2Joint.o : ../Dynamics/Joints/b2Joint.cpp
	$(CXX) -c $(CXX_FLAGS) $(INCLUDE_PATH) $(LAST_INCLUDE_PATH) -o $(OBJECTS_DIR)/b2Joint.o ../Dynamics/Joints/b2Joint.cpp

$(OBJECTS_DIR)/b2LineJoint.o : ../Dynamics/Joints/b2LineJoint.cpp
	$(CXX) -c $(CXX_FLAGS) $(INCLUDE_PATH) $(LAST_INCLUDE_PATH) -o $(OBJECTS_DIR)/b2LineJoint.o ../Dynamics/Joints/b2LineJoint.cpp

$(OBJECTS_DIR)/b2MouseJoint.o : ../Dynamics/Joints/b2MouseJoint.cpp
	$(CXX) -c $(CXX_FLAGS) $(INCLUDE_PATH) $(LAST_INCLUDE_PATH) -o $(OBJECTS_DIR)/b2MouseJoint.o ../Dynamics/Joints/b2MouseJoint.cpp

$(OBJECTS_DIR)/b2PrismaticJoint.o : ../Dynamics/Joints/b2PrismaticJoint.cpp
	$(CXX) -c $(CXX_FLAGS) $(INCLUDE_PATH) $(LAST_INCLUDE_PATH) -o $(OBJECTS_DIR)/b2PrismaticJoint.o ../Dynamics/Joints/b2PrismaticJoint.cpp

$(OBJECTS_DIR)/b2PulleyJoint.o : ../Dynamics/Joints/b2PulleyJoint.cpp
	$(CXX) -c $(CXX_FLAGS) $(INCLUDE_PATH) $(LAST_INCLUDE_PATH) -o $(OBJECTS_DIR)/b2PulleyJoint.o ../Dynamics/Joints/b2PulleyJoint.cpp

$(OBJECTS_DIR)/b2RevoluteJoint.o : ../Dynamics/Joints/b2RevoluteJoint.cpp
	$(CXX) -c $(CXX_FLAGS) $(INCLUDE_PATH) $(LAST_INCLUDE_PATH) -o $(OBJECTS_DIR)/b2RevoluteJoint.o ../Dynamics/Joints/b2RevoluteJoint.cpp

$(OBJECTS_DIR)/b2WeldJoint.o : ../Dynamics/Joints/b2WeldJoint.cpp
	$(CXX) -c $(CXX_FLAGS) $(INCLUDE_PATH) $(LAST_INCLUDE_PATH) -o $(OBJECTS_DIR)/b2WeldJoint.o ../Dynamics/Joints/b2WeldJoint.cpp

license: mit


code:
cocos2d-1.0.1-x-0.13.0-beta @ Mar.30 2012
 [all platforms]
     Bug      #1009: fix a typo error in CCNode::setSkewY() and CCNode::getSkewY()
     Feature  #1022: add a static method named CCString::stringWithContentsOfFile
     Feature  #1072: make CCLabelBMFont support alignment
     Refactor #737: Delete CCTouch::m_nViewId
 [iOS]
     Bug      #1076: fix wrong logging message in CCFileUtils
     Feature  #1033: add support files for Accelerometer Simulation for iPhone Simulator
     Feature  #1089: add support for new ipad
 [android]
     Feature  #721:  support putting audio resource not only under Resources
     Refactor #1061: use JNI Helper in CocosDenshion
     Refactor #1069: make build dependencies from official repos and from sources
 [bada]
     Bug      #984: use static library for cocos2dx project on bada and qnx platform
 [blackberry]
     Feature  #1015: add CCEGLView::EventHandler class and window group id for CCEGLView

 [marmalade]
     Bug      #626: fix a but that application doesn't terminate on exit
 [win32]
     Bug      #1014: fix a bug that "Resources" path in build-win32.bat are error
     Bug      #1020: fix a bug that can not create vs template with lua support
     Refactor #1017: improve win32 timing accuracy
 [lua]
     Bug      #1058: fix a bug that CCLuaEngine to call CCTouch::locationInView () use not exist parameter view id
     Bug      #1074: executeFunctionByHandler() not remove parameters from stack, after pushFunctionByHandler() failed
     Bug      #1075: invalid C++ class register order
     Refactor #1030: rename executeFunctionByRefId() to executeFunctionByHandler() and add some lua support functions
 [linux]
     Bug      #1028: fix a bug that linux makefile uses wrong directory name of CocosDenshion
     Refactor #1051: fix and improve building on linux
     Refactor #1068: use fontconfig of CCImage::initWithString

cocos2d-1.0.1-x-0.12.0 @ Mar.5 2012
 [all platforms]
     Bug      #925: rename HelloWorld/Resource to HelloWorld/Resources
     Bug      #948: fix a bug that CCMutableArray::getIndexOfObject returns 0 on both "index 0" and "not existing"
     Bug      #951: remove definition of NSMutableSet
     Bug      #961: fix mad behaviour in second stage of CCEaseBackInOut
     Bug      #965: remove some dynamic_cast calling since selector_protocol.h was removed
     Bug      #967: fix a bug that PVR Textures cannot be reloaded after GL context lost
     Bug      #986: add init() funciton in CCMenu class
     Feature  #952: make CCLabelBMFont supports other languages, include Chinese, Korean, Janpanese and so on.
     Feature  #972: add Support for CCNotificationCenter
     Refactor #933: refactor CCUserDefault
     Refactor #958: move the implement of SelectorProtocol to CCObject
     Document #975: add comment for CCTMXTiledMap::getMapSize and more methods
 [iOS]
     Bug      #946: fix a bug that can not load HD image for both Retina and Normal correctly
     Bug      #762: fix a bug that CCLabelTTF is in different position (higher) than in previous version on iphone
     Refactor #985: remove template for xcode3
 [android]
     Bug      #947:  fix a bug that long chinese string causes closed loop on android
     Bug      #950:  fix a crash when touching the screen because of RTTI
     Bug      #954:  fix a bug that accelerometer axes inverted on android tablet when setting orientation to portrait
     Bug      #957:  fix a bug that when running textInputTest, application enters background after input character and click back key on android devices
     Bug      #959:  fix a bug that get wrong multitouch id
     Bug      #964:  fix a bug that can not show whole charactor
     Bug      #971:  fix dynamic_cast error on android
     Feature  #982:  make android template supports box2d, chipmunk and lua
     Refactor #970:  use modules in the Android NDK build
     Bug      #1008: fix a bug that missing "return" in SimpleAudioEngine::getEffectsVolume() method on android platform
 [bada]
     Bug      #984: use static library for cocos2dx project on bada and qnx platform
 [blackberry]
     Bug      #960: detect when the application goes and return from background in QNX (Black Berry Playbook)
     Bug      #962: fix some bugs on qnx port
     Bug      #963: fix a bug that applicationWillEnterForeground will be invoked twice when application is launched
     Bug      #968: fix a bug about "Out of bound" in CCFileUtils::getWriteablePath() for BlackBerry
     Feature  #994: add support for bbndk2.0
 [marmalade]
     Bug      #995: modify project configure for marmalade port after adding extension support and refactor resource folder
 [win32]
     Feature  #969: implement Accelerometer Simulation for Win32.
 [lua]
     Bug      #942: fix a crash when invoking CCScheduler:sharedScheduler():scheduleScriptFunc in lua
     Bug      #953: add tolua++ for Mac
     Refactor #973: refactor lua support

cocos2d-1.0.1-x-0.11.0 @ Jan.13 2012
 [blackberry]
     Feature  #907: support blackberry playbook
 [all platforms]
     Bug      #752: fix a bug that enable and disable touch more times in touch handler callback function may cause memory leak
     Bug      #911: fix a bug that TextureCache::addUIImage() cannot create texture when key is null
     Bug      #920: export export functions in CCAffineTransform with CC_DLL
     Bug      #922: make CCTexture2D::setPVRImagesHavePremultipliedAlpha() to be a static function
     Bug      #926: fix a crash caused by RTTI when running TouchesTest
     Bug      #936: fix a bug that touch menu item may crash when selector is null
     Feature  #892: use RTTI to simplify the codes
     Feature  #903: add touch index for CCTouch
     Refactor #934: add 'isEqual' function for CCString, make CCObject::isEqual to a virtual function
     Refactor #940: use new icons and new background pictures with new logo of cocos2d-x
 [android]
     Bug      #923: fix a bug that CCTextureCache::addImageAsync() crashes when a game enters foreground from background
     Bug      #906: remove unneeded codes in CCImage_android.cpp
     Bug      #910: fix a bug that create-android-project.bat may erase exist folder with appointed name
     Bug      #884: fix a crash error caused by CocosDenshion on android simulator
     Bug      #921: fix a bug that accelerometer axes inverted in Motorola Xoom tablet
     Bug      #928: fix a bug that 16-bit texture is changed to 32-bit after application enter foreground
     Bug      #935: fix a bug that terminateProcessJNI() invoke wrong jni function
     Bug      #937: fix a compiling error on android x86
     Bug      #941: fix a bug that volume of background music may not in [0, 1.0]
     Feature  #887: define GL_GLEXT_PROTOTYPES = 1 automatically when compile on ndk r7
     Feature  #919: improve build_native.sh and create-android-project.sh
     Refactor #924: make loading music resources thread safe
     Document #837: Write a document describes how to use jni
     Document #914: update document to fit android r5~r7
 [iOS]
     Bug      #917: implement CCFileUtils::getFileDataFromZip()
     Feature  #893: remove cached data when receiving memory warning on iOS
 [bada]
     Bug      #918: fix a compiling error after renaming airplay to marmalade
     Bug      #927: fix a crash caused by invoking unloadEffect after invoking stopEffect
     Bug      #938: fix a bug that glGenFramebuffersOES isn't supported on wave m device
     Bug      #943: fix a bug that box2d can't be compiled successfully on bada sdk 1.2.1
     Refactor #904: Recreate bada 2.0 projects
 [win32]
     Bug      #915: fix a bug that msvc template uses old version of .cpp files
 [linux]
     Bug      #888: fix compiling error with eclipse
     Bug      #930: fix a crash caused by load jpg format files
 [marmalade]
     Refactor #908: merge marmalade to latest cocos2d-x source

cocos2d-1.0.1-x-0.10.0 @ Dec.2 2011
 [bada]
    Feature  #223  integrate cocos2d-bada branch to master
    Bug      #852  fix a bug that CCSpriteBatchNode cannot be drawn correctly
 [all platforms]
    Feature  #854  integrate pthread and write a test case on all platforms
    Feature  #465  implement CCTextureCache::addImageAsync()
    Feature  #850  upgrade box2d from 2.1.2 to last 2.2.1
    Feature  #781  add functions for effects
    Feature  #760  add methods to get/set CCDirector::m_pNotificationNode
    Bug      #883  fix the crash of SpriteTest
    Refactor #879  use CCAssert() instead of assert()
    Document #882  Write a document describes some cautions about using pthread
 [android]
    Feature  #838  support android x86 platform
    Bug      #758  fix a bug that custom TTF fonts causing low memory
    Bug      #848  fix a bug that accelerometer values are wrong if the content is scaled
    Bug      #885  fix a bug that SimpleAudioEngine::setEffectVolume() don't take effect immediately
    Document #864  write a describe how to build on sdk 4.0 & ndk-r7
    Document #878  write a document describe how to build project for x86 android
    Document #881  write a document describes building android ndk project with ndk-r7
 [linux]
    Bug      #780  fix build error on ubuntu 11.0
    Bug      #776  fix a bug in the audio player

cocos2d-1.0.1-x-0.9.2 @ Oct.20,2011
 [linux]
    Feature  #728  Linux port is born! http://www.cocos2d-x.org/projects/cocos2d-x/wiki/How_to_run_HelloWorld_and_tests_on_linux
 [all platforms]
    Feature  #672  Implements copyWithZone() for CCShow & CCHide
    Feature  #676  add more languages into CCApplication::getCurrentLanguage()
    Feature  #678  add private constructor for CCArray
    Feature  #684  add test case for CCApplication::getCurrentLanguage()
    Feature  #685  add test case in LabelTest to display Chinese charactors
    Bug      #675  Fix memory leak in CCLayer when using accelerometer
    Bug      #686  CCTMXLayer::appendTileForGID() not setting Z index tag causes the first screen of tiles to be re-created
    Bug      #689  CCRect should assert the width and height is positive
    Bug      #698  CCSprite::init() is excited twice in all CCSprite's static methods
    Bug      #700  CC_SWAP32 marco has a typo with leads to error swap result
    Bug      #701  CCZHeader.version should be unsigned short
    Bug      #715  CCFadeOut causes a crash when applied to CCMenuItem and m_pSelectedImage is NULL
    Bug      #718  fix a typo in method CCMenu::alignItemsInRows
    Bug      #749  CCSpriteTest crashes at the test case SpriteNilTexture
    Bug      #750  CCTextureCache::textureForKey() can't find textures added by function addUIImage()
    Refactor #677  Pass arguments by reference instead of pointer if possible
    Refactor #703  Refactor Accelerometer. Because it only sends data to one delegate, so it needs only one setDelegate()
    Document #692  Describe the usage of view orientation http://www.cocos2d-x.org/projects/cocos2d-x/wiki/About_device_orientation
 [android]
    Feature #670  Pause & resume effect playing when activity is paused & resumed
    Feature #687  Implement preloadBackgroundMusic to android
    Feature #688  Support reading resources not only from apk
    Feature #726  use external storage on android
    Feature #746  add a helper method to draw filled polygons
    Bug     #683  getPackagenameJNI() and getCurrentLanguageJNI() mustn't return invalid pointer
    Bug     #696  Some android devices may crash at CCRenderTexture::end(bool)
    Bug     #719  CocosDenshionTest crashes when start the test case on android
    Bug     #714  CCLabelTTF has different visual result between Android & Windows
    Bug     #727  Memory leak of NewStringUTF
    Bug     #736  Remove android:installLocation in AndroidManifest.xml
    Bug     #743  nativeInit is called with wrong screen size when running on device with software android buttons
    Bug     #744  CCUserDefault crashes in v0.9.1
    Bug     #755  Multi-touch causes crash on sum sung devices
 [ios]
    Bug     #660  CCLabelBMFont image error in retina display
    Bug     #693  CCLabelTTF can not break line by '\n' on iOS
    Bug     #716  subbing & adding volume of sound effects don't change volume little by little on iOS
    Bug     #738  Passing CCSize(width,0) to CCLabelTTF causes the label invisible
    Bug     #753  visual orientation is wrong on ios5 simulator
    Bug     #754  Missing png file for CCLabelAtlas cause crashes on iOS 4.3.3 & 5.0
 [win32]
    Feature #731  add ability of simulating android back/menu key on win32
    Feature #735  add ability of simulating android enter/resume background on win32. Shift+F1=android Back, Shift+F2 =android Menu
    Feature #745  export CCTime to all
    Bug     #747  Win32 templates should put all resources into "Resources" folder
    Bug     #748  build error in win32 release version
 [wophone]
    Bug     #702  tests crash at the start on wophone devices
 [lua]
    Feature #704  Print error descriptions ad pop error code in CCLuaScriptModule::executeString & CCLuaScriptModule::executeScriptFile
    Feature #707  Support 'require' for lua on android
    Feature #732  Add particle systems to lua bindings
    Feature #733  Use ant to generate a lua project, refer to http://www.cocos2d-x.org/boards/11/topics/3957
    Feature #734  Use ant to generate LuaCocos2d.cpp

cocos2d-1.0.1-x-0.9.1 @ Aug.17,2011
 [all platforms]
    Feature  #347  Support custom TTF fonts
    Feature  #536  Support PVR Texture
    Feature  #645  update to cocos2d-iphone v1.0.1
    Feature  #633  allow SimpleAudioEngine::playEffect repeatly
    Feature  #630  implement CCRenderTexture::saveBuffer method
    Feature  #613  Call executeCallFuncN instead of executeCallFunc in CCMenuItem::active()
    Feature  #620  add Texture2d test case
    Feature  #638  Add support for per ccz format
    Feature  #641  users can CCRenderTexture::saveBuffer to any path
    Feature  #643  swap Accelerometer input x/y according to the orientation
    Feature  #665  add test case for CCRenderTexture::saveBuffer
    Bug      #513  CCProgressTimer doesn't work with CCspriteFrameCache
    Bug      #609  Retain & Release CCObject in CCSet
    Bug      #628  CCMutableArray::arrayWithObjects should autorelease array object
    Bug      #629  pass eImgFmt to initWithImageData in initWithImageFile
    Bug      #636  CCTextureCache::textureForKey() can't find the right texture
    Bug      #639  m_PositionInPixels isn't correctly initialized
    Bug      #640  the image read from render texture is upseted
    Bug      #644  CCSpriteBatchNode::removeAllChildrenWithCleanup() not work as expected
    Bug      #680  CCtouchDispatcher::rearrangeHandlers() crash
    Refactor #623  refactor Cocos2dJni.cpp
    Refactor #652  refactor char* JniHelper::jstringtochar()
    Document #622  comment CCUserDefault in doxygen format
    Document #651  add CCFileUtils to oxygen api document
 [lua]
    Feature  #679  bind lua to CocosDenshion
    Feature  #647  add a method to set search path of lua script
    Feature  #611  Add some methods in CCMenuItemLabel & CCMenuItemToggle for lua
    Feature  #612  Export CCNode::getContentSizeInPixels & setContentSizeInPixels to lua
    Feature  #653  add CCScheduler::unscheduleScriptFunc
    Bug      #615  CCLOG may crash in LuaEngineImpl
 [android]
    Feature  #610  Remove the support of ndk-r4 crystax.net version
    Bug      #608  CCRenderTexture cannot show textures after sleep and wake-up
    Bug      #618  HelloWorld & Tests crash when X is clicked
    Bug      #619  CCFadeTo may crash on android
    Bug      #624  CCLabelTTF::setString("\n\n\n") crashes on android
    Bug      #625  test_image_rgba4444.pvr.gz can not packed into app
    Bug      #631  TextInputTest crash when input nothing
    Bug      #637  Create resources folder instead of resource in create-android-project.sh
    Bug      #648  CCRenderTexture::saveBuffer may crash on some devices like Moto Defy
    Bug      #655  CCLabelTTF doesn't draw all characters, it may lost the last char
    Refactor #656  refactor CCFileUtils, make it support reading data from directory other than assets
 [ios]
    Feature  #642  CCImage_ios.mm should be modified for saving image
    Feature  #658  xcode3 template should create AppDelegate.cpp/.h instead of ${PROJECT_NAME}AppDelegate.cpp/.h
    Feature  #661  fix TMXTiledMap for iPhone Retina mode
    Bug      #667  AppDelegate::applicationDidEnterBackground isn't invoked on iOS
    Bug      #668  CCLabelBMFont display 4 characters in a square per character block in retina mode
 [win32]
    Feature  #620  change lua library to static lib
    Feature  #632  Update visual studio template for lua support

cocos2d-1.0.0-x-0.9.0 @ Jul.14,2011
 [all platforms]
    Feature  #584  sync with cocos2d-iphone v1.0.0
    Feature  #601  use Chipmunk v5.3.5
    Feature  #581  change return types of xxxAction::reverse() to its own type
    Bug      #522  CCSpriteFrameCache::addSpriteFramesWithFile(const char* pszPlist) crashed if the param have no '/'
    Bug      #522  CCTextureCache::removeTextureForKey(const char*) cache the image path incorrectly
    Bug      #573  CCLayerColor does not init its m_tColor, which will result to a random color
    Bug      #576  some CCMutableDictionary methods must return _KeyT instead of std::string
    Bug      #577  CCReverseTime may crash
    Bug      #578  Debian & LavaFlow of ParticleTest have not picture, the effect of ParticleFire is wrong
    Bug      #580  ShuffleTilesTest of EffectText may crash
 [ios]
    Bug      #546  CCLabelTTF::labelWithString() works incorrectly when height = 0
    Bug      #604  test.xcodeproject miss Summary & Info in xcode4 since v0.8.5
 [android]
    Feature  #547  deal with line wrap of CCLabelTTF::initWithString(...)
 [win32]
    Bug      #659  ChipmunkTest Sensors crashes in a few seconds
    Bug      #583  SimpleAudioEngine::playBackgroundMusic(const char*, true) have no sound on win32
    Bug      #605  export C methods in CCNS.h to dll interfaces
    Bug      #548  export CCConfiguration to dll interfaces
 [marmalade/airplay]
    Bug      #600  incorrect memory allocation in marmalade port
    Refactor #582  use libpng instead of CIwImage in CCImage_airplay.cpp
 [wophone]
    Bug      #545  fix the wrong effect of ChipmunkTest
    Bug      #606  PageTransitionForward in TransitionsTest has wrong visual effect

cocos2d-0.99.5-x-0.8.5 @ Jun.28,2011
 [all platforms]
    Feature  #577  Lua Support! We export all the cocos2d-x classes & methods to lua!
                   Please compile and run HelloLua, and read HelloLua/Resource/hello.lua for more details.
                   And the lua new project template/wizard is ready on xcode3, xcode4 and VisualStudio2008 & 2010
    Feature  #398  Xcode4 templates! Run install-template-xcode.sh to do the magic
    Feature  #323  Internationalization support! Add CCApplication::getCurrentLanguage() method on all platforms
    Feature  #529  add static node() method to CCLayerColor & CCLayerGradient
    Bug      #534  don't raise compile error if ios project includes CCImage.cpp & CCFileUtils.cpp
    Bug      #429  Effect is wrong when the value of defaultAlphaPixelFormet=kCCTexture2DPixelFormat_A8 in CCTexture2D
    Bug      #491  Unsafe cycle in CCScheduler::unscheduleAllSelectors
    Bug      #502  Refactor the singleton mode of CCConfiguration
    Bug      #512,#525  fix warnings in /Wall flag
    Bug      #516  Undefined behavious in ccCArray.h (signed / unsigned conversion)
    Bug      #518  CCScheduler::unscheduleAllSelectors() uses tHashSelectorEntry in wrong way
    Bug      #521  the effect of PageTurn3D is curious
    Bug      #523  CCParticleSystemQuad::particleWithFile() can't work correctly
    Bug      #524  CCFileUtils::dictionaryWithContentsOfFile() can't parse special plist format
    Bug      #526  glScissior can't work correctly when use autoscale function
    Bug      #543  EffectTest renders x4 scale when use auto-scale on android/win32/wophone
    Bug      #544  some test cases of TransitionTest renders x4 scale when use auto-scale on android/win32/wophone
 [android]
    Bug      #490  TextInputTest show words on soft keyboard detach instead of each key pressed
    Bug      #507  RenderTextureTest failed on some android devices
    Bug      #532  GLSurface has no response when tap screen frequently for a long time
    Bug      #542  SimpleAudioEngine::setBackgroundMusicVolume() not work when background music changed
    Refactor #535  remove skia dependence when drawing strings, which cause bug #507
 [ios]
    Feature  #540  Add RootViewController into xcode3/xcode4 templates. Games can use ios rotation mechanism
 [win32]
    Feature  #537  Update PVRFrame lib to version 2.8 for ATI graphic card new driver
 [wophone]
    Bug      #539  games on wophone wva devices probably failed on reading resource from zip package

cocos2d-0.99.5-x-0.8.4 @ May.26,2011
 [android]
    Feature  #496  SUPPORT ANDROID 3.0! We test it on both Motorola XOOM & Samsung Galaxy Tab 10.1 (Highlight!!!!!)
    Bug      #494  typo fixed, Cocos2dxActivity::setPackgeName() to setPackageName()
    Bug      #495  Memory leak of CCFileUtils::getWriteablePath()
    Bug      #497  soft keyboard stays shown on some devices while the project includes CCTextFieldTTF
    Bug      #501  projects creaed by android template have the same package name
    Bug      #510  Tests progress is killed at the power down phase
 [all platforms]
    Feature  #503  upgrade chipmunk from 5.1 to 5.3.4, keep sync with cocos2d-iphone (Highlight!)
    Feature  #509  For integrting IME, we had to rotate UI to landscape by default
    Bug      #499  CCRGBAProtocol isn't inherited and implemented in CCMenuItemSprite
 [ios]
    Bug      #493  the return value of CCFileUtils::getWriteablePath() is not end with '/'
    Bug      #508  Problem in running Tests in Retina resolution since 0.8.2
 [win32]
    Bug      #492  CCFileUtils::fullPathFromRelativeFile forget to consider the path separated by '\'
    Feature  #489  Use GetCurrentDirectory instead of GetModuleFileName in CCFileUtils_win32.cpp

cocos2d-0.99.5-x-0.8.3 @ May.12,2011
 [all platforms]
    Feature  #317  wrap input box for game dev, CCTextFieldTTF. (Highlight!)
    Feature  #455  implement CCUserDefault for data persistence (Highlight!)
    Feature  #456  integrate libcurl for network access (Highlight!)
    Feature  #468  implement CCProfiler & CCProfilingTimer
    Feature  #450  can set default pixel format other than RGBA888
    Feature  #449  Remove the sources for mac platform. We plan to focus on mobile platforms & reduce the complexity
    Refactor #451  Remove the event dispatcher and refactor CCLayer & CCMenu & CCParticleSystemPoint.
    Refactor #452  Refactor CCDirector CCGrid CCNode, reduce the complexity
    Refactor #472  Refactor duplicated modules under cocos2dx/platform, reduce the complexity
    Bug      #341  CCTMXFiledMap crashed when a child is not the obj of CCTMXLayer
    Bug      #371  A layer can't registered as a StandardTouchDelegate when touch event is handling
    Bug      #428  Function addChild low efficiency
    Bug      #448  CCCallFuncO crashes
    Bug      #467  CCLayer:m_eTouchDelegateType = ccTouchDeletateAllBit all the time
    Bug      #471  invoke CCFileUtils::setResourcePath may cause loading texture for ParticleSystem failed
    Bug      #484  CCTextureAtlas::initWithTexture() may cause memory leak
    Bug      #486  transition test FlipX, FlipY, FlipAngular, ZoomFlipXxx flickers on ios simulator & device
 [ios]
    Bug      #447  really exit application when "x" button is clicked
    Bug      #460  cocos2dx + box2d template cannot find libxml2.dylib
 [android]
    Feature  #393  use full version of libxml2, with xmlXPath.. serial methods
    Feature  #477  Set compilation default ndk version to r5
    Bug      #374  replace the method for EGL rendering context lost
    Bug      #453  Android Cocosdenshion can't replace background music
    Bug      #462  no applicationDidEnterBackground / applicationWillEnterBackground on Android
    Bug      #470  use GAME_ROOT or other words instead of HELLOWORLD_ROOT in anroid new projects
    Bug      #475  CCImage::initWithString return true even if the bitmap hasn't been initialized
 [win32]
    Feature  #454  Modify the including path of Box2D genereated by win32 template
    Bug      #459  the project create by template for vs use the RuntimeLibrary MTd, different with other project
 [wophone]
    Feature  #482  Modify the resource data path for the new WoPhone SDK
    Feature  #487  Implement the function CCFiltUtils::getWriteablePath() on wophone
    Refactor #466  Refactor CCFileUtils for the new packing approach on wophone
    Bug      #481  After power down & up, backlight will turn off automaticlly if there's no operation
    Bug      #485  reduce the CPU occupation, modify the approach of FPS control on wophone
 [airplay]
    Feature  #480  add template for airplay

cocos2d-0.99.5-x-0.8.2 @ Apr.7,2011
 [all platforms]
    390    Feature    Implement performance test
    411    Feature    support .plist format outputed by the last version of Zwoptex
    415    Feature    Make all xxxFromFile methods can accept relative path
    439    Feature    all file reading must pass though CCFileUtils::getFileData
    441    Feature    Initialize pointers in construction & detect them in destruction
    427    Refactor   refactor CCTMXXMLParser with multi-platform CCSAXParser design
    434    Refactor   refactor class CCFileUtils
    396    Refactor   remove ccxScopedPtr & ccxScopedArray, use STL instead
    350    Bug        TransitionFade flickers
    391    Bug        CCSpriteFrameCache doesn't support .plist files which format isn't equal to 0
    420    Bug        CCSprite::spriteWithFile() returns a valid object when the image file isn't present
    440    Bug        Can't show MessageBox when imageFromFile can't find the image
 [ios]
    349    Bug        deal with plist files in binary format
    435    Bug        CocosDenshion crashes at foreground/background switching
    438    Bug        MotionStreak Test crashes on device
 [android]
    421    Feature    Add a template & new project script for android
    443    Feature    implement CCKeypadDelegate on android
    367    Bug        Android.mk of HelloWorld and Tests depends on alphabet order
    422    Bug        the 2nd point in multi-touch isn't located to the correct coordinate
    430    Bug        replace glColor4ub with glColor4f to avoid "called unimplement OpenGL ES API" on some android devices
    431    Bug        ParticleFlower on G3 can't show the particles correctly
 [win32]
    417    Bug        No touchEnd when the mouse move out from the window
    424    Bug        open vs2010.sln says cannot open CCamera.cpp
 [airplay]
    379    Feature    integrate airplay sdk port
    442    feature    implement CocosDenshion on airplay port

cocos2d-0.99.5-x-0.8.1 @ Mar.21,2011
 [all platforms]
    400    Bug        typo, rename CCamera.cpp to CCCamera
    403    Feature    rename cocos2d::UIEvent to cocos2d::CCEvent, to avoid class name conflict on ios
    405	   Bug        CCConfiguration::checkForGLExtension(const string&) sometimes may crashes
    407    Bug        replace "CCGL.h" with "CCGL.h" in CCCamera.cpp, for case-sensitive systems
    408    Bug        memory leak in CCImage::_initWithPngData
    409    Feature    rename cocos2d::NSArray to cocos2d::CCArray, to avoid the conflict on ios
    418    Feature    add copyright of cocos2d-iphone original authors to each file
    423    Bug        fix compilation warnings when COCOS2D_DEBUG == 2
 [ios]
    404    Bug        HiResTest isnot prerfect on HVGA/Retina yet
    410    Bug        xcode3 template, cannot find libxml from header searh paths in release build
    419    Bug        test case TMXIsoVertexZ in TileMapTst has wrong effect on ios
 [android]
    399    Bug        HelloWorld crashes when the screen is touched
    405    Bug        CocosDenshion test, BGM isn't paused after HOME key tapped
 [win32]
    395    Bug        make AppDelegate.cpp created by VS wizard portable without any modification
    401    Bug        VisualStudio template for 2010 OutputDir errors

cocos2d-0.99.5-x-0.8.0 @ Mar.15,2011
 [all platforms]
    316    Feature    Resolution auto adjustment, auto scale HVGA resource to WVGA or any other resolutions
    336    Refactor   refactor platform porting layer
    253    Bug        xml parser sometimes crashes
    375    Feature    Rename NS,CG,UI prefix classes/definitions to CC prefix, avoid the crash at ios dev
    332    Feature    upgrade tests from 0.99.4 to 0.99.5
 [ios]
    363    Bug        CCLabelTTF can't treat line breaks and wrapping correctly.
    351    Feature    CCLabelTTF cannot automatic line break on iphone
    352    Bug        ccRemoveHDSuffixFromFile & CCFileUtils::getDoubleResolutionImage isnot work
    392    Bug        border of sprite debug draw isn't scaled if enableRetinaDisplay(true)
    385    Feature    implement ccos2d::CCLog
    388    Feature    update the template for iOS
 [android]
    247    Feature    support multitouch
    242    Feature    support accelerometer on android
    353    Feature    support jpg on android
    344    Feature    add APP_ABI := armeabi armeabi-v7a to improve the performance on some devices
    356    Bug        CCLabelTTF::initWithString crashed
 [wophone]
    386    Bug        resolve the compile conflict on wophone sdk
    383    Bug        The approach which handle left soft-key clicked is not work
    377    Feature    Replace the word "uphone" with "wophone"
    357    Bug        CCLabelTTF doesn't support words contain line breaks.
    348    Bug        CCLabelTTF blur if color = white and fontSize < 24
 [win32]
    373    Feature    Disable PVRFrame window when cocos2d running
    355    Bug        CCLabelTTF doesn't support line breaks and wrapping words
    300    Feature    wizard for Visual C++ 2008 Express & VS2010 Express/Professional

cocos2d-0.99.5-x-0.7.2 @ Jan.26,2011
 [all platforms]
    - upgrade engine logic internal & interfaces to 0.99.5
    - the list of menu items in tests is showing how to scroll now
    - lots of bugs fixed
 [iphone]
    - add new project templates for Xcode
    - add the c++ wrapper for CocosDenshion::SimpleAudioEngine
    - support UTF8 charactors in text renderring, such as CCLabelTTF, CCMenuItemFont
 [android]
    - add CocosDenshion::SimpleAudioEngine implement on android
    - the engine can adjust the apk filename automatically
    - the engine will not crash at surface recreate, especially at background-to-foreground switching
 [wophone]
    - switch the game to background, then press power key will not cause the background music play again
    - remove the methods of using resouce map in cocos2d-wophone & SimpleAudioEngine.
      Only zip resource is recommended and suppported.
    - can auto find the installed path of your game, and load zip resource file from the current folder.
      No absolute path in code any more. Do this to support installing games to micro-SD card

cocos2d-0.99.4-x-0.7.1 @ Dec.20,2010
 [all platforms]
    - add CCKeypadDelegate class, which enable CCLayer to respond "back" key in wophone & android
    - Add namespace for CocosDenshion
    - fix compile errors when enable CC_XXX_DEBUG_DRAW switchs in ccConfig.h
    - fix memory leaks on each platform
    - more details: http://www.cocos2d-x.org/versions/show/5
 [android]
    - Run through all the test cases of cocos2d, support ndk r4,r5, sdk higher than 2.0. Tested on HTC G2,G3,G6,G7
    - HelloWorld integrate all platforms in one directory now
    - WANRNING: this version isn't ready for android games porting yet. The CocosDenshion isn't ported to android,
      and this version will crashes when screen orientation changes or the game gack to foreground
      look more on this bug http://www.cocos2d-x.org/boards/10/topics/202
 [iphone]
    - Add support of loading textureImageData from the ParticleDesign plist file
    - Fix more then 3000 complie warnings
    - You can try to use this version to develop your iOS game now. It's much more stable than the previous version
 [wophone]
    - Games can easily read resources from zip file now. This will drastically reduce the memory usage
    - Add power management: pause the message loop when cocos2d-x game is switched to background or backlight down
    - Multi-touch support
 [win32]
    - SimpleAudioEngine can play background musci with repeating now

cocos2d-0.99.4-x-0.7.0 @ Nov.29,2010
* cocos2d-iphone-cpp port ready! include accelerometer & multi-touch
* refactor the directory structure of HelloWorld & tests
* cocos2d-wophone supports accelerometer
* add cocos2d-x wizard for cocos2d-win32 & cocos2d-wophone for VisualStudio2008
* jump out a message box when load texture failed (win32 & wophone)
* more details: 	http://www.cocos2d-x.org/versions/show/4

cocos2d-0.99.4-wophone-win32-stable-rc1
	http://www.cocos2d-x.org/versions/show/1
	http://www.cocos2d-x.org/versions/show/2
	http://www.cocos2d-x.org/versions/show/3

path: CHANGELOG


code:
LOCAL_PATH := $(call my-dir)
include $(CLEAR_VARS)

LOCAL_MODULE := cocosdenshion_shared

LOCAL_MODULE_FILENAME := libcocosdenshion

LOCAL_SRC_FILES := SimpleAudioEngine.cpp \
jni/SimpleAudioEngineJni.cpp

LOCAL_EXPORT_C_INCLUDES := $(LOCAL_PATH)/../include

LOCAL_C_INCLUDES := $(LOCAL_PATH)/../include \
                    $(LOCAL_PATH)/../../cocos2dx/include \
                    $(LOCAL_PATH)/../../cocos2dx/platform \
                    $(LOCAL_PATH)/../../cocos2dx/platform/android/jni

LOCAL_LDLIBS := -llog

include $(BUILD_SHARED_LIBRARY)

include $(CLEAR_VARS)

LOCAL_MODULE := cocosdenshion_static

LOCAL_MODULE_FILENAME := libcocosdenshion

LOCAL_SRC_FILES := SimpleAudioEngine.cpp \
                   jni/SimpleAudioEngineJni.cpp

LOCAL_EXPORT_C_INCLUDES := $(LOCAL_PATH)/../include

LOCAL_C_INCLUDES := $(LOCAL_PATH)/../include \
                    $(LOCAL_PATH)/../../cocos2dx/include \
                    $(LOCAL_PATH)/../../cocos2dx/platform \
                    $(LOCAL_PATH)/../../cocos2dx/platform/android/jni

LOCAL_EXPORT_LDLIBS := -llog

include $(BUILD_STATIC_LIBRARY)


code:
/****************************************************************************
Copyright (c) 2010 cocos2d-x.org

http://www.cocos2d-x.org

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.

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.
****************************************************************************/

#include "SimpleAudioEngine.h"
#include "jni/SimpleAudioEngineJni.h"

namespace CocosDenshion
{
	static SimpleAudioEngine *s_pEngine = 0;

	SimpleAudioEngine::SimpleAudioEngine()
	{

	}

	SimpleAudioEngine::~SimpleAudioEngine()
	{

	}

	SimpleAudioEngine* SimpleAudioEngine::sharedEngine()
	{
		if (! s_pEngine)
		{
			s_pEngine = new SimpleAudioEngine();
		}

		return s_pEngine;
	}

	void SimpleAudioEngine::end()
	{
		endJNI();
	}

	void SimpleAudioEngine::setResource(const char* pszZipFileName)
	{

	}

    void SimpleAudioEngine::preloadBackgroundMusic(const char* pszFilePath)
	{
        preloadBackgroundMusicJNI(pszFilePath);
	}

	void SimpleAudioEngine::playBackgroundMusic(const char* pszFilePath, bool bLoop)
	{
        playBackgroundMusicJNI(pszFilePath, bLoop);
	}

	void SimpleAudioEngine::stopBackgroundMusic(bool bReleaseData)
	{
		stopBackgroundMusicJNI();
	}

	void SimpleAudioEngine::pauseBackgroundMusic()
	{
		pauseBackgroundMusicJNI();
	}

	void SimpleAudioEngine::resumeBackgroundMusic()
	{
		resumeBackgroundMusicJNI();
	}

	void SimpleAudioEngine::rewindBackgroundMusic()
	{
		rewindBackgroundMusicJNI();
	}

	bool SimpleAudioEngine::willPlayBackgroundMusic()
	{
		return true;
	}

	bool SimpleAudioEngine::isBackgroundMusicPlaying()
	{
		return isBackgroundMusicPlayingJNI();
	}

	float SimpleAudioEngine::getBackgroundMusicVolume()
	{
		return getBackgroundMusicVolumeJNI();
	}

	void SimpleAudioEngine::setBackgroundMusicVolume(float volume)
	{
		setBackgroundMusicVolumeJNI(volume);
	}

	float SimpleAudioEngine::getEffectsVolume()
	{
		return getEffectsVolumeJNI();
	}

	void SimpleAudioEngine::setEffectsVolume(float volume)
	{
		setEffectsVolumeJNI(volume);
	}

	unsigned int SimpleAudioEngine::playEffect(const char* pszFilePath, bool bLoop)
	{
		return playEffectJNI(pszFilePath, bLoop);
	}

	void SimpleAudioEngine::stopEffect(unsigned int nSoundId)
	{
		stopEffectJNI(nSoundId);
	}

	void SimpleAudioEngine::preloadEffect(const char* pszFilePath)
	{
		preloadEffectJNI(pszFilePath);
	}

	void SimpleAudioEngine::unloadEffect(const char* pszFilePath)
	{
		unloadEffectJNI(pszFilePath);
	}

	void SimpleAudioEngine::pauseEffect(unsigned int nSoundId)
	{
		pauseEffectJNI(nSoundId);
	}

	void SimpleAudioEngine::pauseAllEffects()
	{
		pauseAllEffectsJNI();
	}

	void SimpleAudioEngine::resumeEffect(unsigned int nSoundId)
	{
		resumeEffectJNI(nSoundId);
	}

	void SimpleAudioEngine::resumeAllEffects()
	{
		resumeAllEffectsJNI();
	}

	void SimpleAudioEngine::stopAllEffects()
	{
		stopAllEffectsJNI();
	}
}


code:
#include <JniHelper.h>
#include "SimpleAudioEngineJni.h"
#include <android/log.h>

#define  LOG_TAG    "libSimpleAudioEngine"
#define  LOGD(...)  __android_log_print(ANDROID_LOG_DEBUG,LOG_TAG,__VA_ARGS__)
#define  CLASS_NAME "org/cocos2dx/lib/Cocos2dxActivity"

typedef struct JniMethodInfo_
	{
		JNIEnv *    env;
		jclass      classID;
		jmethodID   methodID;
	} JniMethodInfo;

extern "C"
{
	// get env and cache it
	static JNIEnv* getJNIEnv(void)
	{

		JavaVM* jvm = cocos2d::JniHelper::getJavaVM();
        if (NULL == jvm) {
            LOGD("Failed to get JNIEnv. JniHelper::getJavaVM() is NULL");
            return NULL;
        }

		JNIEnv *env = NULL;
		// get jni environment
        jint ret = jvm->GetEnv((void**)&env, JNI_VERSION_1_4);

        switch (ret) {
        case JNI_OK :
            // Success!
            return env;

        case JNI_EDETACHED :
            // Thread not attached

            // TODO : If calling AttachCurrentThread() on a native thread
            // must call DetachCurrentThread() in future.
            // see: http://developer.android.com/guide/practices/design/jni.html

            if (jvm->AttachCurrentThread(&env, NULL) < 0)
            {
                LOGD("Failed to get the environment using AttachCurrentThread()");
                return NULL;
            } else {
                // Success : Attached and obtained JNIEnv!
                return env;
            }

        case JNI_EVERSION :
            // Cannot recover from this error
			LOGD("JNI interface version 1.4 not supported");
        default :
			LOGD("Failed to get the environment using GetEnv()");
            return NULL;
        }
	}

	// get class and make it a global reference, release it at endJni().
	static jclass getClassID(JNIEnv *pEnv)
	{
		jclass ret = pEnv->FindClass(CLASS_NAME);
		if (! ret)
		{
			LOGD("Failed to find class of %s", CLASS_NAME);
		}

		return ret;
	}

	static bool getStaticMethodInfo(JniMethodInfo &methodinfo, const char *methodName, const char *paramCode)
    {
		jmethodID methodID = 0;
		JNIEnv *pEnv = 0;
		bool bRet = false;

        do
        {
			pEnv = getJNIEnv();
			if (! pEnv)
			{
				break;
			}

            jclass classID = getClassID(pEnv);

            methodID = pEnv->GetStaticMethodID(classID, methodName, paramCode);
            if (! methodID)
            {
                LOGD("Failed to find static method id of %s", methodName);
                break;
            }

			methodinfo.classID = classID;
			methodinfo.env = pEnv;
			methodinfo.methodID = methodID;

			bRet = true;
        } while (0);

        return bRet;
    }

	void preloadBackgroundMusicJNI(const char *path)
	{
		// void playBackgroundMusic(String,boolean)
		JniMethodInfo methodInfo;

		if (! getStaticMethodInfo(methodInfo, "preloadBackgroundMusic", "(Ljava/lang/String;)V"))
		{
			return;
		}

		jstring stringArg = methodInfo.env->NewStringUTF(path);
		methodInfo.env->CallStaticVoidMethod(methodInfo.classID, methodInfo.methodID, stringArg);
		methodInfo.env->DeleteLocalRef(stringArg);
		methodInfo.env->DeleteLocalRef(methodInfo.classID);
	}

	void playBackgroundMusicJNI(const char *path, bool isLoop)
	{
		// void playBackgroundMusic(String,boolean)

		JniMethodInfo methodInfo;

		if (! getStaticMethodInfo(methodInfo, "playBackgroundMusic", "(Ljava/lang/String;Z)V"))
		{
			return;
		}

		jstring stringArg = methodInfo.env->NewStringUTF(path);
		methodInfo.env->CallStaticVoidMethod(methodInfo.classID, methodInfo.methodID, stringArg, isLoop);
		methodInfo.env->DeleteLocalRef(stringArg);
		methodInfo.env->DeleteLocalRef(methodInfo.classID);
	}

	void stopBackgroundMusicJNI()
	{
		// void stopBackgroundMusic()

		JniMethodInfo methodInfo;

		if (! getStaticMethodInfo(methodInfo, "stopBackgroundMusic", "()V"))
		{
			return;
		}

		methodInfo.env->CallStaticVoidMethod(methodInfo.classID, methodInfo.methodID);
		methodInfo.env->DeleteLocalRef(methodInfo.classID);
	}

	void pauseBackgroundMusicJNI()
	{
		// void pauseBackgroundMusic()

		JniMethodInfo methodInfo;

		if (! getStaticMethodInfo(methodInfo, "pauseBackgroundMusic", "()V"))
		{
			return;
		}

		methodInfo.env->CallStaticVoidMethod(methodInfo.classID, methodInfo.methodID);
		methodInfo.env->DeleteLocalRef(methodInfo.classID);
	}

	void resumeBackgroundMusicJNI()
	{
		// void resumeBackgroundMusic()

		JniMethodInfo methodInfo;

		if (! getStaticMethodInfo(methodInfo, "resumeBackgroundMusic", "()V"))
		{
			return;
		}

		methodInfo.env->CallStaticVoidMethod(methodInfo.classID, methodInfo.methodID);
		methodInfo.env->DeleteLocalRef(methodInfo.classID);
	}

	void rewindBackgroundMusicJNI()
	{
		// void rewindBackgroundMusic()

		JniMethodInfo methodInfo;

		if (! getStaticMethodInfo(methodInfo, "rewindBackgroundMusic", "()V"))
		{
			return;
		}

		methodInfo.env->CallStaticVoidMethod(methodInfo.classID, methodInfo.methodID);
		methodInfo.env->DeleteLocalRef(methodInfo.classID);
	}

	bool isBackgroundMusicPlayingJNI()
	{
		// boolean rewindBackgroundMusic()

		JniMethodInfo methodInfo;
		jboolean ret = false;

		if (! getStaticMethodInfo(methodInfo, "isBackgroundMusicPlaying", "()Z"))
		{
			return ret;
		}

		ret = methodInfo.env->CallStaticBooleanMethod(methodInfo.classID, methodInfo.methodID);
		methodInfo.env->DeleteLocalRef(methodInfo.classID);

		return ret;
	}

	float getBackgroundMusicVolumeJNI()
	{
		// float getBackgroundMusicVolume()

		JniMethodInfo methodInfo;
		jfloat ret = -1.0;

		if (! getStaticMethodInfo(methodInfo, "getBackgroundMusicVolume", "()F"))
		{
			return ret;
		}

		ret = methodInfo.env->CallStaticFloatMethod(methodInfo.classID, methodInfo.methodID);
		methodInfo.env->DeleteLocalRef(methodInfo.classID);

		return ret;
	}

	void setBackgroundMusicVolumeJNI(float volume)
	{
		// void setBackgroundMusicVolume()

		JniMethodInfo methodInfo;

		if (! getStaticMethodInfo(methodInfo, "setBackgroundMusicVolume", "(F)V"))
		{
			return ;
		}

	    methodInfo.env->CallStaticVoidMethod(methodInfo.classID, methodInfo.methodID, volume);
		methodInfo.env->DeleteLocalRef(methodInfo.classID);
	}

	unsigned int playEffectJNI(const char* path, bool bLoop)
	{
		// int playEffect(String)

		JniMethodInfo methodInfo;
		int ret = 0;

		if (! getStaticMethodInfo(methodInfo, "playEffect", "(Ljava/lang/String;Z)I"))
		{
			return ret;
		}

		jstring stringArg = methodInfo.env->NewStringUTF(path);
		ret = methodInfo.env->CallStaticIntMethod(methodInfo.classID, methodInfo.methodID, stringArg, bLoop);
        methodInfo.env->DeleteLocalRef(stringArg);
		methodInfo.env->DeleteLocalRef(methodInfo.classID);

		return (unsigned int)ret;
	}

	void stopEffectJNI(unsigned int nSoundId)
	{
		// void stopEffect(int)

		JniMethodInfo methodInfo;

		if (! getStaticMethodInfo(methodInfo, "stopEffect", "(I)V"))
		{
			return ;
		}

		methodInfo.env->CallStaticVoidMethod(methodInfo.classID, methodInfo.methodID, (int)nSoundId);
		methodInfo.env->DeleteLocalRef(methodInfo.classID);
	}

	void endJNI()
	{
		// void end()

		JniMethodInfo methodInfo;

		if (! getStaticMethodInfo(methodInfo, "end", "()V"))
		{
			return ;
		}

		methodInfo.env->CallStaticVoidMethod(methodInfo.classID, methodInfo.methodID);
		methodInfo.env->DeleteLocalRef(methodInfo.classID);
	}

	float getEffectsVolumeJNI()
	{
		// float getEffectsVolume()

		JniMethodInfo methodInfo;
		jfloat ret = -1.0;

		if (! getStaticMethodInfo(methodInfo, "getEffectsVolume", "()F"))
		{
			return ret;
		}

		ret = methodInfo.env->CallStaticFloatMethod(methodInfo.classID, methodInfo.methodID);
		methodInfo.env->DeleteLocalRef(methodInfo.classID);

		return ret;
	}

	void setEffectsVolumeJNI(float volume)
	{
		// void setEffectsVolume(float)
		JniMethodInfo methodInfo;

		if (! getStaticMethodInfo(methodInfo, "setEffectsVolume", "(F)V"))
		{
			return ;
		}

		methodInfo.env->CallStaticVoidMethod(methodInfo.classID, methodInfo.methodID, volume);
		methodInfo.env->DeleteLocalRef(methodInfo.classID);
	}

	void preloadEffectJNI(const char *path)
	{
		// void preloadEffect(String)

		JniMethodInfo methodInfo;

		if (! getStaticMethodInfo(methodInfo, "preloadEffect", "(Ljava/lang/String;)V"))
		{
			return ;
		}

		jstring stringArg = methodInfo.env->NewStringUTF(path);
		methodInfo.env->CallStaticVoidMethod(methodInfo.classID, methodInfo.methodID, stringArg);
		methodInfo.env->DeleteLocalRef(stringArg);
		methodInfo.env->DeleteLocalRef(methodInfo.classID);
	}

	void unloadEffectJNI(const char* path)
	{
		// void unloadEffect(String)

		JniMethodInfo methodInfo;

		if (! getStaticMethodInfo(methodInfo, "unloadEffect", "(Ljava/lang/String;)V"))
		{
			return ;
		}

		jstring stringArg = methodInfo.env->NewStringUTF(path);
		methodInfo.env->CallStaticVoidMethod(methodInfo.classID, methodInfo.methodID, stringArg);
		methodInfo.env->DeleteLocalRef(stringArg);
		methodInfo.env->DeleteLocalRef(methodInfo.classID);
	}

	void pauseEffectJNI(unsigned int nSoundId)
	{
		// void pauseEffect(int)

		JniMethodInfo methodInfo;

		if (! getStaticMethodInfo(methodInfo, "pauseEffect", "(I)V"))
		{
			return ;
		}

		methodInfo.env->CallStaticVoidMethod(methodInfo.classID, methodInfo.methodID, (int)nSoundId);
		methodInfo.env->DeleteLocalRef(methodInfo.classID);
	}

	void pauseAllEffectsJNI()
	{
		// void pauseAllEffects()

		JniMethodInfo methodInfo;

		if (! getStaticMethodInfo(methodInfo, "pauseAllEffects", "()V"))
		{
			return ;
		}

		methodInfo.env->CallStaticVoidMethod(methodInfo.classID, methodInfo.methodID);
		methodInfo.env->DeleteLocalRef(methodInfo.classID);
	}

	void resumeEffectJNI(unsigned int nSoundId)
	{
		// void resumeEffect(int)

		JniMethodInfo methodInfo;

		if (! getStaticMethodInfo(methodInfo, "resumeEffect", "(I)V"))
		{
			return ;
		}

		methodInfo.env->CallStaticVoidMethod(methodInfo.classID, methodInfo.methodID, (int)nSoundId);
		methodInfo.env->DeleteLocalRef(methodInfo.classID);
	}

	void resumeAllEffectsJNI()
	{
		// void resumeAllEffects()

		JniMethodInfo methodInfo;

		if (! getStaticMethodInfo(methodInfo, "resumeAllEffects", "()V"))
		{
			return ;
		}

		methodInfo.env->CallStaticVoidMethod(methodInfo.classID, methodInfo.methodID);
		methodInfo.env->DeleteLocalRef(methodInfo.classID);
	}

	void stopAllEffectsJNI()
	{
		// void stopAllEffects()

		JniMethodInfo methodInfo;

		if (! getStaticMethodInfo(methodInfo, "stopAllEffects", "()V"))
		{
			return ;
		}

		methodInfo.env->CallStaticVoidMethod(methodInfo.classID, methodInfo.methodID);
		methodInfo.env->DeleteLocalRef(methodInfo.classID);
	}
}


code:
#ifndef __SIMPLE_AUDIO_ENGINE_JNI__
#define __SIMPLE_AUDIO_ENGINE_JNI__

#include <jni.h>

extern "C"
{
    extern void preloadBackgroundMusicJNI(const char *path);
    extern void playBackgroundMusicJNI(const char *path, bool isLoop);
	extern void stopBackgroundMusicJNI();
	extern void pauseBackgroundMusicJNI();
	extern void resumeBackgroundMusicJNI();
	extern void rewindBackgroundMusicJNI();
	extern bool isBackgroundMusicPlayingJNI();
	extern float getBackgroundMusicVolumeJNI();
	extern void setBackgroundMusicVolumeJNI(float volume);
	extern unsigned int playEffectJNI(const char* path, bool bLoop);
	extern void stopEffectJNI(unsigned int nSoundId);
	extern void endJNI();
	extern float getEffectsVolumeJNI();
	extern void setEffectsVolumeJNI(float volume);
	extern void preloadEffectJNI(const char *path);
	extern void unloadEffectJNI(const char* path);
	extern void pauseEffectJNI(unsigned int nSoundId);
	extern void pauseAllEffectsJNI();
	extern void resumeEffectJNI(unsigned int nSoundId);
	extern void resumeAllEffectsJNI();
	extern void stopAllEffectsJNI();
}

#endif // __SIMPLE_AUDIO_ENGINE_JNI__


code:
/****************************************************************************
Copyright (c) 2010 cocos2d-x.org

http://www.cocos2d-x.org

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.

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.
****************************************************************************/

#include "CCAudioOut.h"
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <errno.h>
#include <FSystem.h>

#define OGG_SUPPORT

#ifdef OGG_SUPPORT
#include "vorbis/vorbisfile.h"
#endif

using namespace Osp::Base;
using namespace Osp::Base::Collection;
using namespace Osp::Media;
using namespace Osp::Io;

namespace CocosDenshion {

#define PRE_BUFFERING_NUM 2
#define DEFAULT_VOLUME_LEVEL 5

typedef struct wave_tag
{
    char              ChunkID[5];
    unsigned long int ChunkSize;
    char              Format[5];
    char              SubChunk1ID[5];
    unsigned long int SubChunk1Size;
    unsigned short int   AudioFormat;
    unsigned short int   NumChannels;
    unsigned long int    SampleRate;
    unsigned long int    ByteRate;
    unsigned short int   BlockAlign;
    unsigned short int   BitsPerSample;
    char              SubChunk2ID[5];
    unsigned long int SubChunk2Size;
}WAVE;

static void GetWaveHeadInfo(File* pFile, WAVE& outWavHead)
{
	char szTmp[100] = {0};
	int i = 0;
	memset(&outWavHead, 0, sizeof(WAVE));
    pFile->Read(outWavHead.ChunkID, 4);
    pFile->Read(&(outWavHead.ChunkSize),4);
    pFile->Read(outWavHead.Format, 4);
    pFile->Read(outWavHead.SubChunk1ID, 4);
    pFile->Read(&(outWavHead.SubChunk1Size), 4);
    pFile->Read(&(outWavHead.AudioFormat),   2);
    pFile->Read(&(outWavHead.NumChannels),   2);
    pFile->Read(&(outWavHead.SampleRate), 4);
    pFile->Read(&(outWavHead.ByteRate),      4);
    pFile->Read(&(outWavHead.BlockAlign), 2);
    pFile->Read(&(outWavHead.BitsPerSample), 2);

	pFile->Seek(FILESEEKPOSITION_BEGIN, 0);
	pFile->Read(szTmp, 64);

	for (i = 0; i <= 60; i++)
	{
		if (szTmp[i] == 'd' && szTmp[i+1] == 'a' && szTmp[i+2] == 't' && szTmp[i+3] == 'a')
		{
			break;
		}
	}

	pFile->Seek(FILESEEKPOSITION_BEGIN, i);
    pFile->Read(outWavHead.SubChunk2ID, 4);
    pFile->Read(&(outWavHead.SubChunk2Size), 4);
}

int CCAudioOut::DecodeOgg(const char *infile)
{
#ifdef OGG_SUPPORT
    FILE *in=NULL;
    OggVorbis_File vf;
    int bs = 0;
    char buf[8192];
    int buflen = 8192;
    unsigned int written = 0;
    int ret;
    ogg_int64_t length = 0;
    ogg_int64_t done = 0;
    int size;
    int seekable = 0;
    int percent = 0;

	in = fopen(infile, "rb");
	if(!in) {
		AppLog("ERROR: Failed to open input file:\n");
		return 1;
	}

    if(ov_open(in, &vf, NULL, 0) < 0) {
    	AppLog("ERROR: Failed to open input as vorbis\n");
        fclose(in);
        return 1;
    }

    if(ov_seekable(&vf)) {
        seekable = 1;
        length = ov_pcm_total(&vf, 0);
        size = 16/8 * ov_info(&vf, 0)->channels;
    }

    if (ov_info(&vf,0)->channels == 2)
    {
    	__sampleChannelType = AUDIO_CHANNEL_TYPE_STEREO;
    }
    else
    {
    	__sampleChannelType = AUDIO_CHANNEL_TYPE_MONO;
    }

    __sampleRate = ov_info(&vf,0)->rate;
    __sampleBitdepth = AUDIO_TYPE_PCM_S16_LE;

    while((ret = ov_read(&vf, buf, buflen, 0, 16/8, 1, &bs)) != 0) {
        if(bs != 0) {
            AppLog("Only one logical bitstream currently supported\n");
            break;
        }

        if(ret < 0) {
            AppLog("Warning: hole in data\n");
            continue;
        }

        if (__pAllPcmBuffer == null)
        {
        	__pAllPcmBuffer = (char*)malloc(ret);
        }
        else
        {
			__pAllPcmBuffer = (char*)realloc(__pAllPcmBuffer, written+ret);
        }

        memcpy(__pAllPcmBuffer+written, buf, ret);

        written += ret;
        if(seekable) {
            done += ret/size;
            if((double)done/(double)length * 200. > (double)percent) {
                percent = (double)done/(double)length *200;
//                //AppLog("[%5.1f%%]", (double)percent/2.);
            }
        }
    }

    __iAllPcmBufferSize = written;

    ov_clear(&vf);
    fclose(in);

#endif

    return 0;
}

CCAudioOut::CCAudioOut()
{

	__volumeLevel = -1;
	__pAllPcmBuffer = null;
	__iAllPcmBufferSize = 0;
	__iAllPcmPos = 0;
	__pAudioOut = null;
	__iFileType = 0;
	__pFile = null;
	__bShortPcmBuffer = false;
	__bBufferConstruted = false;
	__checkInitFiniPair = false;
	__iUsedBufferCount = 0;
	__bLoop = false;
	__bPause = false;
}

CCAudioOut::~CCAudioOut()
{

	Finalize();
	if(__pAudioOut)
	{
		delete __pAudioOut;
		__pAudioOut = null;
	}

	if (__pAllPcmBuffer)
	{
		free(__pAllPcmBuffer);
		__pAllPcmBuffer = null;
	}
}

result CCAudioOut::Initialize(const char* pszFilePath)
{

	// This is called when AudioOut form is moving on the foreground.
	result r = E_SUCCESS;

	__pAllPcmBuffer = null;
	__iAllPcmBufferSize = 0;
	__iAllPcmPos = 0;
	__iUsedBufferCount = 0;

	if(__checkInitFiniPair == false)
	{
		// Reset the configure variables
		__finishChecker =0;
		__bufWrittenCnt = PRE_BUFFERING_NUM;
		__buffReadCnt = 0;
		__buffWriteCnt = 0;

		result r = E_FAILURE;
		if (__pAudioOut == NULL)
		{
			__pAudioOut = new AudioOut();
			if (!__pAudioOut)
			{
				AppLog("[E_OUT_OF_MEMORY] m_pAudio new failed\n");
				return r;
			}

			r = __pAudioOut->Construct(*this);
			if (IsFailed(r))
			{
				AppLog("[Error] m_AudioOut.Construct failed");
				return r;
			}
		}
		else
		{
			AppLog("[Error] __pAudioOut is already existed\n");
		}

		String strFile(pszFilePath);
		if (strFile.EndsWith(".wav"))
		{
			__iFileType = 0;
			// Construct File for feeding buffers
			__pFile = new File();
			if(!__pFile)
			{
				AppLog("[Error] __pFile new failed\n");
				return E_SYSTEM;
			}

			r = __pFile->Construct(pszFilePath, L"rb");
			if (IsFailed(r)) {
				AppLog("[Error] __pFile.Construct failed : %d \n", r);
				return r;
			}

			WAVE wavHead;
			GetWaveHeadInfo(__pFile, wavHead);
			__iAllPcmBufferSize = wavHead.SubChunk2Size;

			if (wavHead.BitsPerSample == 8)
			{
				__sampleBitdepth = AUDIO_TYPE_PCM_U8;

			}
			else if (wavHead.BitsPerSample == 16)
			{
				__sampleBitdepth = AUDIO_TYPE_PCM_S16_LE;
			}
			else
			{
				__sampleBitdepth = AUDIO_TYPE_NONE;
			}

			if (wavHead.NumChannels == 1)
			{
				__sampleChannelType = AUDIO_CHANNEL_TYPE_MONO;
			}
			else if (wavHead.NumChannels == 2)
			{
				__sampleChannelType = AUDIO_CHANNEL_TYPE_STEREO;
			}
			else
			{
				__sampleChannelType = AUDIO_CHANNEL_TYPE_NONE;
			}

			__sampleRate = wavHead.SampleRate;
			__pAllPcmBuffer = (char*)malloc(__iAllPcmBufferSize);
			if (__pAllPcmBuffer != NULL)
			{
				__pFile->Read(__pAllPcmBuffer, __iAllPcmBufferSize);
			}
			else
			{
				AppLog("not more memory...");
			}
		}
		else if (strFile.EndsWith(".ogg"))
		{
			__iFileType = 1;
			long long curTick, oldTick;
			Osp::System::SystemTime::GetTicks(oldTick);
			DecodeOgg(pszFilePath);
			Osp::System::SystemTime::GetTicks(curTick);
			//AppLog("decode ogg to pcm waste %ld", (long)(curTick-oldTick));
		}
		// Prepare AudioOut
		r = __pAudioOut->Prepare( __sampleBitdepth, __sampleChannelType, __sampleRate );
		if (IsFailed(r))
		{
			AppLog("[Error] m_AudioOut.Prepare failed");
			return r;
		}

		__bufferSize = __pAudioOut->GetMinBufferSize();
		//AppLog("[Info] __bufferSize=%d (MaxBuf=%d Min Size %d)\n", __bufferSize, __pAudioOut->GetMaxBufferSize(),__pAudioOut->GetMinBufferSize());

		// Reset Volume or keeping a volume level
		__volumeLevel = __volumeLevel == -1 ? DEFAULT_VOLUME_LEVEL : __volumeLevel;
		r = __pAudioOut->SetVolume(DEFAULT_VOLUME_LEVEL);
		if (IsFailed(r))
		{
			AppLog("[Error] m_AudioOut.SetVolume failed");
			return r;
		}

		if (!__bBufferConstruted)
		{
			__bBufferConstruted = true;
			r = __byteBuffer[0].Construct(__bufferSize);
			if (E_SUCCESS != r)
			{
				AppLog( "[Error] __byteBuffer[0].Construct failed..%d ",r);
				return E_OUT_OF_MEMORY;
			}
			r = __byteBuffer[1].Construct(__bufferSize);
			if (E_SUCCESS != r)
			{
				AppLog( "[Error] __byteBuffer[1].Construct failed..%d ",r);
				return E_OUT_OF_MEMORY;
			}
			r = __byteBuffer[2].Construct(__bufferSize);
			if (E_SUCCESS != r)
			{
				AppLog( "[Error] __byteBuffer[2].Construct failed..%d ",r);
				return E_OUT_OF_MEMORY;
			}
			r = __byteBuffer[3].Construct(__bufferSize);
			if (E_SUCCESS != r)
			{
				AppLog( "[Error] __byteBuffer[3].Construct failed..%d ",r);
				return E_OUT_OF_MEMORY;
			}
		}

		if (__iAllPcmBufferSize <= __bufferSize * 4)
		{
			__bShortPcmBuffer = true;
		}
		else
		{
			__bShortPcmBuffer = false;
		}

		ReWriteBuffer();
		__checkInitFiniPair = true;

	}else{
		//AppLog("[WANRNING] The application state is not proper");
	}
	return r;
}

result CCAudioOut::FeedBuffer (void)
{
	result ret = E_FAILURE;

//	if (__iFileType == 0)
//	{
//		/*
//		 *  Read buffer from file
//		 */
//		if(__pFile)
//		{
//			readSize = __pFile->Read((char *)__byteBuffer[__buffWriteCnt].GetPointer (), __bufferSize);
//			if(readSize != 0)
//			{
//				__buffWriteCnt ++;
//				if (4 == __buffWriteCnt)
//				{
//					__buffWriteCnt = 0;
//				}
//			}else
//			{
//				__finishChecker = PRE_BUFFERING_NUM;
//				__buffWriteCnt = 0;
//			}
//		}
//	}
//	else if (__iFileType == 1)
	{// ogg
		int iRemainSize = __iAllPcmBufferSize - __iAllPcmPos;
		if (iRemainSize < __bufferSize)
		{
			memcpy((void*)__byteBuffer[__buffWriteCnt].GetPointer (), __pAllPcmBuffer+__iAllPcmPos, iRemainSize);
			__iAllPcmPos += iRemainSize;
		}
		else
		{
			memcpy((void*)__byteBuffer[__buffWriteCnt].GetPointer (), __pAllPcmBuffer+__iAllPcmPos, __bufferSize);
			__iAllPcmPos += __bufferSize;
		}

		__iUsedBufferCount++;

		if (__iAllPcmPos < __iAllPcmBufferSize)
		{
			__buffWriteCnt ++;
			if (4 == __buffWriteCnt)
			{
				__buffWriteCnt = 0;
			}
		}
		else
		{
			__finishChecker = PRE_BUFFERING_NUM;
			__buffWriteCnt = 0;
			__iAllPcmPos = 0;
			ret = E_SUCCESS;
		}
	}

	return ret;
}

result CCAudioOut::ReWriteBuffer(void)
{
	int i = 0;
	result r = E_FAILURE;
	__iAllPcmPos = 0;
	__iUsedBufferCount = 0;
	if (__bShortPcmBuffer)
	{
		for (i=0; i<4; i++)
		{
			r = FeedBuffer();
			if (!IsFailed(r)) // Feeding buffers(4)
			{
				break;
			}
		}

		for (i = 0; i < __iUsedBufferCount; i++)
		{
			r = __pAudioOut->WriteBuffer(__byteBuffer[i]);
			if (IsFailed(r))
			{
				AppLog("[Error] m_AudioOut.WriteBuffer failed : %d\n", r);
				return r;
			}
		}
	}
	else
	{
		for (i=0; i<4; i++)
		{
			FeedBuffer(); // Feeding buffers(4)
		}

		for (i = 0; i < 2; i++)
		{
			r = __pAudioOut->WriteBuffer(__byteBuffer[i]);
			if (IsFailed(r))
			{
				AppLog("[Error] m_AudioOut.WriteBuffer failed : %d\n", r);
				return r;
			}
		}
	}
	return r;
}

void CCAudioOut::ReFeedBuffer(void)
{
	result r = E_SUCCESS;
	for (int i=0; i<4; i++)
	{
		FeedBuffer(); // Feeding buffers(4)
	}

	r = __pAudioOut->WriteBuffer(__byteBuffer[0]);
	if (IsFailed(r))
	{
		//AppLog("[Error] m_AudioOut.WriteBuffer failed : %d\n", r);
	}

	r = __pAudioOut->WriteBuffer(__byteBuffer[1]);
	if (IsFailed(r))
	{
		//AppLog("[Error] m_AudioOut.WriteBuffer failed : %d\n", r);
	}
}

result CCAudioOut::Play(bool bLoop/* = false*/)
{
	result ret = E_FAILURE;
	AudioOutState state = __pAudioOut->GetState();

	if(state == AUDIOOUT_STATE_PREPARED || state == AUDIOOUT_STATE_STOPPED)
	{
		__bLoop = bLoop;
		ret = __pAudioOut->Start();
		if (IsFailed(ret))
		{
			AppLog("[Error] m_AudioOut.Start failed : %d\n", ret);
		}
	}
	return ret;
}

result CCAudioOut::Stop(void)
{
	AudioOutState state = __pAudioOut->GetState();
	result r = E_SUCCESS;

	__bPause = false;
	if(state == AUDIOOUT_STATE_PLAYING)
	{
		r = __pAudioOut->Reset();
		if(IsFailed(r))
		{
			AppLog("[Error] AudioOut Reset is failed");
		}
		ReWriteBuffer();
	}

	return r;
}

result CCAudioOut::Pause(void)
{
	result ret = E_FAILURE;

	if( __pAudioOut->GetState() == AUDIOOUT_STATE_PLAYING )
	{
		__bPause = true;
		ret = __pAudioOut->Stop();
		if (IsFailed(ret))
		{
			AppLog("[Error] m_AudioOut.Stop failed : %d\n", ret);
		}
	}

	return ret;
}

result CCAudioOut::Resume(void)
{
	result ret = E_FAILURE;

	if(__bPause && __pAudioOut->GetState() == AUDIOOUT_STATE_STOPPED )
	{
		__bPause = false;
		ret = __pAudioOut->Start();
		if (IsFailed(ret))
		{
			AppLog("[Error] m_AudioOut.Stop failed : %d\n", ret);
		}
	}

	return ret;
}

void CCAudioOut::OnAudioOutBufferEndReached(Osp::Media::AudioOut& src)
{
	if (__bShortPcmBuffer)
	{
		__iUsedBufferCount--;
		if (__iUsedBufferCount <= 0)
		{
			Stop();
			if (__bLoop)
			{
				Play(__bLoop);
			}
		}
	}
	else
	{
		int ret = 0;
	//	//AppLog("thread name is %S", Thread::GetCurrentThread()->GetName().GetPointer());
		//AppLog("__buffReadCnt = %d", __buffReadCnt);
		__byteBuffer[__buffReadCnt++].Clear ();

		if (4 == __buffReadCnt)
				__buffReadCnt = 0;

		if(__finishChecker == 0)
		{
			ret = src.WriteBuffer(__byteBuffer[__bufWrittenCnt++]);
			if (4 == __bufWrittenCnt)
				__bufWrittenCnt = 0;
			FeedBuffer();

		}
		else
		{
			//AppLog("__finishChecker = %d", __finishChecker);
			__finishChecker--;
			if(__finishChecker == 0)
			{
				Stop();
				__bufWrittenCnt = PRE_BUFFERING_NUM;
				__buffReadCnt = 0;
				__buffWriteCnt = 0;
				if (__bLoop)
				{
					Play(__bLoop);
				}
			}
		}
	}

}

void CCAudioOut::OnAudioOutInterrupted(Osp::Media::AudioOut& src)
{
	Pause();
}

void CCAudioOut::OnAudioOutReleased(Osp::Media::AudioOut& src)
{
	Resume();
}

void CCAudioOut::Finalize(void)
{
	if(__checkInitFiniPair)
	{

		// Set OnAudioOutBufferEndReached stop.
		__finishChecker = PRE_BUFFERING_NUM;

		if(__pAudioOut)
		{

			AudioOutState state = __pAudioOut->GetState();
			result r = E_SUCCESS;

			if(state == AUDIOOUT_STATE_PLAYING)
			{
				r = __pAudioOut->Reset();
				if(IsFailed(r))
				{
					AppLog("[Error] AudioOut Reset is failed");
				}

			}

			state = __pAudioOut->GetState();

			if(state == AUDIOOUT_STATE_PREPARED || state == AUDIOOUT_STATE_STOPPED)
			{
				r = __pAudioOut->Unprepare();
				if(IsFailed(r))
				{
					AppLog("[Error] AudioOut UnPrepare is failed");
				}
			}
		}

		if(__pFile)
		{
			delete __pFile;
			__pFile = null;
		}

		__checkInitFiniPair = false;
	}else{
		AppLog("[WANRNING] This application state is not proper");
	}
}

void CCAudioOut::SetVolume(int volume)
{
	if (__pAudioOut)
		__pAudioOut->SetVolume(volume);
}

int CCAudioOut::GetVolume(void) const
{
	int ret = 0;
	if (__pAudioOut)
		ret = __pAudioOut->GetVolume();
	return ret;
}

Osp::Media::AudioOutState CCAudioOut::GetState(void) const
{
	AudioOutState state = AUDIOOUT_STATE_ERROR;
	if (__pAudioOut)
		state = __pAudioOut->GetState();
	return state;
}

}


code:
/****************************************************************************
Copyright (c) 2010 cocos2d-x.org

http://www.cocos2d-x.org

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.

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.
****************************************************************************/

#ifndef __CCAUDIOOUT_H__
#define __CCAUDIOOUT_H__

#include <FBase.h>
#include <FMedia.h>
#include <FIo.h>

namespace CocosDenshion {

class CCAudioOut:
	public Osp::Media::IAudioOutEventListener
{

public:
	CCAudioOut();
	virtual ~CCAudioOut();

	virtual void OnAudioOutBufferEndReached(Osp::Media::AudioOut& src);
	virtual void OnAudioOutInterrupted(Osp::Media::AudioOut& src);
	virtual void OnAudioOutReleased(Osp::Media::AudioOut& src);

	int DecodeOgg(const char *infile);
	result Initialize(const char* pszFilePath);
	result FeedBuffer (void);
	result ReWriteBuffer(void);
	void ReFeedBuffer(void);
	void Finalize(void);

	result Play(bool bLoop = false);
	result Stop(void);
	result Pause(void);
	result Resume(void);

	void SetVolume(int volume);
	int GetVolume(void) const;
	Osp::Media::AudioOutState GetState(void) const;
private:
	Osp::Media::AudioOut 	*__pAudioOut;
	Osp::Base::ByteBuffer  	__byteBuffer [4];
	bool __bBufferConstruted;
	int __iUsedBufferCount;
	Osp::Io::File 			*__pFile;
	Osp::Media::AudioChannelType __sampleChannelType;
	Osp::Media::AudioSampleType __sampleBitdepth;
	bool					__checkInitFiniPair;
	int	__bufferSize;
	int __finishChecker;
	int __buffWriteCnt;
	int __buffReadCnt;
	int __bufWrittenCnt;
	int __volumeLevel;
	bool __bShortPcmBuffer;

	int __iFileType; // 0: wav; 1:ogg
	int __sampleRate;
	char* __pAllPcmBuffer;
	int __iAllPcmBufferSize;
	int __iAllPcmPos;
	bool __bLoop;
	bool __bPause;
};

}

#endif /* __CCAUDIOOUT_H__ */


code:
/****************************************************************************
Copyright (c) 2010 cocos2d-x.org

http://www.cocos2d-x.org

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.

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.
****************************************************************************/

#include "SimpleAudioEngine.h"
#include "CCAudioOut.h"
#include <FBase.h>
#include <FMedia.h>
#include <FSystem.h>
#include <string>
#include <map>
#include <ctype.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <math.h>

using namespace std;
using namespace Osp::Media;
using namespace Osp::System;
using namespace Osp::Base::Runtime;
using namespace Osp::Base::Collection;

#define BREAK_IF(cond)  if (cond) break;

namespace CocosDenshion {

#define MAX_BUFFER_SIZE	2520 // 840 byte

typedef map<unsigned int, CCAudioOut*> EffectList;
typedef pair<unsigned int ,CCAudioOut*> Effect;

static SimpleAudioEngine *s_pSharedAudioEngine = NULL;
static Player       *s_pBackPlayer       = NULL;
static EffectList	s_List;
static float   s_fBackgroundMusicVolume = 1.0f;
static float   s_fEffectsVolume = 1.0f;
static bool    s_bWillPlayBackgroundMusic = false;
static bool    s_bBackgroundMusicPaused = false;
static string s_strResourcePath = "/Res/";

static unsigned int _Hash(const char *key)
{
	unsigned int len = strlen(key);
	const char *end=key+len;
	unsigned int hash;

	for (hash = 0; key < end; key++)
	{
		hash *= 16777619;
		hash ^= (unsigned int) (unsigned char) toupper(*key);
	}
	return (hash);
}

static string fullPathFromRelativePath(const char *pszRelativePath)
{
	string strRet="";
	int len = strlen(pszRelativePath);
	if (pszRelativePath == NULL || len <= 0)
	{
		return strRet;
	}

    if (len > 1 && pszRelativePath[0] == '/')
    {
    	strRet = pszRelativePath;
    }
    else
    {
    	strRet = s_strResourcePath;
    	strRet += pszRelativePath;
    }
	return strRet;
}

class MyPlayerEventListener :
	public IPlayerEventListener
{

public:

	/**
	*	Notifies that audio/video content was opened asynchronously.
	*
	* 	@param[in]	r	The cause of the error
	*	@exception	 E_SUCCESS							The method was successful.
	*	@exception	 E_SYSTEM							A system error occurred.
	*	@exception	 E_CONNECTION_FAILED				Network connection failed.
	* 	@exception	 E_UNSUPPORTED_FORMAT				The specified format is not supported.
	* 	@exception	 E_UNSUPPORTED_CODEC				The specified codec is not supported.
	*	@exception	 E_OUT_OF_MEMORY					Insufficient memory.
	*	@see		Player::OpenFile(), Player::OpenUrl(), Player::OpenBuffer()
	*/
	virtual void OnPlayerOpened( result r )
	{
		AppLog("OnPlayerOpened result = %d", r);
	}

	/**
	*	Notifies that the Player has reached the end of the clip.
	*
	*/
	virtual void OnPlayerEndOfClip(void)
	{
		AppLog("OnPlayerEndOfClip");
	}

	/**
	*	Notifies that the position of the audio/video content was moved asynchronously.
	*
	*	@exception	 E_SUCCESS		The method was successful.
	*	@exception	 E_SYSTEM		A system error occurred.
	*	@see		Player::SeekTo()
	*/

	virtual void OnPlayerSeekCompleted( result r )
	{
		AppLog("OnPlayerSeekCompleted result = %d", r);
	}

	/**
	*	Notifies that streaming data is being buffered.
	*
	*	@param[in]	percent		The percentage of buffering completed
	*	@see		Player::OpenUrl()
	*/
	virtual void OnPlayerBuffering(int percent)
	{
		AppLog("OnPlayerBuffering percent = %d%", percent);
	}

	/**
	*	Notifies that an error has occurred while the Player is working.
	*
	*	@param[in]	r		A player error reason of type ::PlayerErrorReason
	*	@remark		While playing streaming media, the player might throw an error like ::PLAYER_ERROR_CONNECTION_LOST @n
	*				::PLAYER_ERROR_STREAMING_TIMEOUT, ::PLAYER_ERROR_TRANSPORT or ::PLAYER_ERROR_SERVER. @n
	*				If the content includes invalid data, ::PLAYER_ERROR_INVALID_DATA may occur.
	*	@see	PlayerErrorReason
	*/
	virtual void OnPlayerErrorOccurred( PlayerErrorReason r )
	{
		AppLog("OnPlayerErrorOccurred PlayerErrorReason = %d", r);
	}

	/**
	 *	Notifies that the Player is being interrupted by a task of higher priority than Player.
	 *
	 */
	virtual void OnPlayerInterrupted(void)
	{
		AppLog("OnPlayerInterrupted");
		//Insert your code here
		if (s_pBackPlayer->GetState() == PLAYER_STATE_PLAYING)
			s_pBackPlayer->Pause();
	}

	/**
	 *	Notifies that the interrupting Player has been released.
	 *
	 */
	virtual void OnPlayerReleased(void)
	{
		AppLog("OnPlayerReleased");
		//Insert your code here
		if (s_pBackPlayer->GetState() != PLAYER_STATE_PLAYING)
			s_pBackPlayer->Play();
	}

};

static 	MyPlayerEventListener s_playerListener;

static void closeMediaPlayer(Player*& pPlayer)
{
	if (pPlayer != NULL)
	{
		PlayerState nowState = pPlayer->GetState();
		if( nowState == PLAYER_STATE_PLAYING || nowState == PLAYER_STATE_PAUSED )
		{
			pPlayer->Stop();
			pPlayer->Close();
		}
		else if(nowState == PLAYER_STATE_OPENED || nowState == PLAYER_STATE_ENDOFCLIP || nowState == PLAYER_STATE_STOPPED )
		{
			pPlayer->Close();
		}
	}
}

static bool openMediaPlayer(Player*& pPlayer, const char* pszFilePath)
{
	bool bRet = false;
	result r = E_FAILURE;

	do
	{
		closeMediaPlayer(pPlayer);

		if (pPlayer == NULL)
		{
			pPlayer = new Player();
			r = pPlayer->Construct(s_playerListener, null);
			if (IsFailed(r))
			{
				AppLog("player construct fails, pszFilePath = %s", pszFilePath);
				delete pPlayer;
				pPlayer = NULL;
				break;
			}
		}

		string strFilePath = fullPathFromRelativePath(pszFilePath);
		// OpenFile must use synchronous param, for after that it will playing.
		r = pPlayer->OpenFile(strFilePath.c_str(), false);
		if (IsFailed(r))
		{
			AppLog("Open (%s) fails\n", strFilePath.c_str());
			delete pPlayer;
			pPlayer = NULL;
			break;
		}
		else
		{
			bRet = true;
		}
	}
	while (0);

	SimpleAudioEngine::sharedEngine()->setBackgroundMusicVolume(s_fBackgroundMusicVolume);

	return bRet;
}

SimpleAudioEngine::SimpleAudioEngine()
{

}

SimpleAudioEngine::~SimpleAudioEngine()
{
	for (EffectList::iterator it = s_List.begin(); it != s_List.end(); ++it)
	{
		it->second->Stop();
		delete it->second;
	}

	s_List.clear();

	closeMediaPlayer(s_pBackPlayer);
	delete s_pBackPlayer;
	s_pBackPlayer = NULL;
}

SimpleAudioEngine* SimpleAudioEngine::sharedEngine()
{
    if (s_pSharedAudioEngine == NULL)
    {
        s_pSharedAudioEngine = new SimpleAudioEngine;
    }

    return s_pSharedAudioEngine;
}

void SimpleAudioEngine::end()
{
	if (s_pSharedAudioEngine)
	{
		delete s_pSharedAudioEngine;
		s_pSharedAudioEngine = NULL;
	}
}

void SimpleAudioEngine::setResource(const char* pszZipFileName)
{

}

void SimpleAudioEngine::preloadBackgroundMusic(const char* pszFilePath)
{
	openMediaPlayer(s_pBackPlayer, pszFilePath);
}

void SimpleAudioEngine::playBackgroundMusic(const char* pszFilePath, bool bLoop)
{
	result r = E_FAILURE;
	bool bRet = false;
	bRet = openMediaPlayer(s_pBackPlayer, pszFilePath);

    if (bRet)
    {
    	s_pBackPlayer->SetLooping(bLoop);
    	r = s_pBackPlayer->Play();
    }
}

void SimpleAudioEngine::stopBackgroundMusic(bool bReleaseData)
{
	s_bBackgroundMusicPaused = false;
    if (s_pBackPlayer != NULL && PLAYER_STATE_PLAYING == s_pBackPlayer->GetState())
    {
        s_pBackPlayer->Stop();
    }
}

void SimpleAudioEngine::pauseBackgroundMusic()
{
    if (s_pBackPlayer != NULL && PLAYER_STATE_PLAYING == s_pBackPlayer->GetState())
    {
    	s_bBackgroundMusicPaused = true;
        s_pBackPlayer->Pause();
    }
}

void SimpleAudioEngine::resumeBackgroundMusic()
{
    if (s_pBackPlayer != NULL && s_bBackgroundMusicPaused && PLAYER_STATE_PLAYING != s_pBackPlayer->GetState())
    {
    	s_bBackgroundMusicPaused = false;
        s_pBackPlayer->Play();
    }
}

void SimpleAudioEngine::rewindBackgroundMusic()
{
	stopBackgroundMusic();
    if (s_pBackPlayer != NULL)
    {
        if (PLAYER_STATE_PLAYING != s_pBackPlayer->GetState())
        {
         	result r = s_pBackPlayer->Play();
         	if (IsFailed(r))
         	{
         		AppLog("ERROR: %s", GetErrorMessage(r));
         	}
        }
    }
}

bool SimpleAudioEngine::willPlayBackgroundMusic()
{
    return s_bWillPlayBackgroundMusic;
}

bool SimpleAudioEngine::isBackgroundMusicPlaying()
{
    bool bRet = false;

    if (s_pBackPlayer != NULL && s_pBackPlayer->GetState() == PLAYER_STATE_PLAYING)
    {
        bRet = true;
    }

    return bRet;
}

// properties
float SimpleAudioEngine::getBackgroundMusicVolume()
{
    return s_fBackgroundMusicVolume;
}

void SimpleAudioEngine::setBackgroundMusicVolume(float volume)
{
    if (volume > 1.0f)
    {
        volume = 1.0f;
    }
    else if (volume < 0.0f)
    {
        volume = 0.0f;
    }

    if (s_pBackPlayer != NULL)
    {
    	s_pBackPlayer->SetVolume(ceil(volume*99));
    }
    s_fBackgroundMusicVolume = volume;
}

float SimpleAudioEngine::getEffectsVolume()
{
    return s_fEffectsVolume;
}

void SimpleAudioEngine::setEffectsVolume(float volume)
{
    if (volume > 1.0f)
    {
        volume = 1.0f;
    }
    else if (volume < 0.0f)
    {
        volume = 0.0f;
    }

	EffectList::iterator it;
	for (it = s_List.begin(); it != s_List.end(); ++it)
	{
		if (it->second != NULL)
		{
			it->second->SetVolume(ceil(volume*99));
		}
	}
	s_fEffectsVolume = volume;
}

// for sound effects
unsigned int SimpleAudioEngine::playEffect(const char* pszFilePath, bool bLoop/* = false*/)
{
	result r = E_FAILURE;
	string strFilePath = fullPathFromRelativePath(pszFilePath);
	unsigned int nRet = _Hash(strFilePath.c_str());

	preloadEffect(pszFilePath);

	EffectList::iterator p = s_List.find(nRet);
	if (p != s_List.end())
	{
		if (NULL == p->second)
		{
			AppLog("CCAudioOut instance must not be NULL, id = %d", p->first);
			return 0;
		}
		p->second->SetVolume(ceil(s_fEffectsVolume * 99));

	    if (AUDIOOUT_STATE_PLAYING == p->second->GetState())
		{
            return nRet; // Stop waste a lot of time, so just return.
	    	//r = p->second->Stop();
		}

	    if (s_fEffectsVolume > 0.0f)
	    {
	    	r = p->second->Play(bLoop);
	    }

    	if (IsFailed(r))
    	{
    		AppLog("play effect fails, error code = %d", r);
    	}
	}
	return nRet;
}

void SimpleAudioEngine::stopEffect(unsigned int nSoundId)
{
	EffectList::iterator it = s_List.find(nSoundId);
	if (it != s_List.end())
	{
		if (it->second != NULL)
		{
			it->second->Stop();
		}
	}
}

void SimpleAudioEngine::pauseEffect(unsigned int nSoundId)
{
	EffectList::iterator it = s_List.find(nSoundId);
	if (it != s_List.end())
	{
		if (it->second != NULL)
		{
			it->second->Pause();
		}
	}
}

void SimpleAudioEngine::pauseAllEffects()
{
	for (EffectList::iterator it = s_List.begin(); it != s_List.end(); ++it)
	{
		if (it->second != NULL)
		{
			it->second->Pause();
		}
	}
}

void SimpleAudioEngine::resumeEffect(unsigned int nSoundId)
{
	EffectList::iterator it = s_List.find(nSoundId);
	if (it != s_List.end())
	{
		if (it->second != NULL)
		{
			it->second->Resume();
		}
	}
}

void SimpleAudioEngine::resumeAllEffects()
{
	for (EffectList::iterator it = s_List.begin(); it != s_List.end(); ++it)
	{
		if (it->second != NULL)
		{
			it->second->Resume();
		}
	}
}

void SimpleAudioEngine::stopAllEffects()
{
	for (EffectList::iterator it = s_List.begin(); it != s_List.end(); ++it)
	{
		if (it->second != NULL)
		{
			it->second->Stop();
		}
	}
}

void SimpleAudioEngine::preloadEffect(const char* pszFilePath)
{
	int nRet = 0;
	CCAudioOut* pEffectPlayer = NULL;
	do
	{
		BREAK_IF(! pszFilePath);

		string strFilePath = fullPathFromRelativePath(pszFilePath);

		nRet = _Hash(strFilePath.c_str());

		BREAK_IF(s_List.end() != s_List.find(nRet));

		//AppLog("not find effect, create it...");
		if (s_List.size() >= 64)
		{
			// get the first effect, and remove it form list
			AppLog("effect preload more than 64, delete the first effect");
			pEffectPlayer = s_List.begin()->second;
			pEffectPlayer->Finalize();
			s_List.erase(s_List.begin());
		}

		if (NULL == pEffectPlayer)
		{
			pEffectPlayer = new CCAudioOut();
		}

		pEffectPlayer->Initialize(strFilePath.c_str());

		s_List.insert(Effect(nRet, pEffectPlayer));

	} while (0);
}

void SimpleAudioEngine::unloadEffect(const char* pszFilePath)
{
	string strFilePath = fullPathFromRelativePath(pszFilePath);
	unsigned int nID = _Hash(strFilePath.c_str());
	EffectList::iterator p = s_List.find(nID);
	if (p != s_List.end())
	{
		if (p->second != NULL)
		{
			delete p->second;
			p->second = NULL;
			AppLog("delete CCAudioOut, id = %d", nID);
		}
		else
		{
			AppLog("CCAudioOut instance is NULL, id = %d", nID);
		}
		s_List.erase(p);
	}
}

} // end of namespace CocosDenshion