# Path: hearinglosssimulator/gui/myqt.py
# QT = ModuleProxy(['', 'Q', 'Qt'], [QtCore.Qt, QtCore, QtGui, QtWidgets])
# 
# Path: hearinglosssimulator/gui/guitools.py
# def get_dict_from_group_param(param, cascade = False):
#     assert param.type() == 'group'
#     d = {}
#     for p in param.children():
#         if p.type() == 'group':
#             if cascade:
#                 d[p.name()] = get_dict_from_group_param(p, cascade = True)
#             continue
#         else:
#             d[p.name()] = p.value()
#     return d


from hearinglosssimulator.gui.myqt import QT
from hearinglosssimulator.gui.guitools import get_dict_from_group_param
import pyqtgraph as pg
import numpy as np
import sounddevice as sd

 #~ nb_channel=1, sample_rate=44100., dtype='float32',
 #~ nb_freq_band=32, low_freq = 100., high_freq = 15000.,
                #~ tau_level = 0.005,  level_step =1., level_max = 100.,
#~ chunksize=512, backward_chunksize=1024, 
# engine

_params = [
    {'name': 'nb_channel', 'type': 'int', 'value': 2 },
    
    {'name': 'simulator_engine', 'type': 'list', 'values': ['InvComp', 'InvCGC'] },
    
    #~ {'name': 'dtype', 'type': 'list', 'values': ['float32'] },
    {'name': 'nb_freq_band', 'type': 'int', 'value': 32 },
    {'name': 'low_freq', 'type': 'float', 'value':100., 'suffix': 'Hz', 'siPrefix': True},
    {'name': 'high_freq', 'type': 'float', 'value': 15000.,  'suffix': 'Hz', 'siPrefix': True},
    
    {'name': 'tau_level', 'type': 'float', 'value': 0.005,  'suffix': 's', 'siPrefix': True},
    {'name': 'level_max', 'type': 'float', 'value': 100.,  'suffix': 'dBSpl', 'siPrefix': True},
    {'name': 'level_step', 'type': 'float', 'value': 1.,  'suffix': 'dBSpl', 'siPrefix': True},
    
    {'name': 'chunksize', 'type': 'int', 'value': 1024 },
    {'name': 'backward_chunksize', 'type': 'int', 'value': 2048 },
    
]


class SimulatorParameter(QT.QWidget):
    def __init__(self, with_all_params=True, parent = None):
        QT.QWidget.__init__(self, parent)

# Path: hearinglosssimulator/gui/myqt.py
# QT = ModuleProxy(['', 'Q', 'Qt'], [QtCore.Qt, QtCore, QtGui, QtWidgets])
# 
# Path: hearinglosssimulator/gui/guitools.py
# def get_dict_from_group_param(param, cascade = False):
#     assert param.type() == 'group'
#     d = {}
#     for p in param.children():
#         if p.type() == 'group':
#             if cascade:
#                 d[p.name()] = get_dict_from_group_param(p, cascade = True)
#             continue
#         else:
#             d[p.name()] = p.value()
#     return d


# Path: hearinglosssimulator/gui/simulatorparameters.py
from hearinglosssimulator.gui.myqt import QT
from hearinglosssimulator.gui.guitools import get_dict_from_group_param
import pyqtgraph as pg
import numpy as np
import sounddevice as sd


 #~ nb_channel=1, sample_rate=44100., dtype='float32',
 #~ nb_freq_band=32, low_freq = 100., high_freq = 15000.,
                #~ tau_level = 0.005,  level_step =1., level_max = 100.,
#~ chunksize=512, backward_chunksize=1024, 
# engine

_params = [
    {'name': 'nb_channel', 'type': 'int', 'value': 2 },
    
    {'name': 'simulator_engine', 'type': 'list', 'values': ['InvComp', 'InvCGC'] },
    
    #~ {'name': 'dtype', 'type': 'list', 'values': ['float32'] },
    {'name': 'nb_freq_band', 'type': 'int', 'value': 32 },
    {'name': 'low_freq', 'type': 'float', 'value':100., 'suffix': 'Hz', 'siPrefix': True},
    {'name': 'high_freq', 'type': 'float', 'value': 15000.,  'suffix': 'Hz', 'siPrefix': True},
    
    {'name': 'tau_level', 'type': 'float', 'value': 0.005,  'suffix': 's', 'siPrefix': True},
    {'name': 'level_max', 'type': 'float', 'value': 100.,  'suffix': 'dBSpl', 'siPrefix': True},
    {'name': 'level_step', 'type': 'float', 'value': 1.,  'suffix': 'dBSpl', 'siPrefix': True},
    
    {'name': 'chunksize', 'type': 'int', 'value': 1024 },
    {'name': 'backward_chunksize', 'type': 'int', 'value': 2048 },
    
]


class SimulatorParameter(QT.QWidget):
    def __init__(self, with_all_params=True, parent = None):
        QT.QWidget.__init__(self, parent)

        mainlayout  =QT.QVBoxLayout()