Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

iOS: calling DBMeter.start multiple times results in -70db #15

Open
nexorianus opened this issue Sep 12, 2018 · 0 comments
Open

iOS: calling DBMeter.start multiple times results in -70db #15

nexorianus opened this issue Sep 12, 2018 · 0 comments

Comments

@nexorianus
Copy link

nexorianus commented Sep 12, 2018

When calling DBMeter.start() multiple times (accidentally or on purpose) the resulting dB value will always be -70.

I would suggest, throwing an error, on multiple starts.

My setup was:

const dummy = {
  dB: 0,
  isListening: false,
  startMeter() {
    const $this = this;
    setInterval(() => {
      if (!this.paused) {
        if (!this.isListening) {
          DBMeter.isListening((isListening) => {
            this.isListening = isListening;
            if (!isListening) {
              DBMeter.start(_.throttle($this.recordMeter, 100), $this.errorLog);
            }
          }, $this.errorLog);
          return;
        }
        // update stuff with this.db
      }
    }, 100);
  },
  recordMeter(dB) {
    this.dB = dB;
  },
  errorLog(e) { 
    // log
  }
};

On iOS the first few intervals DBMeter.isListening() passes false so i told the system to start again.
After like 0.3 to 1 second DBMeter.isListening() passes true.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant