Page 1 of 1

No method for Load sound-Audio Controls Editor in C# code

Posted: Sun Apr 22, 2018 2:00 pm
by ahmad0karami
I use CryEngine 5.4.0 Build 164 Final


Problem :
I searched a lot for find mehtod or methods for load sound but all output methods is uint !!! ( Engine.AudioSystem )
I want play sound according to this property bottom :

public string _sound1;
[EntityProperty(EntityPropertyType.Sound)]
public string Sound1
{
set {

_sound1 = value;
}

get{

return _sound1;
}

}


Where is the method for play sound?

Re: No method for Load sound-Audio Controls Editor in C# code

Posted: Tue Apr 24, 2018 3:49 pm
by Cry-Flare
Hey Ahmad,

First you will want to setup your Audio Triggers using ACE (Tools->Audio Controls Editor), in the Sandbox Editor. (I assume you are using SDL Mixer for now).
Then you can execute these triggers in C# with something like:

Code: Select all

AudioTriggerId MyTriggerId = Audio.GetTriggerId("My_Trigger_Name");
Audio.Play(MyTriggerId);

Re: No method for Load sound-Audio Controls Editor in C# code

Posted: Tue Apr 24, 2018 4:34 pm
by ahmad0karami
Hey Ahmad,

First you will want to setup your Audio Triggers using ACE (Tools->Audio Controls Editor), in the Sandbox Editor. (I assume you are using SDL Mixer for now).
Then you can execute these triggers in C# with something like:

Code: Select all

AudioTriggerId MyTriggerId = Audio.GetTriggerId("My_Trigger_Name");
Audio.Play(MyTriggerId);
if it is possible , please tell me , how to implement this instruction in c++?

thank you so much :-)

Re: No method for Load sound-Audio Controls Editor in C# code

Posted: Tue Apr 24, 2018 4:42 pm
by ahmad0karami
Hey Ahmad,

First you will want to setup your Audio Triggers using ACE (Tools->Audio Controls Editor), in the Sandbox Editor. (I assume you are using SDL Mixer for now).
Then you can execute these triggers in C# with something like:

Code: Select all

AudioTriggerId MyTriggerId = Audio.GetTriggerId("My_Trigger_Name");
Audio.Play(MyTriggerId);

I'm one year old when I want to write with C++, but I really have a lot of questions and I'm going very slowly :-( I made great tutorials for Schematyc, Flowgraph, and C # for people.
But I want to make my game via C++.

Re: No method for Load sound-Audio Controls Editor in C# code

Posted: Tue Apr 24, 2018 4:55 pm
by Cry-Flare
The equivalent in C++ would be:

Code: Select all

CryAudio::ControlId const MyTriggerId = CryAudio::StringToId("My_Trigger_Name");
gEnv->pAudioSystem->ExecuteTrigger(MyTriggerId);
Although you may need to handle loading and unloading of the trigger manually, depending where and how you use this.

Re: No method for Load sound-Audio Controls Editor in C# code

Posted: Tue Apr 24, 2018 5:43 pm
by ahmad0karami
The equivalent in C++ would be:

Code: Select all

CryAudio::ControlId const MyTriggerId = CryAudio::StringToId("My_Trigger_Name");
gEnv->pAudioSystem->ExecuteTrigger(MyTriggerId);
Although you may need to handle loading and unloading of the trigger manually, depending where and how you use this.
When I left-click First Person Project C++ template , I hear a sound bullet , I checked C++ codes , but I found nothing :-) where I can delete this sound inside C++ ? I know this sound is inside Audio Controls Editor , please help me , thank you ;-)

Re: No method for Load sound-Audio Controls Editor in C# code

Posted: Tue Apr 24, 2018 6:24 pm
by Cry-Thomas
That audio trigger is executed as part of a material effect. I explained in detail how that works here:
viewtopic.php?f=25&t=4245&hilit=excel#p10298

Re: No method for Load sound-Audio Controls Editor in C# code

Posted: Tue Apr 24, 2018 10:47 pm
by ahmad0karami
That audio trigger is executed as part of a material effect. I explained in detail how that works here:
viewtopic.php?f=25&t=4245&hilit=excel#p10298
thank you so much , but I love implement all my code with C++ , I think C++ is best chose ;-)