/**
  * {@inheritdoc}
  */
 protected function execute(InputInterface $input, OutputInterface $output)
 {
     $filename = $input->getOption('filename');
     if (!$filename) {
         $resource = STDIN;
     } else {
         try {
             $file = new \SplFileInfo($filename);
         } catch (\Exception $e) {
             throw new \InvalidArgumentException('Bad filename');
         }
         $resource = fopen($file->getRealPath(), 'rb');
     }
     $width = $input->getArgument('width');
     $height = $input->getArgument('height');
     $dim = $input->getArgument('dim');
     if (!$width) {
         $width = VisualizationEqualizer::WIDTH_DEFAULT;
     }
     if (!$height) {
         $height = VisualizationEqualizer::HEIGHT_DEFAULT;
     }
     if (!$dim) {
         $dim = VisualizationEqualizer::DIM_DEFAULT;
     }
     $render = new ConsoleRender($output);
     $render->setDisplayColor(true);
     $wavReader = new WavReader($resource, new Riff(), new Fmt(), new Data());
     $visualizationEqualizer = new VisualizationEqualizer($resource, $dim, $wavReader, $render);
     $visualizationEqualizer->run((int) $width, (int) $height);
 }
Esempio n. 2
0
 public function testGetDisplayColor()
 {
     $object = new ConsoleRender($this->output);
     $object->setDisplayColor('red');
     $this->assertEquals('red', $object->getDisplayColor());
 }