diff --git a/turntable/application.py b/turntable/application.py index 8d13249..354435e 100644 --- a/turntable/application.py +++ b/turntable/application.py @@ -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), diff --git a/turntable/audio.py b/turntable/audio.py index aa5b8fb..9b0e401 100644 --- a/turntable/audio.py +++ b/turntable/audio.py @@ -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)) diff --git a/turntable/events.py b/turntable/events.py index a16715f..46e0ce6 100644 --- a/turntable/events.py +++ b/turntable/events.py @@ -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