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 implement effectively in native platform particularly for home windows.
I’ve tried to switch these recordsdata:
- CocosEnginenativecocosaudiooalsoftAudioEngine-soft.h / .cpp
- CocosEnginenativecocosaudiooalsoftAudioPlayer.h / .cpp
however in the long run, 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 some other errors?
I’ve look whole log when I’m working gulp command however there isn’t any “error” message. And based mostly on my ss prime there that’s the one one appears to be like sus.
however the level of this subject, it’s not about which log error is. I wish to know which file(s) I ought to modify if we wish to add new parameter to exist module.
For instance: If consumer of this engine wanna add pitch parameter for audio supply, Which file(s) ought to observe for modification. I wager the one who is aware of this case is cocos staff proper?
hello Mr. @zhangxm any replace but?
You possibly can work on the .ts recordsdata, 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 in the event you 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 gives you the pitch area within the element inspector and also you’ll be capable of entry it by way of code (this.node.getComponent(AudioSource).pitch) to work from there.
Wow thanks @coimbra , It is a new data for me. I didn’t understand 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 however it offers none pitch impact and I believe there’s something have to 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 have to deal with?
These steps had been solely so as to add a variable to the element. I’m nonetheless attempting to determine learn 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 recordsdata attempting to make it work with a _pitch variable, however i’m misplaced on this maze. Nonetheless wanting although.
1 Like
Guess i’m caught nearly in the identical spot as you had been. Gulp appears to builds, however my editor crashes after. Eliminated and reinstalled nodejs; tried a couple of instances 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 like open supply ![]()
I’ll attempt to replace cocos supply into 3.8.2 after which lets see the outcome
1 Like
Howdy everybody. I’ve figured it out to some extent.
You possibly can see modifications on this fork on github: lampysprites/cocos-engine/commit/b6040f08c1cc24b935e1cfc067e9d1157f453d4a (i cannot publish hyperlinks!). The patch provides pitch property to AudioSource element.
Presently, 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 publish 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 no less than -leaving solely android and apple unfinished. It’s in the identical repository’s audio-pitch department.
2 Likes
I admire 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
Word this was two+ years, and a serious model in the past so chances are high it gained’t merge.
I’ve no power for fixing it, hope you perceive.

