Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Angelscript audio bindings #3027

Merged
merged 8 commits into from May 3, 2023

Conversation

ohlidalp
Copy link
Member

@ohlidalp ohlidalp commented Mar 20, 2023

The screenshot shows updated demo script bundled with the game. To run it, open console and say loadscript demo_script.as.
obrazek

New objects: SoundClass, SoundScriptTemplateClass, SoundScriptInstanceClass
New enums: SoundTrigger, ModulationSource

The principal interface is in the GameScriptClass (global object game):

array<SoundScriptTemplateClass@>@ getAllSoundScriptTemplates()
SoundScriptTemplateClassPtr@ getSoundScriptTemplate(const string &in)
array<SoundScriptInstanceClass@>@ getAllSoundScriptInstances()
SoundClassPtr@ createSoundFromResource(const string &in filename, const string &in rg_name = string())
SoundScriptInstanceClassPtr@ createSoundScriptInstance(const string &in template, int actor_instance_id = -1)

@ohlidalp
Copy link
Member Author

I added a "sound follows player" checkbox to the 'demo_script.as' - you can use it to "pin" the sound to one place and run around to enjoy the spatial effect.
obrazek

Currently dummy, just tested to build and run OK.
Still dummy, just tested to build + run OK
The argument was used by 'TerrainObjectManager.cpp' but had no effect and the positioning and starting of the sound is done there anyway.

Also clarified what happens with `actor_id` attribute if the sound isn't created for an actor.
Still dummy, just tested to build + run OK
New objects: `SoundClass`, `SoundScriptTemplateClass`, `SoundScriptInstanceClass`
New enums: `SoundTrigger`, `ModulationSource`

The principal interface is in the `GameScriptClass` (global object `game`):

```
array<SoundScriptTemplateClass@>@ getAllSoundScriptTemplates()
SoundScriptTemplateClassPtr@ getSoundScriptTemplate(const string &in)
array<SoundScriptInstanceClass@>@ getAllSoundScriptInstances()
SoundClassPtr@ createSoundFromResource(const string &in filename, const string &in rg_name = string())
SoundScriptInstanceClassPtr@ createSoundScriptInstance(const string &in template, int actor_instance_id = -1)
```
- Fixed script audio not being audible after returning to menu
- Fixed SoundClass and SoundScriptInstanceClass having different functions to set position/velocity.
- Fixed 'demo_script.as' always playing sounds/soundscripts at <0 0 0> corner of the map
- Added "sound follows player" checkbox to 'demo_script.as'
Copy link
Collaborator

@CuriousMike56 CuriousMike56 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No issues found 👍

@ohlidalp ohlidalp merged commit 81d8809 into RigsOfRods:master May 3, 2023
2 checks passed
@ohlidalp ohlidalp deleted the angelscript_audio_diag branch May 3, 2023 20:42
ohlidalp added a commit to tritonas00/rigs-of-rods that referenced this pull request May 3, 2023
Tip: use demo_script.as to show list of soundsources, more info: RigsOfRods#3027
tritonas00 pushed a commit that referenced this pull request May 4, 2023
Tip: use demo_script.as to show list of soundsources, more info: #3027
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants