Hello,
I created procedural sound generation (you press keys and it produce realistic flute sound). A have object witch have AudioSource and my script.
void Start()
{
AudioConfiguration audioConfig = AudioSettings.GetConfiguration();
audioConfig.speakerMode = AudioSpeakerMode.Mono;
audioConfig.sampleRate = 44100;
audioConfig.dspBufferSize = 1024;
AudioSettings.Reset(audioConfig);
if (audioSource != null)
audioSource.Play();
}
void OnAudioFilterRead(float[ ] data, int channels)
{
synthesizer.GetBuffer(data);
}
As you can see, I use OnAudioFilterRead method. In editor is everything ok. But when I make PC build there is some bug… OnAudioFilterRead isn’t called. But only sometimes. I asynchronously load scene (1st level) form menu and it works fine, then asynchronously load next level and bug will appear. Sometimes is broken both of levels.
On other hand, I use same method in Automatic procedural generating, which play specific songs and there is everything ok (on PC build).
Have anyone some advice? I read many posts, but none has solved my problem.
(yes, I know that I posted this thread yesterday, but I didn’t realize that it was on bad forum)