mirror of
https://github.com/clockworkpi/launcher.git
synced 2025-12-13 10:18:51 +01:00
...
This commit is contained in:
parent
b6c142a2b9
commit
dcba607fc0
@ -45,19 +45,16 @@ class PIFI(object):
|
|||||||
rawSamples = os.read(fifoFile,self.sampleSize) # will return empty lines (non-blocking)
|
rawSamples = os.read(fifoFile,self.sampleSize) # will return empty lines (non-blocking)
|
||||||
if len(rawSamples) < 1:
|
if len(rawSamples) < 1:
|
||||||
# print("Read error")
|
# print("Read error")
|
||||||
if self._samples_buffer != None:
|
pass
|
||||||
data = numpy.fromstring(self._samples_buffer, dtype=numpy.int16)
|
|
||||||
numpy.divide(data,2)
|
|
||||||
else:
|
else:
|
||||||
self._samples_buffer = rawSamples
|
self._samples_buffer = rawSamples
|
||||||
data = numpy.fromstring(self._samples_buffer, dtype=numpy.int16)
|
|
||||||
except Exception,e:
|
except Exception,e:
|
||||||
pass
|
pass
|
||||||
|
|
||||||
if self._samples_buffer == None:
|
if self._samples_buffer == None:
|
||||||
return ""
|
return ""
|
||||||
|
|
||||||
# data = numpy.fromstring(self._samples_buffer, dtype=numpy.int16)
|
data = numpy.fromstring(self._samples_buffer, dtype=numpy.int16)
|
||||||
|
|
||||||
data = data * numpy.hanning(len(data))
|
data = data * numpy.hanning(len(data))
|
||||||
|
|
||||||
@ -210,7 +207,7 @@ class MPDSpectrumPage(Page):
|
|||||||
#print("sleeping... 0.01")
|
#print("sleeping... 0.01")
|
||||||
time.sleep(0.01)
|
time.sleep(0.01)
|
||||||
self.read_retry+=1
|
self.read_retry+=1
|
||||||
if self.read_retry > 40:
|
if self.read_retry > 20:
|
||||||
os.close(self._FIFO)
|
os.close(self._FIFO)
|
||||||
self._FIFO = os.open(self._PIFI._MPD_FIFO, os.O_RDONLY | os.O_NONBLOCK)
|
self._FIFO = os.open(self._PIFI._MPD_FIFO, os.O_RDONLY | os.O_NONBLOCK)
|
||||||
self.read_retry = 0
|
self.read_retry = 0
|
||||||
@ -365,7 +362,7 @@ class MPDSpectrumPage(Page):
|
|||||||
# print("spects:",spects)
|
# print("spects:",spects)
|
||||||
|
|
||||||
step = int( round( len( spects ) / meterNum) )
|
step = int( round( len( spects ) / meterNum) )
|
||||||
print(len(spects))
|
# print(len(spects))
|
||||||
self._bbs = []
|
self._bbs = []
|
||||||
|
|
||||||
for i in range(0,meterNum):
|
for i in range(0,meterNum):
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user