Finds an unused audio element, marks it as in use, and return it.
549672
function() {
            for (var i = 0; i < this.channels.length; i++) {
                var chan = this.channels[i];
                /*
                   * Second test looks for stuff that's out of use,
                   * but fallen foul of Chromium bug 280417
                   */
                if (
                    chan.active === false ||
                    (chan.obj.ended &&
                        chan.repeat <= this.sounds[chan.id].played)
                ) {
                    chan.active = true;
                    return chan;
                }
            }
            // If necessary, create a new element, unless we've already reached the max limit
            if (i < this.maxChannels) {
                var c = {
                    obj: this.audioElement(),
                    active: true,
                    // Checks that the channel is being used to play sound id
                    _is: function(id) {
                        return this.id === id && this.active;
                    }
                };
                this.channels.push(c);
                return c;
            }
            // In that case, return null
            return null;
        }
879230
function (file, unused, cb) {
    if (file.isNull()) {
      // nothing to do
      return cb(null, file)
    } else if (file.isStream()) {
      // file.contents is a Stream.  We don't support streams
      this.emit('error', new PluginError(PLUGIN_NAME, 'Streams not supported!'))
    } else if (file.isBuffer()) {
      // lazy init the acss class
      if (!acss) {
        acss = new Atomizer()

        if (addRules) {
          acss.addRules(addRules)
        }
      }

      // generate the class names and push them into the global collector array
      var html = String(file.contents)
      var classes = acss.findClassNames(html)
      foundClasses = Array.prototype.concat(foundClasses, classes)

      // make a note of this file if it's the newer than we've seen before
      if (!latestMod || file.stat && file.stat.mtime > latestMod) {
        latestFile = file
        latestMod = file.stat && file.stat.mtime
      }

      // tell the engine we're done
      cb()
    }
  }
459295
def pick_unused_port():
  
  s = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
  s.bind(('localhost', 0))
  addr, port = s.getsockname()
  s.close()
  return port
1356234
def asset_element_present(self, locator, msg=None):
        
        e = driver.find_elements_by_locator(locator)
        if len(e) == 0:
            raise AssertionError("Element at %s was not found" % locator)
664595
function mediaElementLoaded (el) {
  if (!el.hasAttribute('autoplay') && el.getAttribute('preload') !== 'auto') {
    return;
  }

  // If media specifies autoplay or preload, wait until media is completely buffered.
  return new Promise(function (resolve, reject) {
    if (el.readyState === 4) { return resolve(); }  // Already loaded.
    if (el.error) { return reject(); }  // Error.

    el.addEventListener('loadeddata', checkProgress, false);
    el.addEventListener('progress', checkProgress, false);
    el.addEventListener('error', reject, false);

    function checkProgress () {
      // Add up the seconds buffered.
      var secondsBuffered = 0;
      for (var i = 0; i < el.buffered.length; i++) {
        secondsBuffered += el.buffered.end(i) - el.buffered.start(i);
      }

      // Compare seconds buffered to media duration.
      if (secondsBuffered >= el.duration) {
        // Set in cache because we won't be needing to call three.js loader if we have.
        // a loaded media element.
        // Store video elements only. three.js loader is used for audio elements.
        // See assetParse too.
        if (el.tagName === 'VIDEO') {
          THREE.Cache.files[el.getAttribute('src')] = el;
        }
        resolve();
      }
    }
  });
}
1202559
function() {
            this.supported = {};
            // Without support, no formats are supported
            if (!Crafty.support.audio) return;
            var audio = this.audioElement(),
                canplay;
            for (var i in this.codecs) {
                canplay = audio.canPlayType(this.codecs[i]);
                if (canplay !== "" && canplay !== "no") {
                    this.supported[i] = true;
                } else {
                    this.supported[i] = false;
                }
            }
        }
193403
def getBoolTrackedDeviceProperty(self, unDeviceIndex, prop):
        """"""

        fn = self.function_table.getBoolTrackedDeviceProperty
        pError = ETrackedPropertyError()
        result = fn(unDeviceIndex, prop, byref(pError))
        return result, pError
598339
function getAudioContext() {

        // Fallback to Webkit-specific AudioContext implementation
        var AudioContext = window.AudioContext || window.webkitAudioContext;

        // Get new AudioContext instance if Web Audio API is supported
        if (AudioContext) {
            try {

                // Create new instance if none yet exists
                if (!Guacamole.AudioContextFactory.singleton)
                    Guacamole.AudioContextFactory.singleton = new AudioContext();

                // Return singleton instance
                return Guacamole.AudioContextFactory.singleton;

            }
            catch (e) {
                // Do not use Web Audio API if not allowed by browser
            }
        }

        // Web Audio API not supported
        return null;

    }
397349
function() {
      var self = this;

      if (!self.autoSuspend || !self.ctx || typeof self.ctx.suspend === 'undefined' || !Howler.usingWebAudio) {
        return;
      }

      // Check if any sounds are playing.
      for (var i=0; i<self._howls.length; i++) {
        if (self._howls[i]._webAudio) {
          for (var j=0; j<self._howls[i]._sounds.length; j++) {
            if (!self._howls[i]._sounds[j]._paused) {
              return self;
            }
          }
        }
      }

      if (self._suspendTimer) {
        clearTimeout(self._suspendTimer);
      }

      // If no sound has played after 30 seconds, suspend the context.
      self._suspendTimer = setTimeout(function() {
        if (!self.autoSuspend) {
          return;
        }

        self._suspendTimer = null;
        self.state = 'suspending';
        self.ctx.suspend().then(function() {
          self.state = 'suspended';

          if (self._resumeAfterSuspend) {
            delete self._resumeAfterSuspend;
            self._autoResume();
          }
        });
      }, 30000);

      return self;
    }
269054
function(id) {
      var self = this;

      if (self._endTimers[id]) {
        // Clear the timeout or remove the ended listener.
        if (typeof self._endTimers[id] !== 'function') {
          clearTimeout(self._endTimers[id]);
        } else {
          var sound = self._soundById(id);
          if (sound && sound._node) {
            sound._node.removeEventListener('ended', self._endTimers[id], false);
          }
        }

        delete self._endTimers[id];
      }

      return self;
    }
814060
def get_audio_metadata_old(fname):
    
    audio_dict = {}
    print("IDv2 tag info for %s:" % fname)
    try:
        audio = mutagenx.id3.ID3(fname, translate=False)
    except StandardError as err:
        print("ERROR = " + str(err))
    #else:
        #print(audio.pprint().encode("utf-8", "replace"))
        #for frame in audio.values():
        #    print(repr(frame))
    
    try:
        audio_dict["title"] = audio["title"]
    except KeyError:
        print("No title")
        
    try:
        audio_dict["artist"] = audio["artist"] # tags['TPE1'] 
    except KeyError:
        print("No artist")
        
    try:
        audio_dict["album"] = audio["album"]
    except KeyError:
        print("No album")
        
    try:
        audio_dict["length"] = audio["length"]
    except KeyError:
        print("No length")
        
    #pprint.pprint(audio.tags)
        
    return audio_dict
934061
function() {
			_private.oLog.info(sModuleName + " - Stop");
			var mHarContent = null;
			if (_private.isRecordStarted()) {
				mHarContent = _private.getHarContent(true);
			}

			// do this for a full cleanup
			_private.init();

			return mHarContent;
		}
959594
function() {
         var self = this;

         // Stop playing any active sounds.
         var sounds = self._sounds;
         for (var i=0; i<sounds.length; i++) {
           // Stop the sound if it is currently playing.
           if (!sounds[i]._paused) {
             self.stop(sounds[i]._id);
           }

           // Remove the source or disconnect.
           if (!self._webAudio) {
             // Set the source to 0-second silence to stop any downloading (except in IE).
             var checkIE = /MSIE |Trident\//.test(Howler._navigator && Howler._navigator.userAgent);
             if (!checkIE) {
               sounds[i]._node.src = 'data:audio/wav;base64,UklGRigAAABXQVZFZm10IBIAAAABAAEARKwAAIhYAQACABAAAABkYXRhAgAAAAEA';
             }

             // Remove any event listeners.
             sounds[i]._node.removeEventListener('error', sounds[i]._errorFn, false);
             sounds[i]._node.removeEventListener(Howler._canPlayEvent, sounds[i]._loadFn, false);

             // Release the Audio object back to the pool.
             Howler._releaseHtml5Audio(sounds[i]._node);
           }

           // Empty out all of the nodes.
           delete sounds[i]._node;

           // Make sure all timers are cleared out.
           self._clearTimer(sounds[i]._id);
         }

         // Remove the references in the global Howler object.
         var index = Howler._howls.indexOf(self);
         if (index >= 0) {
           Howler._howls.splice(index, 1);
         }

         // Delete this sound from the cache (if no other Howl is using it).
         var remCache = true;
         for (i=0; i<Howler._howls.length; i++) {
           if (Howler._howls[i]._src === self._src || self._src.indexOf(Howler._howls[i]._src) >= 0) {
             remCache = false;
             break;
           }
         }

         if (cache && remCache) {
           delete cache[self._src];
         }

         // Clear global errors.
         Howler.noAudio = false;

         // Clear out `self`.
         self._state = 'unloaded';
         self._sounds = [];
         self = null;

         return null;
       }
2817
function onAudioLoad(e) {
    if (audio.soundSource === undefined) {
    // create a sound source
      audio.soundSource = audio.context.createMediaElementSource(audio.element);
    } else {
      audio.soundSource.disconnect();
    }

    // Connectors
    audio.soundSource.connect(audio.analyser);
    audio.soundSource.connect(audio.splitter);

    // Sound is loaded and ready to start playing
    audio.loaded = true;
  }
281317
function AudioFeature() {
      var _this;

      var ua = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : null;
      var flags = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
      var cssFlagsPrefix = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : 'audio';

      _classCallCheck(this, AudioFeature);

      _this = _possibleConstructorReturn(this, _getPrototypeOf(AudioFeature).call(this, ua, flags, cssFlagsPrefix));

      _this._createTestElements();

      _this.context = _this.getContext();
      _this.formats = {
        mp3: _this.getMp3(),
        webm: _this.getWebm(),
        ogg: _this.getOgg(),
        opus: _this.getOpus(),
        wav: _this.getWav(),
        m4a: _this.getM4a()
      };
      return _this;
    }
8584
def _unused_label(self, label):
        """"""
        original = label
        existing = self.labels
        i = 2
        while label in existing:
            label = '{}_{}'.format(original, i)
            i += 1
        return label
615941
def unused(self):
        
        self._params.update(
            href=self._resource.get('search_unused'))
        return self