# Path: friture/audiobackend.py
# SAMPLING_RATE = 48000


import numpy as np
from PyQt5 import QtWidgets
from friture.audiobackend import SAMPLING_RATE
#
# Friture 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 Friture.  If not, see <http://www.gnu.org/licenses/>.


DEFAULT_BURST_PERIOD_S = 1.


class BurstGenerator:
    name = "Burst"

    def __init__(self, parent):
        self.T = 1.

        self.settings = SettingsWidget(parent)
        self.settings.spinBox_burst_period.valueChanged.connect(self.setT)

    def setT(self, T):
        self.T = T

    def settingsWidget(self):
        return self.settings

    def signal(self, t):
        floatdata = np.zeros(t.shape)

# Path: friture/audiobackend.py
# SAMPLING_RATE = 48000


# Path: friture/generators/burst.py
import numpy as np
from PyQt5 import QtWidgets
from friture.audiobackend import SAMPLING_RATE

#
# Friture 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 Friture.  If not, see <http://www.gnu.org/licenses/>.


DEFAULT_BURST_PERIOD_S = 1.


class BurstGenerator:
    name = "Burst"

    def __init__(self, parent):
        self.T = 1.

        self.settings = SettingsWidget(parent)
        self.settings.spinBox_burst_period.valueChanged.connect(self.setT)

    def setT(self, T):
        self.T = T

    def settingsWidget(self):
        return self.settings

    def signal(self, t):
        floatdata = np.zeros(t.shape)

        i = (t * SAMPLING_RATE) % (self.T * SAMPLING_RATE)