Skip to content

Enums

Enums

ProcessingState

Bases: Enum

An enum representing the different processing states of CamillaDSP.

Source code in camilladsp\datastructures.py
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
class ProcessingState(Enum):
    """
    An enum representing the different processing states of CamillaDSP.
    """

    RUNNING = auto()
    """Processing is running"""
    PAUSED = auto()
    """Processing is paused"""
    INACTIVE = auto()
    """CamillaDSP is inactive, and waiting for a new config to be supplied"""
    STARTING = auto()
    """The processing is being set up"""
    STALLED = auto()
    """The processing is stalled because the capture device isn't providing any data"""

INACTIVE = auto() class-attribute instance-attribute

CamillaDSP is inactive, and waiting for a new config to be supplied

PAUSED = auto() class-attribute instance-attribute

Processing is paused

RUNNING = auto() class-attribute instance-attribute

Processing is running

STALLED = auto() class-attribute instance-attribute

The processing is stalled because the capture device isn't providing any data

STARTING = auto() class-attribute instance-attribute

The processing is being set up

StopReason

Bases: Enum

An enum representing the possible reasons why CamillaDSP stopped processing. The StopReason enums carry additional data: - CAPTUREERROR and PLAYBACKERROR: Carries the error message as a string. - CAPTUREFORMATCHANGE and PLAYBACKFORMATCHANGE: Carries the estimated new sample rate as an integer. A value of 0 means the new rate is unknown.

The additional data can be accessed by reading the data property.

reason = cdsp.general.stop_reason()
if reason == StopReason.CAPTUREERROR:
    error_msg = reason.data
    print(f"Capture failed, error: {error_msg}")
Source code in camilladsp\datastructures.py
 58
 59
 60
 61
 62
 63
 64
 65
 66
 67
 68
 69
 70
 71
 72
 73
 74
 75
 76
 77
 78
 79
 80
 81
 82
 83
 84
 85
 86
 87
 88
 89
 90
 91
 92
 93
 94
 95
 96
 97
 98
 99
100
101
102
103
104
105
class StopReason(Enum):
    """
    An enum representing the possible reasons why CamillaDSP stopped processing.
    The StopReason enums carry additional data:
    - CAPTUREERROR and PLAYBACKERROR:
      Carries the error message as a string.
    - CAPTUREFORMATCHANGE and PLAYBACKFORMATCHANGE:
      Carries the estimated new sample rate as an integer.
      A value of 0 means the new rate is unknown.

    The additional data can be accessed by reading the `data` property.
    ```python
    reason = cdsp.general.stop_reason()
    if reason == StopReason.CAPTUREERROR:
        error_msg = reason.data
        print(f"Capture failed, error: {error_msg}")
    ```
    """

    NONE = auto()
    """Processing is running and hasn't stopped yet."""
    DONE = auto()
    """The capture device reached the end of the stream."""
    CAPTUREERROR = auto()
    """The capture device encountered an error."""
    PLAYBACKERROR = auto()
    """The playback device encountered an error."""
    CAPTUREFORMATCHANGE = auto()
    """The sample format or rate of the capture device changed. """
    PLAYBACKFORMATCHANGE = auto()
    """The sample format or rate of the playback device changed."""

    def __new__(cls, value):
        obj = object.__new__(cls)
        obj._value_ = value
        obj._data = None
        return obj

    def set_data(self, value):
        """
        Set the custom data property of the enum.
        """
        self._data = value

    @property
    def data(self):
        """Getter for the data property"""
        return self._data

CAPTUREERROR = auto() class-attribute instance-attribute

The capture device encountered an error.

CAPTUREFORMATCHANGE = auto() class-attribute instance-attribute

The sample format or rate of the capture device changed.

DONE = auto() class-attribute instance-attribute

The capture device reached the end of the stream.

NONE = auto() class-attribute instance-attribute

Processing is running and hasn't stopped yet.

PLAYBACKERROR = auto() class-attribute instance-attribute

The playback device encountered an error.

PLAYBACKFORMATCHANGE = auto() class-attribute instance-attribute

The sample format or rate of the playback device changed.

data property

Getter for the data property

set_data(value)

Set the custom data property of the enum.

Source code in camilladsp\datastructures.py
 96
 97
 98
 99
100
def set_data(self, value):
    """
    Set the custom data property of the enum.
    """
    self._data = value