Can't record audio with AudioToolbox on MacOS Mojave

I want to record audio from my Mac's default mic into file. I try to use Audio Toolbox but all examples from the internet (http://www.odiemus.cz/mirrors/iphone/developers/recording_sound.html or http://www.gson.org/bugs/apple/coreaudio/rectest.cc or example from book Learning CoreAudio - https://gist.github.com/goganchic/7a8960611dd2811e1d6c9d7ff258b9a4) generates file with silence.

I'd tried to change output file format (aiff, caf), change audio format (LinearPCM, AAC) - nothing helped. I'd print default device name - it's "Built-in Microphone". Everything looks fine but there is no sound 😟

I've tried Apple official example but still only silence in the result file.

Any ideas what can be wrong?

P.s. in different well know apps like skype, slack, Photo Booth and so on there is no problems with sound recording.