# Path: pym2149/const.py

# 
# Path: pym2149/iface.py
# class AmpScale(type): pass
# 
# class Config(lurlene.iface.Config): pass
# 
# class Platform: pass
# 
# class Stream: pass
# 
# Path: pym2149/nod.py
# class Node:
# 
#     def __init__(self):
#         self.block = None
# 
#     def call(self, block): # I think we don't default masked to False to ensure it is propagated.
#         return self(block, False)
# 
#     def __call__(self, block, masked):
#         if self.block != block:
#             self.block = block
#             self.masked = masked
#             self.result = self.callimpl()
#         elif not masked and self.masked:
#             log.warning("This node has already executed masked: %s", self)
#         return self.result
# 
#     def chain(self, node):
#         return node(self.block, self.masked)
# 
# Path: pym2149/out.py
# class FloatStream(list):
# 
#     chancount = property(len)
# 
# class StereoInfo:
# 
#     @types(Config)
#     def __init__(self, config):
#         self.n = config.chipchannels
#         if config.stereo:
#             self.panlaw = config.panlaw
#             self.maxpan = float(config.maxpan)
#             self.getoutchans = self.getstaticoutchans
#         else:
#             self.getoutchans = self.gettrivialoutchans
# 
#     def pantoamp(self, outchan, pan):
#         return ((1 + (outchan * 2 - 1) * pan) / 2) ** (self.panlaw / 6)
# 
#     def staticamp(self, outchan, chipchan):
#         return self.pantoamp(outchan, (chipchan * 2 - (self.n - 1)) / (self.n - 1) * self.maxpan)
# 
#     def gettrivialoutchans(self):
#         return [TrivialOutChannel]
#     gettrivialoutchans.size = 1
# 
#     def getstaticoutchans(self):
#         return [StaticOutChannel([self.staticamp(oc, cc) for cc in range(self.n)]) for oc in range(2)]
#     getstaticoutchans.size = 2


from .const import clientname
from .iface import AmpScale, Config, Platform, Stream
from .nod import Node
from .out import FloatStream, StereoInfo
from diapyr import types
import outjack.jackclient as jc, logging
# Copyright 2014, 2018, 2019, 2020 Andrzej Cichocki

# This file is part of pym2149.
#
# pym2149 is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# pym2149 is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with pym2149.  If not, see <http://www.gnu.org/licenses/>.


log = logging.getLogger(__name__)

class JackClient(jc.JackClient, Platform):

    @types(Config, StereoInfo)
    def __init__(self, config, stereoinfo):
        portcount = stereoinfo.getoutchans.size + config.SID.enabled # FIXME: This is a hack.

# Path: pym2149/const.py

# 
# Path: pym2149/iface.py
# class AmpScale(type): pass
# 
# class Config(lurlene.iface.Config): pass
# 
# class Platform: pass
# 
# class Stream: pass
# 
# Path: pym2149/nod.py
# class Node:
# 
#     def __init__(self):
#         self.block = None
# 
#     def call(self, block): # I think we don't default masked to False to ensure it is propagated.
#         return self(block, False)
# 
#     def __call__(self, block, masked):
#         if self.block != block:
#             self.block = block
#             self.masked = masked
#             self.result = self.callimpl()
#         elif not masked and self.masked:
#             log.warning("This node has already executed masked: %s", self)
#         return self.result
# 
#     def chain(self, node):
#         return node(self.block, self.masked)
# 
# Path: pym2149/out.py
# class FloatStream(list):
# 
#     chancount = property(len)
# 
# class StereoInfo:
# 
#     @types(Config)
#     def __init__(self, config):
#         self.n = config.chipchannels
#         if config.stereo:
#             self.panlaw = config.panlaw
#             self.maxpan = float(config.maxpan)
#             self.getoutchans = self.getstaticoutchans
#         else:
#             self.getoutchans = self.gettrivialoutchans
# 
#     def pantoamp(self, outchan, pan):
#         return ((1 + (outchan * 2 - 1) * pan) / 2) ** (self.panlaw / 6)
# 
#     def staticamp(self, outchan, chipchan):
#         return self.pantoamp(outchan, (chipchan * 2 - (self.n - 1)) / (self.n - 1) * self.maxpan)
# 
#     def gettrivialoutchans(self):
#         return [TrivialOutChannel]
#     gettrivialoutchans.size = 1
# 
#     def getstaticoutchans(self):
#         return [StaticOutChannel([self.staticamp(oc, cc) for cc in range(self.n)]) for oc in range(2)]
#     getstaticoutchans.size = 2


# Path: pym2149/jackclient.py
from .const import clientname
from .iface import AmpScale, Config, Platform, Stream
from .nod import Node
from .out import FloatStream, StereoInfo
from diapyr import types
import outjack.jackclient as jc, logging

# Copyright 2014, 2018, 2019, 2020 Andrzej Cichocki

# This file is part of pym2149.
#
# pym2149 is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# pym2149 is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with pym2149.  If not, see <http://www.gnu.org/licenses/>.


log = logging.getLogger(__name__)

class JackClient(jc.JackClient, Platform):

    @types(Config, StereoInfo)
    def __init__(self, config, stereoinfo):
        portcount = stereoinfo.getoutchans.size + config.SID.enabled # FIXME: This is a hack.

        super().__init__(clientname, portcount, config.jackringsize, config.jackcoupling)