mirror of
https://github.com/correl/turntable.git
synced 2024-11-23 11:09:56 +00:00
Remove unused audio event
This commit is contained in:
parent
bb3b822cf6
commit
4125544c97
3 changed files with 0 additions and 17 deletions
|
@ -55,7 +55,6 @@ class Application:
|
|||
pcms.append(pcm_out)
|
||||
listener = Listener(
|
||||
pcms,
|
||||
events,
|
||||
audio_config.get("device", "default"),
|
||||
framerate=audio_config.get("framerate", 44100),
|
||||
channels=audio_config.get("channels", 2),
|
||||
|
|
|
@ -7,7 +7,6 @@ from typing import Deque, List, Tuple, Union
|
|||
|
||||
import alsaaudio # type: ignore
|
||||
|
||||
from turntable.events import Audio
|
||||
from turntable.models import PCM
|
||||
|
||||
logger = logging.getLogger(__name__)
|
||||
|
@ -17,7 +16,6 @@ class Listener(Process):
|
|||
def __init__(
|
||||
self,
|
||||
pcm_in: "List[Queue[PCM]]",
|
||||
events: Queue,
|
||||
device: str,
|
||||
sample_length: int = 30,
|
||||
framerate: int = 44100,
|
||||
|
@ -27,7 +25,6 @@ class Listener(Process):
|
|||
super().__init__()
|
||||
logger.info(f"Initializing Listener using '{device}'")
|
||||
self.pcm_in = pcm_in
|
||||
self.events = events
|
||||
self.framerate = framerate
|
||||
self.channels = channels
|
||||
self.capture = alsaaudio.PCM(
|
||||
|
@ -56,18 +53,12 @@ class Listener(Process):
|
|||
|
||||
def run(self) -> None:
|
||||
logger.debug("Starting Listener")
|
||||
framecount = 0
|
||||
event_limit = self.framerate
|
||||
while True:
|
||||
length, data = self.capture.read()
|
||||
if length > 0:
|
||||
pcm = PCM(self.framerate, self.channels, data)
|
||||
for queue in self.pcm_in:
|
||||
queue.put(pcm)
|
||||
framecount += length
|
||||
if framecount >= event_limit:
|
||||
framecount = 0
|
||||
self.events.put(Audio(pcm))
|
||||
else:
|
||||
logger.warning(
|
||||
"Sampler error (length={}, bytes={})".format(length, len(data))
|
||||
|
|
|
@ -1,7 +1,5 @@
|
|||
from dataclasses import dataclass
|
||||
|
||||
from turntable.models import PCM
|
||||
|
||||
|
||||
class Event:
|
||||
@property
|
||||
|
@ -23,8 +21,3 @@ class StoppedPlaying(Event):
|
|||
@dataclass
|
||||
class NewMetadata(Event):
|
||||
title: str
|
||||
|
||||
|
||||
@dataclass
|
||||
class Audio(Event):
|
||||
pcm: PCM
|
||||
|
|
Loading…
Reference in a new issue