Question about event state "Stopping" and transition cross instances

We used command instrument to implement such design. When Player enter battle ready state, we lower the volume of the BGM by using snapshots(which name in chinese), while play the Battle BGM. But player might quit such state at any time. In that case we want to stop the battle BGM, then turn on the previous BGM.

if we use snapshot instrument instead, the snapshot will stop immediately when the Battle BGM stopped. Since we want a fade in fade out transition, we switch to command instrument implementation.


pic2. we start the volume adjusting snapshot when start the Battle BGM


pic3. we set the condition as event state stopping

In the “Stop Snapshot” command instrument, I did such setup. But when I hit the stop button, the Battle BGM instance stuck in the Stopping state. I looked up related topic in the forum. It is said that, if we uses stopping condition, Fmod will not really stop the event instance and left it to developers.

I wonder, in such case, how should we implement the “Stop”? Of course we can try to use parameter condition. Moreover on the other hand, whats the best practice to implement transition (e.g. crossfade) between different instances?

Thankyou so much

Well, I think I’ve found a workaround about this.

I found that, if the playback marker leaves the snapshot instrument area, the snapshot stops itself with AHDSR activated. So instead of making snapshot instrument cover all the timeline, we shorten its length since we only need it when the event is looping in the loop region above.

Then, our player may quit the battle intro at anytime, so when they quit, we use a parameter to activate the transition region(mark in the picture). We may jump to a kind of escaping sound effect with a fade out. And at the same time, the snapshot, which controll the volume of another group, stops with a decay, allowing the volume raise slowly.

This seem to work just fine. But I’m still looking forward to your replay, about the “stopping” question.

BTW, I try to call the EventInstance.stop() and pass the allow_fade_out, but the event seems to stop immediately. And it doesn’t trigger the stopsnapshot instrument (in my first post).

你好 :wave:,我之前也被类似的Stop问题困扰过,今天看到你发的使用了Event Condition之后会改变事件stop规则,又回去试着总结了一下。希望结论是对的而且能帮到你。没用Event Condition的时候一个事件的流程大概是这样的:事件Stopping→track Stopping → track Stopped→事件Stopped。但是用了Event Condition之后会改变事件的Stop条件。至于EventInstance.Stop()传入allow_fade_out和immediate的不同,应该就在于是否让track在Stopping状态下应用AHDSR。下面我开始自问自答一下。

事件什么时候进入Stopping状态?
1.主动调用Stop
2.满足以下所有条件的时候
a.所有乐器已经stop
b.playback position后面没有东西(指是乐器,以及有效的maker和region。(有效指的是condition和destination有值))

事件进入Stopping状态会做什么?
让所有track进入Stopping状态,track的AHDSR会被应用

Track进入Stopping状态会做什么?
应用AHDSR

Track什么时候会Stop?
AHDSR应用结束

事件什么时候会Stop?
一、没用Event condition的情况下
条件1.所有track已经stop
二、用了Event condition的情况下(所有条件都得满足)
条件1.playback position后面没东西
条件2.所有乐器已经stop
条件3.所有track已经stop

此外,还有乐器的stop,(下面的Untrigger指的就是playback position不和乐器的框重叠的那一刻)
async状态下,
没cut,乐器有AHDSR的时候,untrigger就会进入stopping,调用AHDSR
没cut,乐器没AHDSR的时候,untrigger不会发生什么,会让instrument播放完
有cut,乐器有AHDSR的时候,untrigger进入stopping,调用AHDSR
有cur,乐器没AHDSR的时候,untrigger直接停止。

Sync状态下
untrigger时,乐器直接停止

题外话
这里看你图里带中文就默认你是汉语使用者了,我就直接让我们说中文了。有问题欢迎交流,秋秋号是867166780

光顾着总结了,不知道你fmod项目具体怎么安排的,如果你期望event.Stop之后有fadeout,但是他好像马上停了,应该是track上没加AHDSR吧。乐器上的AHDSR好像是别的情况下会用到。至于snapshot的那个instrument就不太清楚了,个人觉得snapshot直接放到轨道里然后给他加intensity的automation曲线也挺好用的。

感谢回复. 先在这个post里回一下. 我后面看了很多文档的说明, 看来之前没有仔细研究过.

测试了一下,snapshot的stop与untrigger.

  1. 当playback position在instrument上stop,即使进入了stopping的状态, 也不会应用adhsr.
  2. playback position离开instrument区域,也即untrigger,即使是跳转, 也会应用ADHSR
  3. 最上方的pic3所显示的通过command instrument来stop snapshot, 会触发ADHSR

目前看来, 如果想要触发snapshot自身设置的intensity ADHSR, 直接触发untrigger似乎是最简单直接的方式. 所以我们之后大概率会采用我第二个回复的实现方式.

实际上我后来发现, 由于我上面的event是包含在一个parameter sheet当中, 而我直接对这个parameter sheet进行stop操作会直接停止这个event. 而如果对event直接操作,则会触发AHDSR.

关于这个问题, 如果想要触发snapshot自身的AHDSR, 总结一下:

  1. 当使用snapshot instrument时, 可以让playback position离开instrument区域
  2. 当使用command instrument的start snapshot event的时候, 再加入一个stopping condition触发的stop snapshot event也可以触发. (前提是让event顺利进入stopping)

A brief summary about how to apply AHDSR of a snapshot:

  1. When using snapshot instrument, the AHDSR will be applied when playback position leave the snapshot area.
  2. When using Command Instrument to start a snapshot event, the AHDSR will be applied as long as you add another Command Instrument which “stop snapshot event” by “stopping conditon”. (Make sure you enter stopping state successfully).

After looking up the forum and the documentation. When using “Stopping Codition” in the event, calling “Stop” will let the event enter “Stopping State”. In that state, AHDSR will be applied and the event won’t stop till it reach the “natural end”. The “natural end,” in my understanding, refers to when the playback position reaches the end of all tracks.

But what if the “Stop” is called in a loop region? Well I tried it and the event stucks in that loop region and never ends. To break this loop, I add a codition to the loop region, showed in the picture below.

It breaks the loop region when enter “Stopping State”.

Or, if I want the event stop right away, I can also add a large traition region.

I wonder whether the work around above is the recommanded approach. Looking forward to reply.

(>w<)
关于Snapshot,后来发现可以直接当成一个Event来调用。直接RuntimeManager.CreateInstance(snapshot的GUID),然后如果你在snapshot上的Intensity上加了AHDSR的话,会直接在start和stop这个snapshot的时候调用。

至于一些best practice,不知道你们有没有去研究过蔚蓝的fmod项目,b站上还有搬运的音频工程师的讲解视频(只包含fmod相关,没有程序方面的),有四个小时。作为一个之前完全没接触过音频的鼠鼠程序,感觉学到了挺多的。

蔚蓝fmod项目在fmod官网就有,b站讲解视频链接[转载] Celeste FMOD Commentary

再偷偷附上个看视频记的笔记,如果打算研究下蔚蓝项目的话,希望能有用。

非常感谢, 我之前只是自己在看蔚蓝的项目, 这个解析视频确实没看到过.

是, 我们项目中可能会混合使用两种方式, 某些通用的snapshot会由代码调用. 而由于某些event中, snapshot的触发与timeline存在关联, 所以尝试把这些snapshot加入到event中, 减少一定调用量. 其实就是在蔚蓝项目中也看到了这样的实践.

Yes, we may take both two approaches in our project. Some general snapshots might be triggered through code, while for certain events where the triggering of snapshots is strongly related to the timeline, we attempt to use snapshots directly within the event to reduce the number of calls. Actually this practice was also observed in the Celeste project.

你好,非常感谢你们分享的信息和解决方法!

Event Condition 确实就像你们讨论的那样,如果在 Command Instrument 里设置了“Event Condition”为“Stopping”,并且Event仍处于“Stopping”状态,这通常是因为Event正在等待所有设置的结束条件(如淡出等)完成。如果这些条件没有正确设置或执行,事件就会持续处于“Stopping”状态,直到所有条件得到满足。

除了上面你们提到的方法外,你也可以考虑在相关Bus的Fader上添加Automation,对Parameter应用Seek Speed。这样可以在不需要编程的情况下达到渐入渐出,平滑过渡的效果。详细的流程我在这篇帖子里发过,如果你感兴趣的话可以看一下: setMuteFadeSpeed for FMOD Studio? - #2 by li_fmod

有任何问题欢迎随时提问。

学到了!感谢分享 : )

1 Like