Ejemplo n.º 1
0
 def _onSample(self, data):
     try:
         if isinstance(data, buffer):
             data = bytes(data)
         self.messageQueue.put_nowait(('chunk', data))
     except QueueFull:
         ansi.error("Message queue to light process full! Continuing...")
Ejemplo n.º 2
0
    def _onSongChanged(self, tags, songInfo):
        print()
        ansi.stdout(
                "Analyzing audio file: {style.fg.blue}{file.currentFilename}{style.none}\n"
                    "{style.bold.fg.black}channels:{style.none} {file.channels}"
                    "   {style.bold.fg.black}sample rate:{style.none} {file.samplerate} Hz"
                    "   {style.bold.fg.black}duration:{style.none} {file.duration} s",
                file=self.sampleGen
                )

        try:
            self.messageQueue.put_nowait(('songChange', self.sampleGen.currentFilename, songInfo))
        except QueueFull:
            ansi.error("Message queue to light process full! Continuing...")

        self.csv.writerow([
            '{} Hz'.format(f)
            for f in self.analyzer.fftFrequencies(self.sampleGen.samplerate)
            ])
Ejemplo n.º 3
0
 def _onExit(self):
     if self.subProcess.is_alive():
         try:
             self.messageQueue.put(('end', ))
         except QueueFull:
             ansi.error("Message queue to light process full! Continuing...")
Ejemplo n.º 4
0
 def _onSongChanged(self, tags, songInfo):
     try:
         self.messageQueue.put_nowait(('songChange', self.sampleGen.currentFilename, songInfo))
     except QueueFull:
         ansi.error("Message queue to light process full! Continuing...")
Ejemplo n.º 5
0
 def _onSample(self):
     try:
         self.messageQueue.put_nowait(('chunk', self.sampleGen.currentData))
     except QueueFull:
         ansi.error("Message queue to light process full! Continuing...")