Beispiel #1
0
void ParserMgr::SetExpressions()
{
#ifdef DEBUG_PM_FUNC
    ScopeTracker st("ParserMgr::SetExpressions", std::this_thread::get_id());
#endif
    try
    {
        ClearExpressions();
        for (size_t i=0; i<ds::NUM_MODELS; ++i)
        {
            const ParamModelBase* model = _modelMgr->Model((ds::PMODEL)i);
            if (!model->DoEvaluate()) continue;
            VecStr temp_expressions = model->TempExpressions();
            for (const auto& it : temp_expressions)
                AddExpression(it);
            const size_t num_pars = model->NumPars();
            for (size_t k=0; k<num_pars; ++k)
                if (model->IsFreeze(k))
                {
                    std::string freeze_val = (model->Id()==ds::DIFF)
                            ? _modelMgr->Model(ds::INIT)->Value(k)
                            : "0";
                    AddExpression(model->TempKey(k) + " = " + freeze_val);
                }
            if (model->Id()==ds::VAR) // ### Really need separate parsers for both here
                for (size_t k=0; k<num_pars; ++k)
                    AddExpression(model->Key(k) + " = " + model->TempKey(k));
        }
    }
    catch (mu::ParserError& e)
    {
        _log->AddExcept("ParserMgr::SetExpressions: " + std::string(e.GetMsg()));
    }
}
Beispiel #2
0
void Actor::SetExpression(string exp) {
	if(expressions[name] == NULL) {
		string n = "actors\\" + name + "-" + exp + ".png";
		SDL_Surface* s = IMG_Load(  n.c_str() );
		AddExpression(s, exp);
	}
	currExpression = exp;
}
Beispiel #3
0
void WatchesTable::OnNewWatch_Iternal(wxCommandEvent& event)
{
	wxString expr = event.GetString();
	if( expr.empty() == false ){
		AddExpression(expr);
		RefreshValues();
	}
}
void UMaterialGraph::RebuildGraph()
{
	check(Material);

	Modify();

	RemoveAllNodes();

	if (!MaterialFunction)
	{
		// Initialize the material input list.
		MaterialInputs.Add( FMaterialInputInfo( GetBaseColorPinName(), MP_BaseColor, LOCTEXT( "BaseColorToolTip", "Defines the overall color of the Material. Each channel is automatically clamped between 0 and 1" ) ) );
		MaterialInputs.Add( FMaterialInputInfo( GetMetallicPinName(), MP_Metallic, LOCTEXT( "MetallicToolTip", "Controls how \"metal-like\" your surface looks like") ) );
		MaterialInputs.Add( FMaterialInputInfo( LOCTEXT("Specular", "Specular"), MP_Specular, LOCTEXT("SpecularToolTip", "Used to scale the current amount of specularity on non-metallic surfaces and is a value between 0 and 1, default at 0.5") ) );
		MaterialInputs.Add( FMaterialInputInfo( LOCTEXT( "Roughness", "Roughness" ), MP_Roughness, LOCTEXT( "RoughnessToolTip", "Controls how rough the Material is. Roughness of 0 (smooth) is a mirror reflection and 1 (rough) is completely matte or diffuse" ) ) );
		MaterialInputs.Add( FMaterialInputInfo( GetEmissivePinName(), MP_EmissiveColor, LOCTEXT( "EmissiveToolTip", "Controls which parts of your Material will appear to glow" ) ) );
		MaterialInputs.Add( FMaterialInputInfo( LOCTEXT("Opacity", "Opacity"), MP_Opacity, LOCTEXT( "OpacityToolTip", "Controls the transluecency of the Material" ) ) );
		MaterialInputs.Add( FMaterialInputInfo( LOCTEXT("OpacityMask", "Opacity Mask"), MP_OpacityMask, LOCTEXT( "OpacityMaskToolTip", "When in Masked mode, a Material is either completely visible or completely invisible" ) ) );
		MaterialInputs.Add( FMaterialInputInfo( GetNormalPinName(), MP_Normal, LOCTEXT( "NormalToolTip", "Takes the input of a normal map" ) ) );
		MaterialInputs.Add( FMaterialInputInfo( GetWorldPositionOffsetPinName(), MP_WorldPositionOffset, LOCTEXT( "WorldPositionOffsetToolTip", "Allows for the vertices of a mesh to be manipulated in world space by the Material" ) ) );
		MaterialInputs.Add( FMaterialInputInfo( LOCTEXT( "WorldDisplacement", "World Displacement" ), MP_WorldDisplacement, LOCTEXT( "WorldDisplacementToolTip", "Allows for the tessellation vertices to be manipulated in world space by the Material" ) ) );
		MaterialInputs.Add( FMaterialInputInfo( LOCTEXT("TessellationMultiplier", "Tessellation Multiplier"), MP_TessellationMultiplier, LOCTEXT( "TessllationMultiplierToolTip", "Controls the amount tessellation along the surface" ) ) );
		MaterialInputs.Add( FMaterialInputInfo( GetSubsurfacePinName(), MP_SubsurfaceColor, LOCTEXT( "SubsurfaceToolTip", "Allows you to add a color to your Material to simulate shifts in color when light passes through the surface" ) ) );
		MaterialInputs.Add( FMaterialInputInfo( GetCustomDataPinName(0), MP_CustomData0, GetCustomDataPinName( 0 ) ) );
		MaterialInputs.Add( FMaterialInputInfo( GetCustomDataPinName(1), MP_CustomData1, GetCustomDataPinName( 1 ) ) );
		MaterialInputs.Add( FMaterialInputInfo( LOCTEXT("AmbientOcclusion", "Ambient Occlusion"), MP_AmbientOcclusion, LOCTEXT( "AmbientOcclusionToolTip", "Simulate the self-shadowing that happens within crevices of a surface" ) ) );
		MaterialInputs.Add( FMaterialInputInfo( LOCTEXT("Refraction", "Refraction"), MP_Refraction, LOCTEXT( "RefractionToolTip", "Takes in a texture or value that simulates the index of refraction of the surface" ) ) );

		for (int32 UVIndex = 0; UVIndex < ARRAY_COUNT(Material->CustomizedUVs); UVIndex++)
		{
			//@todo - localize
			MaterialInputs.Add( FMaterialInputInfo( FText::FromString(FString::Printf(TEXT("Customized UV%u"), UVIndex)), (EMaterialProperty)(MP_CustomizedUVs0 + UVIndex), FText::FromString(FString::Printf( TEXT( "CustomizedUV%uToolTip" ), UVIndex ) ) ) );
		}

		MaterialInputs.Add(FMaterialInputInfo(LOCTEXT("PixelDepthOffset", "Pixel Depth Offset"), MP_PixelDepthOffset, LOCTEXT( "PixelDepthOffsetToolTip", "Pixel Depth Offset" ) ));

		//^^^ New material properties go above here. ^^^^
		MaterialInputs.Add(FMaterialInputInfo(LOCTEXT("MaterialAttributes", "Material Attributes"), MP_MaterialAttributes, LOCTEXT( "MaterialAttributesToolTip", "Material Attributes" ) ));

		// Add Root Node
		FGraphNodeCreator<UMaterialGraphNode_Root> NodeCreator(*this);
		RootNode = NodeCreator.CreateNode();
		RootNode->Material = Material;
		NodeCreator.Finalize();
	}

	for (int32 Index = 0; Index < Material->Expressions.Num(); Index++)
	{
		AddExpression(Material->Expressions[Index]);
	}

	for (int32 Index = 0; Index < Material->EditorComments.Num(); Index++)
	{
		AddComment(Material->EditorComments[Index]);
	}

	LinkGraphNodesFromMaterial();
}
Beispiel #5
0
void ParserMgr::SetExpression(const VecStr& exprns)
{
#ifdef DEBUG_PM_FUNC
    ScopeTracker st("ParserMgr::SetExpression", std::this_thread::get_id());
#endif
    _parser.SetExpr("");
    for (const auto& it: exprns)
        AddExpression(it);
}
Beispiel #6
0
void WatchesTable::OnNewWatch(wxCommandEvent &event)
{
	wxUnusedVar(event);
	wxString expr = wxGetTextFromUser(wxT("Expression to watch:"), wxT("New watch"));
	if (expr.IsEmpty() == false) {
		AddExpression(expr);
		RefreshValues();
	}
}
Beispiel #7
0
void UMaterialGraph::RebuildGraph()
{
	check(Material);

	Modify();

	RemoveAllNodes();

	if (!MaterialFunction)
	{
		// Initialize the material input list.
		MaterialInputs.Add( FMaterialInputInfo( LOCTEXT("BaseColor", "Base Color"), MP_BaseColor ) );	
		MaterialInputs.Add( FMaterialInputInfo( LOCTEXT("Metallic", "Metallic"), MP_Metallic ) );
		MaterialInputs.Add( FMaterialInputInfo( LOCTEXT("Specular", "Specular"), MP_Specular ) );
		MaterialInputs.Add( FMaterialInputInfo( LOCTEXT("Roughness", "Roughness"), MP_Roughness ) );
		MaterialInputs.Add( FMaterialInputInfo( LOCTEXT("EmissiveColor", "Emissive Color"), MP_EmissiveColor ) );
		MaterialInputs.Add( FMaterialInputInfo( LOCTEXT("Opacity", "Opacity"), MP_Opacity ) );
		MaterialInputs.Add( FMaterialInputInfo( LOCTEXT("OpacityMask", "Opacity Mask"), MP_OpacityMask ) );
		MaterialInputs.Add( FMaterialInputInfo( LOCTEXT("Normal", "Normal"), MP_Normal ) );
		MaterialInputs.Add( FMaterialInputInfo( LOCTEXT("WorldPositionOffset", "World Position Offset"), MP_WorldPositionOffset ) );
		MaterialInputs.Add( FMaterialInputInfo( LOCTEXT("WorldDisplacement", "World Displacement"), MP_WorldDisplacement ) );
		MaterialInputs.Add( FMaterialInputInfo( LOCTEXT("TessellationMultiplier", "Tessellation Multiplier"), MP_TessellationMultiplier ) );
		MaterialInputs.Add( FMaterialInputInfo( LOCTEXT("SubsurfaceColor", "Subsurface Color"), MP_SubsurfaceColor ) );
		MaterialInputs.Add( FMaterialInputInfo( LOCTEXT("ClearCoat", "Clear Coat"), MP_ClearCoat ) );
		MaterialInputs.Add( FMaterialInputInfo( LOCTEXT("ClearCoatRoughness", "Clear Coat Roughness"), MP_ClearCoatRoughness ) );
		MaterialInputs.Add( FMaterialInputInfo( LOCTEXT("AmbientOcclusion", "Ambient Occlusion"), MP_AmbientOcclusion ) );
		MaterialInputs.Add( FMaterialInputInfo( LOCTEXT("Refraction", "Refraction"), MP_Refraction) );

		for (int32 UVIndex = 0; UVIndex < ARRAY_COUNT(Material->CustomizedUVs); UVIndex++)
		{
			//@todo - localize
			MaterialInputs.Add( FMaterialInputInfo( FText::FromString(FString::Printf(TEXT("Customized UV%u"), UVIndex)), (EMaterialProperty)(MP_CustomizedUVs0 + UVIndex)) );
		}

		MaterialInputs.Add( FMaterialInputInfo( LOCTEXT("MaterialAttributes", "Material Attributes"), MP_MaterialAttributes) );

		// Add Root Node
		FGraphNodeCreator<UMaterialGraphNode_Root> NodeCreator(*this);
		RootNode = NodeCreator.CreateNode();
		RootNode->Material = Material;
		NodeCreator.Finalize();
	}

	for (int32 Index = 0; Index < Material->Expressions.Num(); Index++)
	{
		AddExpression(Material->Expressions[Index]);
	}

	for (int32 Index = 0; Index < Material->EditorComments.Num(); Index++)
	{
		AddComment(Material->EditorComments[Index]);
	}

	LinkGraphNodesFromMaterial();
}
Beispiel #8
0
    /**
     * Constructor of an extension declares everything the extension contains: objects, actions, conditions and expressions.
     */
    Extension()
    {
        SetExtensionInformation("Network",
                              _("Network features"),
                              _("Built-in extension allowing to exchange data on the network between games."),
                              "Florian Rival",
                              "Open source (MIT License)");

        #if defined(GD_IDE_ONLY)

        AddAction("AddRecipient",
                       _("Add a recipient"),
                       _("Add the computer with the corresponding IP Adress as a recipient of sent data."),
                       _("Add _PARAM0_ to recipients"),
                       _("Network: Sending"),
                       "CppPlatform/Extensions/networkicon24.png",
                       "CppPlatform/Extensions/networkicon.png")

            .AddParameter("string", _("Recipient IP address."))
            .AddParameter("expression", _("Recipient port (Default : 50001)"), "", true)

            .SetFunctionName("GDpriv::NetworkExtension::AddRecipient").SetIncludeFile("Network/NetworkManagerFunctions.h");

        AddAction("RemoveAllRecipients",
                       _("Delete all recipients"),
                       _("Clear the list of the recipients of sent data"),
                       _("Clear the list of recipients"),
                       _("Network: Sending"),
                       "CppPlatform/Extensions/networkicon24.png",
                       "CppPlatform/Extensions/networkicon.png")

            .SetFunctionName("GDpriv::NetworkExtension::RemoveAllRecipients").SetIncludeFile("Network/NetworkManagerFunctions.h");


        AddAction("ListenToPort",
                       _("Initialize data reception"),
                       _("Initialize the network so as to be able te receive data from other computers."),
                       _("Initialize data reception"),
                       _("Network: Reception"),
                       "CppPlatform/Extensions/networkicon24.png",
                       "CppPlatform/Extensions/networkicon.png")

            .AddParameter("expression", _("Listening port (Default : 50001)"), "", true).SetDefaultValue("50001")
            .SetFunctionName("GDpriv::NetworkExtension::ListenToPort").SetIncludeFile("Network/NetworkManagerFunctions.h");

        AddAction("StopListening",
                       _("Stop data reception"),
                       _("Stop data reception."),
                       _("Stop data reception"),
                       _("Network: Reception"),
                       "CppPlatform/Extensions/networkicon24.png",
                       "CppPlatform/Extensions/networkicon.png")

            .SetFunctionName("GDpriv::NetworkExtension::ActStopListening").SetIncludeFile("Network/NetworkManagerFunctions.h");

        AddAction("SendValue",
                       _("Send a value"),
                       _("Send a value to recipients"),
                       _("Send value _PARAM1_ with title _PARAM0_ to recipients"),
                       _("Network: Sending"),
                       "CppPlatform/Extensions/networkicon24.png",
                       "CppPlatform/Extensions/networkicon.png")

            .AddParameter("string", _("Group"))
            .AddParameter("expression", _("Value"))

            .SetFunctionName("GDpriv::NetworkExtension::SendValue").SetIncludeFile("Network/NetworkManagerFunctions.h");

        AddAction("SendString",
                       _("Send a text"),
                       _("Send a text to recipients"),
                       _("Send text _PARAM1_ with title _PARAM0_ to recipients"),
                       _("Network: Sending"),
                       "CppPlatform/Extensions/networkicon24.png",
                       "CppPlatform/Extensions/networkicon.png")

            .AddParameter("string", _("Group"))
            .AddParameter("string", _("Text"))

            .SetFunctionName("GDpriv::NetworkExtension::SendString").SetIncludeFile("Network/NetworkManagerFunctions.h");

        AddAction("ReceivePackets",
                       _("Receive waiting data"),
                       _("Receive data sent by other computers.\nYou can then access to them with the appropriate expressions."),
                       _("Receive data"),
                       _("Network: Reception"),
                       "CppPlatform/Extensions/networkicon24.png",
                       "CppPlatform/Extensions/networkicon.png")

            .SetFunctionName("GDpriv::NetworkExtension::ReceivePackets").SetIncludeFile("Network/NetworkManagerFunctions.h");

        AddAction("ResetReceivedData",
                       _("Delete all received data stored in memory"),
                       _("Delete every received data stored in memory"),
                       _("Delete every received data stored in memory"),
                       _("Network: Reception"),
                       "CppPlatform/Extensions/networkicon24.png",
                       "CppPlatform/Extensions/networkicon.png")

            .SetFunctionName("GDpriv::NetworkExtension::ResetReceivedData").SetIncludeFile("Network/NetworkManagerFunctions.h");

        AddStrExpression("GetReceivedDataString", _("Get the text of a data"), _("Get the text contained in a data"), _("Network: Reception"), "CppPlatform/Extensions/networkicon.png")
            .AddParameter("string", _("Name of the data containing the text to get"))

            .SetFunctionName("GDpriv::NetworkExtension::GetReceivedDataString").SetIncludeFile("Network/NetworkManagerFunctions.h");


        AddExpression("GetReceivedDataValue", _("Get the value of a data"), _("Get the value contained in a data"), _("Network: Reception"), "CppPlatform/Extensions/networkicon.png")
            .AddParameter("string", _("Name of the data containing the text to get"))

            .SetFunctionName("GDpriv::NetworkExtension::GetReceivedDataValue").SetIncludeFile("Network/NetworkManagerFunctions.h");


        AddStrExpression("GetLastError", _("Last error occured"), _("Get the text describing the last error which occured."), _("Network: Errors"), "res/error.png")

            .SetFunctionName("GDpriv::NetworkExtension::GetLastError").SetIncludeFile("Network/NetworkManagerFunctions.h");


        AddStrExpression("GetPublicAddress", _("IP address"), _("Allow to get the public IP Address of the computer."), _("Network"), "CppPlatform/Extensions/networkicon.png")
            .AddParameter("expression", _("Maximum time to wait before getting the address ( in seconds ) ( 0 = no timeout )"), "", true)

            .SetFunctionName("GDpriv::NetworkExtension::GetPublicAddress").SetIncludeFile("Network/NetworkManagerFunctions.h");


        AddStrExpression("GetLocalAddress", _("Local IP address ( local/LAN )"), _("Allow to get the public IP Address of the computer."), _("Network"), "CppPlatform/Extensions/networkicon.png")

            .SetFunctionName("GDpriv::NetworkExtension::GetLocalAddress").SetIncludeFile("Network/NetworkManagerFunctions.h");


        AddAction("GenerateObjectNetworkId",
                       _("Generate objects' identifiers"),
                       _("Generate automatically identifiers for these objects.\nNote that this action must be preferably used at the start of the scene for example, so as to be sure objects\nhave the same unique identifiers on the different computers."),
                       _("Generate unique network identifiers for _PARAM0_"),
                       _("Automatism Automatic Network Updater"),
                       "CppPlatform/Extensions/networkicon24.png",
                       "CppPlatform/Extensions/networkicon.png")

            .AddParameter("objectList", _("Object"))
            .AddParameter("automatism", _("Automatism"), "NetworkAutomatism", false)
            .SetFunctionName("NetworkAutomatism::GenerateObjectNetworkIdentifier").SetIncludeFile("Network/NetworkAutomatism.h");

        #endif

        {
            gd::AutomatismMetadata & aut = AddAutomatism("NetworkAutomatism",
                  _("Automatic network update"),
                  _("NetworkUpdater"),
                  _("Allows to automatically synchronize the objects of a game on the network."),
                  "",
                  "CppPlatform/Extensions/networkicon32.png",
                  "NetworkAutomatism",
                  std::shared_ptr<gd::Automatism>(new NetworkAutomatism),
                  std::shared_ptr<gd::AutomatismsSharedData>(new SceneNetworkDatas));

            #if defined(GD_IDE_ONLY)
            aut.SetIncludeFile("Network/NetworkAutomatism.h");

            aut.AddAction("SetAsSender",
                           _("Set to send data"),
                           _("The automatism will send the data of the objects.\nBe sure to have generated identifiers for these objects before."),
                           _("Set _PARAM0_ to send data"),
                           _("Automatism Automatic Network Updater"),
                           "CppPlatform/Extensions/networkicon24.png",
                           "CppPlatform/Extensions/networkicon.png")
                .AddParameter("object", _("Object"))
                .AddParameter("automatism", _("Automatism"), "NetworkAutomatism", false)
                .SetFunctionName("SetAsSender").SetIncludeFile("Network/NetworkAutomatism.h");

            aut.AddAction("SetAsReceiver",
                           _("Set to receive data"),
                           _("The automatism will receive the data and will update the objects.\nBe sure to have generated identifiers for these objects before."),
                           _("Set _PARAM0_ to receive data"),
                           _("Automatism Automatic Network Updater"),
                           "CppPlatform/Extensions/networkicon24.png",
                           "CppPlatform/Extensions/networkicon.png")
                .AddParameter("object", _("Object"))
                .AddParameter("automatism", _("Automatism"), "NetworkAutomatism", false)
                .SetFunctionName("SetAsReceiver").SetIncludeFile("Network/NetworkAutomatism.h");

            aut.AddAction("SetIdentifier",
                           _("Change object's identifier"),
                           _("Each object need a unique identifier, the same on all computers, so as to be identified and updated"),
                           _("Set identifier of _PARAM0_ to _PARAM2_"),
                           _("Automatism Automatic Network Updater"),
                           "CppPlatform/Extensions/networkicon24.png",
                           "CppPlatform/Extensions/networkicon.png")
                .AddParameter("object", _("Object"))
                .AddParameter("automatism", _("Automatism"), "NetworkAutomatism", false)
                .AddParameter("expression", _("Identifier"))
                .SetFunctionName("SetIdentifier").SetIncludeFile("Network/NetworkAutomatism.h");

            aut.AddExpression("GetIdentifier", _("Get the identifier of the object"), _("Get the identifier of the object"), _("Automatism Automatic Network Updater"), "res/texteicon.png")
                .AddParameter("object", _("Object"))
                .AddParameter("automatism", _("Automatism"), "NetworkAutomatism", false)
                .SetFunctionName("GetIdentifier").SetIncludeFile("Network/NetworkAutomatism.h");
            #endif
        }

        GD_COMPLETE_EXTENSION_COMPILATION_INFORMATION();
    };
Beispiel #9
0
bool TriAcePS1Track::ReadEvent(void)
{
	uint32_t beginOffset = curOffset;

	uint8_t status_byte = GetByte(curOffset++);
	uint8_t event_dur = 0;

	//0-0x7F is a note event
	if (status_byte <= 0x7F)
	{
		event_dur = GetByte(curOffset++); //Delta time from "Note on" to "Next command(op-code)".
		uint8_t note_dur;
		uint8_t velocity;
		if (!impliedNoteDur) note_dur = GetByte(curOffset++);  //Delta time from "Note on" to "Note off".
		else note_dur = impliedNoteDur;
		if (!impliedVelocity) velocity = GetByte(curOffset++);
		else velocity = impliedVelocity;
		AddNoteByDur_Extend(beginOffset, curOffset-beginOffset, status_byte, velocity, note_dur);
	}
	else switch (status_byte)
	{
		case 0x80 :
			AddGenericEvent(beginOffset, curOffset-beginOffset, L"Score Pattern End", NULL, CLR_TRACKEND);
			return false;

		case 0x81 :			//unknown
			event_dur = GetByte(curOffset++);
			curOffset++;
			AddUnknown(beginOffset, curOffset-beginOffset);
			break;

		case 0x82 :			//unknown
			event_dur = GetByte(curOffset++);
			curOffset++;
			AddUnknown(beginOffset, curOffset-beginOffset);
			break;

		case 0x83 :			//program change
			{
				event_dur = GetByte(curOffset++);
				uint8_t progNum = GetByte(curOffset++);
				uint8_t bankNum = GetByte(curOffset++);

				//ATLTRACE("PROGRAM CHANGE   ProgNum: %X    BankNum: %X", progNum, bankNum);
				
				uint8_t bank = (bankNum*2) + ((progNum > 0x7F) ? 1 : 0);
				if (progNum > 0x7F)
					progNum -= 0x80;

				//ATLTRACE("  SELECTING: prog %X bank %X\n", progNum, bank);

				AddBankSelectNoItem(bank);
				AddProgramChange(beginOffset, curOffset-beginOffset, progNum);
			}
			break;

		case 0x84 :			//pitch bend
			{
				event_dur = GetByte(curOffset++);
				short bend = ((char)GetByte(curOffset++)) << 7;
				AddPitchBend(beginOffset, curOffset-beginOffset, bend);
			}
			break;

		case 0x85 :			//volume
			{
				event_dur = GetByte(curOffset++);
				uint8_t val = GetByte(curOffset++);
				AddVol(beginOffset, curOffset-beginOffset, val);
			}
			break;

		case 0x86 :			//expression
			{
				event_dur = GetByte(curOffset++);
				uint8_t val = GetByte(curOffset++);
				AddExpression(beginOffset, curOffset-beginOffset, val);
			}
			break;

		case 0x87 :			//pan
			{
				event_dur = GetByte(curOffset++);
				uint8_t pan = GetByte(curOffset++);
				AddPan(beginOffset, curOffset-beginOffset, pan);
			}
			break;

		case 0x88 :			//unknown
			event_dur = GetByte(curOffset++);
			curOffset++;
			AddUnknown(beginOffset, curOffset-beginOffset);
			break;

		case 0x89 :			//damper pedal
			{
				event_dur = GetByte(curOffset++);
				uint8_t val = GetByte(curOffset++);
				AddSustainEvent(beginOffset, curOffset-beginOffset, val);
			}
			break;

		case 0x8A :			//unknown (tempo?)
			{
				event_dur = GetByte(curOffset++);
				uint8_t val = GetByte(curOffset++);
				AddUnknown(beginOffset, curOffset-beginOffset, L"Unknown Event (tempo?)");
			}
			break;

		case 0x8D :			//Dal Segno: start point
			AddGenericEvent(beginOffset, curOffset-beginOffset, L"Dal Segno: start point", NULL, CLR_UNKNOWN);
			break;

		case 0x8E :			//Dal Segno: end point
			curOffset++;
			AddGenericEvent(beginOffset, curOffset-beginOffset, L"Dal Segno: end point", NULL, CLR_UNKNOWN);
			break;

		case 0x8F :			//rest
			{
				uint8_t rest = GetByte(curOffset++);
				AddRest(beginOffset, curOffset-beginOffset, rest);
			}
			break;

		case 0x90 :			//unknown
			event_dur = GetByte(curOffset++);
			curOffset++;
			AddUnknown(beginOffset, curOffset-beginOffset);
			break;

		case 0x92 :			//unknown
			event_dur = GetByte(curOffset++);
			curOffset++;
			AddUnknown(beginOffset, curOffset-beginOffset);
			break;

		case 0x93 :			//unknown
			event_dur = GetByte(curOffset++);
			curOffset++;
			AddUnknown(beginOffset, curOffset-beginOffset);
			break;

		case 0x94 :			//unknown
			event_dur = GetByte(curOffset++);
			curOffset += 3;
			AddUnknown(beginOffset, curOffset-beginOffset);
			break;

		case 0x95 :			//unknown
			event_dur = GetByte(curOffset++);
			curOffset++;
			AddUnknown(beginOffset, curOffset-beginOffset, L"Unknown Event  (Tie?)");
			break;

		case 0x96 :			//Pitch Bend Range
			{
				event_dur = GetByte(curOffset++);
				uint8_t semitones = GetByte(curOffset++);
				AddPitchBendRange(beginOffset, curOffset-beginOffset, semitones);
			}
			break;

		case 0x97 :			//unknown
			event_dur = GetByte(curOffset++);
			curOffset += 4;
			AddUnknown(beginOffset, curOffset-beginOffset);
			break;

		case 0x99 :			//unknown
			event_dur = GetByte(curOffset++);
			curOffset++;
			AddUnknown(beginOffset, curOffset-beginOffset);
			break;

		case 0x9A :			//unknown
			event_dur = GetByte(curOffset++);
			curOffset++;
			AddUnknown(beginOffset, curOffset-beginOffset);
			break;

		case 0x9B :			//unknown
			event_dur = GetByte(curOffset++);
			curOffset += 5;
			AddUnknown(beginOffset, curOffset-beginOffset);
			break;

		case 0x9E :			//imply note params
			impliedNoteDur = GetByte(curOffset++);
			impliedVelocity = GetByte(curOffset++);
			AddGenericEvent(beginOffset, curOffset-beginOffset, L"Imply Note Params", NULL, CLR_CHANGESTATE);
			break;

		default :
			Alert(L"Unknown event opcode %X at %X", status_byte, beginOffset);
			AddUnknown(beginOffset, curOffset-beginOffset);
			return false;
	}

	if (event_dur)
		AddTime(event_dur);

	return true;
}
Beispiel #10
0
    /**
     * Constructor of an extension declares everything the extension contains: objects, actions, conditions and expressions.
     */
    Extension()
    {
        SetExtensionInformation("SoundObject",
                              _("Sound object"),
                              _("Extension allowing to use spatialized sounds."),
                              "Thomas Flecy, Victor Levasseur et al.",
                              "Open source (MIT License)");


        //Declaration of all objects available
        {
            gd::ObjectMetadata & obj = AddObject("Sound",
                       _("Sound"),
                       _("Invisible object emitting a sound which can be moved in the space."),
                       "CppPlatform/Extensions/soundicon32.png",
                       &CreateSoundObject);

            AddRuntimeObject(obj, "RuntimeSoundObject", CreateRuntimeSoundObject);

            #if defined(GD_IDE_ONLY)
            SoundObject::LoadEdittimeIcon();
            obj.SetIncludeFile("SoundObject/SoundObject.h");

            obj.AddAction("Volume",
                           _("Sound level"),
                           _("Modify the sound level of a Sound object."),
                           _("Do _PARAM1__PARAM2_ to the sound level of _PARAM0_"),
                           _("Parameters"),
                           "res/actions/son24.png",
                           "res/actions/son.png")
                .AddParameter("object", _("Object"), "Sound", false)
                .AddParameter("operator", _("Modification's sign"))
                .AddParameter("expression", _("Value"))
                .codeExtraInformation.SetFunctionName("SetVolume").SetManipulatedType("number").SetAssociatedGetter("GetVolume").SetIncludeFile("SoundObject/SoundObject.h");


            obj.AddAction("Pitch",
                           _("Pitch"),
                           _("Change the pitch of a sound object."),
                           _("Do _PARAM1__PARAM2_ to Pitch of _PARAM0_"),
                           _("Parameters"),
                           "res/actions/son24.png",
                           "res/actions/son.png")
                .AddParameter("object", _("Object"), "Sound", false)
                .AddParameter("operator", _("Modification's sign"))
                .AddParameter("expression", _("Value"))
                .codeExtraInformation.SetFunctionName("SetPitch").SetManipulatedType("number").SetAssociatedGetter("GetPitch").SetIncludeFile("SoundObject/SoundObject.h");


            obj.AddAction("Attenuation",
                           _("Attenuation"),
                           _("Change the attenuation of a sound object."),
                           _("Do _PARAM1__PARAM2_ to the attenuation of _PARAM0_"),
                           _("Parameters"),
                           "res/actions/son24.png",
                           "res/actions/son.png")
                .AddParameter("object", _("Object"), "Sound", false)
                .AddParameter("operator", _("Modification's sign"))
                .AddParameter("expression", _("Value"))
                .codeExtraInformation.SetFunctionName("SetAttenuation").SetManipulatedType("number").SetAssociatedGetter("GetAttenuation").SetIncludeFile("SoundObject/SoundObject.h");


            obj.AddAction("ZPos",
                           _("Z Position"),
                           _("Modify the sound level of a Sound object."),
                           _("Do _PARAM1__PARAM2_ to the sound level of _PARAM0_"),
                           _("Position"),
                           "res/actions/son24.png",
                           "res/actions/son.png")
                .AddParameter("object", _("Object"), "Sound", false)
                .AddParameter("operator", _("Modification's sign"))
                .AddParameter("expression", _("Value"))
                .codeExtraInformation.SetFunctionName("SetZPos").SetManipulatedType("number").SetAssociatedGetter("GetZPos").SetIncludeFile("SoundObject/SoundObject.h");


            obj.AddAction("Loop",
                           _("Automatic restart"),
                           _("Activate or desactivate the looping of a sound."),
                           _("Activate looping for _PARAM0_: _PARAM1_"),
                           _("Parameters"),
                           "res/actions/son24.png",
                           "res/actions/son.png")
                .AddParameter("object", _("Object"), "Sound", false)
                .AddParameter("yesorno", _("Loop"))
                .codeExtraInformation.SetFunctionName("SetLoop").SetIncludeFile("SoundObject/SoundObject.h");


            obj.AddAction("RelativeToListener",
                           _("Listener relation"),
                           _("Activate or desactivate the sound spatialisation relative to the listener."),
                           _("Set _PARAM0_ as relative to the listener position: _PARAM1_"),
                           _("Parameters"),
                           "res/actions/son24.png",
                           "res/actions/son.png")
                .AddParameter("object", _("Object"), "Sound", false)
                .AddParameter("yesorno", _("Relative to the listener"))
                .codeExtraInformation.SetFunctionName("SetRelativeToListener").SetIncludeFile("SoundObject/SoundObject.h");


            obj.AddAction("Play",
                           _("Play"),
                           _("Play a sound."),
                           _("Play sound _PARAM0_"),
                           "",
                           "res/actions/son24.png",
                           "res/actions/son.png")
                .AddParameter("object", _("Object"), "Sound", false)
                .codeExtraInformation.SetFunctionName("Play").SetIncludeFile("SoundObject/SoundObject.h");


            obj.AddAction("Stop",
                           _("Stop"),
                           _("Stop a sound."),
                           _("Stop _PARAM0_"),
                           "",
                           "res/actions/son24.png",
                           "res/actions/son.png")
                .AddParameter("object", _("Object"), "Sound", false)
                .codeExtraInformation.SetFunctionName("Stop").SetIncludeFile("SoundObject/SoundObject.h");


            obj.AddAction("Pause",
                           _("Pause"),
                           _("Pause a sound."),
                           _("Pause _PARAM0_"),
                           "",
                           "res/actions/son24.png",
                           "res/actions/son.png")
                .AddParameter("object", _("Object"), "Sound", false)
                .codeExtraInformation.SetFunctionName("Pause").SetIncludeFile("SoundObject/SoundObject.h");


            obj.AddCondition("Volume",
                           _("Sound level"),
                           _("Test the sound level of a Sound object."),
                           _("Th sound level of _PARAM0_ is _PARAM2_ _PARAM1_"),
                           _("Parameters"),
                           "res/actions/son24.png",
                           "res/actions/son.png")
                .AddParameter("object", _("Object"), "Sound", false)
                .AddParameter("relationalOperator", _("Sign of the test"))
                .AddParameter("expression", _("Value to test"))
                .codeExtraInformation.SetFunctionName("GetVolume").SetManipulatedType("number").SetIncludeFile("SoundObject/SoundObject.h");


            obj.AddCondition("Pitch",
                           _("Pitch"),
                           _("Test the pitch value of a sound."),
                           _("Pitch of _PARAM0_ is _PARAM1__PARAM2_"),
                           _("Parameters"),
                           "res/actions/son24.png",
                           "res/actions/son.png")
                .AddParameter("object", _("Object"), "Sound", false)
                .AddParameter("relationalOperator", _("Sign of the test"))
                .AddParameter("expression", _("Value to test"))
                .codeExtraInformation.SetFunctionName("GetPitch").SetManipulatedType("number").SetIncludeFile("SoundObject/SoundObject.h");


            obj.AddCondition("Attenuation",
                           _("Attenuation"),
                           _("Test the attenuation of a sound."),
                           _("The attenuation of _PARAM0_ is _PARAM1__PARAM2_"),
                           _("Parameters"),
                           "res/actions/son24.png",
                           "res/actions/son.png")
                .AddParameter("object", _("Object"), "Sound", false)
                .AddParameter("relationalOperator", _("Sign of the test"))
                .AddParameter("expression", _("Value to test"))
                .codeExtraInformation.SetFunctionName("GetAttenuation").SetManipulatedType("number").SetIncludeFile("SoundObject/SoundObject.h");


            obj.AddCondition("MinDistance",
                           _("Minimal distance"),
                           _("Test the minimal distance of a sound"),
                           _("The minimal distance of _PARAM0_ is _PARAM1__PARAM2_"),
                           _("Parameters"),
                           "res/actions/son24.png",
                           "res/actions/son.png")
                .AddParameter("object", _("Object"), "Sound", false)
                .AddParameter("relationalOperator", _("Sign of the test"))
                .AddParameter("expression", _("Value to test"))
                .codeExtraInformation.SetFunctionName("GetMinDistance").SetManipulatedType("number").SetIncludeFile("SoundObject/SoundObject.h");


            obj.AddCondition("ZPos",
                           _("Z Position"),
                           _("Test Z position of a sound."),
                           _("The Z position of _PARAM0_ is _PARAM1__PARAM2_"),
                           _("Parameters"),
                           "res/actions/son24.png",
                           "res/actions/son.png")
                .AddParameter("object", _("Object"), "Sound", false)
                .AddParameter("relationalOperator", _("Sign of the test"))
                .AddParameter("expression", _("Value to test"))
                .codeExtraInformation.SetFunctionName("GetZPos").SetManipulatedType("number").SetIncludeFile("SoundObject/SoundObject.h");


            obj.AddCondition("Loop",
                           _("Automatic restart"),
                           _("Test if an sound is looping."),
                           _("_PARAM0_ is looping"),
                           _("Parameters"),
                           "res/actions/son24.png",
                           "res/actions/son.png")
                .AddParameter("object", _("Object"), "Sound", false)
                .codeExtraInformation.SetFunctionName("GetLoop").SetIncludeFile("SoundObject/SoundObject.h");


            obj.AddCondition("Playing",
                           _("Being played"),
                           _("Test if a sound is being played."),
                           _("_PARAM0_ is being played"),
                           "",
                           "res/actions/son24.png",
                           "res/actions/son.png")
                .AddParameter("object", _("Object"), "Sound", false)
                .codeExtraInformation.SetFunctionName("IsPlaying").SetIncludeFile("SoundObject/SoundObject.h");


            obj.AddCondition("Paused",
                           _("Paused"),
                           _("A sound is paused"),
                           _("_PARAM0_ is paused"),
                           "",
                           "res/actions/son24.png",
                           "res/actions/son.png")
                .AddParameter("object", _("Object"), "Sound", false)
                .codeExtraInformation.SetFunctionName("IsPaused").SetIncludeFile("SoundObject/SoundObject.h");


            obj.AddCondition("Stopped",
                           _("Stopped"),
                           _("Test if a sound is stopped."),
                           _("_PARAM0_ is stopped"),
                           "",
                           "res/actions/son24.png",
                           "res/actions/son.png")
                .AddParameter("object", _("Object"), "Sound", false)
                .codeExtraInformation.SetFunctionName("IsStopped").SetIncludeFile("SoundObject/SoundObject.h");


            obj.AddCondition("RelativeToListener",
                           _("Listener relation"),
                           _("Test if a sound is relative to the listener."),
                           _("_PARAM0_ is relative to the listener"),
                           _("Parameters"),
                           "res/conditions/son24.png",
                           "res/conditions/son.png")
                .AddParameter("object", _("Object"), "Sound", false)
                .codeExtraInformation.SetFunctionName("IsRelativeToListener").SetIncludeFile("SoundObject/SoundObject.h");


            obj.AddExpression("Volume", _("Sound level"), _("Sound level"), _("Parameters"), "res/actions/son.png")
                .AddParameter("object", _("Object"), "Sound", false)
                .codeExtraInformation.SetFunctionName("GetVolume").SetIncludeFile("SoundObject/SoundObject.h");


            obj.AddExpression("Pitch", _("Pitch"), _("Pitch"), _("Parameters"), "res/actions/son.png")
                .AddParameter("object", _("Object"), "Sound", false)
                .codeExtraInformation.SetFunctionName("GetPitch").SetIncludeFile("SoundObject/SoundObject.h");


            obj.AddExpression("Attenuation", _("Attenuation"), _("Attenuation"), _("Parameters"), "res/actions/son.png")
                .AddParameter("object", _("Object"), "Sound", false)
                .codeExtraInformation.SetFunctionName("GetAttenuation").SetIncludeFile("SoundObject/SoundObject.h");


            obj.AddExpression("MinDistance", _("Minimal distance"), _("Minimal distance"), _("Parameters"), "res/actions/son.png")
                .AddParameter("object", _("Object"), "Sound", false)
                .codeExtraInformation.SetFunctionName("GetMinDistance").SetIncludeFile("SoundObject/SoundObject.h");


            obj.AddExpression("ZPos", _("Z Position"), _("Z Position"), _("Position"), "res/actions/son.png")
                .AddParameter("object", _("Object"), "Sound", false)
                .codeExtraInformation.SetFunctionName("GetZPos").SetIncludeFile("SoundObject/SoundObject.h");

        #endif
        }

        // Actions liées à l'écouteur
        #if defined(GD_IDE_ONLY)
        AddAction("ListenerX",
                       _("X position"),
                       _("Modify the X position of the listener."),
                       _("Do _PARAM0__PARAM1_ to the X position of the listener"),
                       _("Listener"),
                       "res/actions/son24.png",
                       "res/actions/son.png")

            .AddParameter("operator", _("Modification's sign"))
            .AddParameter("expression", _("Value"))

            .codeExtraInformation.SetFunctionName("SetListenerX").SetManipulatedType("number").SetAssociatedGetter("GetListenerX").SetIncludeFile("SoundObject/SoundListener.h");


        AddAction("ListenerY",
                       _("Y position"),
                       _("Modify the Y position of the listener."),
                       _("Do _PARAM0__PARAM1_ to the Y position of the listener"),
                       _("Listener"),
                       "res/actions/son24.png",
                       "res/actions/son.png")

            .AddParameter("operator", _("Modification's sign"))
            .AddParameter("expression", _("Value"))

            .codeExtraInformation.SetFunctionName("SetListenerY").SetManipulatedType("number").SetAssociatedGetter("GetListenerY").SetIncludeFile("SoundObject/SoundListener.h");


        AddAction("ListenerZ",
                       _("Z position"),
                       _("Modify the Z position of the listener."),
                       _("Do _PARAM0__PARAM1_ to the Z position of the listener"),
                       _("Listener"),
                       "res/actions/son24.png",
                       "res/actions/son.png")

            .AddParameter("operator", _("Modification's sign"))
            .AddParameter("expression", _("Value"))

            .codeExtraInformation.SetFunctionName("SetListenerZ").SetManipulatedType("number").SetAssociatedGetter("GetListenerZ").SetIncludeFile("SoundObject/SoundListener.h");


        AddAction("ListenerDirectionX",
                       _("Direction on X axis"),
                       _("Change the direction of the listener on X axis."),
                       _("Do _PARAM1__PARAM2_ to the direction on X axis of the listener"),
                       _("Listener"),
                       "res/actions/son24.png",
                       "res/actions/son.png")

            .AddParameter("operator", _("Modification's sign"))
            .AddParameter("expression", _("Value"))

            .codeExtraInformation.SetFunctionName("SetListenerDirectionX").SetManipulatedType("number").SetAssociatedGetter("GetListenerDirectionX").SetIncludeFile("SoundObject/SoundListener.h");


        AddAction("ListenerDirectionY",
                       _("Direction on Y axis"),
                       _("Change the direction of the listener on Y axis."),
                       _("Do _PARAM1__PARAM2_ to the direction on Y axis of the listener"),
                       _("Listener"),
                       "res/actions/son24.png",
                       "res/actions/son.png")

            .AddParameter("operator", _("Modification's sign"))
            .AddParameter("expression", _("Value"))

            .codeExtraInformation.SetFunctionName("SetListenerDirectionY").SetManipulatedType("number").SetAssociatedGetter("GetListenerDirectionY").SetIncludeFile("SoundObject/SoundListener.h");


        AddAction("ListenerDirectionZ",
                       _("Direction on Z axis"),
                       _("Change the direction of the listener on Z axis."),
                       _("Do _PARAM1__PARAM2_ to the direction on Z axis of the listener"),
                       _("Listener"),
                       "res/actions/son24.png",
                       "res/actions/son.png")

            .AddParameter("operator", _("Modification's sign"))
            .AddParameter("expression", _("Value"))

            .codeExtraInformation.SetFunctionName("SetListenerDirectionZ").SetManipulatedType("number").SetAssociatedGetter("GetListenerDirectionZ").SetIncludeFile("SoundObject/SoundListener.h");


        // Conditions liées à l'écouteur
        AddCondition("ListenerX",
                       _("X position"),
                       _("Test the position of the listener on X axis."),
                       _("The listener X position is _PARAM1__PARAM0_"),
                       _("Listener"),
                       "res/actions/son24.png",
                       "res/actions/son.png")

            .AddParameter("relationalOperator", _("Sign of the test"))
            .AddParameter("expression", _("Value to test"))
            .codeExtraInformation.SetFunctionName("GetListenerX").SetManipulatedType("number").SetIncludeFile("SoundObject/SoundListener.h");

        AddCondition("ListenerY",
                       _("Y position"),
                       _("Test the position of the listener on Y axis."),
                       _("The listener Y position is _PARAM1__PARAM0_"),
                       _("Listener"),
                       "res/actions/son24.png",
                       "res/actions/son.png")

            .AddParameter("relationalOperator", _("Sign of the test"))
            .AddParameter("expression", _("Value to test"))
            .codeExtraInformation.SetFunctionName("GetListenerY").SetManipulatedType("number").SetIncludeFile("SoundObject/SoundListener.h");

        AddCondition("ListenerZ",
                       _("Z position"),
                       _("Test the position of the listener on Z axis."),
                       _("The listener Z position is _PARAM1__PARAM0_"),
                       _("Listener"),
                       "res/actions/son24.png",
                       "res/actions/son.png")

            .AddParameter("relationalOperator", _("Sign of the test"))
            .AddParameter("expression", _("Value to test"))
            .codeExtraInformation.SetFunctionName("GetListenerZ").SetManipulatedType("number").SetIncludeFile("SoundObject/SoundListener.h");

        AddCondition("ListenerDirectionX",
                       _("X direction"),
                       _("Test the direction of the listener on X axis."),
                       _("The listener X direction is _PARAM1__PARAM0_"),
                       _("Listener"),
                       "res/actions/son24.png",
                       "res/actions/son.png")

            .AddParameter("relationalOperator", _("Sign of the test"))
            .AddParameter("expression", _("Value to test"))
            .codeExtraInformation.SetFunctionName("GetListenerDirectionX").SetManipulatedType("number").SetIncludeFile("SoundObject/SoundListener.h");

        AddCondition("ListenerDirectionY",
                       _("Y direction"),
                       _("Test the direction of the listener on Y axis."),
                       _("The listener Y direction is _PARAM1__PARAM0_"),
                       _("Listener"),
                       "res/actions/son24.png",
                       "res/actions/son.png")

            .AddParameter("relationalOperator", _("Sign of the test"))
            .AddParameter("expression", _("Value to test"))

            .codeExtraInformation.SetFunctionName("GetListenerDirectionY").SetManipulatedType("number").SetIncludeFile("SoundObject/SoundListener.h");




        AddCondition("ListenerDirectionZ",
                       _("Z direction"),
                       _("Test the direction of the listener on Z axis."),
                       _("The listener Z direction is _PARAM1__PARAM0_"),
                       _("Listener"),
                       "res/actions/son24.png",
                       "res/actions/son.png")

            .AddParameter("relationalOperator", _("Sign of the test"))
            .AddParameter("expression", _("Value to test"))

            .codeExtraInformation.SetFunctionName("GetListenerDirectionZ").SetManipulatedType("number").SetIncludeFile("SoundObject/SoundListener.h");




        AddExpression("ListenerX", _("X position"), _("Listener X position"), _("Listener"), "res/actions/son.png")
            .codeExtraInformation.SetFunctionName("GetListenerX").SetIncludeFile("SoundObject/SoundListener.h");


        AddExpression("ListenerY", _("Y position"), _("Listener Y position"), _("Listener"), "res/actions/son.png")
            .codeExtraInformation.SetFunctionName("GetListenerY").SetIncludeFile("SoundObject/SoundListener.h");


        AddExpression("ListenerZ", _("Z position"), _("Listener Z position"), _("Listener"), "res/actions/son.png")
            .codeExtraInformation.SetFunctionName("GetListenerZ").SetIncludeFile("SoundObject/SoundListener.h");


        AddExpression("ListenerDirectionX", _("Direction on X axis"), _("Listener x direction"), _("Listener"), "res/actions/son.png")
            .codeExtraInformation.SetFunctionName("GetListenerDirectionX").SetIncludeFile("SoundObject/SoundListener.h");


        AddExpression("ListenerDirectionY", _("Direction on Y axis"), _("Listener y direction"), _("Listener"), "res/actions/son.png")
            .codeExtraInformation.SetFunctionName("GetListenerDirectionY").SetIncludeFile("SoundObject/SoundListener.h");


        AddExpression("ListenerDirectionZ", _("Direction on Z axis"), _("Listener z direction"), _("Listener"), "res/actions/son.png")
            .codeExtraInformation.SetFunctionName("GetListenerDirectionZ").SetIncludeFile("SoundObject/SoundListener.h");

        #endif

        GD_COMPLETE_EXTENSION_COMPILATION_INFORMATION();
    };
Beispiel #11
0
//--------------------------------------------------
//Revisions:
//	2009. 6.17(Wed.) :	Re-make by "Sound tester 774" in "内蔵音源をMIDI変換するスレ(in http://www.2ch.net)"
//						Add un-known command(op-code).
//--------------------------------------------------
bool AkaoTrack::ReadEvent(void)
{
	ULONG beginOffset = curOffset;
	BYTE status_byte = GetByte(curOffset++);

	int i, k;

	if (status_byte < 0x9A)   //it's either a  note-on message, a tie message, or a rest message
	{
		//looking at offset 8005E5C8 in the FFO FF2 exe for this delta time table code  4294967296  0x100000000/0xBA2E8BA3   = 1.374999... = 11/8
		//0x68 after eq = 9
		/*i = ((status_byte * 0xBA2E8BA3) & 0xFF00000000) >> 32; // emulating multu and mfhi instruction
		//i >>= 3;  //srl 3
*/		i = status_byte / 11;
		k = i*2;  //sll 1 - aka multiply by 2
		k +=  i;   //addu $v0, $v1
		k *= 4;  //sll 2 - aka multiply by 4
		k -= i;  //subu    $v0, $v1
		k = status_byte - k; //subu    $v0, $s1, $v0
		//k now equals the table index value
		//relative key calculation found at 8005E6F8 in FFO FF2 exe

		if (status_byte < 0x83) // it's a note-on message
		{
			relative_key = status_byte / 11;
			base_key = octave*12;
			if (bNotePlaying)
			{
				AddNoteOffNoItem(prevKey);
				bNotePlaying = false;
			}
			//if (bAssociatedWithSSTable)
			//	FindNoteInstrAssoc(hFile, base_key + relative_key);


			AddNoteOn(beginOffset, curOffset-beginOffset, base_key + relative_key, vel);
			bNotePlaying = true;

			AddTime(delta_time_table[k]);
		}
		else if (status_byte < 0x8F)  //if it's between 0x83 and 0x8E it is a tie event
		{
			AddTime(delta_time_table[k]);
			if (loop_counter[loop_layer] == 0 && loop_layer == 0)		//do this so we don't repeat this for every single time it loops
				AddGenericEvent(beginOffset, curOffset-beginOffset, L"Tie", NULL, CLR_TIE);
		}
		else				//otherwise, it's between 0x8F and 0x99 and it's a rest message
		{
			if (bNotePlaying)
			{
				AddNoteOff(beginOffset, curOffset-beginOffset, prevKey);
				bNotePlaying = false;
			}
			AddRest(beginOffset, curOffset-beginOffset, delta_time_table[k]);
		}
	}
	else if ((status_byte >= 0xF0) && (status_byte <= 0xFB))
	{
		relative_key = status_byte-0xF0;
		base_key = octave*12;
		if (bNotePlaying)
		{
			AddNoteOffNoItem(prevKey);
			bNotePlaying = false;
		}
		bNotePlaying = true;
		AddNoteOn(beginOffset, curOffset-beginOffset+1, base_key + relative_key, vel);
		AddTime(GetByte(curOffset++));
	}
	else switch (status_byte)
	{
	 case 0xA0 :
//		----[ 2009. 6.12	change ]-----
//		 AddUnknown(beginOffset, curOffset-beginOffset);
//		 break;
		AddEndOfTrack(beginOffset, curOffset-beginOffset);
		return false;

	 case 0xA1 :			// change program to articulation number
		{
			((AkaoSeq*)parentSeq)->bUsesIndividualArts = true;
			BYTE artNum = GetByte(curOffset++);
			BYTE progNum = ((AkaoSeq*)parentSeq)->instrset->aInstrs.size() + artNum;
			AddProgramChange(beginOffset, curOffset-beginOffset, progNum);
		}
		break;

	case 0xA2 :			// set next note length [ticks]
		curOffset++;
		AddGenericEvent(beginOffset, curOffset-beginOffset, L"Next note length", NULL, CLR_CHANGESTATE);
		break;

	 case 0xA3 :			//set track volume
		 vol = GetByte(curOffset++);			//expression value		
		 AddVol(beginOffset, curOffset-beginOffset, vol);
		 break;

	 case 0xA4:			// pitch slide half steps.  (Portamento)
		{
			BYTE dur = GetByte(curOffset++);		//first byte is duration of slide
			BYTE steps = GetByte(curOffset++);		//second byte is number of halfsteps to slide... not sure if signed or not, only seen positive
			//AddPitchBendSlide(
			AddGenericEvent(beginOffset, curOffset-beginOffset, L"Portamento", NULL, CLR_PORTAMENTO);
		}
		break;

	 case 0xA5 :			//set octave
		 octave = GetByte(curOffset++);
		 AddSetOctave(beginOffset, curOffset-beginOffset, octave);
		 break;

	 case 0xA6 :			//set octave + 1
		 AddIncrementOctave(beginOffset, curOffset-beginOffset);
		 break;

	 case 0xA7 :			//set octave - 1
		 AddDecrementOctave(beginOffset, curOffset-beginOffset);
		 break;

	 case 0xA8 :			//set expression (USED TO BE VELOCITY, may go back after testing, as this is messy)
		 {
			 //vel = GetByte(curOffset++);
			 //vel = Convert7bitPercentVolValToStdMidiVal(vel);		//I THINK THIS APPLIES, BUT NOT POSITIVE
			 //AddGenericEvent(beginOffset, curOffset-beginOffset, L"Set Velocity", NULL, BG_CLR_CYAN);
			 BYTE cExpression = GetByte(curOffset++);
////			 こっちのlog演算は要らない
////			 vel = Convert7bitPercentVolValToStdMidiVal(vel);		//I THINK THIS APPLIES, BUT NOT POSITIVE
			 vel = 127;		//とりあえず 127 にしておく
			 AddExpression(beginOffset, curOffset-beginOffset, cExpression);
		 }
		 break;

	 case 0xA9 :			//set Expression fade
		 {
			BYTE dur = GetByte(curOffset++);
			BYTE targExpr = GetByte(curOffset++);			//reads the target velocity value - the velocity value we are fading toward
			AddExpressionSlide(beginOffset, curOffset-beginOffset, dur, targExpr);
		 }
		 break;

	 case 0xAA :			//set pan
		 {
			BYTE pan = GetByte(curOffset++);
			AddPan(beginOffset, curOffset-beginOffset, pan);
		 }
		break;

	 case 0xAB :			//set pan fade
		 {
			BYTE dur = GetByte(curOffset++);
			BYTE targPan = GetByte(curOffset++);			//reads the target velocity value - the velocity value we are fading toward
			AddPanSlide(beginOffset, curOffset-beginOffset, dur, targPan);
		 }
		 break;

	 case 0xAC :			//unknown
		 curOffset++;
		 AddUnknown(beginOffset, curOffset-beginOffset);
		 break;

/*AD = set attack AE = set decay AF = set sustain level  B0 = AE then AF
<CBongo> B1 = set sustain release  B2 = set release
 B7 might be set A,D,S,R values all at once
 B3 appears to be "reset ADSR to the initial values from the instrument/sample data"*/

	 case 0xAD :
		 curOffset++;
		 AddGenericEvent(beginOffset, curOffset-beginOffset, L"ADSR", NULL, CLR_ADSR);
		 break;
	 case 0xAE :
		 curOffset++;
		 AddGenericEvent(beginOffset, curOffset-beginOffset, L"ADSR", NULL, CLR_ADSR);
		 break;
	 case 0xAF :
		 curOffset++;
		 AddGenericEvent(beginOffset, curOffset-beginOffset, L"ADSR", NULL, CLR_ADSR);
		 break;
	 case 0xB0 :
		 curOffset++;
		 curOffset++;
		 AddGenericEvent(beginOffset, curOffset-beginOffset, L"ADSR", NULL, CLR_ADSR);
		 break;
	 case 0xB1 :
		 curOffset++;
		 AddGenericEvent(beginOffset, curOffset-beginOffset, L"ADSR", NULL, CLR_ADSR);
		 break;
	 case 0xB2 :
		 curOffset++;
		 AddGenericEvent(beginOffset, curOffset-beginOffset, L"ADSR", NULL, CLR_ADSR);
		 break;
	 case 0xB3 :
		 AddGenericEvent(beginOffset, curOffset-beginOffset, L"ADSR", NULL, CLR_ADSR);
		 break;

	//
	//	0xB4 to 0xB7	LFO Pitch bend
	//	0xB8 to 0xBC	LFO Expression
	//	0xBC to 0xBF	LFO Panpot
	//

	 case 0xB4 :			//unknown
		 curOffset += 3;
		 AddGenericEvent(beginOffset, curOffset-beginOffset, L"LFO(Pitch bend) Length, cycle", NULL, CLR_LFO);
		 break;
	 case 0xB5 :
		 curOffset++;
		 AddGenericEvent(beginOffset, curOffset-beginOffset, L"LFO(Pitch bend) Depth", NULL, CLR_LFO);
		 break;
	 case 0xB6 :			//unknown
		 AddGenericEvent(beginOffset, curOffset-beginOffset, L"LFO(Pitch bend) off", NULL, CLR_LFO);
		 break;
	 case 0xB7 :
		 curOffset++;
		 AddUnknown(beginOffset, curOffset-beginOffset);
		 break;

	 case 0xB8 :			//unknown
		 curOffset += 3;
		 AddGenericEvent(beginOffset, curOffset-beginOffset, L"LFO(Expression) Length, cycle", NULL, CLR_LFO);
		 break;
	 case 0xB9 :
		 curOffset++;
		 AddGenericEvent(beginOffset, curOffset-beginOffset, L"LFO(Expression) Depth", NULL, CLR_LFO);
		 break;
	 case 0xBA :			//unknown
		 AddGenericEvent(beginOffset, curOffset-beginOffset, L"LFO(Expression) off", NULL, CLR_LFO);
		 break;
	 case 0xBB :
		 curOffset++;
		 AddUnknown(beginOffset, curOffset-beginOffset);
		 break;

	 case 0xBC :			//unknown
		 curOffset += 2;
		 AddGenericEvent(beginOffset, curOffset-beginOffset, L"LFO(Panpot) Length, cycle", NULL, CLR_LFO);
		 break;
	 case 0xBD :
		 curOffset++;
		 AddGenericEvent(beginOffset, curOffset-beginOffset, L"LFO(Panpot) Depth", NULL, CLR_LFO);
		 break;
	 case 0xBE :			//unknown
		 AddGenericEvent(beginOffset, curOffset-beginOffset, L"LFO(Panpot) off", NULL, CLR_LFO);
		 break;
	 case 0xBF :
		 curOffset++;
		 AddUnknown(beginOffset, curOffset-beginOffset);
		 break;

	 case 0xC0 :
		 {
			char cTranspose = GetByte(curOffset++);
			AddTranspose(beginOffset, curOffset-beginOffset,cTranspose);
		 }
		 break;
	 case 0xC1 :
		 {
			BYTE cTranspose = GetByte(curOffset++);
			AddGenericEvent(beginOffset, curOffset-beginOffset, L"Transpose move", NULL, CLR_TRANSPOSE);
		 }
		 break;

	case 0xC2 :
		 AddGenericEvent(beginOffset, curOffset-beginOffset, L"Reverb On", NULL, CLR_REVERB);
		 break;
	case 0xC3 :
		AddGenericEvent(beginOffset, curOffset-beginOffset, L"Reverb Off", NULL, CLR_REVERB);
		break;

	case 0xC4 :
		 AddGenericEvent(beginOffset, curOffset-beginOffset, L"Noise On", NULL, CLR_UNKNOWN);
		 break;
	case 0xC5 :
		AddGenericEvent(beginOffset, curOffset-beginOffset, L"Noise Off", NULL, CLR_UNKNOWN);
		break;

	case 0xC6 :
		AddGenericEvent(beginOffset, curOffset-beginOffset, L"FM Modulation On", NULL, CLR_UNKNOWN);
		break;
	case 0xC7 :
		AddGenericEvent(beginOffset, curOffset-beginOffset, L"FM Modulation Off", NULL, CLR_UNKNOWN);
		break;

	case 0xC8 :			// set loop begin marker
		AddGenericEvent(beginOffset, curOffset-beginOffset, L"Repeat Start", NULL, CLR_LOOP);
		loop_begin_layer++;
		loop_begin_loc[loop_begin_layer] = curOffset;
		//bInLoop = true;
		break;

	case 0xC9 :
		{
			BYTE value1 = GetByte(curOffset++);
			AddGenericEvent(beginOffset, curOffset-beginOffset, L"Repeat End", NULL, CLR_LOOP);
			if (loop_begin_layer == 0)		//if loop_begin_layer == 0, then there was never a matching loop begin event!  this is seen in ff9 402 and ff9 hunter's chance
				break;
			if (loopID[loop_layer] != curOffset)
			{
				loop_layer++;
				loopID[loop_layer] = curOffset;
				curOffset = loop_begin_loc[loop_begin_layer];
				loop_counter[loop_layer] = value1-2;
				bInLoop = true;
			}
			else if (loop_counter[loop_layer] > 0)
			{
				loop_counter[loop_layer]--;
				curOffset = loop_begin_loc[loop_begin_layer];
				//if (loop_counter[loop_layer] == 0 && loop_layer == 1)
				//	bInLoop = false;
			}
			else
			{
				loopID[loop_layer]=0;
				loop_layer--;
				loop_begin_layer--;
				if (loop_layer == 0)
					bInLoop = false;
			}
		}
		break;

	case 0xCA :
		{
			BYTE value1 = 2;
			AddGenericEvent(beginOffset, curOffset-beginOffset, L"Repeat End", NULL, CLR_LOOP);
			if (loop_begin_layer == 0)
				break;
			if (loopID[loop_layer] != curOffset)
			{
				loop_layer++;
				loopID[loop_layer] = curOffset;
				curOffset = loop_begin_loc[loop_begin_layer];
				loop_counter[loop_layer] = value1-2;
				bInLoop = true;
			}
			else if (loop_counter[loop_layer] > 0)
			{
				loop_counter[loop_layer]--;
				curOffset = loop_begin_loc[loop_begin_layer];
				//if (loop_counter[loop_layer] == 0 && loop_layer == 1)
				//	bInLoop = false;
			}
			else
			{
				loopID[loop_layer]=0;
				loop_layer--;
				loop_begin_layer--;
				if (loop_layer == 0)
					bInLoop = false;
			}
		}
		break;

	case 0xCC :
		AddGenericEvent(beginOffset, curOffset-beginOffset, L"Slur On", NULL, CLR_PORTAMENTO);
		break;
	case 0xCD :
		AddGenericEvent(beginOffset, curOffset-beginOffset, L"Slur Off", NULL, CLR_PORTAMENTO);
		break;

	case 0xD0 :
		AddNoteOff(beginOffset, curOffset-beginOffset, prevKey);
		break;

	case 0xD1 :			// unknown
		AddGenericEvent(beginOffset, curOffset-beginOffset, L"Deactivate Notes?", NULL, CLR_UNKNOWN);
		break;

	case 0xD2 :
		curOffset++;
		 AddUnknown(beginOffset, curOffset-beginOffset);
		break;

	case 0xD3 :
		curOffset++;
		 AddUnknown(beginOffset, curOffset-beginOffset);
		break;

	case 0xD8 :			//pitch bend
		{
			BYTE cValue = GetByte(curOffset++);		//signed data byte.  range of 1 octave (0x7F = +1 octave 0x80 = -1 octave)
			int fullValue = (int)(cValue * 64.503937007874015748031496062992);
			fullValue += 0x2000;
			BYTE lo = fullValue & 0x7F;
			BYTE hi = (fullValue & 0x3F80) >> 7;
			AddPitchBendMidiFormat(beginOffset, curOffset-beginOffset, lo, hi);
		}
		break;

	 case 0xD9 :
		 curOffset++;
		 AddGenericEvent(beginOffset, curOffset-beginOffset, L"Pitch bend move", NULL, CLR_UNKNOWN);
		 break;

	 case 0xDA :
		 curOffset++;
		 AddUnknown(beginOffset, curOffset-beginOffset);
		 break;

	 case 0xDC :
		 curOffset++;
		 AddUnknown(beginOffset, curOffset-beginOffset);
		 break;

	 case 0xDD :
		 curOffset += 2;
		 AddGenericEvent(beginOffset, curOffset-beginOffset, L"LFO(Pitch bend) times", NULL, CLR_UNKNOWN);
		 break;
	 case 0xDE :
		 curOffset += 2;
		 AddGenericEvent(beginOffset, curOffset-beginOffset, L"LFO(Expression) times", NULL, CLR_UNKNOWN);
		 break;
	 case 0xDF :
		 curOffset += 2;
		 AddGenericEvent(beginOffset, curOffset-beginOffset, L"LFO(Panpot) times", NULL, CLR_UNKNOWN);
		 break;

	 case 0xE1 :
		 curOffset++;
		 AddUnknown(beginOffset, curOffset-beginOffset);
		 break;

	 case 0xE6 :
		 curOffset += 2;
		 AddUnknown(beginOffset, curOffset-beginOffset);
		 break;

	 case 0xFC :			//tie time
		 //if (nVersion == VERSION_1 || nVersion == VERSION_2)
		//	 goto MetaEvent;
		 //rest_time += pDoc->GetByte(j++);
		AddTime(GetByte(curOffset++));
		AddGenericEvent(beginOffset, curOffset-beginOffset, L"Tie (custom)", NULL, CLR_TIE);
		break;

	 case 0xFD :
		 {
			 if (bNotePlaying)
			 {
				 AddNoteOffNoItem(prevKey);
		 		bNotePlaying = false;
			 }
			 BYTE restTime = GetByte(curOffset++);
			 AddRest(beginOffset, curOffset-beginOffset, restTime);
		 }
		 break;

	 case 0xFE :			//meta event
		//MetaEvent:
		switch (GetByte(curOffset++))
		{
		case 0x00 :			//tempo
			{
				BYTE value1 = GetByte(curOffset++);
				BYTE value2 = GetByte(curOffset++);
				double dValue1 = ((value2<<8) + value1)/218.4555555555555555555555555;		//no clue how this magic number is properly derived
				AddTempoBPM(beginOffset, curOffset-beginOffset, dValue1);
			}
			break;

		case 0x01 :			//tempo slide
			{
				BYTE value1 = GetByte(curOffset++);    //NEED TO ADDRESS value 1	
				BYTE value2 = GetByte(curOffset++);
				//AddTempoSlide(
				//RecordMidiSetTempo(current_delta_time, value2); 
			}
			break;

		case 0x02 :			//reverb
			curOffset++;
			curOffset++;
			AddGenericEvent(beginOffset, curOffset-beginOffset, L"Reverb Level", NULL, CLR_REVERB);
			break;

		case 0x03 :			//reverb
			curOffset++;
			curOffset++;
			AddGenericEvent(beginOffset, curOffset-beginOffset, L"Reverb Fade", NULL, CLR_REVERB);
			break;

		case 0x04 :			//signals this track uses the drum kit
			AddProgramChange(beginOffset, curOffset-beginOffset, 127, L"Drum kit On");
			//channel = 9;
			break;

		case 0x05 :			//reverb
			AddGenericEvent(beginOffset, curOffset-beginOffset, L"Drum kit Off", NULL, CLR_UNKNOWN);
			break;

		case 0x06 :			//Branch Relative
			{
				ULONG dest = (S16)GetShort(curOffset) + curOffset;
				curOffset += 2;
				ULONG eventLength = curOffset - beginOffset;
				bool bContinue = false;

				curOffset = dest;

				// Check the remaining area that will be processed by CPU-controlled jump.
				for (vector<ULONG>::iterator itAddr = vCondJumpAddr.begin(); itAddr != vCondJumpAddr.end(); ++itAddr)
				{
					if (!IsOffsetUsed(*itAddr))
					{
						// There is an area not visited yet, VGMTrans must try to go there.
						bContinue = true;
						break;
					}
				}

				if (readMode == READMODE_FIND_DELTA_LENGTH)
					deltaLength = GetTime();

				AddGenericEvent(beginOffset, eventLength, L"Dal Segno.(Loop)", NULL, CLR_LOOP);
				return bContinue;

				/*USHORT siValue = GetShort(pDoc, j);
				if (nScanMode == MODE_CONVERT_MIDI)		//if we are converting the midi, the actually branch
				{
					if (seq_repeat_counter-- > 0)
						curOffset += siValue;
					else
						curOffset += 2;
				}
				else
					curOffset += 2;								//otherwise, just skip over the relative branch offset*/
			}
			break;

		case 0x07 :			//Permanence Loop break with conditional.
			{
				BYTE condValue = GetByte(curOffset++);
				ULONG dest = (S16)GetShort(curOffset) + curOffset;
				curOffset += 2;
				ULONG eventLength = curOffset - beginOffset;

				// This event performs conditional jump if certain CPU variable matches to the condValue.
				// VGMTrans will simply try to parse all events as far as possible, instead.
				// (Test case: FF9 416 Final Battle)
				if (!IsOffsetUsed(beginOffset))
				{
					// For the first time, VGMTrans just skips the event,
					// but remembers the destination address for future jump.
					vCondJumpAddr.push_back(dest);
				}
				else
				{
					// For the second time, VGMTrans jumps to the destination address.
					curOffset = dest;
				}

				AddGenericEvent(beginOffset, eventLength, L"Dal Segno (Loop) Break", NULL, CLR_LOOP);
			}
			break;

		case 0x09 :			//Repeat break with conditional.
			curOffset++;
			curOffset++;
			curOffset++;
			AddGenericEvent(beginOffset, curOffset-beginOffset, L"Repeat Break", NULL, CLR_LOOP);
			break;

		//case 0x0E :			//call subroutine
		//case 0x0F :			//return from subroutine

		case 0x10 :			//unknown
			curOffset++;
			AddUnknown(beginOffset, curOffset-beginOffset);
			break;

		case 0x14 :			//program change
			{
				BYTE curProgram = GetByte(curOffset++);
				//if (!bAssociatedWithSSTable)
				//	RecordMidiProgramChange(current_delta_time, curProgram, hFile);
				AddProgramChange(beginOffset, curOffset-beginOffset, curProgram);
			}
			break;

		case 0x15 :			//Time Signature
			{
				BYTE denom = 4; curOffset++;//(192 / GetByte(curOffset++));
				BYTE numer = GetByte(curOffset++);
				//AddTimeSig(beginOffset, curOffset-beginOffset, numer, denom, parentSeq->GetPPQN());
			}
			break;

		case 0x16 :			//Maker
			curOffset += 2;
			AddGenericEvent(beginOffset, curOffset-beginOffset, L"Maker", NULL, CLR_UNKNOWN);
			break;
		case 0x1C :			//unknown
			curOffset++;
			AddUnknown(beginOffset, curOffset-beginOffset);
			break;
		default :
			AddGenericEvent(beginOffset, curOffset-beginOffset, L"UNKNOWN META EVENT", NULL, CLR_UNRECOGNIZED);
			break;
		}
		break;

	default :
		AddGenericEvent(beginOffset, curOffset-beginOffset, L"UNKNOWN EVENT", NULL, CLR_UNRECOGNIZED);
		break;
	}
	return true;
}
Beispiel #12
0
//==============================================================
//		Process of 1 Event
//--------------------------------------------------------------
//	Input
//		Nothing
//	Output
//		Nothing
//	Memo
//		SeqTrack::LoadTrack() から call される。
//==============================================================
bool HOSATrack::ReadEvent(void)
{

	//==================================
	//	[ Local 変数 ]
	//----------------------------------
	const		ULONG	beginOffset	= curOffset;					//start offset point

	const		BYTE	cCommand	= GetByte(curOffset++);			//command (op-code)
	const		BYTE	cCom_bit0	= (cCommand & 0x1F);			//length / contents
	const		BYTE	cCom_bit5	= (cCommand & 0x60) >> 5;		//Delta times
	const		BYTE	cCom_bit7	= (cCommand & 0x80) >> 7;		//0=Notes / 1=Controls

//	unsigned 	int					iMinLengthCounter;				//デルタタイム最小値
//				int					i;		//general
//	vector<char>::iterator			it_note;
//	vector<int unsigned >::iterator	it_Length;



	//==================================
	//	[ Process of "Delta time" and "Note off Event" ]
	//----------------------------------
	//Command用の(DeltaCounter==0)まで繰り返し。
	//while(iDeltaTimeCounter!=0){

	//	//Search the minimum length time [ticks]
	//	iMinLengthCounter	=	iDeltaTimeCounter;
	//	for(i=0;i<listLength.size();i++){
	//		if(iMinLengthCounter > listLength[i]){
	//			iMinLengthCounter = listLength[i];
	//		}
	//	}

	//	//Writing delta time.
	//	AddDelta(iMinLengthCounter);
	//	
	//	//Subtract the minimum length time from "Delta time" and "Length times"
	//	iDeltaTimeCounter	-=	iMinLengthCounter;
	//	for(i=0;i<listNote.size();i++){
	//		listLength[i] -= iMinLengthCounter;
	//	}

	//	//Search the ("Length times" == 0)
	//	it_note		= listNote.begin();
	//	it_Length	= listLength.begin();
	//	while(it_Length != listLength.end()){
	//		if(*it_Length==0){
	//			//Write "Note-off Event"
	//			AddNoteOffNoItem(*it_note);
	//			//Erase note-information from vector.
	//			it_note		= listNote.erase(it_note);
	//			it_Length	= listLength.erase(it_Length);
	//		} else {
	//			it_note++;
	//			it_Length++;
	//		}
	//	}
	//}



	//==================================
	//	[ Process of command (note / control) ]
	//----------------------------------

	//----------------------------------
	//	Command: Notes  (cCommand == 0x00 - 0x7F)
	if(cCom_bit7==0){

		//--------
		//[2]Update the default Note Number
		cNoteNum	= GetByte(curOffset++);

		//--------
		//[3]Update the default Delta time
		ReadDeltaTime(cCom_bit5, &iDeltaTimeCom);

		//--------
		//[4]Update the default Length
		iLengthTimeNote = GetShort(parentSeq->dwOffset + 0x10 + cCom_bit0*2);
		if(iLengthTimeNote==0){
//			iLengthTimeNote = ReadVarLen(curOffset);		//No count curOffset
			iLengthTimeNote = DecodeVariable();
		};

		//--------
		//[5]Update the default Velocity
		if(cNoteNum & 0x80){
			cNoteNum &= 0x7F;
			cVelocity = GetByte(curOffset++);
		};

		//--------
		//[3]Update the default Delta time (continuation)
		if(cCom_bit5==1){
			iDeltaTimeCom = iLengthTimeNote;	//Delta time is the same as note length.
		};
		iDeltaTimeNote = iDeltaTimeCom;			//Default delta time for Note.

		//--------
		//Write Note-On Event
		AddNoteByDur(beginOffset, curOffset-beginOffset, cNoteNum, cVelocity, iLengthTimeNote);


	//----------------------------------
	//	Command: Controls  (cCommand == 0x80 - 0x9F, 0xC0 - 0xFF)
	} else {
		if(cCom_bit5!=1){
			switch(cCom_bit0){
				//------------
				//End of Track
				case(0x00):
					AddEndOfTrack(beginOffset, curOffset-beginOffset);
					return false;
					break;
				//------------
				//Tempo
				case(0x01):
					cTempo = GetByte(curOffset++);
					AddTempoBPM(beginOffset, curOffset-beginOffset, cTempo);
					break;
				//------------
				//Reverb
				case(0x02):
					curOffset++;
					AddGenericEvent(beginOffset, curOffset-beginOffset, L"Reverb Depth", NULL, CLR_REVERB);
					break;
				//------------
				//Instrument
				case(0x03):
					cInstrument = GetByte(curOffset++);
					AddProgramChange(beginOffset, curOffset-beginOffset, cInstrument);
					break;
				//------------
				//Volume
				case(0x04):
					cVolume = GetByte(curOffset++);
					AddVol(beginOffset, curOffset-beginOffset, cVolume);
					break;
				//------------
				//Panpot
				case(0x05):
					cPanpot = GetByte(curOffset++);
					AddPan(beginOffset, curOffset-beginOffset, cPanpot);
					break;
				//------------
				//Expression
				case(0x06):
					cExpression = GetByte(curOffset++);
					AddExpression(beginOffset, curOffset-beginOffset, cExpression);
					break;
				//------------
				//Unknown
				case(0x07):
					curOffset++;
					curOffset++;
					AddUnknown(beginOffset, curOffset-beginOffset);
					break;
				//------------
				//Dal Segno. (Loop)
				case(0x09):
					curOffset++;
					AddGenericEvent(beginOffset, curOffset-beginOffset, L"Dal Segno.(Loop)", NULL, CLR_LOOP);
					break;
				//------------
				//Unknown
				case(0x0F):
					AddUnknown(beginOffset, curOffset-beginOffset);
					break;
				//------------
				//Unknowns
				default:
					curOffset++;
					AddUnknown(beginOffset, curOffset-beginOffset);
					break;
			}

			//--------
			//[3]Delta time
			ULONG	beginOffset2 = curOffset;
			ReadDeltaTime(cCom_bit5, &iDeltaTimeCom);
			if(curOffset != beginOffset2){
				AddGenericEvent(beginOffset2,curOffset-beginOffset2, L"Delta time", NULL, CLR_CHANGESTATE);
			};

	//----------------------------------
	//	Command: Notes  (cCommand == 0xA0 - 0xBF)
		} else {
			if(cCom_bit0 & 0x10){
				//Add (Command = 0xB0 - 0xBF)
				cNoteNum+=(cCom_bit0 & 0x0F);
			}else{
				//Sub (Command = 0xA0 - 0xAF)
				cNoteNum-=(cCom_bit0 & 0x0F);
			};
			//--------
			//Write Note-On Event
			AddNoteByDur(beginOffset, curOffset-beginOffset, cNoteNum, cVelocity, iLengthTimeNote);
			iDeltaTimeCom		= iDeltaTimeNote;
		}
	}

	//==================================
	//	[ Process of "Note" with note length ]
	//----------------------------------
	//if(fNoteOutput!=0){
	//	//Write "Note-on Event"
	//	AddNoteOn(beginOffset, curOffset-beginOffset, fNoteOutput, cVelocity);
	//	//Add note-information to vector.
	//	listNote.push_back(fNoteOutput);		//Note Number
	//	listLength.push_back(iLengthTimeNote);	//Length
	//	//Next delta time
	//	iDeltaTimeCom		= iDeltaTimeNote;
	//}



	//==================================
	//	[ Process of "Setting Delta time" ]
	//----------------------------------
	//iDeltaTimeCounter = iDeltaTimeCom;
	AddTime(iDeltaTimeCom);



	return true;

}
Beispiel #13
0
void main()
{
   auto expression = AddExpression( std::make_shared< Literal >( 2 ), std::make_shared< SubExpression >(
      std::make_shared< Literal >( 3 ), std::make_shared< Literal >( 4 ) )).Evaluate();
}
Beispiel #14
0
void
avtTraceHistoryFilter::PerformIteration(int time, avtDataset_p &ds, bool doDisp)
{
    int   i;

    // Store off the original expression list.
    ParsingExprList *pel = ParsingExprList::Instance();
    ExpressionList orig_list = *(pel->GetList());

    avtContract_p spec = GetGeneralContract();
    avtDataRequest_p dataRequest = spec->GetDataRequest();
    int timestep = dataRequest->GetTimestep();

    int newTimeIndex = timestep-time;
    if (newTimeIndex < 0)
    {
        EXCEPTION1(VisItException, "You asked to trace back before the first"
                      " dump.");
    }

    ExpressionList new_list = *(pel->GetList());
    std::vector<std::string> vars = atts.GetVars();
    for (i = 0 ; i < vars.size () ; i++)
    {
        AddExpression(new_list, vars[i], newTimeIndex);
    }
    if (doDisp)
        AddExpression(new_list, atts.GetDisplacement(), newTimeIndex);
    *(pel->GetList()) = new_list;

    avtSourceFromAVTDataset termsrc(ds);
    avtDataObject_p data = termsrc.GetOutput();

    avtExpressionEvaluatorFilter eef;
    eef.SetInput(data);
    
    avtDataRequest_p dataRequest2 = new avtDataRequest(dataRequest);
    for (i = 0 ; i < vars.size() ; i++)
    {
        char exp_name[1024];
        SNPRINTF(exp_name, 1024, "AVT_TRACE_HIST_%s", vars[i].c_str());
        dataRequest2->AddSecondaryVariable(exp_name);
    }

    if (doDisp)
    {
        char disp_name[1024];
        SNPRINTF(disp_name, 1024, "AVT_TRACE_HIST_%s", 
                                               atts.GetDisplacement().c_str());

        avtDisplaceFilter disp;
        disp.SetInput(eef.GetOutput());

        disp.SetVariable(disp_name);
        disp.SetFactor(1.);
        dataRequest2->AddSecondaryVariable(disp_name);

        avtContract_p spec2 = new avtContract(spec, 
                                                                       dataRequest2);
        disp.Update(spec2);
        ds = disp.GetTypedOutput();
    }
    else
    {
        avtContract_p spec2 = new avtContract(spec, 
                                                                       dataRequest2);
        eef.Update(spec2);
        ds = eef.GetTypedOutput();
    }

    // Restore the original expression list ... i.e. undo the temporary 
    // expressions we put in.
    *(pel->GetList()) = orig_list;
}
Beispiel #15
0
    /**
     * Constructor of an extension declares everything the extension contains: objects, actions, conditions and expressions.
     */
    Extension()
    {
        SetExtensionInformation("AdvancedXML",
                              _("Advanced XML 1.0"),
                              _("Extension allowing to manipulate XML files."),
                              "Victor Levasseur",
                              "Open source (MIT License)");

        #if defined(GD_IDE_ONLY)

        AddAction("NewFile",
                       _("Create an XML document"),
                       _("Create an XML document"),
                       _("Create an XML document into reference _PARAM0_"),
                       _("Advanced XML : Documents"),
                       "res/AdvancedXML/AdvancedXML.png",
                       "res/AdvancedXML/AdvancedXML16.png")

            .AddParameter("string", _("Reference (allow to access later to the element)"))
            .AddCodeOnlyParameter("currentScene", "")

            .codeExtraInformation.SetFunctionName("AdvancedXML::CreateNewDocument").SetIncludeFile("AdvancedXML/src/AdvancedXMLTools.h");

        AddAction("LoadFile",
                       _("Load an XML file"),
                       _("Load an XML file."),
                       _("Load XML File _PARAM0_ into reference _PARAM1_"),
                       _("Advanced XML : Documents"),
                       "res/AdvancedXML/AdvancedXMLOpen.png",
                       "res/AdvancedXML/AdvancedXMLOpen16.png")

            .AddParameter("file", _("Source file"))
            .AddParameter("string", _("Reference (allow to access later to the element)"))
            .AddCodeOnlyParameter("currentScene", "")

            .codeExtraInformation.SetFunctionName("AdvancedXML::LoadXmlFile").SetIncludeFile("AdvancedXML/src/AdvancedXMLTools.h");

        AddAction("SaveFile",
                       _("Save an XML file"),
                       _("Save an XML file."),
                       _("Save XML file _PARAM1_ into _PARAM0_"),
                       _("Advanced XML : Documents"),
                       "res/AdvancedXML/AdvancedXMLSave.png",
                       "res/AdvancedXML/AdvancedXMLSave16.png")

            .AddParameter("file", _("File where to save the document"))
            .AddParameter("string", _("Reference to the XML document"))
            .AddCodeOnlyParameter("currentScene", "")

            .codeExtraInformation.SetFunctionName("AdvancedXML::SaveXmlFile").SetIncludeFile("AdvancedXML/src/AdvancedXMLTools.h");

        AddAction("BrowseTo",
                       _("Load an element into a reference"),
                       _("Load an element (relative to another) in a reference.\nNote: References allows to access to an element using the name of the reference pointing to it."),
                       _("Load path _PARAM2_ (relative to the element _PARAM0_) into reference _PARAM1_"),
                       _("Advanced XML: General"),
                       "res/AdvancedXML/AdvancedXMLRef.png",
                       "res/AdvancedXML/AdvancedXMLRef16.png")

            .AddParameter("string", _("Reference of an existing element ( The path of the element will be relative to this element )"))
            .AddParameter("string", _("Name of the reference to the newly created element"))
            .AddParameter("string", _("Path ( tags can be browsed by separating them using /. Use * to go to the first child element without knowing the tag name )"))
            .AddCodeOnlyParameter("currentScene", "")

            .codeExtraInformation.SetFunctionName("AdvancedXML::BrowseTo").SetIncludeFile("AdvancedXML/src/AdvancedXMLTools.h");

        AddAction("NextSibling",
                       _("Go to next element"),
                       _("Create a reference on the element following the specified element.\nNote: The reference will be invalid if there is no valid element following the specified one.Conditions are available to check if an element is valid."),
                       _("Load the element called _PARAM2_ following _PARAM1_ into reference _PARAM0_"),
                       _("Advanced XML: General"),
                       "res/AdvancedXML/AdvancedXMLRef.png",
                       "res/AdvancedXML/AdvancedXMLRef16.png")

            .AddParameter("string", _("Reference to create"))
            .AddParameter("string", _("Reference to the element preceeding the element to be accessed"))
            .AddParameter("string", _("Tag name filter "), "", true)
            .AddCodeOnlyParameter("currentScene", "")

            .codeExtraInformation.SetFunctionName("AdvancedXML::NextSibling").SetIncludeFile("AdvancedXML/src/AdvancedXMLTools.h");

        AddCondition("IsRefValid",
                       _("The reference is valid"),
                       _("Is valid only when the reference is pointing to an existing and valid element."),
                       _("_PARAM0_ exists and is valid"),
                       _("Advanced XML: General"),
                       "res/AdvancedXML/AdvancedXML.png",
                       "res/AdvancedXML/AdvancedXML16.png")

            .AddParameter("string", _("Reference to the element to be tested"))
            .AddCodeOnlyParameter("currentScene", "")

            .codeExtraInformation.SetFunctionName("AdvancedXML::IsRefValid").SetIncludeFile("AdvancedXML/src/AdvancedXMLTools.h");



        AddCondition("GetElementType",
                       _("Element type"),
                       _("Test the type of the element.\n(0-> Tag, 1-> Text, 2-> Comment, 3-> XML Document, -1 -> Unknown )"),
                       _("Type of _PARAM0_ _PARAM1__PARAM2_"),
                       _("Advanced XML: General"),
                       "res/AdvancedXML/AdvancedXML.png",
                       "res/AdvancedXML/AdvancedXML16.png")

            .AddParameter("string", _("Reference to the element to be tested"))
            .AddParameter("relationalOperator", _("Comparison sign"))
            .AddParameter("expression", _("Type"))
            .AddCodeOnlyParameter("currentScene", "")

            .codeExtraInformation.SetFunctionName("AdvancedXML::GetRefType").SetManipulatedType("number").SetIncludeFile("AdvancedXML/src/AdvancedXMLTools.h");



        AddExpression("GetElementType",
                       _("Element type"),
                       _("Return the type of the element.\n(0-> Tag, 1-> Text, 2-> Comment, 3-> XML Document, -1 -> Unknown )"),
                       _("Advanced XML: General"),
                       "res/AdvancedXML/AdvancedXML16.png")

            .AddParameter("string", _("Element reference"))
            .AddCodeOnlyParameter("currentScene", "")

            .codeExtraInformation.SetFunctionName("AdvancedXML::GetRefType").SetIncludeFile("AdvancedXML/src/AdvancedXMLTools.h");



        AddAction("CreateNewElement",
                       _("Create a new element"),
                       _("Create a new element.\nNote: References allows to access to an element using the name of the reference pointing to it."),
                       _("Create a new element of type _PARAM1_ and attach to it the reference _PARAM0_"),
                       _("Advanced XML: General"),
                       "res/AdvancedXML/AdvancedXMLAdd.png",
                       "res/AdvancedXML/AdvancedXMLAdd16.png")

            .AddParameter("string", _("Reference which will be used to access to the element"))
            .AddParameter("expression", _("Tye of the element to be created\n(0-> Tag, 1-> Text, 2-> Comment )"))
            .AddParameter("string", _("Text of the element\nIf the element is a tag, it will be the tag name,if the element is a text or a comment, it will be the content."))
            .AddCodeOnlyParameter("currentScene", "")

            .codeExtraInformation.SetFunctionName("AdvancedXML::CreateNewElement").SetIncludeFile("AdvancedXML/src/AdvancedXMLTools.h");

        AddAction("DeleteAnElement",
                       _("Delete an element"),
                       _("Delete an element (The element will be removed from its parent and will be destroyed)."),
                       _("Delete element _PARAM0_"),
                       _("Advanced XML: General"),
                       "res/AdvancedXML/AdvancedXMLRemove.png",
                       "res/AdvancedXML/AdvancedXMLRemove16.png")

            .AddParameter("string", _("Reference to the element to be deleted"))
            .AddCodeOnlyParameter("currentScene", "")

            .codeExtraInformation.SetFunctionName("AdvancedXML::DeleteAnElement").SetIncludeFile("AdvancedXML/src/AdvancedXMLTools.h");

        AddAction("InsertElementIntoAnother",
                       _("Add an element inside another"),
                       _("Add an element into another: The element will be a \"child\" of its \"parent\"."),
                       _("Add _PARAM0_ as a child of _PARAM1_ (before _PARAM2_)"),
                       _("Advanced XML: Tag"),
                       "res/AdvancedXML/AdvancedXML.png",
                       "res/AdvancedXML/AdvancedXML16.png")

            .AddParameter("string", _("Reference to the element to be added"))
            .AddParameter("string", _("Reference to the parent element (must be a Tag element)"))
            .AddParameter("string", _("The element will be added before this element (if not defined, the element will be added at the end)"), "", true)
            .AddCodeOnlyParameter("currentScene", "")

            .codeExtraInformation.SetFunctionName("AdvancedXML::InsertElementIntoAnother").SetIncludeFile("AdvancedXML/src/AdvancedXMLTools.h");

        AddAction("SetTagName",
                       _("Change the tag name"),
                       _("Change the tag name"),
                       _("Do _PARAM1__PARAM2_ to the name of tag _PARAM0_"),
                       _("Advanced XML: Tag"),
                       "res/AdvancedXML/AdvancedXML.png",
                       "res/AdvancedXML/AdvancedXML16.png")

            .AddParameter("string", _("Reference to the Tag element"))
            .AddParameter("operator", _("Modification sign"))
            .AddParameter("string", _("Tag name"))
            .AddCodeOnlyParameter("currentScene", "")

            .codeExtraInformation.SetFunctionName("AdvancedXML::SetText").SetIncludeFile("AdvancedXML/src/AdvancedXMLTools.h").SetAssociatedGetter("AdvancedXML::GetText").SetManipulatedType("string");

        AddStrExpression("GetTagName",
                       _("Tag name"),
                       _("Get the name of a tag"),
                       _("Advanced XML: Tag"),
                       "res/AdvancedXML/AdvancedXML16.png")

            .AddParameter("string", _("Element reference"))
            .AddCodeOnlyParameter("currentScene", "")

            .codeExtraInformation.SetFunctionName("AdvancedXML::GetText").SetIncludeFile("AdvancedXML/src/AdvancedXMLTools.h");



        AddAction("SetContent",
                       _("Change the content of the element"),
                       _("Change the content (text) of the element ( For text and comments elements only )."),
                       _("Do _PARAM1__PARAM2_ to the content of _PARAM0_"),
                       _("Advanced XML : Text and comments"),
                       "res/AdvancedXML/AdvancedXML.png",
                       "res/AdvancedXML/AdvancedXML16.png")

            .AddParameter("string", _("Reference to the element"))
            .AddParameter("operator", _("Modification sign"))
            .AddParameter("string", _("Contents"))
            .AddCodeOnlyParameter("currentScene", "")

            .codeExtraInformation.SetFunctionName("AdvancedXML::SetText").SetIncludeFile("AdvancedXML/src/AdvancedXMLTools.h").SetAssociatedGetter("AdvancedXML::GetText").SetManipulatedType("string");

        AddStrExpression("GetContent",
                       _("Contents"),
                       _("Get the content of a text or comment element"),
                       _("Advanced XML : Text and comments"),
                       "res/AdvancedXML/AdvancedXML16.png")

            .AddParameter("string", _("Element reference"))
            .AddCodeOnlyParameter("currentScene", "")

            .codeExtraInformation.SetFunctionName("AdvancedXML::GetText").SetIncludeFile("AdvancedXML/src/AdvancedXMLTools.h");



        AddExpression("GetAttributeNumber",
                       _("Value of an attribute of an element"),
                       _("Get the value of an attribute of an element"),
                       _("Advanced XML: Tag"),
                       "res/AdvancedXML/AdvancedXML16.png")

            .AddParameter("string", _("Element reference"))
            .AddParameter("string", _("Name of the attribute"))
            .AddCodeOnlyParameter("currentScene", "")

            .codeExtraInformation.SetFunctionName("AdvancedXML::GetAttributeNumber").SetIncludeFile("AdvancedXML/src/AdvancedXMLTools.h");



        AddAction("SetAttributeNumber",
                       _("Change the value of an attribute"),
                       _("Change the value of an attribute of an element ( which must be a Tag element )."),
                       _("Do _PARAM2__PARAM3_ to the attribute _PARAM1_ of element _PARAM0_"),
                       _("Advanced XML: Tag"),
                       "res/AdvancedXML/AdvancedXML.png",
                       "res/AdvancedXML/AdvancedXML16.png")

            .AddParameter("string", _("Reference to the element"))
            .AddParameter("string", _("Name of the attribute"))
            .AddParameter("operator", _("Modification sign"))
            .AddParameter("expression", _("Value"))
            .AddCodeOnlyParameter("currentScene", "")

            .codeExtraInformation.SetFunctionName("AdvancedXML::SetAttributeNumber").SetIncludeFile("AdvancedXML/src/AdvancedXMLTools.h").SetAssociatedGetter("AdvancedXML::GetAttributeNumber").SetManipulatedType("number");

        AddStrExpression("GetAttributeString",
                       _("Text of an attribute of an element"),
                       _("Get the text of an attribute of an element"),
                       _("Advanced XML: Tag"),
                       "res/AdvancedXML/AdvancedXML16.png")

            .AddParameter("string", _("Element reference"))
            .AddParameter("string", _("Name of the attribute"))
            .AddCodeOnlyParameter("currentScene", "")

            .codeExtraInformation.SetFunctionName("AdvancedXML::GetAttributeString").SetIncludeFile("AdvancedXML/src/AdvancedXMLTools.h");



        AddAction("SetAttributeString",
                       _("Change the text of an attribute"),
                       _("Change the text of an attribute of an element ( which must be a Tag element )."),
                       _("Do _PARAM2__PARAM3_ to the attribute _PARAM1_ of element _PARAM0_"),
                       _("Advanced XML: Tag"),
                       "res/AdvancedXML/AdvancedXML.png",
                       "res/AdvancedXML/AdvancedXML16.png")

            .AddParameter("string", _("Reference to the element"))
            .AddParameter("string", _("Name of the attribute"))
            .AddParameter("operator", _("Modification sign"))
            .AddParameter("string", _("Value"))
            .AddCodeOnlyParameter("currentScene", "")

            .codeExtraInformation.SetFunctionName("AdvancedXML::SetAttributeString").SetIncludeFile("AdvancedXML/src/AdvancedXMLTools.h").SetAssociatedGetter("AdvancedXML::GetAttributeString").SetManipulatedType("string");

        AddAction("RemoveAttribute",
                       _("Delete an attribute"),
                       _("Delete an attribute from an element ( which must be a Tag element)."),
                       _("Delete attribute _PARAM1_ from the element _PARAM0_"),
                       _("Advanced XML: Tag"),
                       "res/AdvancedXML/AdvancedXML.png",
                       "res/AdvancedXML/AdvancedXML16.png")

            .AddParameter("string", _("Reference to the element"))
            .AddParameter("string", _("Name of the attribute"))
            .AddCodeOnlyParameter("currentScene", "")

            .codeExtraInformation.SetFunctionName("AdvancedXML::RemoveAttribute").SetIncludeFile("AdvancedXML/src/AdvancedXMLTools.h");

        #endif

        GD_COMPLETE_EXTENSION_COMPILATION_INFORMATION();
    };
Beispiel #16
0
bool HeartBeatPS1Seq::ReadEvent(void)
{
	uint32_t beginOffset = curOffset;

	// in this format, end of track (FF 2F 00) comes without delta-time.
	// so handle that crazy sequence the first.
	if (curOffset + 3 <= rawfile->size())
	{
		if (GetByte(curOffset) == 0xff &&
			GetByte(curOffset + 1) == 0x2f &&
			GetByte(curOffset + 2) == 0x00)
		{
			curOffset += 3;
			AddEndOfTrack(beginOffset, curOffset-beginOffset);
			return false;
		}
	}

	uint32_t delta = ReadVarLen(curOffset);
	if (curOffset >= rawfile->size())
		return false;
	AddTime(delta);

	uint8_t status_byte = GetByte(curOffset++);

	if (status_byte <= 0x7F)			// Running Status
	{
		status_byte = runningStatus;
		curOffset--;
	}
	else
		runningStatus = status_byte;

	channel = status_byte&0x0F;
	SetCurTrack(channel);

	switch (status_byte & 0xF0)
	{
	case 0x80 :						//note off
		key = GetByte(curOffset++);
		vel = GetByte(curOffset++);
		AddNoteOff(beginOffset, curOffset-beginOffset, key);
		break;

	case 0x90 :						//note event
		key = GetByte(curOffset++);
		vel = GetByte(curOffset++);
		if (vel > 0)													//if the velocity is > 0, it's a note on
			AddNoteOn(beginOffset, curOffset-beginOffset, key, vel);
		else															//otherwise it's a note off
			AddNoteOff(beginOffset, curOffset-beginOffset, key);
		break;

	case 0xA0 :
		AddUnknown(beginOffset, curOffset-beginOffset);
		return false;

	case 0xB0 :
		{
			uint8_t controlNum = GetByte(curOffset++);
			uint8_t value = GetByte(curOffset++);
			switch (controlNum)		//control number
			{
			case 1:
				AddGenericEvent(beginOffset, curOffset-beginOffset, L"Modulation", NULL, CLR_UNKNOWN);
				if (VGMSeq::readMode == READMODE_CONVERT_TO_MIDI) {
					pMidiTrack->AddControllerEvent(channel, controlNum, value);
				}
				break;

			case 2: // identical to CC#11?
				AddGenericEvent(beginOffset, curOffset-beginOffset, L"Breath Controller?", NULL, CLR_UNKNOWN);
				if (VGMSeq::readMode == READMODE_CONVERT_TO_MIDI) {
					pMidiTrack->AddControllerEvent(channel, controlNum, value);
				}
				break;

			case 4:
				AddGenericEvent(beginOffset, curOffset-beginOffset, L"Foot Controller?", NULL, CLR_UNKNOWN);
				if (VGMSeq::readMode == READMODE_CONVERT_TO_MIDI) {
					pMidiTrack->AddControllerEvent(channel, controlNum, value);
				}
				break;

			case 5:
				AddGenericEvent(beginOffset, curOffset-beginOffset, L"Portamento Time?", NULL, CLR_UNKNOWN);
				if (VGMSeq::readMode == READMODE_CONVERT_TO_MIDI) {
					pMidiTrack->AddControllerEvent(channel, controlNum, value);
				}
				break;

			case 6 :
				AddGenericEvent(beginOffset, curOffset-beginOffset, L"NRPN Data Entry", NULL, CLR_MISC);
				if (VGMSeq::readMode == READMODE_CONVERT_TO_MIDI) {
					pMidiTrack->AddControllerEvent(channel, controlNum, value);
				}
				break;

			case 7 :							//volume
				AddVol(beginOffset, curOffset-beginOffset, value);
				break;

			case 9:
				AddGenericEvent(beginOffset, curOffset-beginOffset, L"Control 9", NULL, CLR_UNKNOWN);
				if (VGMSeq::readMode == READMODE_CONVERT_TO_MIDI) {
					pMidiTrack->AddControllerEvent(channel, controlNum, value);
				}
				break;

			case 10 :							//pan
				AddPan(beginOffset, curOffset-beginOffset, value);
				break;

			case 11 :							//expression
				AddExpression(beginOffset, curOffset-beginOffset, value);
				break;

			case 20:
				AddGenericEvent(beginOffset, curOffset-beginOffset, L"Control 20", NULL, CLR_UNKNOWN);
				if (VGMSeq::readMode == READMODE_CONVERT_TO_MIDI) {
					pMidiTrack->AddControllerEvent(channel, controlNum, value);
				}
				break;

			case 21:
				AddGenericEvent(beginOffset, curOffset-beginOffset, L"Control 21", NULL, CLR_UNKNOWN);
				if (VGMSeq::readMode == READMODE_CONVERT_TO_MIDI) {
					pMidiTrack->AddControllerEvent(channel, controlNum, value);
				}
				break;

			case 22:
				AddGenericEvent(beginOffset, curOffset-beginOffset, L"Control 22", NULL, CLR_UNKNOWN);
				if (VGMSeq::readMode == READMODE_CONVERT_TO_MIDI) {
					pMidiTrack->AddControllerEvent(channel, controlNum, value);
				}
				break;

			case 23:
				AddGenericEvent(beginOffset, curOffset-beginOffset, L"Control 23", NULL, CLR_UNKNOWN);
				if (VGMSeq::readMode == READMODE_CONVERT_TO_MIDI) {
					pMidiTrack->AddControllerEvent(channel, controlNum, value);
				}
				break;

			case 32:
				AddGenericEvent(beginOffset, curOffset-beginOffset, L"Bank LSB?", NULL, CLR_UNKNOWN);
				if (VGMSeq::readMode == READMODE_CONVERT_TO_MIDI) {
					pMidiTrack->AddControllerEvent(channel, controlNum, value);
				}
				break;

			case 52:
				AddGenericEvent(beginOffset, curOffset-beginOffset, L"Control 52", NULL, CLR_UNKNOWN);
				if (VGMSeq::readMode == READMODE_CONVERT_TO_MIDI) {
					pMidiTrack->AddControllerEvent(channel, controlNum, value);
				}
				break;

			case 53:
				AddGenericEvent(beginOffset, curOffset-beginOffset, L"Control 53", NULL, CLR_UNKNOWN);
				if (VGMSeq::readMode == READMODE_CONVERT_TO_MIDI) {
					pMidiTrack->AddControllerEvent(channel, controlNum, value);
				}
				break;

			case 54:
				AddGenericEvent(beginOffset, curOffset-beginOffset, L"Control 54", NULL, CLR_UNKNOWN);
				if (VGMSeq::readMode == READMODE_CONVERT_TO_MIDI) {
					pMidiTrack->AddControllerEvent(channel, controlNum, value);
				}
				break;

			case 55:
				AddGenericEvent(beginOffset, curOffset-beginOffset, L"Control 55", NULL, CLR_UNKNOWN);
				if (VGMSeq::readMode == READMODE_CONVERT_TO_MIDI) {
					pMidiTrack->AddControllerEvent(channel, controlNum, value);
				}
				break;

			case 56:
				AddGenericEvent(beginOffset, curOffset-beginOffset, L"Control 56", NULL, CLR_UNKNOWN);
				if (VGMSeq::readMode == READMODE_CONVERT_TO_MIDI) {
					pMidiTrack->AddControllerEvent(channel, controlNum, value);
				}
				break;

			case 64:
				AddGenericEvent(beginOffset, curOffset-beginOffset, L"Hold 1?", NULL, CLR_UNKNOWN);
				if (VGMSeq::readMode == READMODE_CONVERT_TO_MIDI) {
					pMidiTrack->AddControllerEvent(channel, controlNum, value);
				}
				break;

			case 69:
				AddGenericEvent(beginOffset, curOffset-beginOffset, L"Hold 2?", NULL, CLR_UNKNOWN);
				if (VGMSeq::readMode == READMODE_CONVERT_TO_MIDI) {
					pMidiTrack->AddControllerEvent(channel, controlNum, value);
				}
				break;

			case 71:
				AddGenericEvent(beginOffset, curOffset-beginOffset, L"Resonance?", NULL, CLR_UNKNOWN);
				if (VGMSeq::readMode == READMODE_CONVERT_TO_MIDI) {
					pMidiTrack->AddControllerEvent(channel, controlNum, value);
				}
				break;

			case 72:
				AddGenericEvent(beginOffset, curOffset-beginOffset, L"Release Time?", NULL, CLR_UNKNOWN);
				if (VGMSeq::readMode == READMODE_CONVERT_TO_MIDI) {
					pMidiTrack->AddControllerEvent(channel, controlNum, value);
				}
				break;

			case 73:
				AddGenericEvent(beginOffset, curOffset-beginOffset, L"Attack Time?", NULL, CLR_UNKNOWN);
				if (VGMSeq::readMode == READMODE_CONVERT_TO_MIDI) {
					pMidiTrack->AddControllerEvent(channel, controlNum, value);
				}
				break;

			case 74:
				AddGenericEvent(beginOffset, curOffset-beginOffset, L"Cut Off Frequency?", NULL, CLR_UNKNOWN);
				if (VGMSeq::readMode == READMODE_CONVERT_TO_MIDI) {
					pMidiTrack->AddControllerEvent(channel, controlNum, value);
				}
				break;

			case 75:
				AddGenericEvent(beginOffset, curOffset-beginOffset, L"Decay Time?", NULL, CLR_UNKNOWN);
				if (VGMSeq::readMode == READMODE_CONVERT_TO_MIDI) {
					pMidiTrack->AddControllerEvent(channel, controlNum, value);
				}
				break;

			case 76:
				AddGenericEvent(beginOffset, curOffset-beginOffset, L"Vibrato Rate?", NULL, CLR_UNKNOWN);
				if (VGMSeq::readMode == READMODE_CONVERT_TO_MIDI) {
					pMidiTrack->AddControllerEvent(channel, controlNum, value);
				}
				break;

			case 77:
				AddGenericEvent(beginOffset, curOffset-beginOffset, L"Vibrato Depth?", NULL, CLR_UNKNOWN);
				if (VGMSeq::readMode == READMODE_CONVERT_TO_MIDI) {
					pMidiTrack->AddControllerEvent(channel, controlNum, value);
				}
				break;

			case 78:
				AddGenericEvent(beginOffset, curOffset-beginOffset, L"Vibrato Delay?", NULL, CLR_UNKNOWN);
				if (VGMSeq::readMode == READMODE_CONVERT_TO_MIDI) {
					pMidiTrack->AddControllerEvent(channel, controlNum, value);
				}
				break;

			case 79:
				AddGenericEvent(beginOffset, curOffset-beginOffset, L"Control 79", NULL, CLR_UNKNOWN);
				if (VGMSeq::readMode == READMODE_CONVERT_TO_MIDI) {
					pMidiTrack->AddControllerEvent(channel, controlNum, value);
				}
				break;

			case 91:
				AddReverb(beginOffset, curOffset-beginOffset, value);
				break;

			case 92:
				AddGenericEvent(beginOffset, curOffset-beginOffset, L"Tremolo Depth?", NULL, CLR_UNKNOWN);
				if (VGMSeq::readMode == READMODE_CONVERT_TO_MIDI) {
					pMidiTrack->AddControllerEvent(channel, controlNum, value);
				}
				break;

			case 98:
				switch (value)
				{
				case 20 :
					AddGenericEvent(beginOffset, curOffset-beginOffset, L"NRPN 1 #20", NULL, CLR_MISC);
					break;

				case 30 :
					AddGenericEvent(beginOffset, curOffset-beginOffset, L"NRPN 1 #30", NULL, CLR_MISC);
					break;

				default:
					AddGenericEvent(beginOffset, curOffset-beginOffset, L"NRPN 1", NULL, CLR_MISC);
					break;
				}

				if (VGMSeq::readMode == READMODE_CONVERT_TO_MIDI) {
					pMidiTrack->AddControllerEvent(channel, controlNum, value);
				}
				break;

			case 99 :							//(0x63) nrpn msb
				switch (value)
				{
				case 20 :
					AddGenericEvent(beginOffset, curOffset-beginOffset, L"Loop Start", NULL, CLR_LOOP);
					break;

				case 30 :
					AddGenericEvent(beginOffset, curOffset-beginOffset, L"Loop End", NULL, CLR_LOOP);
					break;

				default:
					AddGenericEvent(beginOffset, curOffset-beginOffset, L"NRPN 2", NULL, CLR_MISC);
					break;
				}

				if (VGMSeq::readMode == READMODE_CONVERT_TO_MIDI) {
					pMidiTrack->AddControllerEvent(channel, controlNum, value);
				}
				break;

			case 121:
				AddGenericEvent(beginOffset, curOffset-beginOffset, L"Reset All Controllers", NULL, CLR_MISC);
				if (VGMSeq::readMode == READMODE_CONVERT_TO_MIDI) {
					pMidiTrack->AddControllerEvent(channel, controlNum, value);
				}
				break;

			case 126:
				AddGenericEvent(beginOffset, curOffset-beginOffset, L"MONO?", NULL, CLR_UNKNOWN);
				if (VGMSeq::readMode == READMODE_CONVERT_TO_MIDI) {
					pMidiTrack->AddControllerEvent(channel, controlNum, value);
				}
				break;

			case 127:
				AddGenericEvent(beginOffset, curOffset-beginOffset, L"Poly?", NULL, CLR_UNKNOWN);
				if (VGMSeq::readMode == READMODE_CONVERT_TO_MIDI) {
					pMidiTrack->AddControllerEvent(channel, controlNum, value);
				}
				break;

			default:
				AddGenericEvent(beginOffset, curOffset-beginOffset, L"Control Event", NULL, CLR_UNKNOWN);
				if (VGMSeq::readMode == READMODE_CONVERT_TO_MIDI) {
					pMidiTrack->AddControllerEvent(channel, controlNum, value);
				}
				break;
			}
		}
		break;

	case 0xC0 :
		{
			uint8_t progNum = GetByte(curOffset++);
			AddProgramChange(beginOffset, curOffset-beginOffset, progNum);
		}
		break;

	case 0xD0 :
		AddUnknown(beginOffset, curOffset-beginOffset);
		return false;

	case 0xE0 :
		{
			uint8_t hi = GetByte(curOffset++);
			uint8_t lo = GetByte(curOffset++);
			AddPitchBendMidiFormat(beginOffset, curOffset-beginOffset, hi, lo);
		}
		break;

	case 0xF0 : 
		{
			if (status_byte == 0xFF)
			{
				if (curOffset + 1 > rawfile->size())
					return false;

				uint8_t metaNum = GetByte(curOffset++);
				uint32_t metaLen = ReadVarLen(curOffset);
				if (curOffset + metaLen > rawfile->size())
					return false;

				switch (metaNum)
				{
				case 0x51 :
					AddTempo(beginOffset, curOffset+metaLen-beginOffset, (GetShortBE(curOffset) << 8) | GetByte(curOffset + 2));
					curOffset += metaLen;
					break;

				case 0x58 :
				{
					uint8_t numer = GetByte(curOffset);
					uint8_t denom = GetByte(curOffset + 1);
					AddTimeSig(beginOffset, curOffset+metaLen-beginOffset, numer, 1<<denom, (uint8_t)GetPPQN());
					curOffset += metaLen;
					break;
				}

				case 0x2F : // apparently not used, but just in case.
					AddEndOfTrack(beginOffset, curOffset+metaLen-beginOffset);
					curOffset += metaLen;
					return false;

				default :
					AddUnknown(beginOffset, curOffset+metaLen-beginOffset);
					curOffset += metaLen;
					break;
				}
			}
			else
			{
				AddUnknown(beginOffset, curOffset-beginOffset);
				return false;
			}
		}
		break;
	}
	return true;
}
Beispiel #17
0
    /**
     * Constructor of an extension declares everything the extension contains: objects, actions, conditions and expressions.
     */
    Extension()
    {
        SetExtensionInformation("Inventory",
                              _("Inventory"),
                              _("Provides action and condition to store an inventory with items in memory."),
                              "Florian Rival",
                              "Open source (MIT License)");

        #if defined(GD_IDE_ONLY)
        AddAction("Add",
                       _("Add an item"),
                       _("Add an item in an inventory."),
                       _("Add a _PARAM2_ to inventory _PARAM1_"),
                       _("Inventories"),
                       "CppPlatform/Extensions/Inventoryicon24.png",
                       "CppPlatform/Extensions/Inventoryicon16.png")

            .AddCodeOnlyParameter("currentScene", "")
            .AddParameter("string", _("Inventory name"))
            .AddParameter("string", _("Item name"))
            .SetFunctionName("InventoryTools::Add").SetIncludeFile("Inventory/InventoryTools.h");

        AddAction("Remove",
                       _("Remove an item"),
                       _("Remove an item from an inventory."),
                       _("Remove a _PARAM2_ from inventory _PARAM1_"),
                       _("Inventories"),
                       "CppPlatform/Extensions/Inventoryicon24.png",
                       "CppPlatform/Extensions/Inventoryicon16.png")

            .AddCodeOnlyParameter("currentScene", "")
            .AddParameter("string", _("Inventory name"))
            .AddParameter("string", _("Item name"))
            .SetFunctionName("InventoryTools::Remove").SetIncludeFile("Inventory/InventoryTools.h");

        AddCondition("Count",
                       _("Item count"),
                       _("Compare the number of an item in an inventory."),
                       _("Count of _PARAM2_ in _PARAM1_ is _PARAM3__PARAM4_"),
                       _("Inventories"),
                       "CppPlatform/Extensions/Inventoryicon24.png",
                       "CppPlatform/Extensions/Inventoryicon16.png")

            .AddCodeOnlyParameter("currentScene", "")
            .AddParameter("string", _("Inventory name"))
            .AddParameter("string", _("Item name"))
            .AddParameter("relationalOperator", _("Sign of the test"))
            .AddParameter("expression", _("Count"))
            .SetFunctionName("InventoryTools::Count").SetIncludeFile("Inventory/InventoryTools.h")
            .SetManipulatedType("number");

        AddCondition("Has",
                       _("Has an item"),
                       _("Check that there is at least one of the specified item in the inventory."),
                       _("Inventory _PARAM1_ contains a _PARAM2_"),
                       _("Inventories"),
                       "CppPlatform/Extensions/Inventoryicon24.png",
                       "CppPlatform/Extensions/Inventoryicon16.png")

            .AddCodeOnlyParameter("currentScene", "")
            .AddParameter("string", _("Inventory name"))
            .AddParameter("string", _("Item name"))
            .SetFunctionName("InventoryTools::Has").SetIncludeFile("Inventory/InventoryTools.h");

        AddAction("SetMaximum",
                       _("Set a maximum count for an item"),
                       _("Set the maximum number that can be added in the inventory for the specified item. By default, there is an unlimited number allowed for each item."),
                       _("Set the maximum count for _PARAM2_ in inventory _PARAM1_ to _PARAM3_"),
                       _("Inventories"),
                       "CppPlatform/Extensions/Inventoryicon24.png",
                       "CppPlatform/Extensions/Inventoryicon16.png")

            .AddCodeOnlyParameter("currentScene", "")
            .AddParameter("string", _("Inventory name"))
            .AddParameter("string", _("Item name"))
            .AddParameter("expression", _("Maximum count"))
            .SetFunctionName("InventoryTools::SetMaximum").SetIncludeFile("Inventory/InventoryTools.h");

        AddAction("SetUnlimited",
                       _("Set unlimited count for an item"),
                       _("Allow an unlimited amount of an object to be in an inventory. This is the case by default for each item."),
                       _("Allow an unlimited count of _PARAM2_ in inventory _PARAM1_: _PARAM3_"),
                       _("Inventories"),
                       "CppPlatform/Extensions/Inventoryicon24.png",
                       "CppPlatform/Extensions/Inventoryicon16.png")

            .AddCodeOnlyParameter("currentScene", "")
            .AddParameter("string", _("Inventory name"))
            .AddParameter("string", _("Item name"))
            .AddParameter("yesorno", _("Allow an unlimited amount?"))
            .SetFunctionName("InventoryTools::SetUnlimited").SetIncludeFile("Inventory/InventoryTools.h");

        AddCondition("IsFull",
                       _("Item full"),
                       _("Check if an item has reached the maximum number allowed in the inventory."),
                       _("Inventory _PARAM1_ is full of _PARAM2_"),
                       _("Inventories"),
                       "CppPlatform/Extensions/Inventoryicon24.png",
                       "CppPlatform/Extensions/Inventoryicon16.png")

            .AddCodeOnlyParameter("currentScene", "")
            .AddParameter("string", _("Inventory name"))
            .AddParameter("string", _("Item name"))
            .SetFunctionName("InventoryTools::Has").SetIncludeFile("Inventory/InventoryTools.h");

        AddAction("Equip",
                       _("Equip an item"),
                       _("Mark an item as being equiped. If the item count is 0 it won't be marked as equiped."),
                       _("Set _PARAM2_ as equiped in inventory _PARAM1_: _PARAM3_"),
                       _("Inventories"),
                       "CppPlatform/Extensions/Inventoryicon24.png",
                       "CppPlatform/Extensions/Inventoryicon16.png")

            .AddCodeOnlyParameter("currentScene", "")
            .AddParameter("string", _("Inventory name"))
            .AddParameter("string", _("Item name"))
            .AddParameter("yesorno", _("Equip?"))
            .SetFunctionName("InventoryTools::Equip").SetIncludeFile("Inventory/InventoryTools.h");

        AddCondition("IsEquipped",
                       _("Item equiped"),
                       _("Check if an item is equiped."),
                       _("_PARAM2_ is equipped in inventory _PARAM1_"),
                       _("Inventories"),
                       "CppPlatform/Extensions/Inventoryicon24.png",
                       "CppPlatform/Extensions/Inventoryicon16.png")

            .AddCodeOnlyParameter("currentScene", "")
            .AddParameter("string", _("Inventory name"))
            .AddParameter("string", _("Item name"))
            .SetFunctionName("InventoryTools::IsEquipped").SetIncludeFile("Inventory/InventoryTools.h");

        AddAction("SerializeToVariable",
                       _("Save an inventory in a variable"),
                       _("Save all the items of the inventory in a variable, so that it can be restored later."),
                       _("Save inventory _PARAM1_ in variable _PARAM2_"),
                       _("Inventories/Variables"),
                       "CppPlatform/Extensions/Inventoryicon24.png",
                       "CppPlatform/Extensions/Inventoryicon16.png")

            .AddCodeOnlyParameter("currentScene", "")
            .AddParameter("string", _("Inventory name"))
            .AddParameter("scenevar", _("Scene variable"))
            .SetFunctionName("InventoryTools::SerializeToVariable").SetIncludeFile("Inventory/InventoryTools.h");

        AddAction("UnserializeFromVariable",
                       _("Load an inventory from a variable"),
                       _("Load the content of the inventory from a variable."),
                       _("Load inventory _PARAM1_ from variable _PARAM2_"),
                       _("Inventories/Variables"),
                       "CppPlatform/Extensions/Inventoryicon24.png",
                       "CppPlatform/Extensions/Inventoryicon16.png")

            .AddCodeOnlyParameter("currentScene", "")
            .AddParameter("string", _("Inventory name"))
            .AddParameter("scenevar", _("Scene variable"))
            .SetFunctionName("InventoryTools::UnserializeFromVariable").SetIncludeFile("Inventory/InventoryTools.h");

        AddExpression("Count", _("Item count"), _("Get the number of an item in the inventory"), _("Inventory"), "CppPlatform/Extensions/Inventoryicon16.png")
            .AddCodeOnlyParameter("currentScene", _(""))
            .AddParameter("string", _("Inventory name"))
            .AddParameter("string", _("Item name"))
            .SetFunctionName("InventoryTools::Count").SetIncludeFile("Inventory/InventoryTools.h");

        #endif

        GD_COMPLETE_EXTENSION_COMPILATION_INFORMATION();
    };
Beispiel #18
0
bool PS1Seq::ReadEvent(void)
{
	uint32_t beginOffset = curOffset;
	uint32_t delta = ReadVarLen(curOffset);
	if (curOffset >= rawfile->size())
		return false;
	AddTime(delta);

	uint8_t status_byte = GetByte(curOffset++);

	//if (status_byte == 0)				//Jump Relative
	//{
	//	short relOffset = (short)GetShortBE(curOffset);
	//	AddGenericEvent(beginOffset, 4, L"Jump Relative", NULL, BG_CLR_PINK);
	//	curOffset += relOffset;

	//	curOffset += 4;		//skip the first 4 bytes (no idea)
	//	SetPPQN(GetShortBE(curOffset));
	//	curOffset += 2;
	//	AddTempo(curOffset, 3, GetWordBE(curOffset-1) & 0xFFFFFF);
	//	curOffset += 3;
	//	uint8_t numer = GetByte(curOffset++);
	//	uint8_t denom = GetByte(curOffset++);
	//	if (numer == 0 || numer > 32)				//sanity check
	//		return false;
	//	AddTimeSig(curOffset-2, 2, numer, 1<<denom, GetPPQN());
	//	SetEventsOffset(offset() + 0x0F);
	//}
//	else
		if (status_byte <= 0x7F)			// Running Status
	{
		if (status_byte == 0)			// some games were ripped to PSF with the EndTrack event missing, so
		{
			if (GetWord(curOffset) == 0)	//if we read a sequence of four 0 bytes, then just treat that
				return false;				//as the end of the track
		}
		status_byte = runningStatus;
		curOffset--;
	}
	else
		runningStatus = status_byte;


	channel = status_byte&0x0F;
	SetCurTrack(channel);

	switch (status_byte & 0xF0)
	{
	case 0x90 :						//note event
		key = GetByte(curOffset++);
		vel = GetByte(curOffset++);
		if (vel > 0)													//if the velocity is > 0, it's a note on
			AddNoteOn(beginOffset, curOffset-beginOffset, key, vel);
		else															//otherwise it's a note off
			AddNoteOff(beginOffset, curOffset-beginOffset, key);
		break;

	case 0xB0 :
		{
			uint8_t controlNum = GetByte(curOffset++);
			uint8_t value = GetByte(curOffset++);
			switch (controlNum)		//control number
			{
			case 0 :							//bank select
				AddGenericEvent(beginOffset, curOffset-beginOffset, L"Bank Select", L"", CLR_MISC);
				AddBankSelectNoItem(value);
				break;

			case 6 :							//data entry
				AddGenericEvent(beginOffset, curOffset-beginOffset, L"NRPN Data Entry", L"", CLR_MISC);
				if (VGMSeq::readMode == READMODE_CONVERT_TO_MIDI) {
					pMidiTrack->AddControllerEvent(channel, controlNum, value);
				}
				break;

			case 7 :							//volume
				AddVol(beginOffset, curOffset-beginOffset, value);
				break;

			case 10 :							//pan
				AddPan(beginOffset, curOffset-beginOffset, value);
				break;

			case 11 :							//expression
				AddExpression(beginOffset, curOffset-beginOffset, value);
				break;

			case 64 :							//damper (hold)
				AddSustainEvent(beginOffset, curOffset-beginOffset, value);
				break;

			case 91 :							//reverb depth (_SsContExternal)
				AddReverb(beginOffset, curOffset-beginOffset, value);
				break;

			case 98 :							//(0x62) NRPN 1 (LSB)
				switch (value)
				{
				case 20 :
					AddGenericEvent(beginOffset, curOffset-beginOffset, L"NRPN 1 #20", L"", CLR_MISC);
					break;

				case 30 :
					AddGenericEvent(beginOffset, curOffset-beginOffset, L"NRPN 1 #30", L"", CLR_MISC);
					break;

				default:
					AddGenericEvent(beginOffset, curOffset-beginOffset, L"NRPN 1", L"", CLR_MISC);
					break;
				}

				if (VGMSeq::readMode == READMODE_CONVERT_TO_MIDI) {
					pMidiTrack->AddControllerEvent(channel, controlNum, value);
				}
				break;

			case 99 :							//(0x63) NRPN 2 (MSB)
				switch (value)
				{
				case 20 :
					AddGenericEvent(beginOffset, curOffset-beginOffset, L"Loop Start", L"", CLR_LOOP);
					break;

				case 30 :
					AddGenericEvent(beginOffset, curOffset-beginOffset, L"Loop End", L"", CLR_LOOP);
					break;

				default:
					AddGenericEvent(beginOffset, curOffset-beginOffset, L"NRPN 2", L"", CLR_MISC);
					break;
				}

				if (VGMSeq::readMode == READMODE_CONVERT_TO_MIDI) {
					pMidiTrack->AddControllerEvent(channel, controlNum, value);
				}
				break;

			case 100 :							//(0x64) RPN 1 (LSB), no effect?
				AddGenericEvent(beginOffset, curOffset-beginOffset, L"RPN 1", L"", CLR_MISC);
				if (VGMSeq::readMode == READMODE_CONVERT_TO_MIDI) {
					pMidiTrack->AddControllerEvent(channel, controlNum, value);
				}
				break;

			case 101 :							//(0x65) RPN 2 (MSB), no effect?
				AddGenericEvent(beginOffset, curOffset-beginOffset, L"RPN 2", L"", CLR_MISC);
				if (VGMSeq::readMode == READMODE_CONVERT_TO_MIDI) {
					pMidiTrack->AddControllerEvent(channel, controlNum, value);
				}
				break;

			case 121 :							//reset all controllers
				AddGenericEvent(beginOffset, curOffset-beginOffset, L"Reset All Controllers", L"", CLR_MISC);
				if (VGMSeq::readMode == READMODE_CONVERT_TO_MIDI) {
					pMidiTrack->AddControllerEvent(channel, controlNum, value);
				}
				break;

			default:
				AddGenericEvent(beginOffset, curOffset-beginOffset, L"Control Event", L"", CLR_UNKNOWN);
				if (VGMSeq::readMode == READMODE_CONVERT_TO_MIDI) {
					pMidiTrack->AddControllerEvent(channel, controlNum, value);
				}
				break;
			}
		}
		break;

	case 0xC0 :
		{
			uint8_t progNum = GetByte(curOffset++);
			AddProgramChange(beginOffset, curOffset-beginOffset, progNum);
		}
		break;

	case 0xE0 :
		{
			uint8_t hi = GetByte(curOffset++);
			uint8_t lo = GetByte(curOffset++);
			AddPitchBendMidiFormat(beginOffset, curOffset-beginOffset, hi, lo);
		}
		break;

	case 0xF0 : 
		{
			if (status_byte == 0xFF)
			{
				switch (GetByte(curOffset++))
				{
				case 0x51 :			//tempo.  This is different from SMF, where we'd expect a 51 then 03.  Also, supports
									//a string of tempo events
					AddTempo(beginOffset, curOffset+3-beginOffset, (GetShortBE(curOffset) << 8) | GetByte(curOffset + 2));
					curOffset += 3;
					break;
				
				case 0x2F :
					AddEndOfTrack(beginOffset, curOffset-beginOffset);
					return false;

				default :
					AddUnknown(beginOffset, curOffset-beginOffset, L"Meta Event");
					return false;
				}
			}
			else
			{
				AddUnknown(beginOffset, curOffset-beginOffset);
				return false;
			}
		}
		break;

	default:
		AddUnknown(beginOffset, curOffset-beginOffset);
		return false;
	}
	return true;
}
//-----------------------------------------------------------------------------
// Purpose: 
//-----------------------------------------------------------------------------
void CBaseFlex::AddSceneExpressions( void )
{
	// Iterate expressions and look for active slots
	for ( int i = 0; i < m_Expressions.Count(); i++ )
	{
		CExpressionInfo *info = &m_Expressions[ i ];
		Assert( info );

		// FIXME:  Need a safe handle to m_pEvent in case of memory deletion?
		CChoreoEvent *event = info->m_pEvent;
		Assert( event );

		CChoreoScene *scene = info->m_pScene;
		Assert( scene );

		switch ( event->GetType() )
		{
		case CChoreoEvent::FLEXANIMATION:
			{
				if ( event->HasEndTime() )
				{
					AddFlexAnimation( info );
				}
			}
			break;
		case CChoreoEvent::EXPRESSION:
			{
				// Expressions have to have an end time!!!
				if ( event->HasEndTime() )
				{
					// Look up the actual strings
					const char *scenefile	= event->GetParameters();
					const char *name		= event->GetParameters2();
					
					// Have to find both strings
					if ( scenefile && name )
					{
						// Find the scene file
						flexsettinghdr_t *pExpHdr = ( flexsettinghdr_t * )FindSceneFile( scenefile );
						if ( pExpHdr )
						{
							flexsettinghdr_t  *pOverrideHdr = NULL;
							
							// Find overrides, if any exist
							studiohdr_t	*hdr = GetModelPtr();
							
							if ( hdr && scene_allowoverrides.GetBool() )
							{
								char overridefile[ 512 ];
								char shortname[ 128 ];
								char modelname[ 128 ];
								
								//Q_strncpy( modelname, modelinfo->GetModelName( model ) ,sizeof(modelname));
								Q_strncpy( modelname, hdr->name ,sizeof(modelname));
								
								// Fix up the name
								Extract_FileBase( modelname, shortname );
								
								Q_snprintf( overridefile,sizeof(overridefile), "%s/%s", shortname, scenefile );
								
								pOverrideHdr = ( flexsettinghdr_t * )FindSceneFile( overridefile );
							}
							
							float scenetime = scene->GetTime();
							
							float scale = event->GetIntensity( scenetime );
							
							// Add the named expression
							AddExpression( name, scale, pExpHdr, pOverrideHdr, !info->m_bStarted );
						}
					}
				}
			}
			break;
		case CChoreoEvent::SEQUENCE:
			{
				AddFlexSequence( info );
			}
			break;
		case CChoreoEvent::GESTURE:
			{
				AddFlexGesture( info );
			}
			break;
		default:
			break;
		}

		/*
		float scenetime = scene->GetTime();

		float scale = event->GetIntensity( scenetime );
		Msg( "%s %f : ", event->GetName(), scale );
	
		// Add the named expression
		AddExpression( name, scale, pExpHdr, pOverrideHdr, !info->m_bStarted );
		*/

		info->m_bStarted = true;
	}
}