Hello Mr @zhangxm and @mr.kylin ,
I’m engaged on audio supply adjustment (including parameter for pitch). Any suggestion which file(s) I ought to modify so It could possibly implement effectively in native platform particularly for home windows.
I’ve tried to change these information:
- CocosEnginenativecocosaudiooalsoftAudioEngine-soft.h / .cpp
- CocosEnginenativecocosaudiooalsoftAudioPlayer.h / .cpp
however ultimately, when I attempt to compile simulator app utilizing command “gulp gen-simulator”, It offers empty construct (no .exe)
@westdragoneye what’s your cocos creator model?
Hello Mr @zhangxm , Thanks for repy.
It’s 3.8.0 sir
Is that this a warning, not an error? Are there every other errors?
I’ve look total log when I’m working gulp command however there isn’t any “error” message. And primarily based on my ss high there that’s the one one appears sus.
however the level of this matter, it’s not about which log error is. I need to know which file(s) I ought to modify if we need to add new parameter to exist module.
For instance: If person of this engine wanna add pitch parameter for audio supply, Which file(s) ought to comply with for modification. I wager the one who is aware of this case is cocos group proper?
hello Mr. @zhangxm any replace but?
You possibly can work on the .ts information, as acknowledged on 3.8 right here Cocos Creator 3.8 Handbook – Engine Customization Workflow
C:ProgramDatacocoseditorsCreator3.8.1resourcesresources3denginecocosaudioaudio-source.ts
Right here I looked for ‘quantity’, then copy/paste/renamed to ‘pitch’ each occurence (all however @tooltip('i18n:audio.quantity') which is right here C:ProgramDatacocoseditorsCreator3.8.1resourcesresources3dengineeditori18n[langCode]localization.js if you happen to could).
C:ProgramDatacocoseditorsCreator3.8.1resourcesresources3dengine@typespalaudio.d.ts
On this one I fastened the errors from the opposite file modifications (constructor, getter and setter, loadOneShotAudio).
C:ProgramDatacocoseditorsCreator3.8.1resourcesresources3denginebin.declarationscc.d.ts
And eventually added the pitch variable getter and setter to the AudioSource class.
Complile the engine (Developer->Compile the engine) and reload (Developer->Reload).
This will provide you with the pitch discipline within the part inspector and also you’ll be capable of entry it through code (this.node.getComponent(AudioSource).pitch) to work from there.
Wow thanks @coimbra , It is a new data for me. I didn’t notice there may be …engine@typespalaudio.d.ts.
Give me a couple of minutes I’ll let you understand my progress.
1 Like
Hello @coimbra , I’ve implement all steps that you simply given to me but it surely offers none pitch impact and I believe there’s something must do with OpenAL scripts.
Like I point out earlier than I added OpenAL API (for pitch management) in :
…EnginenativecocosaudiooalsoftAudioEngine-soft.h / .cpp
additionally in …EnginenativecocosaudiooalsoftAudioPlayer.h / .cpp
Are there any cpp scripts beside that two scritps that must deal with?
These steps had been solely so as to add a variable to the part. I’m nonetheless making an attempt to determine tips on how to apply it to the pitch, since in enginenativecocosaudiooalsoftAudioPlayer.cpp we have already got a line for the pitch, however with a hardcoded worth alSourcef(_alSource, AL_PITCH, 1.0F);
I’ve run by means of a bunch of information making an attempt to make it work with a _pitch variable, however i’m misplaced on this maze. Nonetheless trying although.
1 Like
Guess i’m caught virtually in the identical spot as you had been. Gulp appears to builds, however my editor crashes after. Eliminated and reinstalled nodejs; tried just a few occasions with completely different engine variations; however all the time ends in the identical: builds, then crashes. Can’t even inform you if the modifications utilized.
1 Like
take it straightforward @coimbra , you aren’t alone to really feel that. That’s why I really like open supply ![]()
I’ll attempt to replace cocos supply into 3.8.2 after which lets see the end result
1 Like
Howdy everybody. I’ve figured it out to a point.
You possibly can see modifications on this fork on github: lampysprites/cocos-engine/commit/b6040f08c1cc24b935e1cfc067e9d1157f453d4a (i cannot submit hyperlinks!). The patch provides pitch property to AudioSource part.
At the moment, solely play methodology on openal-soft platform works correctly. I didn’t change playOneShot, and it broke from receiving pitch == 0. I plan to repair it will definitely.
It’d be nice if somebody contributed help to html5, android and apple platforms so it may be thought of for merging. For html5, there appear to be an current patch in the principle repo PR’s which isn’t but merged (i cannot submit hyperlinks!). I can maybe do html5, however have little or no expertise with cell improvement.
1 Like
Alrighty I’ve fastened one shot and (very crudely) merged html5 code from pr#9751, which works in browser at the least -leaving solely android and apple unfinished. It’s in the identical repository’s audio-pitch department.
2 Likes
I recognize your assist bro, I’m going to see your work. Thanks @extendable-arms
Hello, I adopted your hyperlink and it’s the samplerate change of the audio. I don’t assume I can discover the forked repo that you simply talked about. Is it closed?
THX
I discovered it in the principle repo at Audio playrate – help oalsoft, replace html5 by lampysprites · Pull Request #16764 · cocos/cocos-engine · GitHub
Observe this was two+ years, and a serious model in the past so likelihood is it received’t merge.
I’ve no vitality for fixing it, hope you perceive.
thnaks very a lot.
I’m not on-line final week. I simply transfer to fmod and add it to the projetc, lol.
however thanks on your replying.
1 Like


