Create pcm volume controller.

@function
3671
function gain(options) {
	// gain()
	if (options == null) options = {volume: 1};

	// gain(Function)
	// gain(Number)
	else if (typeof options === 'function' || typeof options === 'number')  options = {volume: options};

	var volume;
	if (options.mode === 'tan') {
		volume = Math.tan(options.volume);
	} else {
		volume = options.volume;
	}

	//in case if volume is fn
	if (typeof volume === 'function') return buf => util.fill(buf, (v, x, channels) => v * volume(x, channels, v));

	return buf => util.fill(buf, v => v * volume);
}
1288143
function thumbTypeAudio() {
        $url = $this->getAttachUrl();
        return \HtmlAudio::setSrc($url . '?' . microtime(true))
                         ->setControls('controls');
    }
1328068
function() {
		var api_url,
			self = this;

		// Create Dom element
		this._el.content_item	= TL.Dom.create("div", "tl-media-item tl-media-iframe tl-media-soundcloud tl-media-shadow", this._el.content);

		// Get Media ID
		this.media_id = this.data.url;

		// API URL
		api_url = "https://soundcloud.com/oembed?url=" + this.media_id + "&format=js&callback=?"

		// API Call
		TL.getJSON(api_url, function(d) {
			TL.Load.js("https://w.soundcloud.com/player/api.js", function() {//load soundcloud api for pausing.
				self.createMedia(d);
			});
		});

	}
796451
function createEventHandlers (playemFunctions) {
      var eventHandlers = {
        onApiReady: function (player) {
          // console.log(player.label + " api ready");
          if (whenReady && player == whenReady.player) { whenReady.fct() }
          if (--playersToLoad == 0) { that.emit('onReady') }
        },
        onEmbedReady: function (player) {
          // console.log("embed ready");
          setVolume(volume)
        },
        onBuffering: function (player) {
          setTimeout(function () {
            setPlayTimeout()
            that.emit('onBuffering')
          })
        },
        onPlaying: function (player) {
          // console.log(player.label + ".onPlaying");
          // setPlayTimeout(); // removed because soundcloud sends a "onPlaying" event, even for not authorized tracks
          setVolume(volume)
          setTimeout(function () {
            that.emit('onPlay')
          }, 1)
          if (player.trackInfo && player.trackInfo.duration) {
            eventHandlers.onTrackInfo({
              position: player.trackInfo.position || 0,
              duration: player.trackInfo.duration
            })
          }

          if (progress) { clearInterval(progress) }

          if (player.getTrackPosition) {
            // var that = eventHandlers; //this;
            progress = setInterval(function () {
              player.getTrackPosition(function (trackPos) {
                eventHandlers.onTrackInfo({
                  position: trackPos,
                  duration: player.trackInfo.duration || currentTrack.trackDuration
                })
              })
            }, 1000)
          }
        },
        onTrackInfo: function (trackInfo) {
          // console.log("ontrackinfo", trackInfo, currentTrack);
          if (currentTrack && trackInfo) {
            if (trackInfo.duration) {
              currentTrack.trackDuration = trackInfo.duration
              setPlayTimeout()
            }
            if (trackInfo.position) { currentTrack.trackPosition = trackInfo.position }
          }
          that.emit('onTrackInfo', currentTrack)
        },
        onPaused: function (player) {
          // console.log(player.label + ".onPaused");
          setPlayTimeout()
          if (progress) { clearInterval(progress) }
          progress = null
          // if (!avoidPauseEventPropagation)
          //  that.emit("onPause");
          // avoidPauseEventPropagation = false;
        },
        onEnded: function (player) {
          // console.log(player.label + ".onEnded");
          stopTrack()
          that.emit('onEnd')
          playemFunctions.next()
        },
        onError: function (player, error) {
          console.error(player.label + ' error:', ((error || {}).exception || error || {}).stack || error)
          setPlayTimeout()
          that.emit('onError', error)
        }
      };
      // handlers will only be triggered is their associated player is currently active
      ['onEmbedReady', 'onBuffering', 'onPlaying', 'onPaused', 'onEnded', 'onError'].map(function (evt) {
        var fct = eventHandlers[evt]
        eventHandlers[evt] = function (player, x) {
          if (currentTrack && player == currentTrack.player) { return fct(player, x) }
          /*
          else if (evt != "onEmbedReady")
            console.warn("ignore event:", evt, "from", player, "instead of:", currentTrack.player);
          */
        }
      })
      return eventHandlers
    }
1208495
protected function setupComposer()
    {
        $composer_file = $this->getComposerJsonFile();
        $contents = json_decode(file_get_contents($composer_file), true);
        if (!isset($contents['autoload']['files'])) {
            // Cria a seção files
            $contents['autoload']['files'] = [];
        }

        $autoloader_file = $this->getAutoloaderFile();
        if (array_search($autoloader_file, $contents['autoload']['files']) === false) {
            // Adiciona o arquivo com prioridade
            $contents['autoload']['files'] = array_merge(
                [$autoloader_file],
                $contents['autoload']['files']
            );
        }

        $json_contents = str_replace("\\/", "/", json_encode($contents, JSON_PRETTY_PRINT));
        if (file_put_contents($composer_file, $json_contents) === false) {
            $this->getObfuscator()->addErrorMessage("Could not update composer.json file");
            return false;
        }

        $this->getObfuscator()->addErrorMessage("O arquivo composer.json foi configurado com sucesso.");

        return true;
    }
1181826
function() {
		var t = this;
		var play = document.createElement('div');
		play.className = 'zy_playpause_btn zy_play';
		t.controls.appendChild(play);
		play.addEventListener('click', function() {
			t.media.isUserClick = true;

			if (t.media.paused) {
				t.media.play();
				// Controls bar auto hide after 3s
				if (!t.media.paused && !t.options.alwaysShowControls) {
					t.setControlsTimer(3000)
				}
			} else {
				t.media.pause()
			}
		});

		function togglePlayPause(s) {
			if (t.media.isUserClick || t.options.autoplay) {
				if ('play' === s) {
					_removeClass(play, 'zy_play');
					_addClass(play, 'zy_pause')
				} else {
					_removeClass(play, 'zy_pause');
					_addClass(play, 'zy_play')
				}
			}
		};

		t.media.addEventListener('play', function() {
			togglePlayPause('play')
		});

		t.media.addEventListener('playing', function() {
			togglePlayPause('play')
		});

		t.media.addEventListener('pause', function() {
			togglePlayPause('pse')
		});

		t.media.addEventListener('paused', function() {
			togglePlayPause('pse')
		});
	}
614116
def run_crbox(self,spstring,form,output="",wavecat="INDEF",
                  lowave=0,hiwave=30000):
        """"""

        range=hiwave-lowave
        midwave=range/2.0
        iraf.countrate(spectrum=spstring, magnitude="",
                       instrument="box(%f,%f)"%(midwave,range),
                       form=form,
                       wavecat=wavecat,
                       output=output)
633162
function(data) {
			// NOTES: Do not touch data object
		
			var volumeid, contextmenu, emptyDirs = {}, stayDirs = {},
				rmClass, hashes, calc, gc, collapsed, prevcwd, sorterStr;
			
			if (self.api >= 2.1) {
				// support volume driver option `uiCmdMap`
				self.commandMap = (data.options.uiCmdMap && Object.keys(data.options.uiCmdMap).length)? data.options.uiCmdMap : {};
				if (uiCmdMapPrev !== JSON.stringify(self.commandMap)) {
					uiCmdMapPrev = JSON.stringify(self.commandMap);
				}
			} else {
				self.options.sync = 0;
			}
			
			if (data.init) {
				// init - reset cache
				files = {};
				ownFiles = {};
			} else {
				// remove only files from prev cwd
				// and collapsed directory (included 100+ directories) to empty for perfomance tune in DnD
				prevcwd = cwd;
				rmClass = 'elfinder-subtree-loaded ' + self.res('class', 'navexpand');
				collapsed = self.res('class', 'navcollapse');
				hashes = Object.keys(files);
				calc = function(i) {
					if (!files[i]) {
						return true;
					}
					
					var isDir = (files[i].mime === 'directory'),
						phash = files[i].phash,
						pnav;
					
					if (
						(!isDir
							|| emptyDirs[phash]
							|| (!stayDirs[phash]
								&& $('#'+self.navHash2Id(files[i].hash)).is(':hidden')
								&& $('#'+self.navHash2Id(phash)).next('.elfinder-navbar-subtree').children().length > 100
							)
						)
						&& (isDir || phash !== cwd)
						&& ! remember[i]
					) {
						if (isDir && !emptyDirs[phash]) {
							emptyDirs[phash] = true;
							$('#'+self.navHash2Id(phash))
							 .removeClass(rmClass)
							 .next('.elfinder-navbar-subtree').empty();
						}
						deleteCache(files[i]);
					} else if (isDir) {
						stayDirs[phash] = true;
					}
				};
				gc = function() {
					if (hashes.length) {
						gcJobRes && gcJobRes._abort();
						gcJobRes = self.asyncJob(calc, hashes, {
							interval : 20,
							numPerOnce : 100
						});
					}
				};
				
				self.trigger('filesgc').one('filesgc', function() {
					hashes = [];
				});
				
				self.one('opendone', function() {
					if (prevcwd !== cwd) {
						if (! node.data('lazycnt')) {
							gc();
						} else {
							self.one('lazydone', gc);
						}
					}
				});
			}

			self.sorters = {};
			cwd = data.cwd.hash;
			cache(data.files);
			if (!files[cwd]) {
				cache([data.cwd]);
			}

			// trigger event 'sorterupdate'
			sorterStr = JSON.stringify(self.sorters);
			if (prevSorterStr !== sorterStr) {
				self.trigger('sorterupdate');
				prevSorterStr = sorterStr;
			}

			self.lastDir(cwd);
			
			self.autoSync();
		}
663184
def create_flac (archive, compression, cmd, verbosity, interactive, filenames):
    """"""
    cmdlist = [cmd, filenames[0], '--best', '--output-name', archive]
    return cmdlist
702811
def create_sonos_playlist_from_queue(self, title):
        
        # Note: probably same as Queue service method SaveAsSonosPlaylist
        # but this has not been tested.  This method is what the
        # controller uses.
        response = self.avTransport.SaveQueue([
            ('InstanceID', 0),
            ('Title', title),
            ('ObjectID', '')
        ])
        item_id = response['AssignedObjectID']
        obj_id = item_id.split(':', 2)[1]
        uri = "file:///jffs/settings/savedqueues.rsq#{0}".format(obj_id)
        res = [DidlResource(uri=uri, protocol_info="x-rincon-playlist:*:*:*")]
        return DidlPlaylistContainer(
            resources=res, title=title, parent_id='SQ:', item_id=item_id)
1275711
private function createDefaultControllerMvcFile()
    {
        $moduleName = ucfirst($this->getModule());
        $moduleNameLower = strtolower($this->getModule());
        $moduleNameUpper = strtoupper($this->getModule());

        $moduleControllerFolder = MODULES_PATH . ucfirst($this->getModule()) . DS . 'src' . DS . ucfirst($this->getModule()) . DS . 'Controller';

        /* Criação do arquivo de controller padrão do módulo */
        $cityware_mvc_controller = file_get_contents(dirname(__FILE__) . DS . 'Module' . DS . 'Cityware_Mvc_Controller.tpl');
        $citywareMvcController = str_replace("%moduleName%", $moduleName, str_replace("%moduleNameUpper%", $moduleNameUpper, str_replace("%moduleNameLower%", $moduleNameLower, $cityware_mvc_controller)));
        file_put_contents($moduleControllerFolder . DS . 'AbstractActionController'.$moduleName.'.php', $citywareMvcController);
        chmod($moduleControllerFolder . DS . 'AbstractActionController'.$moduleName.'.php', 0644);
    }
338300
function LGAudioMediaSource() {
        this.properties = {
            gain: 0.5
        };

        this._audionodes = [];
        this._media_stream = null;

        this.addOutput("out", "audio");
        this.addInput("gain", "number");

        //create gain node to control volume
        var context = LGAudio.getAudioContext();
        this.audionode = context.createGain();
        this.audionode.graphnode = this;
        this.audionode.gain.value = this.properties.gain;
    }
865191
protected function createFolderPath()
    {
        $this->write('  + Adding folderPath');

        $rootFolders = $this->container->get('open_orchestra_media.repository.media_folder')->findBy(array('parent' => null));
        foreach ($rootFolders as $folder) {
            $oldPath = $folder->getPath();
            $folder->setPath('/');
            $event = $this->container->get('open_orchestra_media_admin.event.folder_event.factory')->createFolderEvent();
            $event->setFolder($folder);
            $event->setPreviousPath($oldPath);
            $this->container->get('event_dispatcher')->dispatch(FolderEvents::PATH_UPDATED, $event);
        }

        $this->container->get('object_manager')->flush();
    }
1223352
function _createBiquadFilter (defaults) {
    return function (context, opts) {
        if (audioContext) {
            opts = context;
            context = audioContext;
        }
        opts = assign(opts, defaults);

        var filter = context.createBiquadFilter();

        Object.keys(opts).forEach(function (option) {
            if (option !== 'type') {
                filter[option].value = opts[option];
            } else {
                filter.type = opts[option];
            }
        });

        return filter;
    };
}
469453
private function createMediaFolder()
    {
        $mediafolder = new \BackBee\NestedNode\MediaFolder(md5('media'));
        $mediafolder->setTitle('Mediacenter')->setUrl('/');
        $this->entyMgr->persist($mediafolder);
        $this->entyMgr->flush($mediafolder);
    }
19825
def libvlc_media_event_manager(p_md):
    '''
    '''
    f = _Cfunctions.get('libvlc_media_event_manager', None) or \
        _Cfunction('libvlc_media_event_manager', ((1,),), class_result(EventManager),
                    ctypes.c_void_p, Media)
    return f(p_md)
10856
def mount_volume(volume, device='/dev/xvdf', mountpoint='/mnt/data', fstype='ext4'):
    '''
    
    '''
    _ec2().attach_volume(volume, _host_node()['id'], device)
    time.sleep(1)
    sudo('mkdir -p "%s"' % mountpoint)
    sudo('mount -t "%s" "%s" "%s"' % (fstype, device, mountpoint))