AudioChannel speed and frequency changing for 3.3.2

Started by Gord10, Fri 31/10/2014 23:48:23

Previous topic - Next topic

Gord10

You might have seen that I've implemented my own SetSpeed function for Self. I had shared my own 3.2.1 of AGS, but that was such an old version of AGS. So, I implemented those new function to the newest version of AGS (3.3.2.0).

https://www.dropbox.com/s/r827hdym9a4quxv/AGS_3.3.2.0_AudioSpeedAndFreq.zip?dl=0

Not only SetSpeed is present, I've also implemented three new functions: SetFrequency(int newFreq), GetFrequency(), SweepFrequency( int timeMS, int newFreq).

SetSpeed(int newSpeed): Default speed is 1000. It works only for OGG and MP3.
SetFrequency(int newFreq): As far as I see, default is 44100 for OGG and MP3; 22050 for MOD. Works for MP3, OGG, MOD.
SweepFrequency(int timeMS, int newFreq): Gradually changes frequency to the target, during timeMS miliseconds.
Games are art!
My horror game, Self

monkey0506

Hey Gord, this sounds pretty cool, but if there's functions like GetFrequency and SetFrequency, it might make more sense to just implement (expose) this as a single "Frequency" property (attribute) with the getter and setter being hidden inside the engine code itself.

Also, the usual way of implementing these changes into the current code base is to use a pull request against the current development branch (develop-3.4.0) from your personal fork. It's pretty simple to set up, and this lets you make sure that there won't be any conflicts when we try to merge in your changes (make your changes, pull in the latest changes from the main repo's development branch, correct any conflicts, then submit a pull request).

Crimson Wizard

#2
I've added AudioChannel.Speed property to 3.4.0 branch. It also maps "SetSpeed" to it, so it is possible to run "Self" too with it (but SetSpeed does not appear in the Editor).

That is my personal opinion, but I would not like to add something like SweepFrequency as a internal function, because changing a parameter over time can be easily done in script (like Tween module does to many params).
Unless it is something unique in sound, of course.
E: OTOH, knowing that AGS is not very good at changing something at high rate, that may have sense. Some testing may show if AGS can achieve the same with common loop.

E2: But, what is the use for SetFrequency? It sounds like another way to define speed (or vice versa).
Sorry if I sound silly :). I am not an expert in this.

SMF spam blocked by CleanTalk