id
int64 0
755k
| file_name
stringlengths 3
109
| file_path
stringlengths 13
185
| content
stringlengths 31
9.38M
| size
int64 31
9.38M
| language
stringclasses 1
value | extension
stringclasses 11
values | total_lines
int64 1
340k
| avg_line_length
float64 2.18
149k
| max_line_length
int64 7
2.22M
| alphanum_fraction
float64 0
1
| repo_name
stringlengths 6
65
| repo_stars
int64 100
47.3k
| repo_forks
int64 0
12k
| repo_open_issues
int64 0
3.4k
| repo_license
stringclasses 9
values | repo_extraction_date
stringclasses 92
values | exact_duplicates_redpajama
bool 2
classes | near_duplicates_redpajama
bool 2
classes | exact_duplicates_githubcode
bool 2
classes | exact_duplicates_stackv2
bool 1
class | exact_duplicates_stackv1
bool 2
classes | near_duplicates_githubcode
bool 2
classes | near_duplicates_stackv1
bool 2
classes | near_duplicates_stackv2
bool 1
class |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
754,133
|
machinescrollarea.h
|
uwolfer_qtemu/machinescrollarea.h
|
/****************************************************************************
**
** Copyright (C) 2008 Ben Klopfenstein <benklop @ gmail.com>
**
** This file is part of QtEmu.
**
** This program 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 2 of the License, or
** (at your option) any later version.
**
** This program 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 Library General Public License
** along with this library; see the file COPYING.LIB. If not, write to
** the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
** Boston, MA 02110-1301, USA.
**
****************************************************************************/
#ifndef MACHINESCROLLAREA_H
#define MACHINESCROLLAREA_H
//
#include <QScrollArea>
//
class MachineScrollArea : public QScrollArea
{
Q_OBJECT
public:
MachineScrollArea(QWidget *parent);
void resizeEvent(QResizeEvent * event);
void resizeView(int widgetWidth, int widgetHeight);
bool isSplashShown();
void setSplashShown(bool value);
private:
bool splashShown;
signals:
void resized(int, int);
};
#endif
| 1,446
|
C++
|
.h
| 42
| 32.738095
| 77
| 0.682176
|
uwolfer/qtemu
| 136
| 54
| 23
|
GPL-2.0
|
9/20/2024, 9:42:21 PM (Europe/Amsterdam)
| false
| false
| false
| false
| false
| false
| false
| false
|
754,134
|
usbconfig.h
|
uwolfer_qtemu/usbconfig.h
|
/****************************************************************************
**
** Copyright (C) 2008 Ben Klopfenstein <[email protected]>
**
** This file is part of QtEmu.
**
** This program 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 2 of the License, or
** (at your option) any later version.
**
** This program 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 Library General Public License
** along with this library; see the file COPYING.LIB. If not, write to
** the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
** Boston, MA 02110-1301, USA.
**
****************************************************************************/
#ifndef USBCONFIG_H
#define USBCONFIG_H
#include <QObject>
class MachineConfigObject;
class MachineProcess;
class UsbConfig : public QObject
{
Q_OBJECT
public:
UsbConfig(MachineProcess * parent, MachineConfigObject * config);
QStringList getOptionString();
private:
MachineConfigObject * config;
MachineProcess * parent;
public slots:
void vmAddDevice(QString id);
void vmRemoveDevice(QString id);
};
#endif // USBCONFIG_H
| 1,474
|
C++
|
.h
| 41
| 34.02439
| 77
| 0.683767
|
uwolfer/qtemu
| 136
| 54
| 23
|
GPL-2.0
|
9/20/2024, 9:42:21 PM (Europe/Amsterdam)
| false
| false
| false
| false
| false
| false
| false
| false
|
754,135
|
machinetab.h
|
uwolfer_qtemu/machinetab.h
|
/****************************************************************************
**
** Copyright (C) 2006-2008 Urs Wolfer <uwolfer @ fwo.ch>
** Copyright (C) 2008 Ben Klopfenstein <benklop @ gmail.com>
**
** This file is part of QtEmu.
**
** This program 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 2 of the License, or
** (at your option) any later version.
**
** This program 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 Library General Public License
** along with this library; see the file COPYING.LIB. If not, write to
** the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
** Boston, MA 02110-1301, USA.
**
****************************************************************************/
#ifndef MACHINETAB_H
#define MACHINETAB_H
#include <QWidget>
#include <QDomDocument>
#include <QRadioButton>
#include <QButtonGroup>
#include "machineconfigobject.h"
#include "machineconfig.h"
class QPushButton;
class QLineEdit;
class QCheckBox;
class QSlider;
class QSpinBox;
class QTabWidget;
class QTextEdit;
class QFrame;
class QPushButton;
class QMenu;
class MachineProcess;
class MachineView;
class QVBoxLayout;
class QGridLayout;
class QScrollArea;
class QToolButton;
class SettingsTab;
class ControlPanel;
class GuestToolsListener;
class MachineTab : public QWidget
{
Q_OBJECT
public:
MachineTab(QTabWidget *parent, const QString &fileName, const QString &myMachinesPathParent);
QString machineName();
QPushButton *startButton;
QPushButton *stopButton;
QPushButton *suspendButton;
QPushButton *resumeButton;
QPushButton *pauseButton;
MachineConfigObject *machineConfigObject;
SettingsTab *settingsTab;
MachineProcess *machineProcess;
MachineView *machineView;
public slots:
void restart();
private:
void makeConnections();
MachineConfig *machineConfig;
QCheckBox *snapshotCheckBox;
QLineEdit *machineNameEdit;
QLineEdit *consoleCommand;
QTextEdit *console;
QString xmlFileName;
QTabWidget *parentTabWidget;
QTextEdit *notesTextEdit;
QPushButton *cdromReloadButton;
QPushButton *floppyReloadButton;
QString myMachinesPath;
QStringList shownErrors;
QFrame *consoleFrame;
QGridLayout *viewLayout;
QScrollArea *machineScroll;
ControlPanel *controlPanel;
void cleanupView();
GuestToolsListener *guestToolsListener;
private slots:
void start();
void forceStop();
void suspending();
void suspended();
void resuming();
void resumed();
void finished();
void started();
void booting();
void error(const QString& errorMsg);
bool read();
void nameChanged(const QString &name);
void closeMachine();
void snapshot(const int state);
void runCommand();
void clearRestart();
void takeScreenshot();
};
#endif
| 3,213
|
C++
|
.h
| 107
| 26.766355
| 97
| 0.725817
|
uwolfer/qtemu
| 136
| 54
| 23
|
GPL-2.0
|
9/20/2024, 9:42:21 PM (Europe/Amsterdam)
| false
| false
| false
| false
| false
| false
| false
| false
|
754,136
|
guesttoolslistener.h
|
uwolfer_qtemu/guesttoolslistener.h
|
/****************************************************************************
**
** Copyright (C) 2008 Ben Klopfenstein <benklop @ gmail.com>
**
** This file is part of QtEmu.
**
** This program 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 2 of the License, or
** (at your option) any later version.
**
** This program 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 Library General Public License
** along with this library; see the file COPYING.LIB. If not, write to
** the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
** Boston, MA 02110-1301, USA.
**
****************************************************************************/
#ifndef GUESTTOOLSLISTENER_H
#define GUESTTOOLSLISTENER_H
#include <QObject>
#include <QList>
class QLocalSocket;
class GuestModule;
class GuestToolsListener : public QObject
{
Q_OBJECT
public:
GuestToolsListener(QString location, QObject *parent);
private:
QLocalSocket *toolSocket;
QList<GuestModule *> modules;
quint64 blockSize;
void addModules();
public slots:
void dataSender(QString module, QVariant &data);
private slots:
void setupConnection();
void receiveData();
};
#endif
| 1,545
|
C++
|
.h
| 45
| 32.311111
| 77
| 0.688679
|
uwolfer/qtemu
| 136
| 54
| 23
|
GPL-2.0
|
9/20/2024, 9:42:21 PM (Europe/Amsterdam)
| false
| false
| false
| false
| false
| false
| false
| false
|
754,137
|
machinewizard.h
|
uwolfer_qtemu/machinewizard.h
|
/****************************************************************************
**
** Copyright (C) 2006-2008 Urs Wolfer <uwolfer @ fwo.ch>
**
** This file is part of QtEmu.
**
** This program 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 2 of the License, or
** (at your option) any later version.
**
** This program 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 Library General Public License
** along with this library; see the file COPYING.LIB. If not, write to
** the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
** Boston, MA 02110-1301, USA.
**
****************************************************************************/
#ifndef MACHINEWIZARD_H
#define MACHINEWIZARD_H
#include <QWizard>
class QComboBox;
class QLineEdit;
class QDoubleSpinBox;
class QCheckBox;
class MachineWizard : public QWizard
{
Q_OBJECT
public:
explicit MachineWizard(const QString &myMachinesPath, QWidget *parent = 0);
static QString newMachine(const QString &myMachinesPathParent, QWidget *parent);
void accept();
QString myMachinesPath;
};
class ChooseSystemPage : public QWizardPage
{
Q_OBJECT
public:
ChooseSystemPage(MachineWizard *wizard);
bool isComplete() const;
private:
QComboBox *comboSystem;
};
class LocationPage : public QWizardPage
{
Q_OBJECT
public:
LocationPage(MachineWizard *wizard);
void initializePage();
bool isComplete() const;
QLineEdit *pathLineEdit;
QLineEdit *nameLineEdit;
private slots:
void updatePath();
void setNewPath();
};
class ImagePage : public QWizardPage
{
Q_OBJECT
public:
ImagePage(MachineWizard *wizard);
void cleanupPage();
bool isComplete() const;
private:
QDoubleSpinBox *sizeSpinBox;
QCheckBox *encryptionCheckBox;
private slots:
//void enableEncryption(int choice);
};
#endif
| 2,209
|
C++
|
.h
| 74
| 27.202703
| 84
| 0.706022
|
uwolfer/qtemu
| 136
| 54
| 23
|
GPL-2.0
|
9/20/2024, 9:42:21 PM (Europe/Amsterdam)
| false
| false
| false
| false
| false
| false
| false
| false
|
754,138
|
machinesplash.h
|
uwolfer_qtemu/machinesplash.h
|
/****************************************************************************
**
** Copyright (C) 2008 Ben Klopfenstein <[email protected]>
**
** This file is part of QtEmu.
**
** This program 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 2 of the License, or
** (at your option) any later version.
**
** This program 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 Library General Public License
** along with this library; see the file COPYING.LIB. If not, write to
** the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
** Boston, MA 02110-1301, USA.
**
****************************************************************************/
#ifndef MACHINESPLASH_H
#define MACHINESPLASH_H
#include <QWidget>
class QLabel;
class QSvgWidget;
class QRectF;
class QPixmap;
class QString;
/**
@author Ben Klopfenstein <[email protected]>
*/
class MachineSplash : public QWidget
{
Q_OBJECT
public:
MachineSplash(QWidget *parent = 0);
void setPreview(const QString previewLocation = QString());
const QSize sizeHint();
private:
void resizeEvent(QResizeEvent * event);
void showEvent(QShowEvent * event);
QSvgWidget *splashImage;
QLabel *previewImage;
QRectF previewBounds;
QPixmap alpha;
QString previewLoc;
void doResize();
void getPreviewRect();
};
#endif
| 1,691
|
C++
|
.h
| 52
| 30.211538
| 77
| 0.68642
|
uwolfer/qtemu
| 136
| 54
| 23
|
GPL-2.0
|
9/20/2024, 9:42:21 PM (Europe/Amsterdam)
| false
| false
| false
| false
| false
| false
| false
| false
|
754,139
|
interfacemodel.h
|
uwolfer_qtemu/interfacemodel.h
|
/****************************************************************************
**
** Copyright (C) 2008 Ben Klopfenstein <[email protected]>
**
** This file is part of QtEmu.
**
** This program 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 2 of the License, or
** (at your option) any later version.
**
** This program 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 Library General Public License
** along with this library; see the file COPYING.LIB. If not, write to
** the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
** Boston, MA 02110-1301, USA.
**
****************************************************************************/
/****************************************************************************
**
** C++ Interface: interfacemodel
**
** Description: provides a model for the model/view framework to describe the
** various options for a qemu network interface, both guest and host models
** are provided.
**
****************************************************************************/
#ifndef INTERFACEMODEL_H
#define INTERFACEMODEL_H
#include <QAbstractTableModel>
#include <QStringList>
class MachineConfigObject;
/**
@author Ben Klopfenstein <[email protected]>
*/
class InterfaceModel : public QAbstractTableModel
{
Q_OBJECT
public:
InterfaceModel(MachineConfigObject *config, QString nodeType, QObject *parent = 0);
int rowCount(const QModelIndex & parent = QModelIndex() ) const;
int columnCount(const QModelIndex & parent = QModelIndex() ) const;
QVariant data ( const QModelIndex & index, int role = Qt::DisplayRole ) const;
QVariant headerData ( int section, Qt::Orientation orientation, int role = Qt::DisplayRole ) const;
Qt::ItemFlags flags ( const QModelIndex &index ) const;
bool setData( const QModelIndex & index, const QVariant& value, int role );
QString rowName(int row) const;
QString colName(int col) const;
protected:
MachineConfigObject *config;
QString nodeType;
//first string in the list is the key
QStringList columns;
protected slots:
void optionChanged(const QString &nodeType, const QString &nodeName, const QString &optionName, const QVariant &value);
};
class GuestInterfaceModel : public InterfaceModel
{
Q_OBJECT
public:
explicit GuestInterfaceModel(MachineConfigObject *config, QObject *parent = 0);
bool insertRows(int row, int count, const QModelIndex & parent = QModelIndex());
bool removeRows(int row, int count, const QModelIndex & parent = QModelIndex());
};
class HostInterfaceModel : public InterfaceModel
{
Q_OBJECT
public:
explicit HostInterfaceModel(MachineConfigObject *config, QObject *parent = 0);
bool insertRows(int row, int count, const QModelIndex & parent = QModelIndex());
bool removeRows(int row, int count, const QModelIndex & parent = QModelIndex());
};
#endif
| 3,218
|
C++
|
.h
| 77
| 39.480519
| 123
| 0.687921
|
uwolfer/qtemu
| 136
| 54
| 23
|
GPL-2.0
|
9/20/2024, 9:42:21 PM (Europe/Amsterdam)
| false
| false
| false
| false
| false
| false
| false
| false
|
754,140
|
config.h
|
uwolfer_qtemu/config.h
|
/****************************************************************************
**
** Copyright (C) 2006-2008 Urs Wolfer <uwolfer @ fwo.ch>
**
** This file is part of QtEmu.
**
** This program 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 2 of the License, or
** (at your option) any later version.
**
** This program 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 Library General Public License
** along with this library; see the file COPYING.LIB. If not, write to
** the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
** Boston, MA 02110-1301, USA.
**
****************************************************************************/
#ifndef CONFIG_H
#define CONFIG_H
#define VERSION "2.0 Alpha1"
#endif
| 1,084
|
C++
|
.h
| 26
| 40.576923
| 77
| 0.646445
|
uwolfer/qtemu
| 136
| 54
| 23
|
GPL-2.0
|
9/20/2024, 9:42:21 PM (Europe/Amsterdam)
| false
| false
| false
| false
| false
| false
| false
| false
|
754,141
|
guesttools.h
|
uwolfer_qtemu/GuestTools/guesttools.h
|
#ifndef GUESTTOOLS_H
#define GUESTTOOLS_H
#include <QWidget>
#include <QSystemTrayIcon>
#include <QList>
#include <QVariant>
#include "modules/guestmodule.h"
#include "ui_guesttools.h"
#include <qextserialport.h>
class QAction;
class QMenu;
//class QextSerialPort;
//class QDataStream;
class GuestTools : public QWidget
{
Q_OBJECT
public:
GuestTools(QWidget *parent = 0);
~GuestTools();
private:
Ui::GuestToolsClass ui;
void createTrayIcon();
void createActions();
void createModules();
void initSerialPort();
QAction *quitAction;
QSystemTrayIcon *trayIcon;
QMenu *trayIconMenu;
QextSerialPort *port;
quint64 blockSize;
QList<GuestModule *> modules;
public slots:
void dataSender(QString module, QVariant &data);
private slots:
void clickedIcon(QSystemTrayIcon::ActivationReason reason);
void ioReceived();
};
#endif // GUESTTOOLS_H
| 924
|
C++
|
.h
| 38
| 20.921053
| 63
| 0.750865
|
uwolfer/qtemu
| 136
| 54
| 23
|
GPL-2.0
|
9/20/2024, 9:42:21 PM (Europe/Amsterdam)
| false
| false
| false
| false
| false
| false
| false
| false
|
754,142
|
guestmodule.h
|
uwolfer_qtemu/GuestTools/modules/guestmodule.h
|
/*
* guestmodule.h
*
* Created on: Dec 14, 2008
* Author: Ben Klopfenstein
*/
#ifndef GUESTMODULE_H_
#define GUESTMODULE_H_
#include <QObject>
#include <QVariant>
#include <QString>
class GuestModule: public QObject
{
Q_OBJECT
public:
GuestModule(QObject *parent = 0);
virtual ~GuestModule();
virtual void receiveData(QVariant data);
QString moduleName();
protected:
void send(QVariant &data);
void setModuleName(QString name);
private:
QString module;
signals:
void sendData(QString module, QVariant &data);
};
#endif /* GUESTMODULE_H_ */
| 598
|
C++
|
.h
| 28
| 18.5
| 50
| 0.724014
|
uwolfer/qtemu
| 136
| 54
| 23
|
GPL-2.0
|
9/20/2024, 9:42:21 PM (Europe/Amsterdam)
| false
| false
| false
| false
| false
| false
| false
| false
|
754,143
|
clipboardsync.h
|
uwolfer_qtemu/GuestTools/modules/clipboard/clipboardsync.h
|
#ifndef CLIPBOARDSYNC_H
#define CLIPBOARDSYNC_H
#include "../guestmodule.h"
#include <QIODevice>
#include <QClipboard>
#include <QVariant>
class QDataStream;
class ClipboardSync : public GuestModule
{
Q_OBJECT
public:
ClipboardSync(QObject *parent = 0);
~ClipboardSync();
virtual void receiveData(QVariant data);
private:
QClipboard *clipboard;
QVariant previous;
public slots:
void dataChanged(QClipboard::Mode mode);
};
#endif // CLIPBOARDSYNC_H
| 485
|
C++
|
.h
| 21
| 20.333333
| 44
| 0.769231
|
uwolfer/qtemu
| 136
| 54
| 23
|
GPL-2.0
|
9/20/2024, 9:42:21 PM (Europe/Amsterdam)
| false
| false
| false
| false
| false
| false
| false
| false
|
754,144
|
clipboardpoll.h
|
uwolfer_qtemu/GuestTools/modules/clipboard/clipboardpoll.h
|
// -*- Mode: C++; c-basic-offset: 4; indent-tabs-mode: nil; tab-width: 8; -*-
/* This file is part of the KDE project
Copyright (C) 2003 by Lubos Lunak <[email protected]>
This program 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 2 of the License, or (at your option) any later version.
This program 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 this program; see the file COPYING. If not, write to
the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
Boston, MA 02110-1301, USA.
*/
#ifndef _CLIPBOARDPOLL_H_
#define _CLIPBOARDPOLL_H_
#include <QWidget>
#include <QTimer>
#include <X11/Xlib.h>
#include <fixx11h.h>
class ClipboardPoll
: public QWidget
{
Q_OBJECT
public:
ClipboardPoll();
Q_SIGNALS:
void clipboardChanged( bool selectionMode );
protected:
virtual bool x11Event( XEvent* );
private Q_SLOTS:
void timeout();
void qtSelectionChanged();
void qtClipboardChanged();
private:
struct SelectionData
{
Atom atom;
Atom sentinel_atom;
Atom timestamp_atom;
Window last_owner;
bool owner_is_qt;
Time last_change;
bool waiting_for_timestamp;
Time waiting_x_time;
};
void updateQtOwnership( SelectionData& data );
bool checkTimestamp( SelectionData& data );
bool changedTimestamp( SelectionData& data, const XEvent& e );
void initPolling();
QTimer m_timer;
SelectionData m_selection;
SelectionData m_clipboard;
Atom m_xa_clipboard;
Atom m_xa_timestamp;
int m_xfixes_event_base;
};
#endif
| 2,114
|
C++
|
.h
| 60
| 28.666667
| 77
| 0.670744
|
uwolfer/qtemu
| 136
| 54
| 23
|
GPL-2.0
|
9/20/2024, 9:42:21 PM (Europe/Amsterdam)
| false
| false
| false
| false
| false
| false
| false
| false
|
754,150
|
vncclientthread.h
|
uwolfer_qtemu/vnc/vncclientthread.h
|
/****************************************************************************
**
** Copyright (C) 2007-2008 Urs Wolfer <uwolfer @ kde.org>
**
** This file is part of KDE.
**
** This program 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 2 of the License, or
** (at your option) any later version.
**
** This program 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 this program; see the file COPYING. If not, write to
** the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
** Boston, MA 02110-1301, USA.
**
****************************************************************************/
#ifndef VNCCLIENTTHREAD_H
#define VNCCLIENTTHREAD_H
#ifdef QTONLY
#include <QDebug>
#define kDebug(n) qDebug()
#define kBacktrace() ""
#define i18n tr
#else
#include <KDebug>
#include <KLocale>
#endif
#include "remoteview.h"
#include <QQueue>
#include <QThread>
#include <QImage>
#include <QMutex>
extern "C" {
#include <rfb/rfbclient.h>
}
class ClientEvent
{
public:
virtual ~ClientEvent();
virtual void fire(rfbClient*) = 0;
};
class KeyClientEvent : public ClientEvent
{
public:
KeyClientEvent(int key, int pressed)
: m_key(key), m_pressed(pressed) {}
void fire(rfbClient*);
private:
int m_key;
int m_pressed;
};
class PointerClientEvent : public ClientEvent
{
public:
PointerClientEvent(int x, int y, int buttonMask)
: m_x(x), m_y(y), m_buttonMask(buttonMask) {}
void fire(rfbClient*);
private:
int m_x;
int m_y;
int m_buttonMask;
};
class ClientCutEvent : public ClientEvent
{
public:
ClientCutEvent(const QString &text)
: text(text) {}
void fire(rfbClient*);
private:
QString text;
};
class VncClientThread: public QThread
{
Q_OBJECT
public:
explicit VncClientThread(QObject *parent = 0);
~VncClientThread();
const QImage image(int x = 0, int y = 0, int w = 0, int h = 0);
void setImage(const QImage &img);
void emitUpdated(int x, int y, int w, int h);
void emitGotCut(const QString &text);
void stop();
void setHost(const QString &host);
void setPort(int port);
void setQuality(RemoteView::Quality quality);
void setPassword(const QString &password) {
m_password = password;
}
const QString password() const {
return m_password;
}
RemoteView::Quality quality() const;
uint8_t *frameBuffer;
signals:
void imageUpdated(int x, int y, int w, int h);
void gotCut(const QString &text);
void passwordRequest();
void outputErrorMessage(const QString &message);
public slots:
void mouseEvent(int x, int y, int buttonMask);
void keyEvent(int key, bool pressed);
void clientCut(const QString &text);
protected:
void run();
private:
static rfbBool newclient(rfbClient *cl);
static void updatefb(rfbClient *cl, int x, int y, int w, int h);
static void cuttext(rfbClient *cl, const char *text, int textlen);
static char* passwdHandler(rfbClient *cl);
static void outputHandler(const char *format, ...);
QImage m_image;
rfbClient *cl;
QString m_host;
QString m_password;
int m_port;
QMutex mutex;
RemoteView::Quality m_quality;
QQueue<ClientEvent* > m_eventQueue;
volatile bool m_stopped;
volatile bool m_passwordError;
private slots:
void checkOutputErrorMessage();
};
#endif
| 3,789
|
C++
|
.h
| 130
| 25.661538
| 77
| 0.677313
|
uwolfer/qtemu
| 136
| 54
| 23
|
GPL-2.0
|
9/20/2024, 9:42:21 PM (Europe/Amsterdam)
| false
| false
| false
| false
| false
| false
| false
| false
|
754,153
|
KiwiHttp_Session.cpp
|
Musicoll_Kiwi/Modules/KiwiNetwork/KiwiHttp/KiwiHttp_Session.cpp
|
/*
==============================================================================
This file is part of the KIWI library.
- Copyright (c) 2014-2016, Pierre Guillot & Eliott Paris.
- Copyright (c) 2016-2019, CICM, ANR MUSICOLL, Eliott Paris, Pierre Guillot, Jean Millot.
Permission is granted to use this software under the terms of the GPL v3
(or any later version). Details can be found at: www.gnu.org/licenses
KIWI 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.
------------------------------------------------------------------------------
Contact : [email protected]
==============================================================================
*/
#include "KiwiHttp_Session.h"
#include "KiwiHttp_Util.h"
namespace kiwi { namespace network { namespace http {
// ================================================================================ //
// SESSION ID //
// ================================================================================ //
static uint64_t id_cnt = 0;
uint64_t getNextId()
{
return ++id_cnt;
}
// ================================================================================ //
// HTTP PAYLOAD //
// ================================================================================ //
Payload::Payload(const std::initializer_list<Pair>& pairs)
: Payload(begin(pairs), end(pairs))
{
;
}
void Payload::AddPair(const Pair& pair)
{
if(!content.empty())
{
content += "&";
}
auto escaped = util::urlEncode(pair.value);
content += pair.key + "=" + escaped;
}
// ================================================================================ //
// HTTP PARAMETERS //
// ================================================================================ //
Parameters::Parameters(std::initializer_list<Parameter> const& parameters)
{
for(auto const& parameter : parameters)
{
AddParameter(parameter);
}
}
void Parameters::AddParameter(Parameter const& parameter)
{
if (!content.empty())
{
content += "&";
}
auto escapedKey = util::urlEncode(parameter.key);
if (parameter.value.empty())
{
content += escapedKey;
}
else
{
auto escapedValue = util::urlEncode(parameter.value);
content += escapedKey + "=" + escapedValue;
}
}
// ================================================================================ //
// BODY //
// ================================================================================ //
Body::Body(std::string const& body)
: content(body)
{
}
// ================================================================================ //
// SESSION //
// ================================================================================ //
Session::Session()
: m_port("80")
, m_target()
, m_parameters()
, m_payload()
, m_body()
, m_timeout(0)
, m_id(getNextId())
, m_query()
, m_req_header()
{
m_req_header.version(11);
}
uint64_t Session::getId() const
{
return m_id;
}
void Session::setHost(std::string const& host)
{
m_req_header.set(beast::http::field::host, host);
}
void Session::setPort(std::string const& port)
{
m_port = port;
}
void Session::setTarget(std::string const& endpoint)
{
m_target = endpoint;
}
void Session::setTimeout(Timeout timeout)
{
m_timeout = timeout;
}
void Session::setAuthorization(std::string const& auth)
{
m_req_header.set(beast::http::field::authorization, auth);
}
void Session::setParameters(Parameters && parameters)
{
m_parameters = std::move(parameters);
}
void Session::setPayload(Payload && payload)
{
m_payload = std::move(payload);
}
void Session::setBody(std::string const& content)
{
m_body.content = content;
}
bool Session::executed()
{
return m_query && m_query->executed();
}
void Session::cancel()
{
if (m_query)
{
m_query->cancel();
}
}
Session::Response Session::Get()
{
return makeResponse(beast::http::verb::get);
}
void Session::GetAsync(Callback callback)
{
makeResponse(beast::http::verb::get, std::move(callback));
}
Session::Response Session::Post()
{
return makeResponse(beast::http::verb::post);
}
void Session::PostAsync(Callback callback)
{
makeResponse(beast::http::verb::post, std::move(callback));
}
Session::Response Session::Put()
{
return makeResponse(beast::http::verb::put);
}
void Session::PutAsync(Callback callback)
{
makeResponse(beast::http::verb::put, std::move(callback));
}
Session::Response Session::Delete()
{
return makeResponse(beast::http::verb::delete_);
}
void Session::DeleteAsync(Callback callback)
{
makeResponse(beast::http::verb::delete_, std::move(callback));
}
void Session::initQuery()
{
if (!m_query)
{
const auto makeTarget = [this]() {
if(!m_parameters.content.empty())
{
return m_target + "?" + m_parameters.content;
}
return m_target;
};
auto request = std::make_unique<Request<beast::http::string_body>>(std::move(m_req_header));
request->target(makeTarget());
if(!(m_req_header.method() == beast::http::verb::get) &&
(!m_payload.content.empty()
|| !m_body.content.empty()))
{
if(!m_payload.content.empty())
{
request->set(beast::http::field::content_type, "application/x-www-form-urlencoded");
request->body() = std::move(m_payload.content);
}
else if(!m_body.content.empty())
{
auto& req = *request;
const auto content_type = req[beast::http::field::content_type];
if(content_type.empty())
{
request->set(beast::http::field::content_type, "application/octet-stream");
}
request->body() = std::move(m_body.content);
}
}
m_query = std::make_unique<HttpQuery>(std::move(request), m_port);
}
}
Session::Response Session::makeResponse(beast::http::verb verb)
{
m_req_header.method(verb);
initQuery();
return m_query->writeQuery(m_timeout);
}
void Session::makeResponse(beast::http::verb verb, Session::Callback && callback)
{
m_req_header.method(verb);
initQuery();
m_query->writeQueryAsync(callback, m_timeout);
}
}}} // namespace kiwi::network::http
| 8,016
|
C++
|
.cpp
| 220
| 27.281818
| 104
| 0.453314
|
Musicoll/Kiwi
| 134
| 11
| 7
|
GPL-3.0
|
9/20/2024, 9:42:21 PM (Europe/Amsterdam)
| false
| false
| false
| false
| false
| false
| false
| false
|
754,154
|
KiwiHttp_Util.cpp
|
Musicoll_Kiwi/Modules/KiwiNetwork/KiwiHttp/KiwiHttp_Util.cpp
|
/*
==============================================================================
This file is part of the KIWI library.
- Copyright (c) 2014-2016, Pierre Guillot & Eliott Paris.
- Copyright (c) 2016-2019, CICM, ANR MUSICOLL, Eliott Paris, Pierre Guillot, Jean Millot.
Permission is granted to use this software under the terms of the GPL v3
(or any later version). Details can be found at: www.gnu.org/licenses
KIWI 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.
------------------------------------------------------------------------------
Contact : [email protected]
==============================================================================
*/
#include "KiwiHttp_Util.h"
#include <cstdint>
#include <iomanip>
#include <sstream>
#include <string>
#include <cctype>
namespace kiwi { namespace network { namespace http { namespace util {
std::string urlEncode(const std::string& value)
{
std::ostringstream escaped;
escaped.fill('0');
escaped << std::hex;
for (auto i = value.cbegin(), n = value.cend(); i != n; ++i)
{
std::string::value_type c = (*i);
// Keep alphanumeric and other accepted characters intact
if (std::isalnum(c) || c == '-' || c == '_' || c == '.' || c == '~')
{
escaped << c;
continue;
}
// Any other characters are percent-encoded
escaped << '%' << std::setw(2) << std::int32_t((unsigned char) c);
}
return escaped.str();
}
}}}} // namespace kiwi::network::http::util
| 1,849
|
C++
|
.cpp
| 41
| 37.487805
| 90
| 0.543829
|
Musicoll/Kiwi
| 134
| 11
| 7
|
GPL-3.0
|
9/20/2024, 9:42:21 PM (Europe/Amsterdam)
| false
| false
| false
| false
| false
| false
| false
| false
|
754,155
|
KiwiTool_Beacon.cpp
|
Musicoll_Kiwi/Modules/KiwiTool/KiwiTool_Beacon.cpp
|
/*
==============================================================================
This file is part of the KIWI library.
- Copyright (c) 2014-2016, Pierre Guillot & Eliott Paris.
- Copyright (c) 2016-2019, CICM, ANR MUSICOLL, Eliott Paris, Pierre Guillot, Jean Millot.
Permission is granted to use this software under the terms of the GPL v3
(or any later version). Details can be found at: www.gnu.org/licenses
KIWI 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.
------------------------------------------------------------------------------
Contact : [email protected]
==============================================================================
*/
#include <KiwiTool/KiwiTool_Beacon.h>
namespace kiwi { namespace tool {
// ================================================================================ //
// BEACON //
// ================================================================================ //
Beacon::Beacon(std::string const& name) : m_name(name)
{
;
}
void Beacon::bind(Castaway& castaway)
{
m_castaways.insert(&castaway);
}
void Beacon::unbind(Castaway& castaway)
{
m_castaways.erase(&castaway);
}
void Beacon::dispatch(std::vector<Atom> const& args)
{
for(auto* castaway : m_castaways)
{
castaway->receive(args);
}
}
// ================================================================================ //
// BEACON FACTORY //
// ================================================================================ //
Beacon& Beacon::Factory::getBeacon(std::string const& name)
{
auto it = m_beacons.find(name);
if(it != m_beacons.end())
{
return *it->second.get();
}
Beacon* beacon = new Beacon(name);
if(beacon)
{
m_beacons[name] = std::unique_ptr<Beacon>(beacon);
}
return *beacon;
}
}}
| 2,343
|
C++
|
.cpp
| 56
| 35.25
| 90
| 0.428379
|
Musicoll/Kiwi
| 134
| 11
| 7
|
GPL-3.0
|
9/20/2024, 9:42:21 PM (Europe/Amsterdam)
| false
| false
| false
| false
| false
| false
| false
| false
|
754,156
|
KiwiTool_Atom.cpp
|
Musicoll_Kiwi/Modules/KiwiTool/KiwiTool_Atom.cpp
|
/*
==============================================================================
This file is part of the KIWI library.
- Copyright (c) 2014-2016, Pierre Guillot & Eliott Paris.
- Copyright (c) 2016-2019, CICM, ANR MUSICOLL, Eliott Paris, Pierre Guillot, Jean Millot.
Permission is granted to use this software under the terms of the GPL v3
(or any later version). Details can be found at: www.gnu.org/licenses
KIWI 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.
------------------------------------------------------------------------------
Contact : [email protected]
==============================================================================
*/
#include <KiwiTool/KiwiTool_Atom.h>
namespace kiwi { namespace tool {
// ================================================================================ //
// ATOM //
// ================================================================================ //
Atom::Atom() noexcept
: m_type(Type::Null)
, m_value()
{
;
}
Atom::Atom(const bool value) noexcept
: m_type(Type::Int)
, m_value(value ? int_t(1) : int_t(0))
{
;
}
Atom::Atom(const int value) noexcept
: m_type(Type::Int)
, m_value(static_cast<int_t>(value))
{
;
}
Atom::Atom(const long value) noexcept
: m_type(Type::Int)
, m_value(static_cast<int_t>(value))
{
;
}
Atom::Atom(const long long value) noexcept
: m_type(Type::Int)
, m_value(static_cast<int_t>(value))
{
;
}
Atom::Atom(const float value) noexcept
: m_type(Type::Float)
, m_value(static_cast<float_t>(value))
{
;
}
Atom::Atom(const double value) noexcept
: m_type(Type::Float)
, m_value(static_cast<float_t>(value))
{
;
}
Atom::Atom(string_t const& sym)
: m_type(Type::String)
, m_value(sym)
{
;
}
Atom::Atom(string_t&& sym)
: m_type(Type::String)
, m_value(std::move(sym))
{
;
}
Atom::Atom(char const* sym)
: m_type(Type::String)
, m_value(std::move(sym))
{
;
}
Atom Atom::Comma()
{
Atom atom;
atom.m_type = Type::Comma;
return atom;
}
Atom Atom::Dollar(int_t index)
{
assert((index > 0 && index <= 9));
Atom atom(index);
atom.m_type = Type::Dollar;
return (index > 0 && index <= 9) ? atom : Atom();
}
Atom::Atom(Atom const& other)
: m_type(other.m_type)
{
switch(m_type)
{
case Type::Int:
case Type::Dollar:
{
m_value = other.m_value.int_v;
break;
}
case Type::Float:
{
m_value = other.m_value.float_v;
break;
}
case Type::String:
{
assert(other.m_value.string_v != nullptr);
m_value = *other.m_value.string_v;
break;
}
case Type::Comma:
{
break;
}
default: break;
}
}
Atom::Atom(Atom&& other)
: m_type(std::move(other.m_type))
, m_value(std::move(other.m_value))
{
// leave the other as a Null value Atom
other.m_type = Type::Null;
other.m_value = {};
}
Atom::~Atom()
{
if(isString())
{
std::allocator<string_t> alloc;
alloc.destroy(m_value.string_v);
alloc.deallocate(m_value.string_v, 1);
}
}
Atom& Atom::operator=(Atom const& other)
{
if(!other.isString())
{
if(isString())
{
std::allocator<string_t> alloc;
alloc.destroy(m_value.string_v);
alloc.deallocate(m_value.string_v, 1);
}
m_value = other.m_value;
}
else
{
if(isString())
{
*m_value.string_v = *other.m_value.string_v;
}
else
{
m_value.string_v = create_string_pointer(*other.m_value.string_v);
}
}
m_type = other.m_type;
return *this;
}
Atom& Atom::operator=(Atom&& other) noexcept
{
std::swap(m_type, other.m_type);
std::swap(m_value, other.m_value);
return *this;
}
// ================================================================================ //
// Type Getters //
// ================================================================================ //
Atom::Type Atom::getType() const noexcept
{
return m_type;
}
bool Atom::isNull() const noexcept
{
return (m_type == Type::Null);
}
bool Atom::isInt() const noexcept
{
return m_type == Type::Int;
}
bool Atom::isFloat() const noexcept
{
return m_type == Type::Float;
}
bool Atom::isNumber() const noexcept
{
return (isInt() || isFloat());
}
bool Atom::isString() const noexcept
{
return m_type == Type::String;
}
bool Atom::isBang() const
{
static const auto bang_str = "bang";
return isString() && getString() == bang_str;
}
bool Atom::isComma() const noexcept
{
return m_type == Type::Comma;
}
bool Atom::isDollar() const noexcept
{
return m_type == Type::Dollar;
}
// ================================================================================ //
// Value Getters //
// ================================================================================ //
Atom::int_t Atom::getInt() const noexcept
{
if(isInt())
{
return m_value.int_v;
}
else if(isFloat())
{
return static_cast<int_t>(m_value.float_v);
}
return int_t(0);
}
Atom::float_t Atom::getFloat() const noexcept
{
if(isFloat())
{
return m_value.float_v;
}
else if(isInt())
{
return static_cast<float_t>(m_value.int_v);
}
return float_t(0.0);
}
Atom::string_t const& Atom::getString() const
{
if(isString())
{
return *m_value.string_v;
}
static const std::string empty_string;
return empty_string;
}
//! @brief Retrieves the Dollar index value if the Atom is a dollar type.
//! @return The Dollar index if the Atom is a dollar, 0 otherwise.
//! @see getType(), isDollar(), isDollarTyped()
Atom::int_t Atom::getDollarIndex() const
{
return isDollar() ? m_value.int_v : 0;
}
// ================================================================================ //
// VALUE //
// ================================================================================ //
//! @internal Exception-safe object creation helper
Atom::string_t* Atom::create_string_pointer(string_t const& v)
{
std::allocator<string_t> alloc;
auto deleter = [&alloc](string_t * object) { alloc.deallocate(object, 1); };
std::unique_ptr<string_t, decltype(deleter)> object(alloc.allocate(1), deleter);
alloc.construct(object.get(), v);
return object.release();
}
Atom::string_t* Atom::create_string_pointer(string_t&& v)
{
std::allocator<string_t> alloc;
auto deleter = [&alloc](string_t * object) { alloc.deallocate(object, 1); };
std::unique_ptr<string_t, decltype(deleter)> object(alloc.allocate(1), deleter);
alloc.construct(object.get(), std::move(v));
return object.release();
}
// ================================================================================ //
// ATOM HELPER //
// ================================================================================ //
std::vector<Atom> AtomHelper::parse(std::string const& text, int flags)
{
std::vector<Atom> atoms;
const auto text_end = text.cend();
auto text_it = text.begin();
enum class NumberState
{
NaN = -1,
MaybeNumber = 0,
GotMinus,
GotDigit,
GotDotWithoutDigit,
GotDotAfterDigit,
GotDigitAfterDot,
GotExpon,
GotPlusMinusAfterExpon,
GotDigitAfterExpon,
};
enum class DollarState
{
NotDollar = -1,
MaybeDollar = 0,
GotDollar,
DollarValid, // $1 => $9
};
for(;;)
{
// skip witespaces
while((text_it != text_end) && (*text_it == ' ' || (*text_it <= 13 && *text_it >= 9)))
text_it++;
if(text_it == text_end)
break; // end of parsing
std::ostringstream text_buffer;
NumberState numstate = NumberState::MaybeNumber;
DollarState dollar_state = ((flags & ParsingFlags::Dollar)
? DollarState::MaybeDollar
: DollarState::NotDollar);
bool is_quoted = false;
bool is_comma = false;
int dollar_index = 0;
bool lastslash = false;
bool slash = false;
while(text_it != text_end)
{
bool buffer_is_empty = (((long)text_buffer.tellp()) == 0);
char c = *text_it;
lastslash = slash;
slash = (c == '\\');
// skip witespaces characters
if(c == ' ' || (c <= 13 && c >= 9))
{
// preserve whitespaces in quoted tags
if(!is_quoted)
{
break;
}
}
else if(c == '\"' && !lastslash)
{
// closing quote
if(is_quoted)
{
text_it++;
break;
}
// opening quote
if(buffer_is_empty)
{
text_it++;
is_quoted = true;
continue;
}
}
else if(is_comma
|| ((flags & ParsingFlags::Comma) && (c == ',' && !is_quoted)))
{
if(!buffer_is_empty)
{
break;
}
is_comma = true;
}
else if(!is_quoted && numstate >= NumberState::MaybeNumber)
{
const bool digit = (c >= '0' && c <= '9'),
dot = (c == '.'), minus = (c == '-'),
plusminus = (minus || (c == '+')),
expon = (c == 'e' || c == 'E');
if (numstate == NumberState::MaybeNumber)
{
if (minus) numstate = NumberState::GotMinus;
else if (digit) numstate = NumberState::GotDigit;
else if (dot) numstate = NumberState::GotDotWithoutDigit;
else numstate = NumberState::NaN;
}
else if (numstate == NumberState::GotMinus)
{
if (digit) numstate = NumberState::GotDigit;
else if (dot) numstate = NumberState::GotDotWithoutDigit;
else numstate = NumberState::NaN;
}
else if (numstate == NumberState::GotDigit)
{
if (dot) numstate = NumberState::GotDotAfterDigit;
else if (expon) numstate = NumberState::GotDigit;
else if (!digit) numstate = NumberState::NaN;
}
else if (numstate == NumberState::GotDotWithoutDigit)
{
if (digit) numstate = NumberState::GotDigitAfterDot;
else numstate = NumberState::NaN;
}
else if (numstate == NumberState::GotDotAfterDigit)
{
if (digit) numstate = NumberState::GotDigitAfterDot;
else if (expon) numstate = NumberState::GotExpon;
else numstate = NumberState::NaN;
}
else if (numstate == NumberState::GotDigitAfterDot)
{
if (expon) numstate = NumberState::GotExpon;
else if (!digit) numstate = NumberState::NaN;
}
else if (numstate == NumberState::GotExpon)
{
if (plusminus) numstate = NumberState::GotPlusMinusAfterExpon;
else if (digit) numstate = NumberState::GotDigitAfterExpon;
else numstate = NumberState::NaN;
}
else if (numstate == NumberState::GotPlusMinusAfterExpon)
{
if (digit) numstate = NumberState::GotDigitAfterExpon;
else numstate = NumberState::NaN;
}
else if (numstate == NumberState::GotDigitAfterExpon)
{
if (!digit) numstate = NumberState::NaN;
}
}
if(dollar_state >= DollarState::MaybeDollar
&& numstate == NumberState::NaN && !is_quoted)
{
if(dollar_state == DollarState::MaybeDollar)
{
dollar_state = ((buffer_is_empty && (c == '$') && !is_quoted && !lastslash)
? DollarState::GotDollar
: DollarState::NotDollar);
}
else if (dollar_state == DollarState::GotDollar)
{
dollar_state = ((c > '0' && c <= '9')
? DollarState::DollarValid
: DollarState::NotDollar);
dollar_index = (dollar_state == DollarState::DollarValid ? (c - '0') : 0);
}
else if (dollar_state == DollarState::DollarValid)
{
if((c == ' ') || (flags & ParsingFlags::Comma && c == ','))
{
break;
}
else
{
dollar_state = DollarState::NotDollar;
}
}
}
// strip slashes
if(slash)
{
if(!lastslash)
{
text_it++;
continue;
}
else
{
slash = false;
}
}
text_buffer << c;
text_it++;
}
const auto& word = text_buffer.str();
if(!word.empty())
{
if(numstate == NumberState::GotDigit)
{
atoms.emplace_back(std::stol(word));
}
else if(numstate == NumberState::GotDotAfterDigit
|| numstate == NumberState::GotDigitAfterDot
|| numstate == NumberState::GotDigitAfterExpon)
{
atoms.emplace_back(std::stod(word));
}
else if(is_comma)
{
atoms.emplace_back(Atom::Comma());
}
else if(dollar_state == DollarState::DollarValid)
{
atoms.emplace_back(Atom::Dollar(dollar_index));
}
else
{
atoms.emplace_back(word);
}
}
}
return atoms;
}
std::string AtomHelper::toString(Atom const& atom, const bool add_quotes)
{
switch(atom.getType())
{
case Atom::Type::Int:
{
return std::to_string(atom.getInt());
}
case Atom::Type::Float:
{
return trimDecimal(std::to_string(atom.getFloat()));
}
case Atom::Type::String:
{
const auto& str = atom.getString();
if(!str.empty())
{
const bool need_quote = add_quotes && str.find_first_of(' ', 0) != std::string::npos;
if(need_quote)
{
std::ostringstream output;
output << "\"";
// add slashes
for(auto c : str)
{
if(c == '\\' || c == '"')
{
output << '\\';
}
output << c;
}
output << "\"";
return output.str();
}
return str;
}
}
case Atom::Type::Comma:
{
return ",";
}
case Atom::Type::Dollar:
{
return "$" + std::to_string(atom.getDollarIndex());
}
default : break;
}
return {};
}
std::string AtomHelper::toString(std::vector<Atom> const& atoms, const bool add_quotes)
{
static const auto delimiter = ' ';
std::ostringstream output;
if(!atoms.empty())
{
for(std::vector<Atom>::size_type i = 0; i < atoms.size();)
{
output << toString(atoms[i], add_quotes);
if(++i != atoms.size() && !atoms[i].isComma())
{
output << delimiter;
}
}
}
return output.str();
}
std::string AtomHelper::trimDecimal(std::string const& text)
{
auto output = text;
auto pos = text.find('.');
if(pos != std::string::npos)
{
auto size = text.size();
while(size > pos && text[size - 1] == '0')
{
output.pop_back();
size--;
}
}
return output;
}
}}
| 20,348
|
C++
|
.cpp
| 570
| 21.391228
| 105
| 0.402283
|
Musicoll/Kiwi
| 134
| 11
| 7
|
GPL-3.0
|
9/20/2024, 9:42:21 PM (Europe/Amsterdam)
| false
| false
| false
| false
| false
| false
| false
| false
|
754,157
|
KiwiTool_Parameter.cpp
|
Musicoll_Kiwi/Modules/KiwiTool/KiwiTool_Parameter.cpp
|
/*
==============================================================================
This file is part of the KIWI library.
- Copyright (c) 2014-2016, Pierre Guillot & Eliott Paris.
- Copyright (c) 2016-2019, CICM, ANR MUSICOLL, Eliott Paris, Pierre Guillot, Jean Millot.
Permission is granted to use this software under the terms of the GPL v3
(or any later version). Details can be found at: www.gnu.org/licenses
KIWI 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.
------------------------------------------------------------------------------
Contact : [email protected]
==============================================================================
*/
#include <KiwiTool/KiwiTool_Parameter.h>
namespace kiwi { namespace tool {
Parameter::Parameter(Type type):
m_type(type),
m_atoms()
{
switch (m_type)
{
case Type::Float:
{
float value = 0;
m_atoms.push_back(value);
break;
}
case Type::Int:
{
int value = 0;
m_atoms.push_back(value);
break;
}
case Type::String:
{
std::string value = "";
m_atoms.push_back(value);
}
}
}
Parameter::Parameter(Type type, std::vector<Atom> const atoms):
m_type(type),
m_atoms(atoms)
{
switch (m_type)
{
case Type::Float:
{
assert(m_atoms.size() == 1 && m_atoms[0].isFloat() && "Parameter float bad initialization");
m_atoms = atoms;
break;
}
case Type::Int:
{
assert(m_atoms.size() == 1 && m_atoms[0].isInt() && "Parameter int bad initialization");
break;
}
case Type::String:
{
assert(m_atoms.size() == 1 && m_atoms[0].isString() && "Parameter string bad initialization");
break;
}
}
}
Parameter::Parameter(Parameter const& other):
m_type(other.m_type),
m_atoms(other.m_atoms)
{
}
Parameter::~Parameter()
{
}
Parameter& Parameter::operator=(Parameter const& other)
{
assert(m_type == other.m_type && "Parameter assignment with different types");
if (&other != this)
{
m_atoms = other.m_atoms;
}
return *this;
}
Parameter::Type Parameter::getType() const
{
return m_type;
}
Atom const& Parameter::operator[](size_t index) const
{
assert(m_atoms.size() > index);
return m_atoms[index];
}
}}
| 2,978
|
C++
|
.cpp
| 92
| 22.967391
| 110
| 0.496091
|
Musicoll/Kiwi
| 134
| 11
| 7
|
GPL-3.0
|
9/20/2024, 9:42:21 PM (Europe/Amsterdam)
| false
| false
| false
| false
| false
| false
| false
| false
|
754,158
|
KiwiModel_DataModel.cpp
|
Musicoll_Kiwi/Modules/KiwiModel/KiwiModel_DataModel.cpp
|
/*
==============================================================================
This file is part of the KIWI library.
- Copyright (c) 2014-2016, Pierre Guillot & Eliott Paris.
- Copyright (c) 2016-2019, CICM, ANR MUSICOLL, Eliott Paris, Pierre Guillot, Jean Millot.
Permission is granted to use this software under the terms of the GPL v3
(or any later version). Details can be found at: www.gnu.org/licenses
KIWI 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.
------------------------------------------------------------------------------
Contact : [email protected]
==============================================================================
*/
#include <flip/DataModel.h>
#include <KiwiModel/KiwiModel_Def.h>
#include <KiwiModel/KiwiModel_DataModel.h>
#include <KiwiModel/KiwiModel_Point.h>
#include <KiwiModel/KiwiModel_Bounds.h>
#include <KiwiModel/KiwiModel_PatcherUser.h>
namespace kiwi
{
namespace model
{
bool DataModel::initialised = false;
void DataModel::declareObjects()
{
model::NewBox::declare();
model::ErrorBox::declare();
model::Slider::declare();
model::Print::declare();
model::Receive::declare();
model::Plus::declare();
model::Times::declare();
model::Delay::declare();
model::Metro::declare();
model::Pipe::declare();
model::Bang::declare();
model::Toggle::declare();
model::AdcTilde::declare();
model::DacTilde::declare();
model::OscTilde::declare();
model::Loadmess::declare();
model::PlusTilde::declare();
model::TimesTilde::declare();
model::SigTilde::declare();
model::MeterTilde::declare();
model::DelaySimpleTilde::declare();
model::Message::declare();
model::NoiseTilde::declare();
model::PhasorTilde::declare();
model::SahTilde::declare();
model::SnapshotTilde::declare();
model::Trigger::declare();
model::LineTilde::declare();
model::Minus::declare();
model::Divide::declare();
model::Equal::declare();
model::Less::declare();
model::Greater::declare();
model::Different::declare();
model::Pow::declare();
model::Modulo::declare();
model::MinusTilde::declare();
model::DivideTilde::declare();
model::LessTilde::declare();
model::GreaterTilde::declare();
model::EqualTilde::declare();
model::DifferentTilde::declare();
model::LessEqual::declare();
model::LessEqualTilde::declare();
model::GreaterEqual::declare();
model::GreaterEqualTilde::declare();
model::Comment::declare();
model::Pack::declare();
model::Unpack::declare();
model::Random::declare();
model::Scale::declare();
model::Select::declare();
model::Number::declare();
model::NumberTilde::declare();
model::Hub::declare();
model::Mtof::declare();
model::Send::declare();
model::Gate::declare();
model::Switch::declare();
model::GateTilde::declare();
model::SwitchTilde::declare();
model::Float::declare();
model::ClipTilde::declare();
model::Clip::declare();
model::SfPlayTilde::declare();
model::SfRecordTilde::declare();
model::FaustTilde::declare();
model::Route::declare();
model::OSCReceive::declare();
model::OSCSend::declare();
}
void DataModel::init(std::function<void()> declare_object)
{
assert(!initialised);
if(initialised) return; // abort
const std::string model_version = KIWI_MODEL_VERSION_STRING;
#ifdef DEBUG
std::cout << "- kiwi model version : " << model_version << '\n';
#endif
DataModel::version(model_version);
// basic data structures
model::Point::declare();
model::Bounds::declare();
// patcher elements declaration :
model::Object::declare();
declare_object();
// Links
Link::declare();
// Patcher
Patcher::declare();
initialised = true;
}
}
}
| 5,087
|
C++
|
.cpp
| 121
| 29.206612
| 91
| 0.520451
|
Musicoll/Kiwi
| 134
| 11
| 7
|
GPL-3.0
|
9/20/2024, 9:42:21 PM (Europe/Amsterdam)
| false
| false
| false
| false
| false
| false
| false
| false
|
754,159
|
KiwiModel_Link.cpp
|
Musicoll_Kiwi/Modules/KiwiModel/KiwiModel_Link.cpp
|
/*
==============================================================================
This file is part of the KIWI library.
- Copyright (c) 2014-2016, Pierre Guillot & Eliott Paris.
- Copyright (c) 2016-2019, CICM, ANR MUSICOLL, Eliott Paris, Pierre Guillot, Jean Millot.
Permission is granted to use this software under the terms of the GPL v3
(or any later version). Details can be found at: www.gnu.org/licenses
KIWI 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.
------------------------------------------------------------------------------
Contact : [email protected]
==============================================================================
*/
#include "KiwiModel_DataModel.h"
#include "KiwiModel_Object.h"
#include "KiwiModel_Link.h"
#include "KiwiModel_PatcherUser.h"
namespace kiwi
{
namespace model
{
// ================================================================================ //
// LINK::declare //
// ================================================================================ //
void Link::declare()
{
if(DataModel::has<Link>()) return;
DataModel::declare<Link>()
.name("cicm.kiwi.Link")
.member<flip::ObjectRef<model::Object>, &Link::m_sender>("sender_obj")
.member<flip::ObjectRef<model::Object>, &Link::m_receiver>("receiver_obj")
.member<flip::Int, &Link::m_index_outlet>("outlet_index")
.member<flip::Int, &Link::m_index_inlet>("inlet_index");
}
// ================================================================================ //
// LINK //
// ================================================================================ //
Link::Link(model::Object const& from, const size_t outlet, model::Object const& to, const size_t inlet) :
m_sender(from.ref()),
m_receiver(to.ref()),
m_index_outlet(outlet),
m_index_inlet(inlet)
{
;
}
model::Object const& Link::getSenderObject() const
{
return !removed() ? *m_sender.value() : *m_sender.before();
}
model::Object const& Link::getReceiverObject() const
{
return !removed() ? *m_receiver.value() : *m_receiver.before();
}
bool Link::isSenderValid() const
{
return m_sender.value() != nullptr;
}
bool Link::isReceiverValid() const
{
return m_receiver.value() != nullptr;
}
size_t Link::getSenderIndex() const
{
int64_t value = !removed() ? m_index_outlet.value() : m_index_outlet.before();
return static_cast<size_t>(value);
}
size_t Link::getReceiverIndex() const
{
int64_t value = !removed() ? m_index_inlet.value() : m_index_inlet.before();
return static_cast<size_t>(value);
}
bool Link::isSignal() const
{
return getSenderObject().getOutlet(getSenderIndex()).getType() == PinType(PinType::IType::Signal);
}
}
}
| 3,662
|
C++
|
.cpp
| 78
| 36.448718
| 114
| 0.458793
|
Musicoll/Kiwi
| 134
| 11
| 7
|
GPL-3.0
|
9/20/2024, 9:42:21 PM (Europe/Amsterdam)
| false
| false
| false
| false
| false
| false
| false
| false
|
754,160
|
KiwiModel_Bounds.cpp
|
Musicoll_Kiwi/Modules/KiwiModel/KiwiModel_Bounds.cpp
|
/*
==============================================================================
This file is part of the KIWI library.
- Copyright (c) 2014-2016, Pierre Guillot & Eliott Paris.
- Copyright (c) 2016-2019, CICM, ANR MUSICOLL, Eliott Paris, Pierre Guillot, Jean Millot.
Permission is granted to use this software under the terms of the GPL v3
(or any later version). Details can be found at: www.gnu.org/licenses
KIWI 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.
------------------------------------------------------------------------------
Contact : [email protected]
==============================================================================
*/
#include <KiwiModel/KiwiModel_Bounds.h>
#include <KiwiModel/KiwiModel_DataModel.h>
namespace kiwi { namespace model {
void Bounds::declare()
{
if(DataModel::has<model::Bounds>())
return; // abort
DataModel::declare<model::Bounds>()
.name("cicm.kiwi.Bounds")
.member<flip::Float, &Bounds::m_x>("x")
.member<flip::Float, &Bounds::m_y>("y")
.member<flip::Float, &Bounds::m_width>("width")
.member<flip::Float, &Bounds::m_height>("height");
}
Bounds::Bounds(double x, double y, double width, double height)
: m_x(x)
, m_y(y)
{
setSize(width, height);
}
double Bounds::getX() const
{
return m_x;
}
double Bounds::getY() const
{
return m_y;
}
double Bounds::getWidth() const
{
return m_width;
}
double Bounds::getHeight() const
{
return m_height;
}
void Bounds::setX(double x)
{
m_x = x;
}
void Bounds::setY(double y)
{
m_y = y;
}
void Bounds::setWidth(double width)
{
m_width = std::max(0., width);
}
void Bounds::setHeight(double height)
{
m_height = std::max(0., height);
}
void Bounds::setPosition(double x, double y)
{
setX(x);
setY(y);
}
void Bounds::setSize(double width, double height)
{
setWidth(width);
setHeight(height);
}
}}
| 2,493
|
C++
|
.cpp
| 77
| 24.545455
| 91
| 0.537326
|
Musicoll/Kiwi
| 134
| 11
| 7
|
GPL-3.0
|
9/20/2024, 9:42:21 PM (Europe/Amsterdam)
| false
| false
| false
| false
| false
| false
| false
| false
|
754,161
|
KiwiModel_PatcherValidator.cpp
|
Musicoll_Kiwi/Modules/KiwiModel/KiwiModel_PatcherValidator.cpp
|
/*
==============================================================================
This file is part of the KIWI library.
- Copyright (c) 2014-2016, Pierre Guillot & Eliott Paris.
- Copyright (c) 2016-2019, CICM, ANR MUSICOLL, Eliott Paris, Pierre Guillot, Jean Millot.
Permission is granted to use this software under the terms of the GPL v3
(or any later version). Details can be found at: www.gnu.org/licenses
KIWI 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.
------------------------------------------------------------------------------
Contact : [email protected]
==============================================================================
*/
#include "KiwiModel_PatcherValidator.h"
namespace kiwi
{
namespace model
{
// ================================================================================ //
// PATCHER VALIDATOR //
// ================================================================================ //
void PatcherValidator::validate(Patcher & patcher)
{
if (patcher.changed())
{
if (patcher.objectsChanged())
{
for(Object const& object : patcher.getObjects())
{
if(object.removed())
{
objectRemoved(object, patcher);
}
}
}
if (patcher.linksChanged())
{
for(Link const& link : patcher.getLinks())
{
if(link.added())
{
linkAdded(link);
}
}
}
}
}
void PatcherValidator::objectRemoved(Object const& object, Patcher const& patcher) const
{
for(Link const& link : patcher.getLinks())
{
if((link.getSenderObject().ref() == object.ref() || link.getReceiverObject().ref() == object.ref())
&& !link.removed())
{
flip_VALIDATION_FAILED ("Removing object without removing its links");
}
}
}
void PatcherValidator::linkAdded(Link const& link) const
{
if(!link.isSenderValid() || !link.isReceiverValid())
{
flip_VALIDATION_FAILED ("Creating link to non existing object");
}
PinType outlet_type = link.getSenderObject().getOutlet(link.getSenderIndex()).getType();
if (!link.getReceiverObject().getInlet(link.getReceiverIndex()).hasType(outlet_type))
{
flip_VALIDATION_FAILED("Link creation type mismatch between outlet and inlet");
}
}
}
}
| 3,270
|
C++
|
.cpp
| 73
| 30.452055
| 116
| 0.436956
|
Musicoll/Kiwi
| 134
| 11
| 7
|
GPL-3.0
|
9/20/2024, 9:42:21 PM (Europe/Amsterdam)
| false
| false
| false
| false
| false
| false
| false
| false
|
754,162
|
KiwiModel_Patcher.cpp
|
Musicoll_Kiwi/Modules/KiwiModel/KiwiModel_Patcher.cpp
|
/*
==============================================================================
This file is part of the KIWI library.
- Copyright (c) 2014-2016, Pierre Guillot & Eliott Paris.
- Copyright (c) 2016-2019, CICM, ANR MUSICOLL, Eliott Paris, Pierre Guillot, Jean Millot.
Permission is granted to use this software under the terms of the GPL v3
(or any later version). Details can be found at: www.gnu.org/licenses
KIWI 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.
------------------------------------------------------------------------------
Contact : [email protected]
==============================================================================
*/
#include "KiwiModel_DataModel.h"
#include "KiwiModel_PatcherUser.h"
#include "KiwiModel_PatcherUser.h"
#include "KiwiModel_Factory.h"
namespace kiwi
{
namespace model
{
// ================================================================================ //
// PATCHER::declare //
// ================================================================================ //
void Patcher::declare()
{
assert(! DataModel::has<Patcher>());
Patcher::View::declare();
Patcher::User::declare();
DataModel::declare<Patcher>()
.name("cicm.kiwi.Patcher")
.member<Objects, &Patcher::m_objects>("objects")
.member<Links, &Patcher::m_links>("links")
.member<Users, &Patcher::m_users>("users");
}
// ================================================================================ //
// PATCHER MODEL //
// ================================================================================ //
Patcher::Patcher()
: signal_user_connect(Signal_USER_CONNECT, *this)
, signal_user_disconnect(Signal_USER_DISCONNECT, *this)
, signal_get_connected_users(Signal_GET_CONNECTED_USERS, *this)
, signal_receive_connected_users(Signal_RECEIVE_CONNECTED_USERS, *this)
, signal_stack_overflow(Signal_STACK_OVERFLOW, *this)
, signal_stack_overflow_clear(Signal_STACK_OVERFLOW_CLEAR, *this)
{
// user changes doesn't need to be stored in an history.
m_users.disable_in_undo();
}
Patcher::~Patcher()
{
m_links.clear();
m_objects.clear();
}
model::Object & Patcher::addObject(std::unique_ptr<model::Object> && object)
{
assert(object != nullptr);
return *m_objects.insert(m_objects.end(), std::move(object));
}
model::Object & Patcher::replaceObject(model::Object const& old_object,
std::unique_ptr<model::Object> && new_object)
{
assert(new_object != nullptr);
model::Object & object_ref = addObject(std::move(new_object));
// re-link object
const size_t new_inlets = object_ref.getNumberOfInlets();
const size_t new_outlets = object_ref.getNumberOfOutlets();
for(model::Link& link : getLinks())
{
if(!link.removed())
{
const model::Object& from = link.getSenderObject();
const size_t outlet_index = link.getSenderIndex();
const model::Object& to = link.getReceiverObject();
const size_t inlet_index = link.getReceiverIndex();
if(&from == &old_object)
{
if(outlet_index < new_outlets)
{
addLink(object_ref, outlet_index, to, inlet_index);
}
}
if(&to == &old_object)
{
if(inlet_index < new_inlets)
{
addLink(from, outlet_index, object_ref, inlet_index);
}
}
}
}
removeObject(old_object);
return object_ref;
}
model::Object& Patcher::addObject(std::string const& name, flip::Mold const& mold)
{
return *m_objects.insert(m_objects.end(), Factory::create(name, mold));
}
model::Link* Patcher::addLink(model::Object const& from, const size_t outlet,
model::Object const& to, const size_t inlet)
{
if(canConnect(from, outlet, to, inlet))
{
const auto it = m_links.emplace(m_links.end(), from, outlet, to, inlet);
return it.operator->();
}
return nullptr;
}
bool Patcher::canConnect(model::Object const& from, const size_t outlet,
model::Object const& to, const size_t inlet) const
{
// check source object
const auto from_it = findObject(from);
const bool from_valid = (from_it != m_objects.cend() && from_it->getNumberOfOutlets() > outlet);
// check destination object
const auto to_it = findObject(to);
const bool to_valid = (to_it != m_objects.cend() && to_it->getNumberOfInlets() > inlet);
if(from_valid && to_valid)
{
// Check if link does not exists.
const auto find_link = [&from, &outlet, &to, &inlet](model::Link const& link_model)
{
return (link_model.getSenderObject().ref() == from.ref() &&
link_model.getReceiverObject().ref() == to.ref() &&
link_model.getSenderIndex() == outlet &&
link_model.getReceiverIndex() == inlet);
};
// Check if inlets and outlets types are compatible
if (std::find_if(m_links.begin(), m_links.end(), find_link) == m_links.cend())
{
return to_it->getInlet(inlet).hasType(from_it->getOutlet(outlet).getType());
}
}
return false;
}
void Patcher::removeObject(model::Object const& object, Patcher::View* view)
{
auto object_it = findObject(object);
if(object_it != m_objects.end())
{
// first remove links connected to this object
for(auto link_it = m_links.begin(); link_it != m_links.end();)
{
if(!link_it.removed())
{
if(link_it->getSenderObject().ref() == object.ref()
|| link_it->getReceiverObject().ref() == object.ref())
{
if(view != nullptr)
{
view->unselectLink(*link_it);
}
link_it = m_links.erase(link_it);
}
else
{
++link_it;
}
}
else
{
++link_it;
}
}
if(view != nullptr)
{
view->unselectObject(*object_it);
}
m_objects.erase(object_it);
}
}
void Patcher::removeLink(model::Link const& link, Patcher::View* view)
{
const auto link_it = findLink(link);
if(link_it != m_links.end())
{
if(!link_it.removed())
{
if(view != nullptr)
{
view->unselectLink(*link_it);
}
m_links.erase(link_it);
}
}
}
bool Patcher::objectsChanged() const noexcept
{
return m_objects.changed();
}
bool Patcher::linksChanged() const noexcept
{
return m_links.changed();
}
bool Patcher::usersChanged() const noexcept
{
return m_users.changed();
}
Patcher::Objects const& Patcher::getObjects() const noexcept
{
return m_objects;
}
Patcher::Objects& Patcher::getObjects() noexcept
{
return m_objects;
}
Patcher::Links const& Patcher::getLinks() const noexcept
{
return m_links;
}
Patcher::Links& Patcher::getLinks() noexcept
{
return m_links;
}
Patcher::Users const& Patcher::getUsers() const noexcept
{
return m_users;
}
Patcher::Users& Patcher::getUsers() noexcept
{
return m_users;
}
bool Patcher::hasSelfUser() const
{
auto it = std::find_if(m_users.begin(), m_users.end(),
[self_id = document().user()](User const& user)
{
return (user.getId() == self_id);
});
return it != m_users.end();
}
Patcher::User& Patcher::useSelfUser()
{
auto it = std::find_if(m_users.begin(), m_users.end(),
[self_id = document().user()](User const& user) {
return (user.getId() == self_id);
});
// creates and returns a new user if it didn't exist.
return (it != m_users.end()) ? *it : *m_users.emplace();
}
Patcher::Objects::const_iterator Patcher::findObject(model::Object const& object) const
{
const auto find_it = [&object](model::Object const& object_model)
{
return (object.ref() == object_model.ref());
};
return std::find_if(m_objects.begin(), m_objects.end(), find_it);
}
Patcher::Links::const_iterator Patcher::findLink(model::Link const& link) const
{
const auto find_it = [&link](model::Link const& link_model)
{
return (link.ref() == link_model.ref());
};
return std::find_if(m_links.begin(), m_links.end(), find_it);
}
Patcher::Objects::iterator Patcher::findObject(model::Object const& object)
{
const auto find_it = [&object](model::Object const& object_model)
{
return (object.ref() == object_model.ref());
};
return std::find_if(m_objects.begin(), m_objects.end(), find_it);
}
Patcher::Links::iterator Patcher::findLink(model::Link const& link)
{
const auto find_it = [&link](model::Link const& link_model)
{
return (link.ref() == link_model.ref());
};
return std::find_if(m_links.begin(), m_links.end(), find_it);
}
}
}
| 12,443
|
C++
|
.cpp
| 275
| 28.061818
| 109
| 0.444841
|
Musicoll/Kiwi
| 134
| 11
| 7
|
GPL-3.0
|
9/20/2024, 9:42:21 PM (Europe/Amsterdam)
| false
| false
| false
| false
| false
| false
| false
| false
|
754,163
|
KiwiModel_Factory.cpp
|
Musicoll_Kiwi/Modules/KiwiModel/KiwiModel_Factory.cpp
|
/*
==============================================================================
This file is part of the KIWI library.
- Copyright (c) 2014-2016, Pierre Guillot & Eliott Paris.
- Copyright (c) 2016-2019, CICM, ANR MUSICOLL, Eliott Paris, Pierre Guillot, Jean Millot.
Permission is granted to use this software under the terms of the GPL v3
(or any later version). Details can be found at: www.gnu.org/licenses
KIWI 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.
------------------------------------------------------------------------------
Contact : [email protected]
==============================================================================
*/
#include <cassert>
#include <KiwiModel/KiwiModel_Objects/KiwiModel_ErrorBox.h>
#include "KiwiModel_Factory.h"
namespace kiwi
{
namespace model
{
// ================================================================================ //
// FACTORY //
// ================================================================================ //
std::vector<std::unique_ptr<ObjectClass>> Factory::m_object_classes;
std::unique_ptr<model::Object> Factory::create(std::vector<tool::Atom> const& atoms)
{
std::unique_ptr<model::Object> object;
auto * object_class = !atoms.empty() ? getClassByName(atoms[0].getString()) : getClassByName("newbox");
if (object_class == nullptr)
{
object_class = getClassByName("errorbox");
object = object_class->create(std::vector<tool::Atom>());
dynamic_cast<ErrorBox*>(object.get())->setError("object \"" + atoms[0].getString() + "\" not found");
}
else
{
try
{
std::vector<tool::Atom> args(atoms.empty() ? atoms.begin() : atoms.begin() + 1, atoms.end());
object = object_class->create(args);
}
catch(model::Object::Error & e)
{
object_class = getClassByName("errorbox");
object = object_class->create(std::vector<tool::Atom>());
dynamic_cast<ErrorBox*>(object.get())->setError(e.what());
}
}
object->m_text = tool::AtomHelper::toString(atoms);
return object;
}
std::unique_ptr<model::Object> Factory::create(std::string const& name, flip::Mold const& mold)
{
auto const* class_ptr = getClassByName(name);
if(class_ptr != nullptr)
{
return class_ptr->moldCast(mold);
}
else
{
throw std::runtime_error("Factory can't create object " + name);
}
}
void Factory::copy(model::Object const& object, flip::Mold& mold)
{
const auto name = object.getName();
auto const* class_ptr = getClassByName(name);
if(class_ptr != nullptr)
{
class_ptr->moldMake(object, mold);
}
else
{
throw std::runtime_error("can't copy object " + name);
}
}
bool Factory::has(std::string const& name)
{
for(const auto& object_class : m_object_classes)
{
if(object_class->getName() == name || object_class->hasAlias(name))
return true;
}
return false;
}
ObjectClass const* Factory::getClassByName(std::string const& name,
const bool ignore_aliases)
{
for(const auto& object_class : m_object_classes)
{
if(object_class->getName() == name || (!ignore_aliases && object_class->hasAlias(name)))
return object_class.get();
}
return nullptr;
}
ObjectClass const* Factory::getClassByTypeId(size_t type_id)
{
auto found_class = std::find_if(m_object_classes.begin(),
m_object_classes.end(),
[type_id](std::unique_ptr<ObjectClass> const& object_class)
{
return object_class->m_type_id == type_id;
});
return found_class != m_object_classes.end() ? found_class->get() : nullptr;
}
std::vector<std::string> Factory::getNames(const bool ignore_aliases, const bool ignore_internals)
{
std::vector<std::string> names;
names.reserve(m_object_classes.size());
for(const auto& object_class : m_object_classes)
{
if(!object_class->hasFlag(ObjectClass::Flag::Internal) || !ignore_internals)
{
names.emplace_back(object_class->getName());
if(!ignore_aliases && object_class->hasAlias())
{
const auto aliases = object_class->getAliases();
names.insert(names.end(), aliases.begin(), aliases.end());
}
}
}
return names;
}
std::string Factory::toModelName(std::string const& name)
{
std::string model_name = "cicm.kiwi.object.";
for (char const& c : name)
{
assert(c != '\\' && "using antislash character in object name");
if (uint8_t (c) < 0x20
|| uint8_t (c) == 0x20
|| uint8_t (c) == 0x7f
|| uint8_t (c) >= 0x80)
{
int i = (int) c;
std::string int_string = "\x5C" + std::to_string(i) + "\x5C";
model_name.append(int_string);
}
else
{
model_name.push_back(c);
}
}
return model_name;
}
std::string Factory::toKiwiName(std::string const& model_name)
{
std::string prefix = "cicm.kiwi.object.";
assert(model_name.find(prefix) == 0);
std::string kiwi_name = model_name;
kiwi_name.erase(0, prefix.size());
size_t slash_pos = kiwi_name.find('\\');
while(slash_pos != std::string::npos)
{
size_t next_slash = kiwi_name.find('\\', slash_pos + 1);
std::string int_string = kiwi_name.substr(slash_pos + 1, next_slash - slash_pos);
char c = (char) std::stoi(int_string);
kiwi_name.replace(slash_pos, next_slash - slash_pos + 1, 1, c);
slash_pos = kiwi_name.find('\\');
}
return kiwi_name;
}
}
}
| 7,889
|
C++
|
.cpp
| 165
| 30.248485
| 118
| 0.46042
|
Musicoll/Kiwi
| 134
| 11
| 7
|
GPL-3.0
|
9/20/2024, 9:42:21 PM (Europe/Amsterdam)
| false
| false
| false
| false
| false
| false
| false
| false
|
754,164
|
KiwiModel_PatcherUser.cpp
|
Musicoll_Kiwi/Modules/KiwiModel/KiwiModel_PatcherUser.cpp
|
/*
==============================================================================
This file is part of the KIWI library.
- Copyright (c) 2014-2016, Pierre Guillot & Eliott Paris.
- Copyright (c) 2016-2019, CICM, ANR MUSICOLL, Eliott Paris, Pierre Guillot, Jean Millot.
Permission is granted to use this software under the terms of the GPL v3
(or any later version). Details can be found at: www.gnu.org/licenses
KIWI 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.
------------------------------------------------------------------------------
Contact : [email protected]
==============================================================================
*/
#include "KiwiModel_DataModel.h"
#include "KiwiModel_PatcherUser.h"
namespace kiwi
{
namespace model
{
// ================================================================================ //
// PATCHER::declare //
// ================================================================================ //
void Patcher::User::declare()
{
assert(! DataModel::has<Patcher::User>());
DataModel::declare<Patcher::User>()
.name("cicm.kiwi.Patcher.User")
.member<flip::Collection<Patcher::View>, &Patcher::User::m_views>("views");
}
// ================================================================================ //
// PATCHER USER //
// ================================================================================ //
Patcher::User::User()
{
}
Patcher::View& Patcher::User::addView()
{
return *m_views.emplace();
}
flip::Collection<Patcher::View>::iterator Patcher::User::removeView(View const& view)
{
auto it = m_views.find_if([&view](View const& patcher_view) {
return (&view == &patcher_view);
});
if(it != m_views.end())
{
return m_views.erase(it);
}
return m_views.end();
}
uint64_t Patcher::User::getId() const
{
return ref().user();
}
flip::Collection<Patcher::View> const& Patcher::User::getViews() const noexcept
{
return m_views;
}
flip::Collection<Patcher::View>& Patcher::User::getViews() noexcept
{
return m_views;
}
size_t Patcher::User::getNumberOfViews() const noexcept
{
return std::count_if(m_views.begin(), m_views.end(), [](auto){return true;});
}
}
}
| 3,143
|
C++
|
.cpp
| 69
| 34.318841
| 95
| 0.425532
|
Musicoll/Kiwi
| 134
| 11
| 7
|
GPL-3.0
|
9/20/2024, 9:42:21 PM (Europe/Amsterdam)
| false
| false
| false
| false
| false
| false
| false
| false
|
754,165
|
KiwiModel_PatcherView.cpp
|
Musicoll_Kiwi/Modules/KiwiModel/KiwiModel_PatcherView.cpp
|
/*
==============================================================================
This file is part of the KIWI library.
- Copyright (c) 2014-2016, Pierre Guillot & Eliott Paris.
- Copyright (c) 2016-2019, CICM, ANR MUSICOLL, Eliott Paris, Pierre Guillot, Jean Millot.
Permission is granted to use this software under the terms of the GPL v3
(or any later version). Details can be found at: www.gnu.org/licenses
KIWI 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.
------------------------------------------------------------------------------
Contact : [email protected]
==============================================================================
*/
#include "KiwiModel_DataModel.h"
#include "KiwiModel_PatcherView.h"
namespace kiwi
{
namespace model
{
// ================================================================================ //
// PATCHER::declare //
// ================================================================================ //
void Patcher::View::Object::declare()
{
assert(! DataModel::has<Patcher::View::Object>());
DataModel::declare<Patcher::View::Object>()
.name("cicm.kiwi.Patcher.View.Object")
.template member<flip::ObjectRef<model::Object>, &View::Object::m_ref>("ref");
}
void Patcher::View::Link::declare()
{
assert(! DataModel::has<Patcher::View::Link>());
DataModel::declare<Patcher::View::Link>()
.name("cicm.kiwi.Patcher.View.Link")
.member<flip::ObjectRef<model::Link>, &View::Link::m_ref>("ref");
}
void Patcher::View::declare()
{
assert(! DataModel::has<Patcher::View>());
Patcher::View::Object::declare();
Patcher::View::Link::declare();
DataModel::declare<Patcher::View>()
.name("cicm.kiwi.Patcher.View")
.member<flip::Collection<View::Object>, &View::m_selected_objects>("selected_objects")
.member<flip::Collection<View::Link>, &View::m_selected_links>("selected_links")
.member<flip::Bool, &View::m_is_locked>("locked")
.member<flip::Float, &View::m_zoom_factor>("zoom_factor")
.member<Bounds, &View::m_screen_bounds>("screen_bounds")
.member<Point, &View::m_view_position>("view_position")
;
}
// ================================================================================ //
// PATCHER VIEW //
// ================================================================================ //
Patcher::View::View() : m_is_locked(false), m_zoom_factor(1.)
{
;
}
Patcher::View::~View()
{
m_selected_links.clear();
m_selected_objects.clear();
}
Patcher& Patcher::View::getPatcher()
{
return ancestor<Patcher>();
}
void Patcher::View::setLock(bool locked)
{
m_is_locked = locked;
}
bool Patcher::View::getLock() const noexcept
{
return m_is_locked;
}
bool Patcher::View::lockChanged() const noexcept
{
return m_is_locked.changed();
}
void Patcher::View::setZoomFactor(double zoom_factor)
{
const double min_zoom = 0.25;
const double max_zoom = 4.;
m_zoom_factor = std::max(min_zoom, std::min(zoom_factor, max_zoom));
}
double Patcher::View::getZoomFactor() const noexcept
{
return m_zoom_factor;
}
bool Patcher::View::zoomFactorChanged() const noexcept
{
return m_zoom_factor.changed();
}
std::vector<model::Object*> Patcher::View::getSelectedObjects()
{
std::vector<model::Object*> objects;
for(auto& object : m_selected_objects)
{
objects.push_back(object.get());
}
return objects;
}
std::vector<model::Link*> Patcher::View::getSelectedLinks()
{
std::vector<model::Link*> links;
for(auto& link : m_selected_links)
{
links.push_back(link.get());
}
return links;
}
bool Patcher::View::isSelected(model::Object const& object) const
{
for(auto& ref : m_selected_objects)
{
if(!ref.removed())
{
auto* sel_object = ref.get();
if(sel_object != nullptr && sel_object == &object) return true;
}
}
return false;
}
bool Patcher::View::isSelected(model::Link const& link) const
{
for(auto& ref : m_selected_links)
{
if(!ref.removed())
{
auto* sel_link = ref.get();
if(sel_link != nullptr && sel_link == &link) return true;
}
}
return false;
}
bool Patcher::View::selectionChanged() const
{
return (m_selected_objects.changed() || m_selected_links.changed());
}
void Patcher::View::selectObject(model::Object& object)
{
if(!isSelected(object))
{
m_selected_objects.emplace(object);
}
}
void Patcher::View::selectLink(model::Link& link)
{
if(!isSelected(link))
{
m_selected_links.emplace(link);
}
}
void Patcher::View::unselectObject(model::Object& object)
{
const auto find_object = [&object] (View::Object& ref)
{
if(!ref.removed())
{
auto* sel_object = ref.get();
if(sel_object != nullptr && sel_object == &object) return true;
}
return false;
};
auto it = std::find_if(m_selected_objects.begin(), m_selected_objects.end(), find_object);
if(it != m_selected_objects.end())
{
m_selected_objects.erase(it);
}
}
void Patcher::View::unselectLink(model::Link& link)
{
const auto find_link = [&link] (View::Link& ref)
{
if(!ref.removed())
{
auto* sel_link = ref.get();
if(sel_link != nullptr && sel_link == &link) return true;
}
return false;
};
auto it = std::find_if(m_selected_links.begin(), m_selected_links.end(), find_link);
if(it != m_selected_links.end())
{
m_selected_links.erase(it);
}
}
void Patcher::View::unselectAll()
{
m_selected_links.clear();
m_selected_objects.clear();
}
void Patcher::View::selectAll()
{
unselectAll();
auto& patcher = getPatcher();
for(auto& object : patcher.getObjects())
{
if(!object.removed())
{
m_selected_objects.emplace(object);
}
}
for(auto& link : patcher.getLinks())
{
if(!link.removed())
{
m_selected_links.emplace(link);
}
}
}
Bounds const& Patcher::View::getScreenBounds() const
{
return m_screen_bounds;
}
void Patcher::View::setScreenBounds(double x, double y, double width, double height)
{
m_screen_bounds.setPosition(x, y);
m_screen_bounds.setSize(width, height);
}
Point const& Patcher::View::getViewPosition() const
{
return m_view_position;
}
void Patcher::View::setViewPosition(double x, double y)
{
m_view_position.setPosition(x, y);
}
// ================================================================================ //
// PATCHER VIEW OBJECT //
// ================================================================================ //
Patcher::View::Object::Object(model::Object& object) : m_ref(&object)
{
;
}
model::Object* Patcher::View::Object::get() const
{
return m_ref.value();
}
// ================================================================================ //
// PATCHER VIEW LINK //
// ================================================================================ //
Patcher::View::Link::Link(model::Link& link) : m_ref(&link)
{
;
}
model::Link* Patcher::View::Link::get() const
{
return m_ref.value();
}
}
}
| 10,461
|
C++
|
.cpp
| 253
| 26.474308
| 103
| 0.426724
|
Musicoll/Kiwi
| 134
| 11
| 7
|
GPL-3.0
|
9/20/2024, 9:42:21 PM (Europe/Amsterdam)
| false
| false
| false
| false
| false
| false
| false
| false
|
754,166
|
KiwiModel_ObjectClass.cpp
|
Musicoll_Kiwi/Modules/KiwiModel/KiwiModel_ObjectClass.cpp
|
/*
==============================================================================
This file is part of the KIWI library.
- Copyright (c) 2014-2016, Pierre Guillot & Eliott Paris.
- Copyright (c) 2016-2019, CICM, ANR MUSICOLL, Eliott Paris, Pierre Guillot, Jean Millot.
Permission is granted to use this software under the terms of the GPL v3
(or any later version). Details can be found at: www.gnu.org/licenses
KIWI 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.
------------------------------------------------------------------------------
Contact : [email protected]
==============================================================================
*/
#include <KiwiModel/KiwiModel_ObjectClass.h>
#include <KiwiModel/KiwiModel_Object.h>
#include <KiwiModel/KiwiModel_Factory.h>
namespace kiwi { namespace model {
// ================================================================================ //
// PARAMETER CLASS //
// ================================================================================ //
ParameterClass::ParameterClass(tool::Parameter::Type type):
m_type(),
m_data_type(type)
{
}
ParameterClass::~ParameterClass()
{
}
tool::Parameter::Type ParameterClass::getDataType() const
{
return m_data_type;
}
void ParameterClass::setType(Type param_type)
{
m_type = param_type;
}
ParameterClass::Type ParameterClass::getType() const
{
return m_type;
}
// ================================================================================ //
// OBJECT CLASS //
// ================================================================================ //
ObjectClass::ObjectClass(std::string const& name, ctor_t ctor):
m_name(name),
m_model_name(Factory::toModelName(name)),
m_aliases(),
m_params(),
m_ctor(ctor),
m_flags(),
m_mold_maker(),
m_mold_caster(),
m_type_id()
{
}
ObjectClass::~ObjectClass()
{
}
bool ObjectClass::hasAlias() const noexcept
{
return !m_aliases.empty();
}
std::string const& ObjectClass::getName() const
{
return m_name;
}
std::string const& ObjectClass::getModelName() const
{
return m_model_name;
}
std::set<std::string> const& ObjectClass::getAliases() const noexcept
{
return m_aliases;
}
bool ObjectClass::hasAlias(std::string const& alias) const noexcept
{
return (m_aliases.count(alias) != 0);
}
void ObjectClass::addAlias(std::string const& alias)
{
m_aliases.insert(alias);
}
void ObjectClass::addAttribute(std::string const& name, std::unique_ptr<ParameterClass> param_class)
{
assert(param_class != nullptr);
param_class->setType(ParameterClass::Type::Attribute);
m_params[name] = std::move(param_class);
}
bool ObjectClass::hasAttribute(std::string const& name) const
{
auto found_param = m_params.find(name);
return found_param != m_params.end()
&& found_param->second->getType() == ParameterClass::Type::Attribute;
}
ParameterClass const& ObjectClass::getAttribute(std::string const& name) const
{
return *m_params.at(name);
}
void ObjectClass::addParameter(std::string name, std::unique_ptr<ParameterClass> param_class)
{
assert(param_class != nullptr);
param_class->setType(ParameterClass::Type::Parameter);
m_params[name] = std::move(param_class);
}
bool ObjectClass::hasParameter(std::string const& name) const
{
auto found_param = m_params.find(name);
return found_param != m_params.end()
&& found_param->second->getType() == ParameterClass::Type::Parameter;
}
ParameterClass const& ObjectClass::getParameter(std::string const& name) const
{
return *m_params.at(name);
}
std::map<std::string, std::unique_ptr<ParameterClass>> const& ObjectClass::getParameters() const
{
return m_params;
}
void ObjectClass::setFlag(Flag const& flag)
{
m_flags.insert(flag);
}
bool ObjectClass::hasFlag(Flag const& flag) const
{
return m_flags.find(flag) != m_flags.end();
}
void ObjectClass::setMoldMaker(mold_maker_t maker)
{
m_mold_maker = maker;
}
void ObjectClass::setMoldCaster(mold_caster_t caster)
{
m_mold_caster = caster;
}
void ObjectClass::setTypeId(size_t type_id)
{
m_type_id = type_id;
}
std::unique_ptr<model::Object> ObjectClass::create(std::vector<tool::Atom> const& args) const
{
return m_ctor(args);
}
void ObjectClass::moldMake(model::Object const& object, flip::Mold& mold) const
{
m_mold_maker(object, mold);
}
std::unique_ptr<model::Object> ObjectClass::moldCast(flip::Mold const& mold) const
{
return m_mold_caster(mold);
}
}}
| 5,507
|
C++
|
.cpp
| 152
| 29.243421
| 104
| 0.5606
|
Musicoll/Kiwi
| 134
| 11
| 7
|
GPL-3.0
|
9/20/2024, 9:42:21 PM (Europe/Amsterdam)
| false
| false
| false
| false
| false
| false
| false
| false
|
754,167
|
KiwiModel_Object.cpp
|
Musicoll_Kiwi/Modules/KiwiModel/KiwiModel_Object.cpp
|
/*
==============================================================================
This file is part of the KIWI library.
- Copyright (c) 2014-2016, Pierre Guillot & Eliott Paris.
- Copyright (c) 2016-2019, CICM, ANR MUSICOLL, Eliott Paris, Pierre Guillot, Jean Millot.
Permission is granted to use this software under the terms of the GPL v3
(or any later version). Details can be found at: www.gnu.org/licenses
KIWI 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.
------------------------------------------------------------------------------
Contact : [email protected]
==============================================================================
*/
#include <KiwiModel/KiwiModel_Factory.h>
#include <KiwiModel/KiwiModel_Object.h>
#include <KiwiModel/KiwiModel_DataModel.h>
namespace kiwi
{
namespace model
{
// ================================================================================ //
// INLET/OUTLET //
// ================================================================================ //
PinType::PinType(flip::Default&)
{
;
}
PinType::PinType(IType type):
m_type(type)
{
}
PinType::IType PinType::getType() const
{
return !removed() ? m_type.value() : m_type.before();
}
bool PinType::operator<(PinType const& other) const
{
return getType() < other.getType();
}
bool PinType::operator==(PinType const& other) const
{
return !(*this < other) && !(other < *this);
}
void PinType::declare()
{
if(DataModel::has<model::PinType>()) return;
DataModel::declare<PinType::IType>()
.name("cicm.kiwi.Type")
.enumerator<PinType::IType::Control>("Control")
.enumerator<PinType::IType::Signal>("Signal");
DataModel::declare<model::PinType>()
.name("cicm.kiwi.PinType")
.member<flip::Enum<IType>, &PinType::m_type>("type");
}
Inlet::Inlet(flip::Default&)
{
;
}
Inlet::Inlet(std::set<PinType> types):
m_types()
{
m_types.insert(m_types.begin(), types.begin(), types.end());
}
bool Inlet::hasType(PinType type) const
{
return m_types.find_if([type](PinType const& inlet_type){return inlet_type == type; }) != m_types.end();
}
void Inlet::declare()
{
if(DataModel::has<model::Inlet>()) return;
PinType::declare();
DataModel::declare<model::Inlet>()
.name("cicm.kiwi.Inlet")
.member<flip::Array<PinType>, &Inlet::m_types>("types");
};
Outlet::Outlet(flip::Default&):
m_type(PinType::IType::Control)
{
;
}
Outlet::Outlet(PinType type):
m_type(type)
{
}
PinType const& Outlet::getType() const
{
return m_type;
}
void Outlet::declare()
{
if(DataModel::has<model::Outlet>()) return;
PinType::declare();
DataModel::declare<model::Outlet>()
.name("cicm.kiwi.Outlet")
.member<PinType, &Outlet::m_type>("type");
};
// ================================================================================ //
// OBJECT::declare //
// ================================================================================ //
void Object::declare()
{
if(DataModel::has<model::Object>()) return;
Outlet::declare();
Inlet::declare();
DataModel::declare<model::Object>()
.name("cicm.kiwi.Object")
.member<flip::String, &Object::m_text>("text")
.member<flip::Array<Inlet>, &Object::m_inlets>("inlets")
.member<flip::Array<Outlet>, &Object::m_outlets>("outlets")
.member<flip::Float, &Object::m_position_x>("pos_x")
.member<flip::Float, &Object::m_position_y>("pos_y")
.member<flip::Float, &Object::m_width>("width")
.member<flip::Float, &Object::m_height>("height");
}
// ================================================================================ //
// OBJECT //
// ================================================================================ //
Object::Object(flip::Default&)
{}
Object::Object()
: m_width(60.)
, m_height(20.)
{}
void Object::writeAttribute(std::string const& name, tool::Parameter const& parameter)
{
}
void Object::readAttribute(std::string const& name, tool::Parameter & parameter) const
{
}
bool Object::attributeChanged(std::string const& name) const
{
return false;
}
void Object::addListener(Listener& listener) const
{
m_listeners.add(listener);
}
void Object::removeListener(Listener& listener) const
{
m_listeners.remove(listener);
}
std::vector<tool::Atom> const& Object::getArguments() const
{
if (m_args == nullptr)
{
m_args.reset(new std::vector<tool::Atom>());
std::vector<tool::Atom> parsed_text = tool::AtomHelper::parse(getText());
if (parsed_text.size() > 1)
{
*m_args->insert(m_args->begin(), parsed_text.begin() + 1, parsed_text.end());
}
}
return *m_args;
}
tool::Parameter const& Object::getAttribute(std::string const& name) const
{
assert(getClass().hasAttribute(name) && "Atribute not declared");
ParameterClass const& attribute_class = getClass().getAttribute(name);
if (m_attributes.find(name) == m_attributes.end())
{
m_attributes.insert( make_pair(name, tool::Parameter(attribute_class.getDataType())));
readAttribute(name, m_attributes.at(name));
}
else if(attributeChanged(name))
{
readAttribute(name, m_attributes.at(name));
}
return m_attributes.at(name);
}
void Object::setAttribute(std::string const& name, tool::Parameter const& param)
{
assert(getClass().hasAttribute(name) && "Attribute not declare");
assert(getClass().getAttribute(name).getDataType() == param.getType());
writeAttribute(name, param);
}
std::set<std::string> Object::getChangedAttributes() const
{
std::set<std::string> changed_parameters;
for (auto & param_class : getClass().getParameters())
{
if (param_class.second->getType() == ParameterClass::Type::Attribute
&& attributeChanged(param_class.first))
{
changed_parameters.insert(param_class.first);
}
}
return changed_parameters;
}
tool::Parameter const& Object::getParameter(std::string const& name) const
{
assert(getClass().hasParameter(name) && "Parameter not declare");
ParameterClass const& param_class = getClass().getParameter(name);
if (m_parameters.find(name) == m_parameters.end())
{
m_parameters.insert(make_pair(name, tool::Parameter(param_class.getDataType())));
}
return m_parameters.at(name);
}
void Object::setParameter(std::string const& name, tool::Parameter const& param)
{
assert(getClass().hasParameter(name) && "Parameter not declare");
assert(getClass().getParameter(name).getDataType() == param.getType());
if (m_parameters.find(name) == m_parameters.end())
{
m_parameters.insert(make_pair(name, param));
}
else
{
m_parameters.at(name) = param;
}
m_listeners.call(&Listener::modelParameterChanged, name, m_parameters.at(name));
}
std::string Object::getName() const
{
return getClass().getName();
}
ObjectClass const& Object::getClass() const
{
return *Factory::getClassByTypeId(typeid(*this).hash_code());
}
std::string Object::getText() const
{
return m_text;
}
flip::Array<Inlet> const& Object::getInlets() const
{
return m_inlets;
}
Inlet const& Object::getInlet(size_t index) const
{
flip::Array<Inlet>::const_iterator it = m_inlets.begin();
std::advance(it, index);
return *it;
}
size_t Object::getNumberOfInlets() const
{
return m_inlets.count_if([](Inlet const&){return true;});
}
bool Object::inletsChanged() const noexcept
{
return m_inlets.changed();
}
flip::Array<Outlet> const& Object::getOutlets() const
{
return m_outlets;
}
Outlet const& Object::getOutlet(size_t index) const
{
flip::Array<Outlet>::const_iterator it = m_outlets.begin();
std::advance(it, index);
return (*it);
}
size_t Object::getNumberOfOutlets() const
{
return m_outlets.count_if([](Outlet const&){return true;});
}
bool Object::outletsChanged() const noexcept
{
return m_outlets.changed();
}
void Object::setPosition(double x, double y)
{
m_position_x = x;
m_position_y = y;
}
bool Object::positionChanged() const noexcept
{
return (m_position_x.changed() || m_position_y.changed());
}
bool Object::sizeChanged() const noexcept
{
return (m_width.changed() || m_height.changed());
}
bool Object::boundsChanged() const noexcept
{
return (positionChanged() || sizeChanged());
}
double Object::getX() const noexcept
{
return !removed() ? m_position_x.value() : m_position_x.before();
}
double Object::getY() const noexcept
{
return !removed() ? m_position_y.value() : m_position_y.before();
}
void Object::setWidth(double new_width)
{
m_width = std::max(0., new_width);
}
void Object::setHeight(double new_height)
{
m_height = std::max(0., new_height);
}
double Object::getWidth() const noexcept
{
return !removed() ? m_width.value() : m_width.before();
}
double Object::getHeight() const noexcept
{
return !removed() ? m_height.value() : m_height.before();
}
void Object::setInlets(flip::Array<Inlet> const& inlets)
{
m_inlets = inlets;
}
void Object::setOutlets(flip::Array<Outlet> const& outlets)
{
m_outlets = outlets;
}
void Object::pushInlet(std::set<PinType> types)
{
m_inlets.emplace(m_inlets.end(), types);
}
void Object::pushOutlet(PinType type)
{
m_outlets.emplace(m_outlets.end(), type);
}
std::string Object::getIODescription(bool is_inlet, size_t index) const
{
return (is_inlet ? "inlet " : "outlet ") + std::to_string(index);
}
bool Object::hasFlag(ObjectClass::Flag flag) const
{
return getClass().hasFlag(flag);
}
}
}
| 13,187
|
C++
|
.cpp
| 328
| 27.338415
| 116
| 0.494391
|
Musicoll/Kiwi
| 134
| 11
| 7
|
GPL-3.0
|
9/20/2024, 9:42:21 PM (Europe/Amsterdam)
| false
| false
| false
| false
| false
| false
| false
| false
|
754,168
|
KiwiModel_Point.cpp
|
Musicoll_Kiwi/Modules/KiwiModel/KiwiModel_Point.cpp
|
/*
==============================================================================
This file is part of the KIWI library.
- Copyright (c) 2014-2016, Pierre Guillot & Eliott Paris.
- Copyright (c) 2016-2019, CICM, ANR MUSICOLL, Eliott Paris, Pierre Guillot, Jean Millot.
Permission is granted to use this software under the terms of the GPL v3
(or any later version). Details can be found at: www.gnu.org/licenses
KIWI 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.
------------------------------------------------------------------------------
Contact : [email protected]
==============================================================================
*/
#include <KiwiModel/KiwiModel_Point.h>
#include <KiwiModel/KiwiModel_DataModel.h>
namespace kiwi { namespace model {
void Point::declare()
{
if(DataModel::has<model::Point>())
return; // abort
DataModel::declare<model::Point>()
.name("cicm.kiwi.Point")
.member<flip::Float, &Point::m_x>("x")
.member<flip::Float, &Point::m_y>("y");
}
Point::Point(double x, double y)
: m_x(x)
, m_y(y)
{}
double Point::getX() const
{
return m_x;
}
double Point::getY() const
{
return m_y;
}
void Point::setX(double x)
{
m_x = x;
}
void Point::setY(double y)
{
m_y = y;
}
void Point::setPosition(double x, double y)
{
setX(x);
setY(y);
}
}}
| 1,794
|
C++
|
.cpp
| 52
| 27.057692
| 91
| 0.527108
|
Musicoll/Kiwi
| 134
| 11
| 7
|
GPL-3.0
|
9/20/2024, 9:42:21 PM (Europe/Amsterdam)
| false
| false
| false
| false
| false
| false
| false
| false
|
754,169
|
KiwiModel_DocumentManager.cpp
|
Musicoll_Kiwi/Modules/KiwiModel/KiwiModel_DocumentManager.cpp
|
/*
==============================================================================
This file is part of the KIWI library.
- Copyright (c) 2014-2016, Pierre Guillot & Eliott Paris.
- Copyright (c) 2016-2019, CICM, ANR MUSICOLL, Eliott Paris, Pierre Guillot, Jean Millot.
Permission is granted to use this software under the terms of the GPL v3
(or any later version). Details can be found at: www.gnu.org/licenses
KIWI 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.
------------------------------------------------------------------------------
Contact : [email protected]
==============================================================================
*/
#include <KiwiModel/KiwiModel_DocumentManager.h>
#include <KiwiModel/KiwiModel_PatcherUser.h>
namespace kiwi { namespace model {
// ================================================================================ //
// DOCUMENT MANAGER //
// ================================================================================ //
DocumentManager::DocumentManager(flip::DocumentBase& document)
: m_document(document)
, m_history(m_document)
{}
DocumentManager::~DocumentManager()
{}
void DocumentManager::commit(flip::Type& type, std::string action)
{
auto& patcher = type.ancestor<model::Patcher>();
patcher.entity().use<DocumentManager>().commit(action);
}
void DocumentManager::pull(flip::Type& type)
{
model::Patcher& patcher = type.ancestor<model::Patcher>();
patcher.entity().use<DocumentManager>().pull();
}
void DocumentManager::startCommitGesture(flip::Type& type)
{
auto& patcher = type.ancestor<model::Patcher>();
patcher.entity().use<DocumentManager>().startCommitGesture();
}
void DocumentManager::commitGesture(flip::Type& type, std::string action)
{
auto& patcher = type.ancestor<model::Patcher>();
patcher.entity().use<DocumentManager>().commitGesture(action);
}
void DocumentManager::endCommitGesture(flip::Type& type)
{
auto& patcher = type.ancestor<model::Patcher>();
patcher.entity().use<DocumentManager>().endCommitGesture();
}
bool DocumentManager::isInCommitGesture(flip::Type& type)
{
auto & patcher = type.ancestor<model::Patcher>();
return(patcher.entity().use<DocumentManager>().m_session != nullptr);
}
bool DocumentManager::canUndo()
{
return m_history.last_undo() != m_history.end();
}
std::string DocumentManager::getUndoLabel()
{
assert(canUndo());
return m_history.last_undo()->label();
}
void DocumentManager::undo()
{
assert(canUndo());
m_history.execute_undo();
}
bool DocumentManager::canRedo()
{
return m_history.first_redo() != m_history.end();
}
std::string DocumentManager::getRedoLabel()
{
assert(canRedo());
return m_history.first_redo()->label();
}
void DocumentManager::redo()
{
assert(canRedo());
m_history.execute_redo();
}
//=============================================================================
void DocumentManager::commit(std::string action)
{
if(!action.empty())
{
m_document.set_label(action);
}
auto tx = m_document.commit();
push();
if(!action.empty())
{
m_history.add_undo_step(tx);
}
}
void DocumentManager::pull()
{
m_document.pull();
}
void DocumentManager::push()
{
m_document.push();
}
void DocumentManager::startCommitGesture()
{
if(m_session)
{
m_session->revert();
}
else
{
m_session.reset(new Session(m_document));
}
m_session->start();
}
void DocumentManager::commitGesture(std::string action)
{
assert(m_session && "call startCommitGesture before");
m_session->commit(action);
}
void DocumentManager::endCommitGesture()
{
assert(m_session && "call startCommitGesture before");
m_session->end(&m_history);
m_document.push();
m_session.reset();
}
// ================================================================================ //
// SESSION //
// ================================================================================ //
DocumentManager::Session::Session(flip::DocumentBase& document)
: m_document(document)
, m_history(document)
{}
DocumentManager::Session::~Session()
{}
void DocumentManager::Session::start()
{
if(m_tx.empty())
return;
m_document.execute_backward(m_tx);
}
void DocumentManager::Session::commit()
{
bool first_flag = m_tx.empty();
auto tx = m_document.commit();
m_document.execute_backward(tx);
m_document.execute_backward(m_tx);
flip::Transaction tx_abs;
m_document.root<model::Patcher>().make(tx_abs);
tx_abs.invert_direction();
m_tx = tx_abs;
if(tx.has_metadata(flip::Transaction::key_label))
{
m_tx.impl_use_metadata_map()[flip::Transaction::key_label] = tx.label();
}
if(first_flag)
{
m_history.add_undo_step(m_tx);
}
else if(m_tx.empty())
{
m_history.erase(m_history.last_undo());
}
else
{
*m_history.last_undo() = m_tx;
}
m_document.revert();
}
void DocumentManager::Session::commit(std::string label)
{
if(!label.empty())
{
m_document.set_label(label);
}
commit();
}
void DocumentManager::Session::end(flip::History<flip::HistoryStoreMemory>* master_history)
{
if(m_tx.empty()) return;
if(master_history != nullptr)
{
// copy session transaction into the master history.
master_history->add_undo_step(m_tx);
}
m_tx.clear();
m_history.clear();
}
void DocumentManager::Session::revert()
{
if(m_tx.empty()) return;
m_document.execute_backward(m_tx);
m_tx.clear();
m_document.commit();
m_history.erase(m_history.last_undo());
}
}}
| 7,039
|
C++
|
.cpp
| 201
| 26.402985
| 95
| 0.531173
|
Musicoll/Kiwi
| 134
| 11
| 7
|
GPL-3.0
|
9/20/2024, 9:42:21 PM (Europe/Amsterdam)
| false
| false
| false
| false
| false
| false
| false
| false
|
754,170
|
KiwiModel_Converter_v2_v3.cpp
|
Musicoll_Kiwi/Modules/KiwiModel/KiwiModel_Converters/KiwiModel_Converter_v2_v3.cpp
|
/*
==============================================================================
This file is part of the KIWI library.
- Copyright (c) 2014-2016, Pierre Guillot & Eliott Paris.
- Copyright (c) 2016-2019, CICM, ANR MUSICOLL, Eliott Paris, Pierre Guillot, Jean Millot.
Permission is granted to use this software under the terms of the GPL v3
(or any later version). Details can be found at: www.gnu.org/licenses
KIWI 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.
------------------------------------------------------------------------------
Contact : [email protected]
==============================================================================
*/
#include <flip/BackEndIR.h>
#include <KiwiModel/KiwiModel_Converters/KiwiModel_ConverterBase.h>
namespace kiwi { namespace model {
//! @brief Nothing to do from v2 to v3
struct Converter_v2_v3 : public ConverterBase
{
Converter_v2_v3() : ConverterBase("v2", "v3") {}
bool operator () (flip::BackEndIR& backend) const override
{
// nothing to do from v2 to v3
return true;
}
};
}}
| 1,329
|
C++
|
.cpp
| 28
| 42.428571
| 90
| 0.582875
|
Musicoll/Kiwi
| 134
| 11
| 7
|
GPL-3.0
|
9/20/2024, 9:42:21 PM (Europe/Amsterdam)
| false
| false
| false
| false
| false
| false
| false
| false
|
754,171
|
KiwiModel_Converter.cpp
|
Musicoll_Kiwi/Modules/KiwiModel/KiwiModel_Converters/KiwiModel_Converter.cpp
|
/*
==============================================================================
This file is part of the KIWI library.
- Copyright (c) 2014-2016, Pierre Guillot & Eliott Paris.
- Copyright (c) 2016-2019, CICM, ANR MUSICOLL, Eliott Paris, Pierre Guillot, Jean Millot.
Permission is granted to use this software under the terms of the GPL v3
(or any later version). Details can be found at: www.gnu.org/licenses
KIWI 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.
------------------------------------------------------------------------------
Contact : [email protected]
==============================================================================
*/
#include <string>
#include <KiwiModel/KiwiModel_Def.h>
#include <KiwiModel/KiwiModel_Converters/KiwiModel_Converter.h>
#include <KiwiModel/KiwiModel_Converters/KiwiModel_Converter_v1_v2.cpp>
#include <KiwiModel/KiwiModel_Converters/KiwiModel_Converter_v2_v3.cpp>
#include <KiwiModel/KiwiModel_Converters/KiwiModel_Converter_v3_v4.cpp>
#include <KiwiModel/KiwiModel_Converters/KiwiModel_Converter_v4_v40x.cpp>
namespace kiwi { namespace model {
// ================================================================================ //
// CONVERTER //
// ================================================================================ //
Converter::Converter()
{
addConverter<Converter_v1_v2>();
addConverter<Converter_v2_v3>();
addConverter<Converter_v3_v4>();
addConverter<Converter_v4_v401>();
addConverter<Converter_v401_v402>();
addConverter<Converter_v402_v403>();
}
Converter::~Converter()
{}
Converter& Converter::use()
{
static Converter instance;
return instance;
}
std::string const& Converter::getLatestVersion()
{
static const std::string latest_version = KIWI_MODEL_VERSION_STRING;
return latest_version;
}
bool Converter::canConvertToLatestFrom(std::string const& version)
{
auto& converters = use().converters();
if(version == getLatestVersion())
{
return true;
}
for(auto& conversion : converters)
{
if(conversion->v_from == version)
{
if(canConvertToLatestFrom(conversion->v_to))
{
return true;
}
}
}
return false;
}
template<class T>
bool Converter::addConverter()
{
m_converters.emplace_back(std::make_unique<T>());
return true;
}
auto Converter::converters() -> converters_t&
{
return m_converters;
}
bool Converter::process(flip::BackEndIR & backend)
{
auto& conversions = use().converters();
for(auto& conversion : conversions)
{
conversion->process(backend);
if(backend.version == getLatestVersion())
{
return true;
}
}
return false;
}
}}
| 3,368
|
C++
|
.cpp
| 89
| 30.078652
| 90
| 0.547081
|
Musicoll/Kiwi
| 134
| 11
| 7
|
GPL-3.0
|
9/20/2024, 9:42:21 PM (Europe/Amsterdam)
| false
| false
| false
| false
| false
| false
| false
| false
|
754,172
|
KiwiModel_Converter_v1_v2.cpp
|
Musicoll_Kiwi/Modules/KiwiModel/KiwiModel_Converters/KiwiModel_Converter_v1_v2.cpp
|
/*
==============================================================================
This file is part of the KIWI library.
- Copyright (c) 2014-2016, Pierre Guillot & Eliott Paris.
- Copyright (c) 2016-2019, CICM, ANR MUSICOLL, Eliott Paris, Pierre Guillot, Jean Millot.
Permission is granted to use this software under the terms of the GPL v3
(or any later version). Details can be found at: www.gnu.org/licenses
KIWI 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.
------------------------------------------------------------------------------
Contact : [email protected]
==============================================================================
*/
#include <flip/BackEndIR.h>
#include <KiwiModel/KiwiModel_Converters/KiwiModel_ConverterBase.h>
namespace kiwi { namespace model {
//! @brief Removes "patcher_name" member from the patcher
struct Converter_v1_v2 : public ConverterBase
{
Converter_v1_v2() : ConverterBase("v1", "v2") {}
bool operator () (flip::BackEndIR& backend) const override
{
flip::BackEndIR::Type& patcher = backend.root;
// removing patcher name.
patcher.members.remove_if([](std::pair<std::string,
flip::BackEndIR::Type> const& member) {
return member.first == "patcher_name";
});
return true;
}
};
}}
| 1,644
|
C++
|
.cpp
| 33
| 41.787879
| 90
| 0.569043
|
Musicoll/Kiwi
| 134
| 11
| 7
|
GPL-3.0
|
9/20/2024, 9:42:21 PM (Europe/Amsterdam)
| false
| false
| false
| false
| false
| false
| false
| false
|
754,173
|
KiwiModel_Converter_v3_v4.cpp
|
Musicoll_Kiwi/Modules/KiwiModel/KiwiModel_Converters/KiwiModel_Converter_v3_v4.cpp
|
/*
==============================================================================
This file is part of the KIWI library.
- Copyright (c) 2014-2016, Pierre Guillot & Eliott Paris.
- Copyright (c) 2016-2019, CICM, ANR MUSICOLL, Eliott Paris, Pierre Guillot, Jean Millot.
Permission is granted to use this software under the terms of the GPL v3
(or any later version). Details can be found at: www.gnu.org/licenses
KIWI 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.
------------------------------------------------------------------------------
Contact : [email protected]
==============================================================================
*/
#include <flip/BackEndIR.h>
#include <KiwiModel/KiwiModel_Converters/KiwiModel_ConverterBase.h>
#include <KiwiTool/KiwiTool_Atom.h>
namespace kiwi { namespace model {
//! @brief v3 to v4 converter
//! @details random object conversion:
// - remove seed inlet (was third inlet in < v4)
// - remove range inlet (second) if range argument is defined
// - diconnect invalids links
struct Converter_v3_v4 : public ConverterBase
{
Converter_v3_v4() : ConverterBase("v3", "v4") {}
bool operator () (flip::BackEndIR& backend) const override
{
flip::BackEndIR::Type& patcher = backend.root;
walk(patcher, [](flip::BackEndIR::Type& type) {
if (type.get_class () != "cicm.kiwi.object.random")
return; // abort
auto const& text_value = type.member("text").second.value.blob;
const std::string text { text_value.begin(), text_value.end() };
const auto parsed_text = tool::AtomHelper::parse(text);
auto& inlets = type.member("inlets").second.array;
if(inlets.size() == 3)
{
inlets.erase(inlets.begin());
const bool has_range_arg = (parsed_text.size() > 1
&& parsed_text[1].isNumber());
if(has_range_arg)
{
inlets.erase(inlets.begin());
}
}
});
remove_invalid_links(backend);
return true;
}
bool remove_invalid_links(flip::BackEndIR& backend) const
{
flip::BackEndIR::Type& patcher = backend.root;
auto& objects = patcher.member("objects").second.array;
// A link is considered invalid if sender or receiver object does not exist,
// or if it's bound to a pin that does not exist.
auto is_invalid_link = [&objects](flip::BackEndIR::Type& type) {
auto const& sender_ref = type.member("sender_obj").second.value.ref;
auto const& receiver_ref = type.member("receiver_obj").second.value.ref;
auto const& sender_outlet = type.member("outlet_index").second.value.int_num;
auto const& receiver_inlet = type.member("inlet_index").second.value.int_num;
bool sender_found = false;
bool receiver_found = false;
// check sender validity
for(auto& object : objects)
{
auto& type = object.second;
if(!sender_found && type.ref == sender_ref)
{
sender_found = true;
const auto outlet_count = type.member("outlets").second.array.size();
if(sender_outlet >= outlet_count)
{
// bad outlet
return false;
}
}
if(!receiver_found && type.ref == receiver_ref)
{
receiver_found = true;
const auto inlet_count = type.member("inlets").second.array.size();
if(receiver_inlet >= inlet_count)
{
// bad inlet
return false;
}
}
if(sender_found && receiver_found)
{
break;
}
}
return (!sender_found || !receiver_found);
};
auto& links = patcher.member("links").second.array;
auto iter = links.begin();
const auto end_iter = links.cend();
for(; iter != end_iter;)
{
if (is_invalid_link(iter->second))
{
links.erase(iter++);
}
else
{
++iter;
}
}
return true;
}
};
}}
| 5,480
|
C++
|
.cpp
| 112
| 30.732143
| 93
| 0.480974
|
Musicoll/Kiwi
| 134
| 11
| 7
|
GPL-3.0
|
9/20/2024, 9:42:21 PM (Europe/Amsterdam)
| false
| false
| false
| false
| false
| false
| false
| false
|
754,174
|
KiwiModel_Converter_v4_v40x.cpp
|
Musicoll_Kiwi/Modules/KiwiModel/KiwiModel_Converters/KiwiModel_Converter_v4_v40x.cpp
|
/*
==============================================================================
This file is part of the KIWI library.
- Copyright (c) 2014-2016, Pierre Guillot & Eliott Paris.
- Copyright (c) 2016-2019, CICM, ANR MUSICOLL, Eliott Paris, Pierre Guillot, Jean Millot.
Permission is granted to use this software under the terms of the GPL v3
(or any later version). Details can be found at: www.gnu.org/licenses
KIWI 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.
------------------------------------------------------------------------------
Contact : [email protected]
==============================================================================
*/
#include <flip/BackEndIR.h>
#include <KiwiModel/KiwiModel_Converters/KiwiModel_ConverterBase.h>
namespace kiwi { namespace model {
//! @brief removes "min_width", "min_height" and "ratio" members from model::Object
struct Converter_v4_v401 : public ConverterBase
{
Converter_v4_v401() : ConverterBase("v4", "v4.0.1") {}
bool operator () (flip::BackEndIR& backend) const override
{
flip::BackEndIR::Type& patcher = backend.root;
auto& objects = patcher.member("objects").second.array;
for(auto& object : objects)
{
object.second.object_remove_member("min_width");
object.second.object_remove_member("min_height");
object.second.object_remove_member("ratio");
}
return true;
}
};
//! @brief Nothing to do from v4.0.1 to v4.0.2
//! @details faust~ object added
struct Converter_v401_v402 : public ConverterBase
{
Converter_v401_v402() : ConverterBase("v4.0.1", "v4.0.2") {}
bool operator () (flip::BackEndIR& backend) const override
{
// nothing to do from v4.0.1 to v4.0.2
return true;
}
};
//! @brief Nothing to do from v4.0.2 to v4.0.3
//! @details add Bounds and Point classes
//! Add screen_bounds and view_position to Patcher::View
struct Converter_v402_v403 : public ConverterBase
{
Converter_v402_v403() : ConverterBase("v4.0.2", "v4.0.3") {}
bool operator () (flip::BackEndIR& backend) const override
{
flip::BackEndIR::Type& patcher = backend.root;
flip::walk(patcher, [](flip::BackEndIR::Type & type) {
// skip every type that is not a "patcherview"
if (type.get_class () != "cicm.kiwi.Patcher.View")
return;
type.object_add_member_object("screen_bounds", "cicm.kiwi.Bounds");
type.object_add_member_object("view_position", "cicm.kiwi.Point");
});
return true;
}
};
}}
| 3,113
|
C++
|
.cpp
| 65
| 37.661538
| 90
| 0.575873
|
Musicoll/Kiwi
| 134
| 11
| 7
|
GPL-3.0
|
9/20/2024, 9:42:21 PM (Europe/Amsterdam)
| false
| false
| false
| false
| false
| false
| false
| false
|
754,175
|
KiwiModel_DelaySimpleTilde.cpp
|
Musicoll_Kiwi/Modules/KiwiModel/KiwiModel_Objects/KiwiModel_DelaySimpleTilde.cpp
|
/*
==============================================================================
This file is part of the KIWI library.
- Copyright (c) 2014-2016, Pierre Guillot & Eliott Paris.
- Copyright (c) 2016-2019, CICM, ANR MUSICOLL, Eliott Paris, Pierre Guillot, Jean Millot.
Permission is granted to use this software under the terms of the GPL v3
(or any later version). Details can be found at: www.gnu.org/licenses
KIWI 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.
------------------------------------------------------------------------------
Contact : [email protected]
==============================================================================
*/
#include <KiwiModel/KiwiModel_Objects/KiwiModel_DelaySimpleTilde.h>
#include <KiwiModel/KiwiModel_Factory.h>
#include <KiwiModel/KiwiModel_DataModel.h>
namespace kiwi { namespace model {
// ================================================================================ //
// OBJECT DELAYSIMPLE~ //
// ================================================================================ //
void DelaySimpleTilde::declare()
{
std::unique_ptr<ObjectClass> delaytilde_class(new ObjectClass("delaysimple~",
&DelaySimpleTilde::create));
flip::Class<DelaySimpleTilde> & delaytilde_model = DataModel::declare<DelaySimpleTilde>()
.name(delaytilde_class->getModelName().c_str())
.inherit<Object>();
Factory::add<DelaySimpleTilde>(std::move(delaytilde_class), delaytilde_model);
}
std::unique_ptr<Object> DelaySimpleTilde::create(std::vector<tool::Atom> const& args)
{
return std::make_unique<DelaySimpleTilde>(args);
}
DelaySimpleTilde::DelaySimpleTilde(std::vector<tool::Atom> const& args)
{
if (args.size() > 2)
{
throw Error("delaysimple~ too many arguments");
}
if (args.size() > 0 && !args[0].isNumber())
{
throw Error("delaysimple~ delay argument is not a number");
}
if (args.size() > 1 && !args[1].isNumber())
{
throw Error("delaysimple~ feedback argument is not a number ");
}
pushInlet({PinType::IType::Control, PinType::IType::Signal});
pushInlet({PinType::IType::Control, PinType::IType::Signal});
pushInlet({PinType::IType::Control});
pushOutlet(PinType::IType::Signal);
}
std::string DelaySimpleTilde::getIODescription(bool is_inlet, size_t index) const
{
if(is_inlet)
{
if(index == 0)
{
return "(signal) Input to be delayed";
}
else if(index == 1)
{
return "(signal/float) Delay time (ms)";
}
else if(index == 2)
{
return "(float) Feedback (0-1)";
}
}
else
{
return "(signal) Delayed output signal";
}
return {};
}
}}
| 3,483
|
C++
|
.cpp
| 77
| 34.311688
| 106
| 0.50288
|
Musicoll/Kiwi
| 134
| 11
| 7
|
GPL-3.0
|
9/20/2024, 9:42:21 PM (Europe/Amsterdam)
| false
| false
| false
| false
| false
| false
| false
| false
|
754,176
|
KiwiModel_SnapshotTilde.cpp
|
Musicoll_Kiwi/Modules/KiwiModel/KiwiModel_Objects/KiwiModel_SnapshotTilde.cpp
|
/*
==============================================================================
This file is part of the KIWI library.
- Copyright (c) 2014-2016, Pierre Guillot & Eliott Paris.
- Copyright (c) 2016-2019, CICM, ANR MUSICOLL, Eliott Paris, Pierre Guillot, Jean Millot.
Permission is granted to use this software under the terms of the GPL v3
(or any later version). Details can be found at: www.gnu.org/licenses
KIWI 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.
------------------------------------------------------------------------------
Contact : [email protected]
==============================================================================
*/
#include <KiwiModel/KiwiModel_Objects/KiwiModel_SnapshotTilde.h>
#include <KiwiModel/KiwiModel_Factory.h>
namespace kiwi { namespace model {
// ================================================================================ //
// SNAPSHOT~ //
// ================================================================================ //
void SnapshotTilde::declare()
{
std::unique_ptr<ObjectClass> snapshottilde_class(new ObjectClass("snapshot~", &SnapshotTilde::create));
flip::Class<SnapshotTilde> & snapshottilde_model = DataModel::declare<SnapshotTilde>()
.name(snapshottilde_class->getModelName().c_str())
.inherit<Object>();
Factory::add<SnapshotTilde>(std::move(snapshottilde_class), snapshottilde_model);
}
std::unique_ptr<Object> SnapshotTilde::create(std::vector<tool::Atom> const& args)
{
return std::make_unique<SnapshotTilde>(args);
}
SnapshotTilde::SnapshotTilde(std::vector<tool::Atom> const& args)
{
if (args.size() > 0)
{
throw Error("snapshot~ too many arguments");
}
pushInlet({PinType::IType::Signal, PinType::IType::Control});
pushOutlet(PinType::IType::Control);
}
std::string SnapshotTilde::getIODescription(bool is_inlet, size_t index) const
{
return (is_inlet
? "(signal) Input, (bang) Reports signal value"
: "(signal) Values");
}
}}
| 2,540
|
C++
|
.cpp
| 48
| 44.020833
| 111
| 0.524712
|
Musicoll/Kiwi
| 134
| 11
| 7
|
GPL-3.0
|
9/20/2024, 9:42:21 PM (Europe/Amsterdam)
| false
| false
| false
| false
| false
| false
| false
| false
|
754,177
|
KiwiModel_Send.cpp
|
Musicoll_Kiwi/Modules/KiwiModel/KiwiModel_Objects/KiwiModel_Send.cpp
|
/*
==============================================================================
This file is part of the KIWI library.
- Copyright (c) 2014-2016, Pierre Guillot & Eliott Paris.
- Copyright (c) 2016-2019, CICM, ANR MUSICOLL, Eliott Paris, Pierre Guillot, Jean Millot.
Permission is granted to use this software under the terms of the GPL v3
(or any later version). Details can be found at: www.gnu.org/licenses
KIWI 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.
------------------------------------------------------------------------------
Contact : [email protected]
==============================================================================
*/
#include <KiwiModel/KiwiModel_Objects/KiwiModel_Send.h>
#include <KiwiModel/KiwiModel_Factory.h>
namespace kiwi { namespace model {
// ================================================================================ //
// SEND //
// ================================================================================ //
void Send::declare()
{
std::unique_ptr<ObjectClass> send_class(new ObjectClass("send", &Send::create));
send_class->addAlias("s");
flip::Class<Send> & send_model = DataModel::declare<Send>()
.name(send_class->getModelName().c_str())
.inherit<Object>();
Factory::add<Send>(std::move(send_class), send_model);
}
std::unique_ptr<Object> Send::create(std::vector<tool::Atom> const& args)
{
return std::make_unique<Send>(args);
}
Send::Send(std::vector<tool::Atom> const& args)
{
if (args.empty())
throw Error("send requires one argument");
if (args.size() > 1)
throw Error("send requires only one argument");
if (args.size() == 1 && !args[0].isString())
throw Error("send argument must be a symbol");
pushInlet({PinType::IType::Control});
}
std::string Send::getIODescription(bool is_inlet, size_t index) const
{
std::string description = "";
if (is_inlet)
{
if (index == 0)
{
description = "message to send to corresponding receive objects";
}
}
return description;
}
}}
| 2,680
|
C++
|
.cpp
| 56
| 38.232143
| 90
| 0.5
|
Musicoll/Kiwi
| 134
| 11
| 7
|
GPL-3.0
|
9/20/2024, 9:42:21 PM (Europe/Amsterdam)
| false
| false
| false
| false
| false
| false
| false
| false
|
754,178
|
KiwiModel_OscTilde.cpp
|
Musicoll_Kiwi/Modules/KiwiModel/KiwiModel_Objects/KiwiModel_OscTilde.cpp
|
/*
==============================================================================
This file is part of the KIWI library.
- Copyright (c) 2014-2016, Pierre Guillot & Eliott Paris.
- Copyright (c) 2016-2019, CICM, ANR MUSICOLL, Eliott Paris, Pierre Guillot, Jean Millot.
Permission is granted to use this software under the terms of the GPL v3
(or any later version). Details can be found at: www.gnu.org/licenses
KIWI 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.
------------------------------------------------------------------------------
Contact : [email protected]
==============================================================================
*/
#include <KiwiModel/KiwiModel_Objects/KiwiModel_OscTilde.h>
#include <KiwiModel/KiwiModel_DataModel.h>
#include <KiwiModel/KiwiModel_Factory.h>
namespace kiwi { namespace model {
// ================================================================================ //
// OBJECT OSC~ //
// ================================================================================ //
void OscTilde::declare()
{
std::unique_ptr<ObjectClass> osctilde_class(new ObjectClass("osc~", &OscTilde::create));
flip::Class<OscTilde> & osctilde_model = DataModel::declare<OscTilde>()
.name(osctilde_class->getModelName().c_str())
.inherit<Object>();
Factory::add<OscTilde>(std::move(osctilde_class), osctilde_model);
}
std::unique_ptr<Object> OscTilde::create(std::vector<tool::Atom> const& args)
{
return std::make_unique<OscTilde>(args);
}
OscTilde::OscTilde(std::vector<tool::Atom> const& args):
model::Object()
{
if (args.size() > 1)
throw Error("osc~ too many arguments");
if (args.size() == 1 && !args[0].isNumber())
throw Error("osc~ wrong arguments [" + args[0].getString() + "]");
pushInlet({PinType::IType::Control, PinType::IType::Signal});
pushInlet({PinType::IType::Control, PinType::IType::Signal});
pushOutlet(PinType::IType::Signal);
}
std::string OscTilde::getIODescription(bool is_inlet, size_t index) const
{
if(is_inlet)
{
if(index == 0)
{
return "(signal/float) Set frequency";
}
else if(index == 1)
{
return "(signal/float) Set phase (0-1)";
}
}
else
{
return "(signal) Output";
}
return {};
}
}}
| 2,944
|
C++
|
.cpp
| 64
| 36.484375
| 96
| 0.50252
|
Musicoll/Kiwi
| 134
| 11
| 7
|
GPL-3.0
|
9/20/2024, 9:42:21 PM (Europe/Amsterdam)
| false
| false
| false
| false
| false
| false
| false
| false
|
754,179
|
KiwiModel_Operator.cpp
|
Musicoll_Kiwi/Modules/KiwiModel/KiwiModel_Objects/KiwiModel_Operator.cpp
|
/*
==============================================================================
This file is part of the KIWI library.
- Copyright (c) 2014-2016, Pierre Guillot & Eliott Paris.
- Copyright (c) 2016-2019, CICM, ANR MUSICOLL, Eliott Paris, Pierre Guillot, Jean Millot.
Permission is granted to use this software under the terms of the GPL v3
(or any later version). Details can be found at: www.gnu.org/licenses
KIWI 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.
------------------------------------------------------------------------------
Contact : [email protected]
==============================================================================
*/
#include <KiwiModel/KiwiModel_Objects/KiwiModel_Operator.h>
#include <KiwiModel/KiwiModel_Factory.h>
namespace kiwi { namespace model {
// ================================================================================ //
// OPERATOR //
// ================================================================================ //
void Operator::declare()
{
DataModel::declare<Operator>()
.name("cicm.kiwi.object.operator")
.inherit<Object>();
}
Operator::Operator(std::vector<tool::Atom> const& args):
Object()
{
if (args.size() > 1)
{
throw Error("operator too many arguments");
}
if (args.size() == 1 && !args[0].isNumber())
{
throw Error("operator argument must be a number");
}
pushInlet({PinType::IType::Control});
if (args.empty())
{
pushInlet({PinType::IType::Control});
}
pushOutlet(PinType::IType::Control);
}
std::string Operator::getIODescription(bool is_inlet, size_t index) const
{
return is_inlet ? (index == 0) ? "Left operand" : "Right operand" : "Result";
}
}}
| 2,195
|
C++
|
.cpp
| 49
| 37.387755
| 90
| 0.493976
|
Musicoll/Kiwi
| 134
| 11
| 7
|
GPL-3.0
|
9/20/2024, 9:42:21 PM (Europe/Amsterdam)
| false
| false
| false
| false
| false
| false
| false
| false
|
754,180
|
KiwiModel_Gate.cpp
|
Musicoll_Kiwi/Modules/KiwiModel/KiwiModel_Objects/KiwiModel_Gate.cpp
|
/*
==============================================================================
This file is part of the KIWI library.
- Copyright (c) 2014-2016, Pierre Guillot & Eliott Paris.
- Copyright (c) 2016-2019, CICM, ANR MUSICOLL, Eliott Paris, Pierre Guillot, Jean Millot.
Permission is granted to use this software under the terms of the GPL v3
(or any later version). Details can be found at: www.gnu.org/licenses
KIWI 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.
------------------------------------------------------------------------------
Contact : [email protected]
==============================================================================
*/
#include <KiwiModel/KiwiModel_Factory.h>
#include <KiwiModel/KiwiModel_Objects/KiwiModel_Gate.h>
namespace kiwi { namespace model {
// ================================================================================ //
// GATE //
// ================================================================================ //
void Gate::declare()
{
std::unique_ptr<ObjectClass> gate_class(new ObjectClass("gate", &Gate::create));
flip::Class<Gate> & gate_model = DataModel::declare<Gate>()
.name(gate_class->getModelName().c_str())
.inherit<Object>();
Factory::add<Gate>(std::move(gate_class), gate_model);
}
std::unique_ptr<Object> Gate::create(std::vector<tool::Atom> const& args)
{
return std::make_unique<Gate>(args);
}
Gate::Gate(std::vector<tool::Atom> const& args)
{
if (args.size() <= 0)
throw Error("gate number of gates must be specified");
if (args.size() > 2)
throw Error("gate takes at most 2 arguments");
if (args.size() > 1 && !args[1].isNumber())
throw Error("gate 2nd argument must be a number");
if (args.size() > 0)
{
if (!args[0].isInt())
{
throw Error("gate 1rst argument must be an integer");
}
else if(args[0].getInt() < 0)
{
throw Error("gate 1rst argument must be greater than 0");
}
}
pushInlet({PinType::IType::Control});
pushInlet({PinType::IType::Control});
if (args.empty())
{
pushOutlet(PinType::IType::Control);
}
else
{
for(int outlet = 0; outlet < args[0].getInt(); ++outlet)
{
pushOutlet(PinType::IType::Control);
}
}
}
std::string Gate::getIODescription(bool is_inlet, size_t index) const
{
std::string description = "";
if (is_inlet)
{
if (index == 0)
{
description = "Int Open/Close gate";
}
else if(index == 1)
{
description = "Dispatch message to opened gate";
}
}
else
{
description = "Ouput " + std::to_string(index + 1) + " sends message when opened";
}
return description;
}
}}
| 3,538
|
C++
|
.cpp
| 86
| 30.686047
| 94
| 0.477423
|
Musicoll/Kiwi
| 134
| 11
| 7
|
GPL-3.0
|
9/20/2024, 9:42:21 PM (Europe/Amsterdam)
| false
| false
| false
| false
| false
| false
| false
| false
|
754,181
|
KiwiModel_Different.cpp
|
Musicoll_Kiwi/Modules/KiwiModel/KiwiModel_Objects/KiwiModel_Different.cpp
|
/*
==============================================================================
This file is part of the KIWI library.
- Copyright (c) 2014-2016, Pierre Guillot & Eliott Paris.
- Copyright (c) 2016-2019, CICM, ANR MUSICOLL, Eliott Paris, Pierre Guillot, Jean Millot.
Permission is granted to use this software under the terms of the GPL v3
(or any later version). Details can be found at: www.gnu.org/licenses
KIWI 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.
------------------------------------------------------------------------------
Contact : [email protected]
==============================================================================
*/
#include <KiwiModel/KiwiModel_Objects/KiwiModel_Different.h>
#include <KiwiModel/KiwiModel_Factory.h>
namespace kiwi { namespace model {
// ================================================================================ //
// OBJECT DIFFERENT //
// ================================================================================ //
void Different::declare()
{
if (!DataModel::has<model::Operator>())
{
Operator::declare();
}
std::unique_ptr<ObjectClass> different_class(new ObjectClass("!=",
&Different::create));
flip::Class<Different> & different_model = DataModel::declare<Different>()
.name(different_class->getModelName().c_str())
.inherit<Operator>();
Factory::add<Different>(std::move(different_class), different_model);
}
std::unique_ptr<Object> Different::create(std::vector<tool::Atom> const& args)
{
return std::make_unique<Different>(args);
}
Different::Different(std::vector<tool::Atom> const& args):
Operator(args)
{
}
}}
| 2,208
|
C++
|
.cpp
| 42
| 42.761905
| 97
| 0.489048
|
Musicoll/Kiwi
| 134
| 11
| 7
|
GPL-3.0
|
9/20/2024, 9:42:21 PM (Europe/Amsterdam)
| false
| false
| false
| false
| false
| false
| false
| false
|
754,182
|
KiwiModel_NoiseTilde.cpp
|
Musicoll_Kiwi/Modules/KiwiModel/KiwiModel_Objects/KiwiModel_NoiseTilde.cpp
|
/*
==============================================================================
This file is part of the KIWI library.
- Copyright (c) 2014-2016, Pierre Guillot & Eliott Paris.
- Copyright (c) 2016-2019, CICM, ANR MUSICOLL, Eliott Paris, Pierre Guillot, Jean Millot.
Permission is granted to use this software under the terms of the GPL v3
(or any later version). Details can be found at: www.gnu.org/licenses
KIWI 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.
------------------------------------------------------------------------------
Contact : [email protected]
==============================================================================
*/
#include <KiwiModel/KiwiModel_Objects/KiwiModel_NoiseTilde.h>
#include <KiwiModel/KiwiModel_DataModel.h>
#include <KiwiModel/KiwiModel_Factory.h>
namespace kiwi { namespace model {
// ================================================================================ //
// NOISE~ //
// ================================================================================ //
void NoiseTilde::declare()
{
std::unique_ptr<ObjectClass> noisetilde_class(new ObjectClass("noise~", &NoiseTilde::create));
flip::Class<NoiseTilde> & noisetilde_model = DataModel::declare<NoiseTilde>().name(noisetilde_class->getModelName().c_str()).inherit<Object>();
Factory::add<NoiseTilde>(std::move(noisetilde_class), noisetilde_model);
}
std::unique_ptr<Object> NoiseTilde::create(std::vector<tool::Atom> const& args)
{
return std::make_unique<NoiseTilde>(args);
}
NoiseTilde::NoiseTilde(std::vector<tool::Atom> const& args)
{
if (args.size() > 0)
{
throw Error("noise~ too many arguments");
}
pushOutlet(PinType::IType::Signal);
}
std::string NoiseTilde::getIODescription(bool is_inlet, size_t index) const
{
return "(signal) noise value";
}
}}
| 2,257
|
C++
|
.cpp
| 44
| 45.113636
| 151
| 0.545752
|
Musicoll/Kiwi
| 134
| 11
| 7
|
GPL-3.0
|
9/20/2024, 9:42:21 PM (Europe/Amsterdam)
| false
| false
| false
| false
| false
| false
| false
| false
|
754,183
|
KiwiModel_SfPlayTilde.cpp
|
Musicoll_Kiwi/Modules/KiwiModel/KiwiModel_Objects/KiwiModel_SfPlayTilde.cpp
|
/*
==============================================================================
This file is part of the KIWI library.
- Copyright (c) 2014-2016, Pierre Guillot & Eliott Paris.
- Copyright (c) 2016-2019, CICM, ANR MUSICOLL, Eliott Paris, Pierre Guillot, Jean Millot.
Permission is granted to use this software under the terms of the GPL v3
(or any later version). Details can be found at: www.gnu.org/licenses
KIWI 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.
------------------------------------------------------------------------------
Contact : [email protected]
==============================================================================
*/
#include <KiwiModel/KiwiModel_Objects/KiwiModel_SfPlayTilde.h>
#include <KiwiModel/KiwiModel_Factory.h>
namespace kiwi { namespace model {
// ================================================================================ //
// SFPLAY~ //
// ================================================================================ //
void SfPlayTilde::declare()
{
auto kiwi_class = std::make_unique<ObjectClass>("sf.play~", &SfPlayTilde::create);
auto& flip_class = DataModel::declare<SfPlayTilde>()
.name(kiwi_class->getModelName().c_str())
.inherit<model::Object>();
Factory::add<SfPlayTilde>(std::move(kiwi_class), flip_class);
}
std::unique_ptr<Object> SfPlayTilde::create(std::vector<tool::Atom> const& args)
{
return std::make_unique<SfPlayTilde>(args);
}
SfPlayTilde::SfPlayTilde(std::vector<tool::Atom> const& args)
{
pushInlet({PinType::IType::Signal, PinType::IType::Control});
pushOutlet(PinType::IType::Signal);
if(!args.empty() && args[0].isInt())
{
const auto channels = args[0].getInt();
if(channels > 1)
{
for(auto i = 1; i < channels; ++i)
{
pushOutlet({PinType::IType::Signal});
}
}
}
pushOutlet(PinType::IType::Control); // bang when finished
}
std::string SfPlayTilde::getIODescription(bool is_inlet, size_t index) const
{
if(is_inlet)
{
if(index == 0)
{
return "(msg) Open file, 0 to stop, 1 to start";
}
}
else
{
if(index < getNumberOfOutlets() - 1)
{
return "Audio Channel " + std::to_string(index + 1);
}
else
{
return "bang when playing ended";
}
}
return {};
}
}}
| 2,988
|
C++
|
.cpp
| 72
| 32.222222
| 90
| 0.490238
|
Musicoll/Kiwi
| 134
| 11
| 7
|
GPL-3.0
|
9/20/2024, 9:42:21 PM (Europe/Amsterdam)
| false
| false
| false
| false
| false
| false
| false
| false
|
754,184
|
KiwiModel_Select.cpp
|
Musicoll_Kiwi/Modules/KiwiModel/KiwiModel_Objects/KiwiModel_Select.cpp
|
/*
==============================================================================
This file is part of the KIWI library.
- Copyright (c) 2014-2016, Pierre Guillot & Eliott Paris.
- Copyright (c) 2016-2019, CICM, ANR MUSICOLL, Eliott Paris, Pierre Guillot, Jean Millot.
Permission is granted to use this software under the terms of the GPL v3
(or any later version). Details can be found at: www.gnu.org/licenses
KIWI 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.
------------------------------------------------------------------------------
Contact : [email protected]
==============================================================================
*/
#include <KiwiModel/KiwiModel_Objects/KiwiModel_Select.h>
#include <KiwiModel/KiwiModel_Factory.h>
namespace kiwi { namespace model {
// ================================================================================ //
// SELECT //
// ================================================================================ //
void Select::declare()
{
auto kiwi_class = std::make_unique<ObjectClass>("select", &Select::create);
kiwi_class->addAlias("sel");
auto& flip_class = (DataModel::declare<Select>()
.name(kiwi_class->getModelName().c_str())
.inherit<Object>());
Factory::add<Select>(std::move(kiwi_class), flip_class);
}
std::unique_ptr<Object> Select::create(std::vector<tool::Atom> const& args)
{
return std::make_unique<Select>(args);
}
Select::Select(std::vector<tool::Atom> const& args)
{
if (args.empty())
{
throw Error("select requires at least one argument");
}
pushInlet({PinType::IType::Control});
for(size_t i = 0; i < args.size(); ++i)
{
pushOutlet(PinType::IType::Control);
pushInlet({PinType::IType::Control});
}
pushOutlet(PinType::IType::Control);
}
std::string Select::getIODescription(bool is_inlet, size_t index) const
{
std::string description = "";
if (is_inlet)
{
if (index == 0)
{
description = "Value to be tested";
}
else
{
description = "Sets value " + std::to_string(index) + " to be tested";
}
}
else
{
auto const& args = getArguments();
if (index == args.size())
{
description = "Input if doesn't match";
}
else
{
description = "Outputs bang if input matches \"" + tool::AtomHelper::toString(args[index]) + "\"";
}
}
return description;
}
}}
| 3,168
|
C++
|
.cpp
| 76
| 31.657895
| 114
| 0.483609
|
Musicoll/Kiwi
| 134
| 11
| 7
|
GPL-3.0
|
9/20/2024, 9:42:21 PM (Europe/Amsterdam)
| false
| false
| false
| false
| false
| false
| false
| false
|
754,185
|
KiwiModel_Divide.cpp
|
Musicoll_Kiwi/Modules/KiwiModel/KiwiModel_Objects/KiwiModel_Divide.cpp
|
/*
==============================================================================
This file is part of the KIWI library.
- Copyright (c) 2014-2016, Pierre Guillot & Eliott Paris.
- Copyright (c) 2016-2019, CICM, ANR MUSICOLL, Eliott Paris, Pierre Guillot, Jean Millot.
Permission is granted to use this software under the terms of the GPL v3
(or any later version). Details can be found at: www.gnu.org/licenses
KIWI 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.
------------------------------------------------------------------------------
Contact : [email protected]
==============================================================================
*/
#include <KiwiModel/KiwiModel_Objects/KiwiModel_Divide.h>
#include <KiwiModel/KiwiModel_Factory.h>
namespace kiwi { namespace model {
// ================================================================================ //
// OBJECT DIVIDE //
// ================================================================================ //
void Divide::declare()
{
if (!DataModel::has<model::Operator>())
{
Operator::declare();
}
std::unique_ptr<ObjectClass> divide_class(new ObjectClass("/",
&Divide::create));
flip::Class<Divide> & divide_model = DataModel::declare<Divide>()
.name(divide_class->getModelName().c_str())
.inherit<Operator>();
Factory::add<Divide>(std::move(divide_class), divide_model);
}
std::unique_ptr<Object> Divide::create(std::vector<tool::Atom> const& args)
{
return std::make_unique<Divide>(args);
}
Divide::Divide(std::vector<tool::Atom> const& args):
Operator(args)
{
}
}}
| 2,147
|
C++
|
.cpp
| 42
| 41.666667
| 90
| 0.480137
|
Musicoll/Kiwi
| 134
| 11
| 7
|
GPL-3.0
|
9/20/2024, 9:42:21 PM (Europe/Amsterdam)
| false
| false
| false
| false
| false
| false
| false
| false
|
754,186
|
KiwiModel_OSCReceive.cpp
|
Musicoll_Kiwi/Modules/KiwiModel/KiwiModel_Objects/KiwiModel_OSCReceive.cpp
|
/*
==============================================================================
This file is part of the KIWI library.
- Copyright (c) 2014-2016, Pierre Guillot & Eliott Paris.
- Copyright (c) 2016-2019, CICM, ANR MUSICOLL, Eliott Paris, Pierre Guillot, Jean Millot.
Permission is granted to use this software under the terms of the GPL v3
(or any later version). Details can be found at: www.gnu.org/licenses
KIWI 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.
------------------------------------------------------------------------------
Contact : [email protected]
==============================================================================
*/
#include <KiwiModel/KiwiModel_Objects/KiwiModel_OSCReceive.h>
#include <KiwiModel/KiwiModel_Factory.h>
namespace kiwi { namespace model {
// ================================================================================ //
// OSC.receive //
// ================================================================================ //
void OSCReceive::declare()
{
auto object_class = std::make_unique<ObjectClass>("OSC.receive", &OSCReceive::create);
auto& model = DataModel::declare<OSCReceive>()
.name(object_class->getModelName().c_str())
.inherit<Object>();
Factory::add<OSCReceive>(std::move(object_class), model);
}
std::unique_ptr<Object> OSCReceive::create(std::vector<tool::Atom> const& args)
{
return std::make_unique<OSCReceive>(args);
}
OSCReceive::OSCReceive(std::vector<tool::Atom> const& args)
{
if(args.empty())
{
pushInlet({PinType::IType::Control});
}
pushOutlet(PinType::IType::Control);
}
std::string OSCReceive::getIODescription(bool is_inlet, size_t index) const
{
if(is_inlet)
{
return "port (int) Set port to listen to";
}
return "OSC messages received";
}
}}
| 2,273
|
C++
|
.cpp
| 49
| 39.489796
| 94
| 0.526119
|
Musicoll/Kiwi
| 134
| 11
| 7
|
GPL-3.0
|
9/20/2024, 9:42:21 PM (Europe/Amsterdam)
| false
| false
| false
| false
| false
| false
| false
| false
|
754,187
|
KiwiModel_SfRecordTilde.cpp
|
Musicoll_Kiwi/Modules/KiwiModel/KiwiModel_Objects/KiwiModel_SfRecordTilde.cpp
|
/*
==============================================================================
This file is part of the KIWI library.
- Copyright (c) 2014-2016, Pierre Guillot & Eliott Paris.
- Copyright (c) 2016-2019, CICM, ANR MUSICOLL, Eliott Paris, Pierre Guillot, Jean Millot.
Permission is granted to use this software under the terms of the GPL v3
(or any later version). Details can be found at: www.gnu.org/licenses
KIWI 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.
------------------------------------------------------------------------------
Contact : [email protected]
==============================================================================
*/
#include <KiwiModel/KiwiModel_Objects/KiwiModel_SfRecordTilde.h>
#include <KiwiModel/KiwiModel_Factory.h>
namespace kiwi { namespace model {
// ================================================================================ //
// SFRECORD~ //
// ================================================================================ //
void SfRecordTilde::declare()
{
auto kiwi_class = std::make_unique<ObjectClass>("sf.record~", &SfRecordTilde::create);
auto& flip_class = DataModel::declare<SfRecordTilde>()
.name(kiwi_class->getModelName().c_str())
.inherit<model::Object>();
Factory::add<SfRecordTilde>(std::move(kiwi_class), flip_class);
}
std::unique_ptr<Object> SfRecordTilde::create(std::vector<tool::Atom> const& args)
{
return std::make_unique<SfRecordTilde>(args);
}
SfRecordTilde::SfRecordTilde(std::vector<tool::Atom> const& args)
{
pushInlet({PinType::IType::Signal, PinType::IType::Control});
pushOutlet(PinType::IType::Signal);
if(!args.empty() && args[0].isInt())
{
const auto channels = args[0].getInt();
if(channels > 1)
{
for(auto i = 1; i < channels; ++i)
{
pushInlet({PinType::IType::Signal});
}
}
}
}
std::string SfRecordTilde::getIODescription(bool is_inlet, size_t index) const
{
if(is_inlet)
{
if(index == 0)
{
return "Audio Channel 1, open a file and start/stop recording";
}
else
{
return "Audio Channel " + std::to_string(index + 1);
}
}
else
{
if(index == 0)
{
return "(signal) Recording time (ms)";
}
}
return {};
}
}}
| 2,922
|
C++
|
.cpp
| 71
| 32.126761
| 94
| 0.490614
|
Musicoll/Kiwi
| 134
| 11
| 7
|
GPL-3.0
|
9/20/2024, 9:42:21 PM (Europe/Amsterdam)
| false
| false
| false
| false
| false
| false
| false
| false
|
754,188
|
KiwiModel_Random.cpp
|
Musicoll_Kiwi/Modules/KiwiModel/KiwiModel_Objects/KiwiModel_Random.cpp
|
/*
==============================================================================
This file is part of the KIWI library.
- Copyright (c) 2014-2016, Pierre Guillot & Eliott Paris.
- Copyright (c) 2016-2019, CICM, ANR MUSICOLL, Eliott Paris, Pierre Guillot, Jean Millot.
Permission is granted to use this software under the terms of the GPL v3
(or any later version). Details can be found at: www.gnu.org/licenses
KIWI 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.
------------------------------------------------------------------------------
Contact : [email protected]
==============================================================================
*/
#include <KiwiModel/KiwiModel_Objects/KiwiModel_Random.h>
#include <KiwiModel/KiwiModel_Factory.h>
namespace kiwi { namespace model {
// ================================================================================ //
// RANDOM //
// ================================================================================ //
void Random::declare()
{
auto kiwi_class = std::make_unique<ObjectClass>("random", &Random::create);
auto& flip_class = DataModel::declare<Random>()
.name(kiwi_class->getModelName().c_str())
.inherit<Object>();
Factory::add<Random>(std::move(kiwi_class), flip_class);
}
std::unique_ptr<Object> Random::create(std::vector<tool::Atom> const& args)
{
return std::make_unique<Random>(args);
}
Random::Random(std::vector<tool::Atom> const& args)
{
if (args.size() > 2)
{
throw Error("random: too many arguments");
}
if (args.size() > 0 && !args[0].isNumber())
{
throw Error("random: range argument must be a number");
}
if (args.size() > 1 && !args[1].isNumber())
{
throw Error("random: seed argument must be a number");
}
pushInlet({PinType::IType::Control}); // bang or seed message inlet
if (args.size() == 0)
{
pushInlet({PinType::IType::Control}); // range inlet
}
pushOutlet(PinType::IType::Control);
}
std::string Random::getIODescription(bool is_inlet, size_t index) const
{
if (is_inlet)
{
if (index == 0)
{
return "bang causes random number generation, seed sets the seed";
}
else if (index == 1)
{
return "Sets the maximum range (exclusive)";
}
}
else if(index == 0)
{
return "Outputs random number";
}
return {};
}
}}
| 3,022
|
C++
|
.cpp
| 73
| 32.643836
| 90
| 0.497532
|
Musicoll/Kiwi
| 134
| 11
| 7
|
GPL-3.0
|
9/20/2024, 9:42:21 PM (Europe/Amsterdam)
| false
| false
| false
| false
| false
| false
| false
| false
|
754,189
|
KiwiModel_Pack.cpp
|
Musicoll_Kiwi/Modules/KiwiModel/KiwiModel_Objects/KiwiModel_Pack.cpp
|
/*
==============================================================================
This file is part of the KIWI library.
- Copyright (c) 2014-2016, Pierre Guillot & Eliott Paris.
- Copyright (c) 2016-2019, CICM, ANR MUSICOLL, Eliott Paris, Pierre Guillot, Jean Millot.
Permission is granted to use this software under the terms of the GPL v3
(or any later version). Details can be found at: www.gnu.org/licenses
KIWI 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.
------------------------------------------------------------------------------
Contact : [email protected]
==============================================================================
*/
#include <KiwiModel/KiwiModel_Objects/KiwiModel_Pack.h>
#include <KiwiModel/KiwiModel_Factory.h>
namespace kiwi { namespace model {
// ================================================================================ //
// PACK //
// ================================================================================ //
void Pack::declare()
{
std::unique_ptr<ObjectClass> pack_class(new ObjectClass("pack", &Pack::create));
flip::Class<Pack> & pack_model = DataModel::declare<Pack>()
.name(pack_class->getModelName().c_str())
.inherit<Object>();
Factory::add<Pack>(std::move(pack_class), pack_model);
}
std::unique_ptr<Object> Pack::create(std::vector<tool::Atom> const& args)
{
return std::make_unique<Pack>(args);
}
Pack::Pack(std::vector<tool::Atom> const& args)
{
pushOutlet({PinType::IType::Control});
for(size_t i = 0; i < args.size(); ++i)
{
pushInlet({PinType::IType::Control});
}
}
std::string Pack::getIODescription(bool is_inlet, size_t index) const
{
if(!is_inlet)
{
return "Combined list from input";
}
else if (is_inlet)
{
auto const& args = getArguments();
const std::string type_str = [atom = args[index]]() {
switch(atom.getType())
{
case tool::Atom::Type::Int: return "int";
case tool::Atom::Type::Float: return "float";
case tool::Atom::Type::String: return "symbol";
default: return "null";
}
}();
auto description = type_str + " atom " + std::to_string(index + 1) + " in list";
if(index == 0)
{
description += ", causes output";
}
return description;
}
return {};
}
}}
| 3,058
|
C++
|
.cpp
| 68
| 34.279412
| 92
| 0.473868
|
Musicoll/Kiwi
| 134
| 11
| 7
|
GPL-3.0
|
9/20/2024, 9:42:21 PM (Europe/Amsterdam)
| false
| false
| false
| false
| false
| false
| false
| false
|
754,190
|
KiwiModel_PlusTilde.cpp
|
Musicoll_Kiwi/Modules/KiwiModel/KiwiModel_Objects/KiwiModel_PlusTilde.cpp
|
/*
==============================================================================
This file is part of the KIWI library.
- Copyright (c) 2014-2016, Pierre Guillot & Eliott Paris.
- Copyright (c) 2016-2019, CICM, ANR MUSICOLL, Eliott Paris, Pierre Guillot, Jean Millot.
Permission is granted to use this software under the terms of the GPL v3
(or any later version). Details can be found at: www.gnu.org/licenses
KIWI 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.
------------------------------------------------------------------------------
Contact : [email protected]
==============================================================================
*/
#include <KiwiModel/KiwiModel_Objects/KiwiModel_PlusTilde.h>
#include <KiwiModel/KiwiModel_DataModel.h>
#include <KiwiModel/KiwiModel_Factory.h>
namespace kiwi { namespace model {
// ================================================================================ //
// OBJECT PLUS~ //
// ================================================================================ //
void PlusTilde::declare()
{
if (!DataModel::has<model::OperatorTilde>())
{
OperatorTilde::declare();
}
std::unique_ptr<ObjectClass> plustilde_class(new ObjectClass("+~", &PlusTilde::create));
flip::Class<PlusTilde> & plustilde_model = DataModel::declare<PlusTilde>()
.name(plustilde_class->getModelName().c_str())
.inherit<OperatorTilde>();
Factory::add<PlusTilde>(std::move(plustilde_class), plustilde_model);
}
std::unique_ptr<Object> PlusTilde::create(std::vector<tool::Atom> const& args)
{
return std::make_unique<PlusTilde>(args);
}
PlusTilde::PlusTilde(std::vector<tool::Atom> const& args):
OperatorTilde(args)
{
}
}}
| 2,202
|
C++
|
.cpp
| 42
| 44.261905
| 97
| 0.514327
|
Musicoll/Kiwi
| 134
| 11
| 7
|
GPL-3.0
|
9/20/2024, 9:42:21 PM (Europe/Amsterdam)
| false
| false
| false
| false
| false
| false
| false
| false
|
754,191
|
KiwiModel_DacTilde.cpp
|
Musicoll_Kiwi/Modules/KiwiModel/KiwiModel_Objects/KiwiModel_DacTilde.cpp
|
/*
==============================================================================
This file is part of the KIWI library.
- Copyright (c) 2014-2016, Pierre Guillot & Eliott Paris.
- Copyright (c) 2016-2019, CICM, ANR MUSICOLL, Eliott Paris, Pierre Guillot, Jean Millot.
Permission is granted to use this software under the terms of the GPL v3
(or any later version). Details can be found at: www.gnu.org/licenses
KIWI 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.
------------------------------------------------------------------------------
Contact : [email protected]
==============================================================================
*/
#include <KiwiModel/KiwiModel_Objects/KiwiModel_DacTilde.h>
#include <KiwiModel/KiwiModel_DataModel.h>
#include <KiwiModel/KiwiModel_Factory.h>
namespace kiwi { namespace model {
// ================================================================================ //
// OBJECT DAC~ //
// ================================================================================ //
void DacTilde::declare()
{
std::unique_ptr<ObjectClass> dactilde_class(new ObjectClass("dac~", &DacTilde::create));
flip::Class<DacTilde> & dactilde_model = DataModel::declare<DacTilde>()
.name(dactilde_class->getModelName().c_str())
.inherit<Object>();
Factory::add<DacTilde>(std::move(dactilde_class), dactilde_model);
}
std::unique_ptr<Object> DacTilde::create(std::vector<tool::Atom> const& args)
{
return std::make_unique<DacTilde>(args);
}
DacTilde::DacTilde(std::vector<tool::Atom> const& args)
{
size_t channels = parseArgsAsChannelRoutes(args).size();
pushInlet({PinType::IType::Signal, PinType::IType::Control});
for (int i = 1; i < channels; ++i)
{
pushInlet({PinType::IType::Signal});
}
}
std::vector<size_t> DacTilde::parseArgsAsChannelRoutes(std::vector<tool::Atom> const& args) const
{
std::vector<size_t> routes;
for(tool::Atom const& arg : args)
{
if (arg.isNumber())
{
if (arg.getInt() <= 0)
{
throw Error("null or negative channel");
}
routes.push_back(arg.getInt() - 1);
}
else if(arg.isString())
{
std::string inputs(arg.getString());
size_t sep_pos = inputs.find(":");
if (sep_pos == std::string::npos)
{
throw Error("wrong symbol syntax");
}
int left_input = std::stoi(inputs.substr(0, sep_pos)) - 1;
int right_input = std::stoi(inputs.substr(inputs.find(":") + 1)) - 1;
if (left_input < 0 || right_input < 0)
{
throw Error("null or negative channel");
}
const bool rev = left_input > right_input;
for (int channel = left_input;
rev ? channel >= right_input : channel <= right_input;
rev ? --channel : ++channel)
{
routes.push_back(channel);
}
}
}
if (routes.empty())
{
routes = {0, 1};
}
return routes;
}
std::string DacTilde::getIODescription(bool is_inlet, size_t index) const
{
if(is_inlet)
{
if(index < getNumberOfInlets())
{
auto text_atoms = tool::AtomHelper::parse(getText());
text_atoms.erase(text_atoms.cbegin());
const auto routes = parseArgsAsChannelRoutes(text_atoms);
if(index == 0)
{
return "Start/Stop dsp, (signal) Audio Out Channel " + std::to_string(routes[0] + 1);
}
else
{
return "(signal) Audio Out Channel " + std::to_string(routes[index] + 1);
}
}
}
return {};
}
}
}
| 5,155
|
C++
|
.cpp
| 107
| 30.682243
| 109
| 0.439092
|
Musicoll/Kiwi
| 134
| 11
| 7
|
GPL-3.0
|
9/20/2024, 9:42:21 PM (Europe/Amsterdam)
| false
| false
| false
| false
| false
| false
| false
| false
|
754,192
|
KiwiModel_ErrorBox.cpp
|
Musicoll_Kiwi/Modules/KiwiModel/KiwiModel_Objects/KiwiModel_ErrorBox.cpp
|
/*
==============================================================================
This file is part of the KIWI library.
- Copyright (c) 2014-2016, Pierre Guillot & Eliott Paris.
- Copyright (c) 2016-2019, CICM, ANR MUSICOLL, Eliott Paris, Pierre Guillot, Jean Millot.
Permission is granted to use this software under the terms of the GPL v3
(or any later version). Details can be found at: www.gnu.org/licenses
KIWI 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.
------------------------------------------------------------------------------
Contact : [email protected]
==============================================================================
*/
#include <memory>
#include <KiwiModel/KiwiModel_Objects/KiwiModel_ErrorBox.h>
#include <KiwiModel/KiwiModel_ObjectClass.h>
#include <KiwiModel/KiwiModel_Factory.h>
namespace kiwi { namespace model {
// ================================================================================ //
// ERRORBOX //
// ================================================================================ //
void ErrorBox::declare()
{
std::unique_ptr<ObjectClass> object_class(new ObjectClass("errorbox",
&ErrorBox::create));
object_class->setFlag(ObjectClass::Flag::Internal);
flip::Class<ErrorBox> & data_model = DataModel::declare<ErrorBox>()
.name(object_class->getModelName().c_str())
.inherit<Object>();
Factory::add<ErrorBox>(std::move(object_class), data_model);
}
std::unique_ptr<Object> ErrorBox::create(std::vector<tool::Atom> const& atoms)
{
return std::make_unique<ErrorBox>();
}
ErrorBox::ErrorBox():
m_error()
{
}
void ErrorBox::setInlets(flip::Array<Inlet> const& inlets)
{
model::Object::setInlets(inlets);
}
void ErrorBox::setOutlets(flip::Array<Outlet> const& outlets)
{
model::Object::setOutlets(outlets);
}
std::string ErrorBox::getIODescription(bool is_inlet, size_t index) const
{
return "(nothing here)";
}
void ErrorBox::setError(std::string const& error_message)
{
m_error = error_message;
}
std::string ErrorBox::getError() const
{
return m_error;
}
}}
| 2,648
|
C++
|
.cpp
| 61
| 36.180328
| 90
| 0.538091
|
Musicoll/Kiwi
| 134
| 11
| 7
|
GPL-3.0
|
9/20/2024, 9:42:21 PM (Europe/Amsterdam)
| false
| false
| false
| false
| false
| false
| false
| false
|
754,193
|
KiwiModel_Hub.cpp
|
Musicoll_Kiwi/Modules/KiwiModel/KiwiModel_Objects/KiwiModel_Hub.cpp
|
/*
==============================================================================
This file is part of the KIWI library.
- Copyright (c) 2014-2016, Pierre Guillot & Eliott Paris.
- Copyright (c) 2016-2019, CICM, ANR MUSICOLL, Eliott Paris, Pierre Guillot, Jean Millot.
Permission is granted to use this software under the terms of the GPL v3
(or any later version). Details can be found at: www.gnu.org/licenses
KIWI 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.
------------------------------------------------------------------------------
Contact : [email protected]
==============================================================================
*/
#include <KiwiModel/KiwiModel_Objects/KiwiModel_Hub.h>
#include <KiwiModel/KiwiModel_Factory.h>
namespace kiwi { namespace model {
// ================================================================================ //
// OBJECT HUB //
// ================================================================================ //
void Hub::declare()
{
// Objectclass
auto kiwi_class = std::make_unique<ObjectClass>("hub", &Hub::create);
// Parameters
auto param_message = std::make_unique<ParameterClass>(tool::Parameter::Type::String);
kiwi_class->addAttribute("message", std::move(param_message));
// DataModel
auto& flip_class = DataModel::declare<Hub>()
.name(kiwi_class->getModelName().c_str())
.inherit<Object>()
.member<flip::Message<std::string>, &Hub::m_message>("message");
Factory::add<Hub>(std::move(kiwi_class), flip_class);
}
std::unique_ptr<Object> Hub::create(std::vector<tool::Atom> const& args)
{
return std::make_unique<Hub>(args);
}
Hub::Hub(std::vector<tool::Atom> const& args)
: Object()
, m_message()
{
if (args.size() > 0)
throw Error("message too many arguments");
pushInlet({PinType::IType::Control});
pushOutlet(PinType::IType::Control);
m_message.disable_in_undo();
}
Hub::Hub(flip::Default& d)
: Object(d)
, m_message()
{
m_message.disable_in_undo();
}
void Hub::writeAttribute(std::string const& name, tool::Parameter const& parameter)
{
if (name == "message")
{
m_message.send(parameter[0].getString());
}
}
void Hub::readAttribute(std::string const& name, tool::Parameter & parameter) const
{
if (name == "message")
{
m_message.get([¶meter](bool forward_flag, std::string received_message)
{
parameter = tool::Parameter(tool::Parameter::Type::String, {received_message});
});
}
}
bool Hub::attributeChanged(std::string const& name) const
{
return name == "message" && m_message.changed();
}
std::string Hub::getIODescription(bool is_inlet, size_t index) const
{
if (is_inlet && index == 0)
{
return "Sends message to all users";
}
else if(!is_inlet && index == 0)
{
return "Outputs message received from other users";
}
else
{
return "";
}
}
}}
| 3,605
|
C++
|
.cpp
| 91
| 31.736264
| 95
| 0.52808
|
Musicoll/Kiwi
| 134
| 11
| 7
|
GPL-3.0
|
9/20/2024, 9:42:21 PM (Europe/Amsterdam)
| false
| false
| false
| false
| false
| false
| false
| false
|
754,194
|
KiwiModel_AdcTilde.cpp
|
Musicoll_Kiwi/Modules/KiwiModel/KiwiModel_Objects/KiwiModel_AdcTilde.cpp
|
/*
==============================================================================
This file is part of the KIWI library.
- Copyright (c) 2014-2016, Pierre Guillot & Eliott Paris.
- Copyright (c) 2016-2019, CICM, ANR MUSICOLL, Eliott Paris, Pierre Guillot, Jean Millot.
Permission is granted to use this software under the terms of the GPL v3
(or any later version). Details can be found at: www.gnu.org/licenses
KIWI 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.
------------------------------------------------------------------------------
Contact : [email protected]
==============================================================================
*/
#include <KiwiModel/KiwiModel_Objects/KiwiModel_AdcTilde.h>
#include <KiwiModel/KiwiModel_DataModel.h>
#include <KiwiModel/KiwiModel_Factory.h>
namespace kiwi { namespace model {
// ================================================================================ //
// OBJECT ADC~ //
// ================================================================================ //
void AdcTilde::declare()
{
std::unique_ptr<ObjectClass> adctilde_class(new ObjectClass("adc~", &AdcTilde::create));
flip::Class<AdcTilde> & adctilde_model = DataModel::declare<AdcTilde>()
.name(adctilde_class->getModelName().c_str())
.inherit<Object>();
Factory::add<AdcTilde>(std::move(adctilde_class), adctilde_model);
}
std::unique_ptr<Object> AdcTilde::create(std::vector<tool::Atom> const& args)
{
return std::make_unique<AdcTilde>(args);
}
AdcTilde::AdcTilde(std::vector<tool::Atom> const& args)
{
size_t channels = parseArgsAsChannelRoutes(args).size();
pushInlet({PinType::IType::Control});
for (int i = 0; i < channels; ++i)
{
pushOutlet({PinType::IType::Signal});
}
}
std::vector<size_t> AdcTilde::parseArgsAsChannelRoutes(std::vector<tool::Atom> const& args) const
{
std::vector<size_t> routes;
for(tool::Atom const& arg : args)
{
if (arg.isNumber())
{
if (arg.getInt() <= 0)
{
throw Error("audio interface null or negative channel");
}
routes.push_back(arg.getInt() - 1);
}
else if(arg.isString())
{
std::string inputs(arg.getString());
size_t sep_pos = inputs.find(":");
if (sep_pos == std::string::npos)
{
throw Error("audio interface wrong arguments");
}
int left_input = std::stoi(inputs.substr(0, sep_pos)) - 1;
int right_input = std::stoi(inputs.substr(inputs.find(":") + 1)) - 1;
if (left_input < 0 || right_input < 0)
{
throw Error("audio interface null or negative channel");
}
const bool rev = left_input > right_input;
for (int channel = left_input;
rev ? channel >= right_input : channel <= right_input;
rev ? --channel : ++channel)
{
routes.push_back(channel);
}
}
}
if (routes.empty())
{
routes = {0, 1};
}
return routes;
}
std::string AdcTilde::getIODescription(bool is_inlet, size_t index) const
{
if(is_inlet)
{
return "Start/Stop dsp";
}
else
{
if(index < getNumberOfOutlets())
{
auto text_atoms = tool::AtomHelper::parse(getText());
text_atoms.erase(text_atoms.cbegin());
const auto routes = parseArgsAsChannelRoutes(text_atoms);
return "(signal) Audio In Channel " + std::to_string(routes[index] + 1);
}
}
return {};
}
}}
| 4,580
|
C++
|
.cpp
| 103
| 31.330097
| 101
| 0.484123
|
Musicoll/Kiwi
| 134
| 11
| 7
|
GPL-3.0
|
9/20/2024, 9:42:21 PM (Europe/Amsterdam)
| false
| false
| false
| false
| false
| false
| false
| false
|
754,195
|
KiwiModel_TimesTilde.cpp
|
Musicoll_Kiwi/Modules/KiwiModel/KiwiModel_Objects/KiwiModel_TimesTilde.cpp
|
/*
==============================================================================
This file is part of the KIWI library.
- Copyright (c) 2014-2016, Pierre Guillot & Eliott Paris.
- Copyright (c) 2016-2019, CICM, ANR MUSICOLL, Eliott Paris, Pierre Guillot, Jean Millot.
Permission is granted to use this software under the terms of the GPL v3
(or any later version). Details can be found at: www.gnu.org/licenses
KIWI 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.
------------------------------------------------------------------------------
Contact : [email protected]
==============================================================================
*/
#include <KiwiModel/KiwiModel_Objects/KiwiModel_TimesTilde.h>
#include <KiwiModel/KiwiModel_DataModel.h>
#include <KiwiModel/KiwiModel_Factory.h>
namespace kiwi { namespace model {
// ================================================================================ //
// OBJECT TIMES~ //
// ================================================================================ //
void TimesTilde::declare()
{
if (!DataModel::has<model::OperatorTilde>())
{
OperatorTilde::declare();
}
std::unique_ptr<ObjectClass> timestilde_class(new ObjectClass("*~", &TimesTilde::create));
flip::Class<TimesTilde> & plustilde_model = DataModel::declare<TimesTilde>()
.name(timestilde_class->getModelName().c_str())
.inherit<OperatorTilde>();
Factory::add<TimesTilde>(std::move(timestilde_class), plustilde_model);
}
std::unique_ptr<Object> TimesTilde::create(std::vector<tool::Atom> const& args)
{
return std::make_unique<TimesTilde>(args);
}
TimesTilde::TimesTilde(std::vector<tool::Atom> const& args):
OperatorTilde(args)
{
}
}}
| 2,217
|
C++
|
.cpp
| 42
| 44.571429
| 99
| 0.517307
|
Musicoll/Kiwi
| 134
| 11
| 7
|
GPL-3.0
|
9/20/2024, 9:42:21 PM (Europe/Amsterdam)
| false
| false
| false
| false
| false
| false
| false
| false
|
754,196
|
KiwiModel_Metro.cpp
|
Musicoll_Kiwi/Modules/KiwiModel/KiwiModel_Objects/KiwiModel_Metro.cpp
|
/*
==============================================================================
This file is part of the KIWI library.
- Copyright (c) 2014-2016, Pierre Guillot & Eliott Paris.
- Copyright (c) 2016-2019, CICM, ANR MUSICOLL, Eliott Paris, Pierre Guillot, Jean Millot.
Permission is granted to use this software under the terms of the GPL v3
(or any later version). Details can be found at: www.gnu.org/licenses
KIWI 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.
------------------------------------------------------------------------------
Contact : [email protected]
==============================================================================
*/
#include <KiwiModel/KiwiModel_Objects/KiwiModel_Metro.h>
#include <KiwiModel/KiwiModel_Factory.h>
#include <KiwiModel/KiwiModel_DataModel.h>
namespace kiwi { namespace model {
// ================================================================================ //
// OBJECT METRO //
// ================================================================================ //
void Metro::declare()
{
std::unique_ptr<ObjectClass> metro_class(new ObjectClass("metro", &Metro::create));
flip::Class<Metro> & metro_model = DataModel::declare<Metro>()
.name(metro_class->getModelName().c_str())
.inherit<Object>();
Factory::add<Metro>(std::move(metro_class), metro_model);
}
std::unique_ptr<Object> Metro::create(std::vector<tool::Atom> const& args)
{
return std::make_unique<Metro>(args);
}
Metro::Metro(std::vector<tool::Atom> const& args)
{
if (args.size() > 1)
throw Error("metro too many arguments");
if (args.size() == 1 && !args[0].isNumber())
throw Error("metro wrong argument [" + args[0].getString() + "]");
pushInlet({PinType::IType::Control});
if (args.empty())
{
pushInlet({PinType::IType::Control});
}
pushOutlet(PinType::IType::Control);
}
std::string Metro::getIODescription(bool is_inlet, size_t index) const
{
if(is_inlet)
{
if(index == 0)
{
return "Start/Stop metronome";
}
else if(index == 1)
{
return "Set time interval";
}
}
else
{
return "Outputs metronome ticks as bang";
}
return {};
}
}}
| 2,868
|
C++
|
.cpp
| 66
| 33.939394
| 91
| 0.49128
|
Musicoll/Kiwi
| 134
| 11
| 7
|
GPL-3.0
|
9/20/2024, 9:42:21 PM (Europe/Amsterdam)
| false
| false
| false
| false
| false
| false
| false
| false
|
754,197
|
KiwiModel_Delay.cpp
|
Musicoll_Kiwi/Modules/KiwiModel/KiwiModel_Objects/KiwiModel_Delay.cpp
|
/*
==============================================================================
This file is part of the KIWI library.
- Copyright (c) 2014-2016, Pierre Guillot & Eliott Paris.
- Copyright (c) 2016-2019, CICM, ANR MUSICOLL, Eliott Paris, Pierre Guillot, Jean Millot.
Permission is granted to use this software under the terms of the GPL v3
(or any later version). Details can be found at: www.gnu.org/licenses
KIWI 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.
------------------------------------------------------------------------------
Contact : [email protected]
==============================================================================
*/
#include <KiwiModel/KiwiModel_DataModel.h>
#include <KiwiModel/KiwiModel_Factory.h>
#include <KiwiModel/KiwiModel_Objects/KiwiModel_Delay.h>
namespace kiwi
{
namespace model
{
// ================================================================================ //
// OBJECT DELAY //
// ================================================================================ //
void Delay::declare()
{
std::unique_ptr<ObjectClass> delay_class(new ObjectClass("delay",
&Delay::create));
flip::Class<Delay> & delay_model = DataModel::declare<Delay>()
.name(delay_class->getModelName().c_str())
.inherit<Object>();
Factory::add<Delay>(std::move(delay_class), delay_model);
}
std::unique_ptr<Object> Delay::create(std::vector<tool::Atom> const& args)
{
return std::make_unique<Delay>(args);
}
Delay::Delay(std::vector<tool::Atom> const& args)
{
if (args.size() > 1)
throw Error("delay too many arguments");
if(args.size() == 1 && !args[0].isNumber())
throw Error("delay argument must be a number");
pushInlet({PinType::IType::Control});
if (args.empty())
{
pushInlet({PinType::IType::Control});
}
pushOutlet(PinType::IType::Control);
}
std::string Delay::getIODescription(bool is_inlet, size_t index) const
{
if(is_inlet)
{
if(index == 0)
{
return "bang gets delayed, message \"stop\" cancels";
}
else if(index == 1)
{
return "Set delay time";
}
}
else
{
return "Delayed bang";
}
return {};
}
}
}
| 3,138
|
C++
|
.cpp
| 71
| 31.225352
| 94
| 0.449231
|
Musicoll/Kiwi
| 134
| 11
| 7
|
GPL-3.0
|
9/20/2024, 9:42:21 PM (Europe/Amsterdam)
| false
| false
| false
| false
| false
| false
| false
| false
|
754,198
|
KiwiModel_Scale.cpp
|
Musicoll_Kiwi/Modules/KiwiModel/KiwiModel_Objects/KiwiModel_Scale.cpp
|
/*
==============================================================================
This file is part of the KIWI library.
- Copyright (c) 2014-2016, Pierre Guillot & Eliott Paris.
- Copyright (c) 2016-2019, CICM, ANR MUSICOLL, Eliott Paris, Pierre Guillot, Jean Millot.
Permission is granted to use this software under the terms of the GPL v3
(or any later version). Details can be found at: www.gnu.org/licenses
KIWI 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.
------------------------------------------------------------------------------
Contact : [email protected]
==============================================================================
*/
#include <KiwiModel/KiwiModel_Objects/KiwiModel_Scale.h>
#include <KiwiModel/KiwiModel_Factory.h>
namespace kiwi { namespace model {
// ================================================================================ //
// SCALE //
// ================================================================================ //
void Scale::declare()
{
std::unique_ptr<ObjectClass> scale_class(new ObjectClass("scale", &Scale::create));
flip::Class<Scale> & scale_model = DataModel::declare<Scale>().name(scale_class->getModelName().c_str()).inherit<Object>();
Factory::add<Scale>(std::move(scale_class), scale_model);
}
std::unique_ptr<Object> Scale::create(std::vector<tool::Atom> const& args)
{
return std::make_unique<Scale>(args);
}
Scale::Scale(std::vector<tool::Atom> const& args)
{
if (args.size() > 4)
{
throw Error("scale too manu arguments");
}
if (args.size() > 3 && !args[3].isNumber())
{
throw Error("scale output high must be a number");
}
if (args.size() > 2 && !args[2].isNumber())
{
throw Error("scale output low must be a number");
}
if (args.size() > 1 && !args[1].isNumber())
{
throw Error("scale intput high must be a number ");
}
if (args.size() > 0 && !args[0].isNumber())
{
throw Error("scale input low must be a number");
}
pushInlet({PinType::IType::Control});
pushInlet({PinType::IType::Control});
pushInlet({PinType::IType::Control});
pushInlet({PinType::IType::Control});
pushInlet({PinType::IType::Control});
pushOutlet(PinType::IType::Control);
}
std::string Scale::getIODescription(bool is_inlet, size_t index) const
{
if (is_inlet)
{
if (index == 0)
{
return "Number to be scaled";
}
else if (index == 1)
{
return "Sets input low value";
}
else if (index == 2)
{
return "Sets input high value";
}
else if(index == 3)
{
return "Sets output low value";
}
else if (index == 4)
{
return "Sets output high value";
}
}
else
{
return "Ouputs the scaling result";
}
return "";
}
}}
| 3,592
|
C++
|
.cpp
| 91
| 29.868132
| 131
| 0.485055
|
Musicoll/Kiwi
| 134
| 11
| 7
|
GPL-3.0
|
9/20/2024, 9:42:21 PM (Europe/Amsterdam)
| false
| false
| false
| false
| false
| false
| false
| false
|
754,199
|
KiwiModel_FaustTilde.cpp
|
Musicoll_Kiwi/Modules/KiwiModel/KiwiModel_Objects/KiwiModel_FaustTilde.cpp
|
/*
==============================================================================
This file is part of the KIWI library.
- Copyright (c) 2014-2016, Pierre Guillot & Eliott Paris.
- Copyright (c) 2016-2019, CICM, ANR MUSICOLL, Eliott Paris, Pierre Guillot, Jean Millot.
Permission is granted to use this software under the terms of the GPL v3
(or any later version). Details can be found at: www.gnu.org/licenses
KIWI 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.
------------------------------------------------------------------------------
Contact : [email protected]
==============================================================================
*/
#include <KiwiModel/KiwiModel_Objects/KiwiModel_FaustTilde.h>
#include <KiwiModel/KiwiModel_DataModel.h>
#include <KiwiModel/KiwiModel_Factory.h>
namespace kiwi { namespace model {
// ================================================================================ //
// OBJECT FAUST~ //
// ================================================================================ //
void FaustTilde::iString::declare()
{
DataModel::declare<FaustTilde::iString>()
.name("faust_istring")
.member<flip::String, &FaustTilde::iString::value>("value");
}
FaustTilde::iString::iString(flip::Default& d)
{
value.disable_in_undo();
}
FaustTilde::iString::iString(flip::String&& v) : value(v)
{
value.disable_in_undo();
}
FaustTilde::iString::iString(std::string const& v) : value(v)
{
value.disable_in_undo();
}
void FaustTilde::declare()
{
std::unique_ptr<ObjectClass> fausttilde_class(new ObjectClass("faust~", &FaustTilde::create));
auto param_dsp_code_changed = std::make_unique<ParameterClass>(tool::Parameter::Type::String);
fausttilde_class->addAttribute("dspcodechanged", std::move(param_dsp_code_changed));
auto param_edit_code_changed = std::make_unique<ParameterClass>(tool::Parameter::Type::String);
fausttilde_class->addAttribute("editcodechanged", std::move(param_edit_code_changed));
auto param_lock_state = std::make_unique<ParameterClass>(tool::Parameter::Type::Int);
fausttilde_class->addAttribute("lockstate", std::move(param_lock_state));
auto param_compile_options = std::make_unique<ParameterClass>(tool::Parameter::Type::String);
fausttilde_class->addAttribute("compileoptionschanged", std::move(param_compile_options));
iString::declare();
flip::Class<FaustTilde> & fausttilde_model = DataModel::declare<FaustTilde>()
.name(fausttilde_class->getModelName().c_str())
.inherit<Object>()
.member<flip::String, &FaustTilde::m_dsp_code>("dspcode")
.member<flip::Message<std::string>, &FaustTilde::m_dsp_code_changed>("dspcodechanged")
.member<flip::String, &FaustTilde::m_edit_code>("editcode")
.member<flip::Message<std::string>, &FaustTilde::m_edit_code_changed>("editcodechanged")
.member<flip::Int, &FaustTilde::m_lock_state>("lockstate")
.member<flip::Array<iString>, &FaustTilde::m_compiles_options>("compileoptions")
.member<flip::Message<std::string>, &FaustTilde::m_compiles_options_changed>("compileoptionschanged");
Factory::add<FaustTilde>(std::move(fausttilde_class), fausttilde_model);
}
std::unique_ptr<Object> FaustTilde::create(std::vector<tool::Atom> const& args)
{
return std::make_unique<FaustTilde>(args);
}
FaustTilde::FaustTilde(flip::Default& d) : model::Object(d)
{
m_dsp_code.disable_in_undo();
m_dsp_code_changed.disable_in_undo();
m_edit_code.disable_in_undo();
m_edit_code_changed.disable_in_undo();
m_lock_state.disable_in_undo();
m_compiles_options.disable_in_undo();
m_compiles_options_changed.disable_in_undo();
}
FaustTilde::FaustTilde(std::vector<tool::Atom> const& args)
{
m_dsp_code.disable_in_undo();
m_dsp_code_changed.disable_in_undo();
m_edit_code.disable_in_undo();
m_edit_code_changed.disable_in_undo();
m_lock_state.disable_in_undo();
m_compiles_options.disable_in_undo();
m_compiles_options_changed.disable_in_undo();
if (args.size() < 2)
{
throw Error("faust~ expects 2 default arguments: the number of inlets and the number of outlets.");
}
if (!args[0].isInt() || args[0].getInt() < 0)
{
throw Error("faust~ 1st argument must be the number of inlets - positive or null");
}
if (!args[1].isInt() || args[1].getInt() < 0)
{
throw Error("faust~ 2nd argument must be the number of outlets - positive or null");
}
pushInlet({PinType::IType::Control, PinType::IType::Signal});
for(int i = 1; i < args[0].getInt(); ++i)
{
pushInlet({PinType::IType::Signal});
}
for(int i = 0; i < args[1].getInt(); ++i)
{
pushOutlet(PinType::IType::Signal);
}
pushOutlet(PinType::IType::Control);
}
std::string FaustTilde::getIODescription(bool is_inlet, size_t index) const
{
if(is_inlet)
{
if(index == 0)
{
return std::string("Messages and Audio Input Channel ") + std::to_string(index);
}
return std::string("Audio Input Channel ") + std::to_string(index);
}
else
{
if(index == getNumberOfOutlets() - 1)
{
return std::string("Extra Output");
}
return std::string("Audio Output Channel ") + std::to_string(index);
}
}
void FaustTilde::setDSPCode(std::string const& newcode)
{
m_dsp_code = newcode;
}
std::string FaustTilde::getDSPCode() const
{
return m_dsp_code;
}
void FaustTilde::setEditCode(std::string const& newcode)
{
m_edit_code = newcode;
}
std::string FaustTilde::getEditCode() const
{
return m_edit_code;
}
int64_t FaustTilde::getLockState() const
{
return m_lock_state;
}
void FaustTilde::setCompileOptions(std::vector<std::string> const& newcompileoptions)
{
m_compiles_options.clear();
for(auto const& option : newcompileoptions)
{
m_compiles_options.emplace(m_compiles_options.end(), flip::String(option));
}
}
std::vector<std::string> FaustTilde::getCompileOptions() const
{
std::vector<std::string> options;
auto it = m_compiles_options.begin();
while(it != m_compiles_options.end())
{
options.push_back((*it).value);
++it;
}
return options;
}
void FaustTilde::writeAttribute(std::string const& name, tool::Parameter const& parameter)
{
if(name == "dspcodechanged")
{
m_dsp_code_changed.send(parameter[0].getString());
}
else if(name == "editcodechanged")
{
m_edit_code_changed.send(parameter[0].getString());
}
else if(name == "lockstate")
{
m_lock_state = parameter[0].getInt();
}
else if(name == "compileoptionschanged")
{
m_compiles_options_changed.send(parameter[0].getString());
}
}
void FaustTilde::readAttribute(std::string const& name, tool::Parameter & parameter) const
{
if(name == "dspcodechanged")
{
m_dsp_code_changed.get([¶meter](bool forward_flag, std::string received_message)
{
parameter = tool::Parameter(tool::Parameter::Type::String, {received_message});
});
}
else if(name == "editcodechanged")
{
m_edit_code_changed.get([¶meter](bool forward_flag, std::string received_message)
{
parameter = tool::Parameter(tool::Parameter::Type::String, {received_message});
});
}
else if(name == "lockstate")
{
parameter = tool::Parameter(tool::Parameter::Type::Int, {static_cast<int64_t>(m_lock_state)});
}
else if(name == "compileoptionschanged")
{
m_compiles_options_changed.get([¶meter](bool forward_flag, std::string received_message)
{
parameter = tool::Parameter(tool::Parameter::Type::String, {received_message});
});
}
}
bool FaustTilde::attributeChanged(std::string const& name) const
{
if(name == "dspcodechanged")
{
return m_dsp_code_changed.changed();
}
else if(name == "editcodechanged")
{
return m_edit_code_changed.changed();
}
else if(name == "lockstate")
{
return m_lock_state.changed();
}
else if(name == "compileoptionschanged")
{
return m_compiles_options_changed.changed();
}
return false;
}
}}
| 9,765
|
C++
|
.cpp
| 235
| 31.710638
| 119
| 0.563444
|
Musicoll/Kiwi
| 134
| 11
| 7
|
GPL-3.0
|
9/20/2024, 9:42:21 PM (Europe/Amsterdam)
| false
| false
| false
| false
| false
| false
| false
| false
|
754,200
|
KiwiModel_DivideTilde.cpp
|
Musicoll_Kiwi/Modules/KiwiModel/KiwiModel_Objects/KiwiModel_DivideTilde.cpp
|
/*
==============================================================================
This file is part of the KIWI library.
- Copyright (c) 2014-2016, Pierre Guillot & Eliott Paris.
- Copyright (c) 2016-2019, CICM, ANR MUSICOLL, Eliott Paris, Pierre Guillot, Jean Millot.
Permission is granted to use this software under the terms of the GPL v3
(or any later version). Details can be found at: www.gnu.org/licenses
KIWI 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.
------------------------------------------------------------------------------
Contact : [email protected]
==============================================================================
*/
#include <KiwiModel/KiwiModel_Objects/KiwiModel_DivideTilde.h>
#include <KiwiModel/KiwiModel_Factory.h>
namespace kiwi { namespace model {
// ================================================================================ //
// OBJECT /~ //
// ================================================================================ //
void DivideTilde::declare()
{
if (!DataModel::has<model::OperatorTilde>())
{
OperatorTilde::declare();
}
std::unique_ptr<ObjectClass> dividetilde_class(new ObjectClass("/~", &DivideTilde::create));
flip::Class<DivideTilde> & dividetilde_model = DataModel::declare<DivideTilde>()
.name(dividetilde_class->getModelName().c_str())
.inherit<OperatorTilde>();
Factory::add<DivideTilde>(std::move(dividetilde_class), dividetilde_model);
}
std::unique_ptr<Object> DivideTilde::create(std::vector<tool::Atom> const& args)
{
return std::make_unique<DivideTilde>(args);
}
DivideTilde::DivideTilde(std::vector<tool::Atom> const& args):
OperatorTilde(args)
{
}
}}
| 2,215
|
C++
|
.cpp
| 41
| 45.04878
| 112
| 0.506641
|
Musicoll/Kiwi
| 134
| 11
| 7
|
GPL-3.0
|
9/20/2024, 9:42:21 PM (Europe/Amsterdam)
| false
| false
| false
| false
| false
| false
| false
| false
|
754,201
|
KiwiModel_SigTilde.cpp
|
Musicoll_Kiwi/Modules/KiwiModel/KiwiModel_Objects/KiwiModel_SigTilde.cpp
|
/*
==============================================================================
This file is part of the KIWI library.
- Copyright (c) 2014-2016, Pierre Guillot & Eliott Paris.
- Copyright (c) 2016-2019, CICM, ANR MUSICOLL, Eliott Paris, Pierre Guillot, Jean Millot.
Permission is granted to use this software under the terms of the GPL v3
(or any later version). Details can be found at: www.gnu.org/licenses
KIWI 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.
------------------------------------------------------------------------------
Contact : [email protected]
==============================================================================
*/
#include <KiwiModel/KiwiModel_Objects/KiwiModel_SigTilde.h>
#include <KiwiModel/KiwiModel_DataModel.h>
#include <KiwiModel/KiwiModel_Factory.h>
namespace kiwi { namespace model {
// ================================================================================ //
// OBJECT SIG~ //
// ================================================================================ //
void SigTilde::declare()
{
std::unique_ptr<ObjectClass> sigtilde_class(new ObjectClass("sig~", &SigTilde::create));
flip::Class<SigTilde> & sigtilde_model = DataModel::declare<SigTilde>()
.name(sigtilde_class->getModelName().c_str())
.inherit<Object>();
Factory::add<SigTilde>(std::move(sigtilde_class), sigtilde_model);
}
std::unique_ptr<Object> SigTilde::create(std::vector<tool::Atom> const& args)
{
return std::make_unique<SigTilde>(args);
}
SigTilde::SigTilde(std::vector<tool::Atom> const& args)
{
if (args.size() > 1)
{
throw Error("sig~ too many arguments");
}
if (args.size() == 1 && !args[0].isNumber())
{
throw Error("sig~ argument must be a number");
}
if (args.empty() || !args[0].isNumber())
{
pushInlet({PinType::IType::Control});
}
pushOutlet(PinType::IType::Signal);
}
std::string SigTilde::getIODescription(bool is_inlet, size_t index) const
{
return is_inlet ? "(float/int) Set signal value" : "(signal) Output value";
}
}}
| 2,640
|
C++
|
.cpp
| 54
| 40.092593
| 96
| 0.51244
|
Musicoll/Kiwi
| 134
| 11
| 7
|
GPL-3.0
|
9/20/2024, 9:42:21 PM (Europe/Amsterdam)
| false
| false
| false
| false
| false
| false
| false
| false
|
754,202
|
KiwiModel_Greater.cpp
|
Musicoll_Kiwi/Modules/KiwiModel/KiwiModel_Objects/KiwiModel_Greater.cpp
|
/*
==============================================================================
This file is part of the KIWI library.
- Copyright (c) 2014-2016, Pierre Guillot & Eliott Paris.
- Copyright (c) 2016-2019, CICM, ANR MUSICOLL, Eliott Paris, Pierre Guillot, Jean Millot.
Permission is granted to use this software under the terms of the GPL v3
(or any later version). Details can be found at: www.gnu.org/licenses
KIWI 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.
------------------------------------------------------------------------------
Contact : [email protected]
==============================================================================
*/
#include <KiwiModel/KiwiModel_Objects/KiwiModel_Greater.h>
#include <KiwiModel/KiwiModel_Factory.h>
namespace kiwi { namespace model {
// ================================================================================ //
// OBJECT GREATER //
// ================================================================================ //
void Greater::declare()
{
if (!DataModel::has<model::Operator>())
{
Operator::declare();
}
std::unique_ptr<ObjectClass> greater_class(new ObjectClass(">",
&Greater::create));
flip::Class<Greater> & greater_model = DataModel::declare<Greater>()
.name(greater_class->getModelName().c_str())
.inherit<Operator>();
Factory::add<Greater>(std::move(greater_class), greater_model);
}
std::unique_ptr<Object> Greater::create(std::vector<tool::Atom> const& args)
{
return std::make_unique<Greater>(args);
}
Greater::Greater(std::vector<tool::Atom> const& args):
Operator(args)
{
}
}}
| 2,167
|
C++
|
.cpp
| 42
| 42.02381
| 91
| 0.483244
|
Musicoll/Kiwi
| 134
| 11
| 7
|
GPL-3.0
|
9/20/2024, 9:42:21 PM (Europe/Amsterdam)
| false
| false
| false
| false
| false
| false
| false
| false
|
754,203
|
KiwiModel_Unpack.cpp
|
Musicoll_Kiwi/Modules/KiwiModel/KiwiModel_Objects/KiwiModel_Unpack.cpp
|
/*
==============================================================================
This file is part of the KIWI library.
- Copyright (c) 2014-2016, Pierre Guillot & Eliott Paris.
- Copyright (c) 2016-2019, CICM, ANR MUSICOLL, Eliott Paris, Pierre Guillot, Jean Millot.
Permission is granted to use this software under the terms of the GPL v3
(or any later version). Details can be found at: www.gnu.org/licenses
KIWI 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.
------------------------------------------------------------------------------
Contact : [email protected]
==============================================================================
*/
#include <KiwiModel/KiwiModel_Objects/KiwiModel_Unpack.h>
#include <KiwiModel/KiwiModel_Factory.h>
namespace kiwi { namespace model {
// ================================================================================ //
// UNPACK //
// ================================================================================ //
void Unpack::declare()
{
std::unique_ptr<ObjectClass> unpack_class(new ObjectClass("unpack", &Unpack::create));
flip::Class<Unpack> & unpack_model = DataModel::declare<Unpack>()
.name(unpack_class->getModelName().c_str())
.inherit<Object>();
Factory::add<Unpack>(std::move(unpack_class), unpack_model);
}
std::unique_ptr<Object> Unpack::create(std::vector<tool::Atom> const& args)
{
return std::make_unique<Unpack>(args);
}
Unpack::Unpack(std::vector<tool::Atom> const& args)
{
pushInlet({PinType::IType::Control});
for(size_t i = 0; i < args.size(); ++i)
{
pushOutlet(PinType::IType::Control);
}
}
std::string Unpack::getIODescription(bool is_inlet, size_t index) const
{
if(is_inlet)
{
return "list to be unpacked";
}
else
{
std::vector<tool::Atom> const& args = getArguments();
const std::string type_str = [atom = args[index]]() {
switch(atom.getType())
{
case tool::Atom::Type::Int: return "int";
case tool::Atom::Type::Float: return "float";
case tool::Atom::Type::String: return "symbol";
default: return "null";
}
}();
return "element " + std::to_string(index + 1) + " in list (" + type_str + ")";
}
return {};
}
}}
| 2,967
|
C++
|
.cpp
| 63
| 36.380952
| 99
| 0.479442
|
Musicoll/Kiwi
| 134
| 11
| 7
|
GPL-3.0
|
9/20/2024, 9:42:21 PM (Europe/Amsterdam)
| false
| false
| false
| false
| false
| false
| false
| false
|
754,204
|
KiwiModel_Route.cpp
|
Musicoll_Kiwi/Modules/KiwiModel/KiwiModel_Objects/KiwiModel_Route.cpp
|
/*
==============================================================================
This file is part of the KIWI library.
- Copyright (c) 2014-2016, Pierre Guillot & Eliott Paris.
- Copyright (c) 2016-2019, CICM, ANR MUSICOLL, Eliott Paris, Pierre Guillot, Jean Millot.
Permission is granted to use this software under the terms of the GPL v3
(or any later version). Details can be found at: www.gnu.org/licenses
KIWI 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.
------------------------------------------------------------------------------
Contact : [email protected]
==============================================================================
*/
#include <KiwiModel/KiwiModel_Objects/KiwiModel_Route.h>
#include <KiwiModel/KiwiModel_Factory.h>
namespace kiwi { namespace model {
// ================================================================================ //
// ROUTE //
// ================================================================================ //
void Route::declare()
{
auto object_class = std::make_unique<ObjectClass>("route", &Route::create);
auto& model = DataModel::declare<Route>()
.name(object_class->getModelName().c_str())
.inherit<Object>();
Factory::add<Route>(std::move(object_class), model);
}
std::unique_ptr<Object> Route::create(std::vector<tool::Atom> const& args)
{
return std::make_unique<Route>(args);
}
Route::Route(std::vector<tool::Atom> const& args)
{
pushInlet({PinType::IType::Control});
const auto nargs = args.size();
if(nargs == 0)
{
pushInlet({PinType::IType::Control}); // custom selector input
pushOutlet(PinType::IType::Control); // custom selector output
}
else
{
for(size_t i = 0; i < args.size(); ++i)
{
pushOutlet(PinType::IType::Control);
}
}
pushOutlet(PinType::IType::Control); // not match outlet
}
std::string Route::getIODescription(bool is_inlet, size_t index) const
{
if(is_inlet)
{
if(index == 0)
return "(anything) Message to be routed";
if (index == 1)
return "(int/float/symbol) Change selector";
}
auto const& args = getArguments();
if(args.empty() && index == 0)
{
return {"Message matches input selector"};
}
if(!args.empty() && index < args.size())
{
return {"Message matches " + tool::AtomHelper::toString(args[index])};
}
return "Doesn't match";
}
}}
| 3,056
|
C++
|
.cpp
| 71
| 34.070423
| 90
| 0.505252
|
Musicoll/Kiwi
| 134
| 11
| 7
|
GPL-3.0
|
9/20/2024, 9:42:21 PM (Europe/Amsterdam)
| false
| false
| false
| false
| false
| false
| false
| false
|
754,205
|
KiwiModel_Plus.cpp
|
Musicoll_Kiwi/Modules/KiwiModel/KiwiModel_Objects/KiwiModel_Plus.cpp
|
/*
==============================================================================
This file is part of the KIWI library.
- Copyright (c) 2014-2016, Pierre Guillot & Eliott Paris.
- Copyright (c) 2016-2019, CICM, ANR MUSICOLL, Eliott Paris, Pierre Guillot, Jean Millot.
Permission is granted to use this software under the terms of the GPL v3
(or any later version). Details can be found at: www.gnu.org/licenses
KIWI 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.
------------------------------------------------------------------------------
Contact : [email protected]
==============================================================================
*/
#include <KiwiModel/KiwiModel_Objects/KiwiModel_Plus.h>
#include <KiwiModel/KiwiModel_Factory.h>
namespace kiwi { namespace model {
// ================================================================================ //
// OBJECT PLUS //
// ================================================================================ //
void Plus::declare()
{
if (!DataModel::has<model::Operator>())
{
Operator::declare();
}
std::unique_ptr<ObjectClass> plus_class(new ObjectClass("+",
&Plus::create));
flip::Class<Plus> & plus_model = DataModel::declare<Plus>()
.name(plus_class->getModelName().c_str())
.inherit<Operator>();
Factory::add<Plus>(std::move(plus_class), plus_model);
}
std::unique_ptr<Object> Plus::create(std::vector<tool::Atom> const& args)
{
return std::make_unique<Plus>(args);
}
Plus::Plus(std::vector<tool::Atom> const& args):
Operator(args)
{
}
}}
| 2,108
|
C++
|
.cpp
| 42
| 40.952381
| 90
| 0.473737
|
Musicoll/Kiwi
| 134
| 11
| 7
|
GPL-3.0
|
9/20/2024, 9:42:21 PM (Europe/Amsterdam)
| false
| false
| false
| false
| false
| false
| false
| false
|
754,206
|
KiwiModel_Message.cpp
|
Musicoll_Kiwi/Modules/KiwiModel/KiwiModel_Objects/KiwiModel_Message.cpp
|
/*
==============================================================================
This file is part of the KIWI library.
- Copyright (c) 2014-2016, Pierre Guillot & Eliott Paris.
- Copyright (c) 2016-2019, CICM, ANR MUSICOLL, Eliott Paris, Pierre Guillot, Jean Millot.
Permission is granted to use this software under the terms of the GPL v3
(or any later version). Details can be found at: www.gnu.org/licenses
KIWI 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.
------------------------------------------------------------------------------
Contact : [email protected]
==============================================================================
*/
#include <KiwiModel/KiwiModel_Objects/KiwiModel_Message.h>
#include <KiwiModel/KiwiModel_ObjectClass.h>
#include <KiwiModel/KiwiModel_DataModel.h>
#include <KiwiModel/KiwiModel_Factory.h>
namespace kiwi { namespace model {
// ================================================================================ //
// OBJECT SLIDER //
// ================================================================================ //
void Message::declare()
{
// Objectclass
std::unique_ptr<ObjectClass> mess_class(new ObjectClass("message", &Message::create));
// Parameters
std::unique_ptr<ParameterClass> param_text(new ParameterClass(tool::Parameter::Type::String));
mess_class->addAttribute("text", std::move(param_text));
// Flags
mess_class->setFlag(ObjectClass::Flag::DefinedSize);
// DataModel
flip::Class<Message> & message_model = DataModel::declare<Message>()
.name(mess_class->getModelName().c_str())
.inherit<Object>()
.member<flip::String, &Message::m_message_text>("message_text");
Factory::add<Message>(std::move(mess_class), message_model);
}
std::unique_ptr<Object> Message::create(std::vector<tool::Atom> const& args)
{
if (args.size() > 0)
throw Error("message too many arguments");
return std::make_unique<Message>();
}
Message::Message():
Object(),
m_message_text("")
{
setWidth(40);
setHeight(20.);
pushInlet({PinType::IType::Control});
pushOutlet(PinType::IType::Control);
addSignal<>(Signal::outputMessage, *this);
}
Message::Message(flip::Default& d):
Object(d),
m_message_text("")
{
addSignal<>(Signal::outputMessage, *this);
}
void Message::writeAttribute(std::string const& name, tool::Parameter const& parameter)
{
if (name == "text")
{
m_message_text = parameter[0].getString();
}
}
void Message::readAttribute(std::string const& name, tool::Parameter & parameter) const
{
std::string const& message = m_message_text;
parameter = tool::Parameter(tool::Parameter::Type::String, {message});
}
bool Message::attributeChanged(std::string const& name) const
{
bool changed = false;
if (name == "text" && m_message_text.changed())
{
changed = true;
}
return changed;
}
std::string Message::getIODescription(bool is_inlet, size_t index) const
{
if (is_inlet && index == 0)
{
return "Trigger the message";
}
else if(!is_inlet && index == 0)
{
return "Message result";
}
else
{
return "";
}
}
}}
| 3,995
|
C++
|
.cpp
| 97
| 32.041237
| 111
| 0.531167
|
Musicoll/Kiwi
| 134
| 11
| 7
|
GPL-3.0
|
9/20/2024, 9:42:21 PM (Europe/Amsterdam)
| false
| false
| false
| false
| false
| false
| false
| false
|
754,207
|
KiwiModel_MeterTilde.cpp
|
Musicoll_Kiwi/Modules/KiwiModel/KiwiModel_Objects/KiwiModel_MeterTilde.cpp
|
/*
==============================================================================
This file is part of the KIWI library.
- Copyright (c) 2014-2016, Pierre Guillot & Eliott Paris.
- Copyright (c) 2016-2019, CICM, ANR MUSICOLL, Eliott Paris, Pierre Guillot, Jean Millot.
Permission is granted to use this software under the terms of the GPL v3
(or any later version). Details can be found at: www.gnu.org/licenses
KIWI 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.
------------------------------------------------------------------------------
Contact : [email protected]
==============================================================================
*/
#include <KiwiModel/KiwiModel_Objects/KiwiModel_MeterTilde.h>
#include <KiwiModel/KiwiModel_DataModel.h>
#include <KiwiModel/KiwiModel_Factory.h>
namespace kiwi { namespace model {
// ================================================================================ //
// OBJECT METER~ //
// ================================================================================ //
void MeterTilde::declare()
{
std::unique_ptr<ObjectClass> metertilde_class(new ObjectClass("meter~", &MeterTilde::create));
metertilde_class->setFlag(ObjectClass::Flag::DefinedSize);
flip::Class<MeterTilde> & metertilde_model = DataModel::declare<MeterTilde>()
.name(metertilde_class->getModelName().c_str())
.inherit<Object>();
Factory::add<MeterTilde>(std::move(metertilde_class), metertilde_model);
}
std::unique_ptr<Object> MeterTilde::create(std::vector<tool::Atom> const& args)
{
return std::make_unique<MeterTilde>(args);
}
MeterTilde::MeterTilde(flip::Default& d):
model::Object(d)
{
addSignal<float>(Signal::PeakChanged, *this);
}
MeterTilde::MeterTilde(std::vector<tool::Atom> const& args):
model::Object()
{
if (!args.empty())
{
throw Error("meter~ too many arguments");
}
setWidth(100);
setHeight(20);
pushInlet({PinType::IType::Signal});
pushOutlet(PinType::IType::Control);
addSignal<float>(Signal::PeakChanged, *this);
}
std::string MeterTilde::getIODescription(bool is_inlet , size_t index) const
{
std::string description;
if (is_inlet && index == 0)
{
description = "Input monitored signal";
}
else if (!is_inlet && index == 0)
{
description = "Sends peak value each metering intervall";
}
return description;
}
}
}
| 3,021
|
C++
|
.cpp
| 67
| 36.492537
| 102
| 0.533613
|
Musicoll/Kiwi
| 134
| 11
| 7
|
GPL-3.0
|
9/20/2024, 9:42:21 PM (Europe/Amsterdam)
| false
| false
| false
| false
| false
| false
| false
| false
|
754,208
|
KiwiModel_SahTilde.cpp
|
Musicoll_Kiwi/Modules/KiwiModel/KiwiModel_Objects/KiwiModel_SahTilde.cpp
|
/*
==============================================================================
This file is part of the KIWI library.
- Copyright (c) 2014-2016, Pierre Guillot & Eliott Paris.
- Copyright (c) 2016-2019, CICM, ANR MUSICOLL, Eliott Paris, Pierre Guillot, Jean Millot.
Permission is granted to use this software under the terms of the GPL v3
(or any later version). Details can be found at: www.gnu.org/licenses
KIWI 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.
------------------------------------------------------------------------------
Contact : [email protected]
==============================================================================
*/
#include <KiwiModel/KiwiModel_Objects/KiwiModel_SahTilde.h>
#include <KiwiModel/KiwiModel_Factory.h>
namespace kiwi { namespace model {
// ================================================================================ //
// SAH~ //
// ================================================================================ //
void SahTilde::declare()
{
std::unique_ptr<ObjectClass> sahtilde_class(new ObjectClass("sah~", &SahTilde::create));
flip::Class<SahTilde> & sahtilde_model = DataModel::declare<SahTilde>().name(sahtilde_class->getModelName().c_str()).inherit<Object>();
Factory::add<SahTilde>(std::move(sahtilde_class), sahtilde_model);
}
std::unique_ptr<Object> SahTilde::create(std::vector<tool::Atom> const& args)
{
return std::make_unique<SahTilde>(args);
}
SahTilde::SahTilde(std::vector<tool::Atom> const& args)
{
if (args.size() > 1)
{
throw Error("sah~ too many arguments");
}
if (args.size() == 1 && !args[0].isNumber())
{
throw Error("sah~ threshold shall be a number");
}
pushInlet({PinType::IType::Signal});
pushInlet({PinType::IType::Control, PinType::IType::Signal});
pushOutlet(PinType::IType::Signal);
}
std::string SahTilde::getIODescription(bool is_inlet, size_t index) const
{
if(is_inlet)
{
if(index == 0)
{
return "(signal) Values to sample";
}
else if(index == 1)
{
return "(signal/control) Trigger input";
}
}
else
{
return "(signal) Output sampled value";
}
return {};
}
}}
| 2,789
|
C++
|
.cpp
| 64
| 35.140625
| 143
| 0.508391
|
Musicoll/Kiwi
| 134
| 11
| 7
|
GPL-3.0
|
9/20/2024, 9:42:21 PM (Europe/Amsterdam)
| false
| false
| false
| false
| false
| false
| false
| false
|
754,209
|
KiwiModel_Loadmess.cpp
|
Musicoll_Kiwi/Modules/KiwiModel/KiwiModel_Objects/KiwiModel_Loadmess.cpp
|
/*
==============================================================================
This file is part of the KIWI library.
- Copyright (c) 2014-2016, Pierre Guillot & Eliott Paris.
- Copyright (c) 2016-2019, CICM, ANR MUSICOLL, Eliott Paris, Pierre Guillot, Jean Millot.
Permission is granted to use this software under the terms of the GPL v3
(or any later version). Details can be found at: www.gnu.org/licenses
KIWI 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.
------------------------------------------------------------------------------
Contact : [email protected]
==============================================================================
*/
#include <KiwiModel/KiwiModel_Objects/KiwiModel_Loadmess.h>
#include <KiwiModel/KiwiModel_DataModel.h>
#include <KiwiModel/KiwiModel_Factory.h>
namespace kiwi { namespace model {
// ================================================================================ //
// OBJECT LOADMESS //
// ================================================================================ //
void Loadmess::declare()
{
std::unique_ptr<ObjectClass> loadmess_class(new ObjectClass("loadmess", &Loadmess::create));
flip::Class<Loadmess> & loadmess_model = DataModel::declare<Loadmess>()
.name(loadmess_class->getModelName().c_str())
.inherit<Object>();
Factory::add<Loadmess>(std::move(loadmess_class), loadmess_model);
}
std::unique_ptr<Object> Loadmess::create(std::vector<tool::Atom> const& args)
{
return std::make_unique<Loadmess>(args);
}
Loadmess::Loadmess(std::vector<tool::Atom> const& args)
{
if (args.empty())
throw Error("loadmess argument is required");
pushInlet({PinType::IType::Control});
pushOutlet(PinType::IType::Control);
}
std::string Loadmess::getIODescription(bool is_inlet, size_t index) const
{
if(!is_inlet && index == 0)
{
return "Sends message when patch is loaded";
}
else if(is_inlet && index == 0)
{
return "Bang to retrigger message";
}
return {};
}
}}
| 2,569
|
C++
|
.cpp
| 53
| 39.867925
| 100
| 0.519737
|
Musicoll/Kiwi
| 134
| 11
| 7
|
GPL-3.0
|
9/20/2024, 9:42:21 PM (Europe/Amsterdam)
| false
| false
| false
| false
| false
| false
| false
| false
|
754,210
|
KiwiModel_GreaterEqual.cpp
|
Musicoll_Kiwi/Modules/KiwiModel/KiwiModel_Objects/KiwiModel_GreaterEqual.cpp
|
/*
==============================================================================
This file is part of the KIWI library.
- Copyright (c) 2014-2016, Pierre Guillot & Eliott Paris.
- Copyright (c) 2016-2019, CICM, ANR MUSICOLL, Eliott Paris, Pierre Guillot, Jean Millot.
Permission is granted to use this software under the terms of the GPL v3
(or any later version). Details can be found at: www.gnu.org/licenses
KIWI 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.
------------------------------------------------------------------------------
Contact : [email protected]
==============================================================================
*/
#include <KiwiModel/KiwiModel_Objects/KiwiModel_GreaterEqual.h>
#include <KiwiModel/KiwiModel_Factory.h>
namespace kiwi { namespace model {
// ================================================================================ //
// OBJECT GREATEREQUAL //
// ================================================================================ //
void GreaterEqual::declare()
{
if (!DataModel::has<model::Operator>())
{
Operator::declare();
}
std::unique_ptr<ObjectClass> greaterequal_class(new ObjectClass(">=",
&GreaterEqual::create));
flip::Class<GreaterEqual> & greaterequal_model = DataModel::declare<GreaterEqual>()
.name(greaterequal_class->getModelName().c_str())
.inherit<Operator>();
Factory::add<GreaterEqual>(std::move(greaterequal_class), greaterequal_model);
}
std::unique_ptr<Object> GreaterEqual::create(std::vector<tool::Atom> const& args)
{
return std::make_unique<GreaterEqual>(args);
}
GreaterEqual::GreaterEqual(std::vector<tool::Atom> const& args):
Operator(args)
{
}
}}
| 2,263
|
C++
|
.cpp
| 42
| 43.833333
| 106
| 0.49884
|
Musicoll/Kiwi
| 134
| 11
| 7
|
GPL-3.0
|
9/20/2024, 9:42:21 PM (Europe/Amsterdam)
| false
| false
| false
| false
| false
| false
| false
| false
|
754,211
|
KiwiModel_Receive.cpp
|
Musicoll_Kiwi/Modules/KiwiModel/KiwiModel_Objects/KiwiModel_Receive.cpp
|
/*
==============================================================================
This file is part of the KIWI library.
- Copyright (c) 2014-2016, Pierre Guillot & Eliott Paris.
- Copyright (c) 2016-2019, CICM, ANR MUSICOLL, Eliott Paris, Pierre Guillot, Jean Millot.
Permission is granted to use this software under the terms of the GPL v3
(or any later version). Details can be found at: www.gnu.org/licenses
KIWI 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.
------------------------------------------------------------------------------
Contact : [email protected]
==============================================================================
*/
#include <KiwiModel/KiwiModel_Objects/KiwiModel_Receive.h>
#include <KiwiModel/KiwiModel_Factory.h>
namespace kiwi { namespace model {
// ================================================================================ //
// OBJECT RECEIVE //
// ================================================================================ //
void Receive::declare()
{
// class
std::unique_ptr<ObjectClass> receive_class(new ObjectClass("receive",
&Receive::create));
receive_class->addAlias("r");
// data model
flip::Class<Receive> & receive_model = DataModel::declare<Receive>()
.name(receive_class->getModelName().c_str())
.inherit<Object>();
Factory::add<Receive>(std::move(receive_class), receive_model);
}
std::unique_ptr<Object> Receive::create(std::vector<tool::Atom> const& args)
{
return std::make_unique<Receive>(args);
}
Receive::Receive(std::vector<tool::Atom> const& args):
Object()
{
if (args.empty())
{
throw Error("receive requires one argument");
}
if (args.size() > 1)
{
throw Error("receive requires only one argument");
}
if (args.size() == 1 && !args[0].isString())
{
throw Error("receive argument must be a symbol");
}
pushOutlet(PinType::IType::Control);
}
std::string Receive::getIODescription(bool is_inlet, size_t index) const
{
if(!is_inlet)
{
return "Receive messages";
}
return {};
}
}}
| 2,778
|
C++
|
.cpp
| 62
| 34.596774
| 91
| 0.488649
|
Musicoll/Kiwi
| 134
| 11
| 7
|
GPL-3.0
|
9/20/2024, 9:42:21 PM (Europe/Amsterdam)
| false
| false
| false
| false
| false
| false
| false
| false
|
754,212
|
KiwiModel_GreaterEqualTilde.cpp
|
Musicoll_Kiwi/Modules/KiwiModel/KiwiModel_Objects/KiwiModel_GreaterEqualTilde.cpp
|
/*
==============================================================================
This file is part of the KIWI library.
- Copyright (c) 2014-2016, Pierre Guillot & Eliott Paris.
- Copyright (c) 2016-2019, CICM, ANR MUSICOLL, Eliott Paris, Pierre Guillot, Jean Millot.
Permission is granted to use this software under the terms of the GPL v3
(or any later version). Details can be found at: www.gnu.org/licenses
KIWI 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.
------------------------------------------------------------------------------
Contact : [email protected]
==============================================================================
*/
#include <KiwiModel/KiwiModel_Objects/KiwiModel_GreaterEqualTilde.h>
#include <KiwiModel/KiwiModel_Factory.h>
namespace kiwi { namespace model {
// ================================================================================ //
// OBJECT >=~ //
// ================================================================================ //
void GreaterEqualTilde::declare()
{
if (!DataModel::has<model::OperatorTilde>())
{
OperatorTilde::declare();
}
std::unique_ptr<ObjectClass> greaterequal_class(new ObjectClass(">=~", &GreaterEqualTilde::create));
flip::Class<GreaterEqualTilde> & greaterequal_model = DataModel::declare<GreaterEqualTilde>()
.name(greaterequal_class->getModelName().c_str())
.inherit<OperatorTilde>();
Factory::add<GreaterEqualTilde>(std::move(greaterequal_class), greaterequal_model);
}
std::unique_ptr<Object> GreaterEqualTilde::create(std::vector<tool::Atom> const& args)
{
return std::make_unique<GreaterEqualTilde>(args);
}
GreaterEqualTilde::GreaterEqualTilde(std::vector<tool::Atom> const& args):
OperatorTilde(args)
{
}
}}
| 2,282
|
C++
|
.cpp
| 41
| 46.682927
| 113
| 0.52092
|
Musicoll/Kiwi
| 134
| 11
| 7
|
GPL-3.0
|
9/20/2024, 9:42:21 PM (Europe/Amsterdam)
| false
| false
| false
| false
| false
| false
| false
| false
|
754,213
|
KiwiModel_ClipTilde.cpp
|
Musicoll_Kiwi/Modules/KiwiModel/KiwiModel_Objects/KiwiModel_ClipTilde.cpp
|
/*
==============================================================================
This file is part of the KIWI library.
- Copyright (c) 2014-2016, Pierre Guillot & Eliott Paris.
- Copyright (c) 2016-2019, CICM, ANR MUSICOLL, Eliott Paris, Pierre Guillot, Jean Millot.
Permission is granted to use this software under the terms of the GPL v3
(or any later version). Details can be found at: www.gnu.org/licenses
KIWI 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.
------------------------------------------------------------------------------
Contact : [email protected]
==============================================================================
*/
#include <KiwiModel/KiwiModel_Objects/KiwiModel_ClipTilde.h>
#include <KiwiModel/KiwiModel_Factory.h>
namespace kiwi { namespace model {
// ================================================================================ //
// CLIP~ //
// ================================================================================ //
void ClipTilde::declare()
{
std::unique_ptr<ObjectClass> cliptilde_class(new ObjectClass("clip~", &ClipTilde::create));
flip::Class<ClipTilde> & cliptilde_model = DataModel::declare<ClipTilde>()
.name(cliptilde_class->getModelName().c_str())
.inherit<Object>();
Factory::add<ClipTilde>(std::move(cliptilde_class), cliptilde_model);
}
std::unique_ptr<Object> ClipTilde::create(std::vector<tool::Atom> const& args)
{
return std::make_unique<ClipTilde>(args);
}
ClipTilde::ClipTilde(std::vector<tool::Atom> const& args):
Object()
{
if (args.size() > 2)
throw Error("clip~ only takes two arguments");
if (args.size() > 1 && !args[1].isNumber())
throw Error("clip~ maximum must be a number");
if(args.size() > 0 && !args[0].isNumber())
throw Error("clip~ minimum value must be a number");
pushInlet({PinType::IType::Signal});
pushInlet({PinType::IType::Signal, PinType::IType::Control});
pushInlet({PinType::IType::Signal, PinType::IType::Control});
pushOutlet(PinType::IType::Signal);
}
std::string ClipTilde::getIODescription(bool is_inlet, size_t index) const
{
std::string description = "";
if (is_inlet)
{
if (index == 0)
{
description = "clipped input";
}
else if (index == 1)
{
description = "signal or float, minimum value";
}
else if(index == 2)
{
description = "signal or float, maximum value";
}
}
else
{
description = "clipped signal";
}
return description;
}
}}
| 3,173
|
C++
|
.cpp
| 71
| 35.676056
| 99
| 0.518109
|
Musicoll/Kiwi
| 134
| 11
| 7
|
GPL-3.0
|
9/20/2024, 9:42:21 PM (Europe/Amsterdam)
| false
| false
| false
| false
| false
| false
| false
| false
|
754,214
|
KiwiModel_Bang.cpp
|
Musicoll_Kiwi/Modules/KiwiModel/KiwiModel_Objects/KiwiModel_Bang.cpp
|
/*
==============================================================================
This file is part of the KIWI library.
- Copyright (c) 2014-2016, Pierre Guillot & Eliott Paris.
- Copyright (c) 2016-2019, CICM, ANR MUSICOLL, Eliott Paris, Pierre Guillot, Jean Millot.
Permission is granted to use this software under the terms of the GPL v3
(or any later version). Details can be found at: www.gnu.org/licenses
KIWI 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.
------------------------------------------------------------------------------
Contact : [email protected]
==============================================================================
*/
#include <KiwiModel/KiwiModel_Objects/KiwiModel_Bang.h>
#include <KiwiModel/KiwiModel_Factory.h>
#include <KiwiModel/KiwiModel_DataModel.h>
namespace kiwi { namespace model {
// ================================================================================ //
// OBJECT BANG //
// ================================================================================ //
void Bang::declare()
{
std::unique_ptr<ObjectClass> bang_class(new ObjectClass("bang", &Bang::create));
bang_class->setFlag(ObjectClass::Flag::DefinedSize);
flip::Class<Bang> & bang_model = DataModel::declare<Bang>().name(bang_class->getModelName().c_str()).inherit<Object>();
Factory::add<Bang>(std::move(bang_class), bang_model);
}
std::unique_ptr<Object> Bang::create(std::vector<tool::Atom> const& args)
{
return std::make_unique<Bang>(args);
}
Bang::Bang(std::vector<tool::Atom> const& args):
Object()
{
if (!args.empty())
{
throw Error("bang too many arguments");
}
addSignal<>(Signal::TriggerBang, *this);
addSignal<>(Signal::FlashBang, *this);
setWidth(20);
pushInlet({PinType::IType::Control});
pushOutlet(PinType::IType::Control);
}
Bang::Bang(flip::Default& d):
Object(d)
{
addSignal<>(Signal::TriggerBang, *this);
addSignal<>(Signal::FlashBang, *this);
}
std::string Bang::getIODescription(bool is_inlet, size_t index) const
{
if (is_inlet && index == 0)
{
return "Makes the object flash and sends bang through first outlet";
}
else if(!is_inlet && index == 0)
{
return "Sends bang";
}
else
{
return "";
}
}
}}
| 2,813
|
C++
|
.cpp
| 67
| 34.746269
| 127
| 0.525366
|
Musicoll/Kiwi
| 134
| 11
| 7
|
GPL-3.0
|
9/20/2024, 9:42:21 PM (Europe/Amsterdam)
| false
| false
| false
| false
| false
| false
| false
| false
|
754,215
|
KiwiModel_EqualTilde.cpp
|
Musicoll_Kiwi/Modules/KiwiModel/KiwiModel_Objects/KiwiModel_EqualTilde.cpp
|
/*
==============================================================================
This file is part of the KIWI library.
- Copyright (c) 2014-2016, Pierre Guillot & Eliott Paris.
- Copyright (c) 2016-2019, CICM, ANR MUSICOLL, Eliott Paris, Pierre Guillot, Jean Millot.
Permission is granted to use this software under the terms of the GPL v3
(or any later version). Details can be found at: www.gnu.org/licenses
KIWI 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.
------------------------------------------------------------------------------
Contact : [email protected]
==============================================================================
*/
#include <KiwiModel/KiwiModel_Objects/KiwiModel_EqualTilde.h>
#include <KiwiModel/KiwiModel_Factory.h>
namespace kiwi { namespace model {
// ================================================================================ //
// OBJECT ==~ //
// ================================================================================ //
void EqualTilde::declare()
{
if (!DataModel::has<model::OperatorTilde>())
{
OperatorTilde::declare();
}
std::unique_ptr<ObjectClass> equaltilde_class(new ObjectClass("==~", &EqualTilde::create));
flip::Class<EqualTilde> & equaltilde_model = DataModel::declare<EqualTilde>()
.name(equaltilde_class->getModelName().c_str())
.inherit<OperatorTilde>();
Factory::add<EqualTilde>(std::move(equaltilde_class), equaltilde_model);
}
std::unique_ptr<Object> EqualTilde::create(std::vector<tool::Atom> const& args)
{
return std::make_unique<EqualTilde>(args);
}
EqualTilde::EqualTilde(std::vector<tool::Atom> const& args):
OperatorTilde(args)
{
}
}}
| 2,202
|
C++
|
.cpp
| 41
| 44.731707
| 111
| 0.502625
|
Musicoll/Kiwi
| 134
| 11
| 7
|
GPL-3.0
|
9/20/2024, 9:42:21 PM (Europe/Amsterdam)
| false
| false
| false
| false
| false
| false
| false
| false
|
754,216
|
KiwiModel_Slider.cpp
|
Musicoll_Kiwi/Modules/KiwiModel/KiwiModel_Objects/KiwiModel_Slider.cpp
|
/*
==============================================================================
This file is part of the KIWI library.
- Copyright (c) 2014-2016, Pierre Guillot & Eliott Paris.
- Copyright (c) 2016-2019, CICM, ANR MUSICOLL, Eliott Paris, Pierre Guillot, Jean Millot.
Permission is granted to use this software under the terms of the GPL v3
(or any later version). Details can be found at: www.gnu.org/licenses
KIWI 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.
------------------------------------------------------------------------------
Contact : [email protected]
==============================================================================
*/
#include <KiwiModel/KiwiModel_Factory.h>
#include <KiwiModel/KiwiModel_ObjectClass.h>
#include <KiwiModel/KiwiModel_Objects/KiwiModel_Slider.h>
namespace kiwi { namespace model {
// ================================================================================ //
// OBJECT SLIDER //
// ================================================================================ //
void Slider::declare()
{
std::unique_ptr<ObjectClass> slider_class(new ObjectClass("slider",
&Slider::create));
// parameters
std::unique_ptr<ParameterClass> param_value(new ParameterClass(tool::Parameter::Type::Float));
slider_class->addParameter("value", std::move(param_value));
// flags
slider_class->setFlag(ObjectClass::Flag::DefinedSize);
// data model
flip::Class<Slider> & slider_model = DataModel::declare<Slider>()
.name(slider_class->getModelName().c_str())
.inherit<Object>();
Factory::add<Slider>(std::move(slider_class), slider_model);
}
std::unique_ptr<Object> Slider::create(std::vector<tool::Atom> const& args)
{
if (!args.empty())
{
throw Error("slider too many arguments");
}
return std::make_unique<Slider>();
}
Slider::Slider():
Object()
{
addSignal<>(Signal::OutputValue, *this);
setWidth(20);
setHeight(50.);
pushInlet({PinType::IType::Control});
pushOutlet(PinType::IType::Control);
}
Slider::Slider(flip::Default& d):
Object(d)
{
addSignal<>(Signal::OutputValue, *this);
}
std::string Slider::getIODescription(bool is_inlet, size_t index) const
{
if (is_inlet && index == 0)
{
return "Sets current slider value. Value is between 0 and 1";
}
else if(!is_inlet && index == 0)
{
return "Outputs the slider's value";
}
else
{
return "";
}
}
}}
| 3,183
|
C++
|
.cpp
| 74
| 33.351351
| 102
| 0.507353
|
Musicoll/Kiwi
| 134
| 11
| 7
|
GPL-3.0
|
9/20/2024, 9:42:21 PM (Europe/Amsterdam)
| false
| false
| false
| false
| false
| false
| false
| false
|
754,217
|
KiwiModel_Float.cpp
|
Musicoll_Kiwi/Modules/KiwiModel/KiwiModel_Objects/KiwiModel_Float.cpp
|
/*
==============================================================================
This file is part of the KIWI library.
- Copyright (c) 2014-2016, Pierre Guillot & Eliott Paris.
- Copyright (c) 2016-2019, CICM, ANR MUSICOLL, Eliott Paris, Pierre Guillot, Jean Millot.
Permission is granted to use this software under the terms of the GPL v3
(or any later version). Details can be found at: www.gnu.org/licenses
KIWI 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.
------------------------------------------------------------------------------
Contact : [email protected]
==============================================================================
*/
#include <KiwiModel/KiwiModel_Objects/KiwiModel_Float.h>
#include <KiwiModel/KiwiModel_Factory.h>
namespace kiwi { namespace model {
// ================================================================================ //
// FLOAT //
// ================================================================================ //
void Float::declare()
{
std::unique_ptr<ObjectClass> float_class(new ObjectClass("float",
&Float::create));
float_class->addAlias("f");
flip::Class<Float> & float_model = DataModel::declare<Float>()
.name(float_class->getModelName().c_str())
.inherit<Object>();
Factory::add<Float>(std::move(float_class), float_model);
}
std::unique_ptr<Object> Float::create(std::vector<tool::Atom> const& args)
{
return std::make_unique<Float>(args);
}
Float::Float(std::vector<tool::Atom> const& args)
{
if (args.size() > 1)
throw Error("float only take one argument");
if (args.size() > 0 && !args[0].isNumber())
throw Error("float initial value must be a number");
pushInlet({PinType::IType::Control});
pushInlet({PinType::IType::Control});
pushOutlet(PinType::IType::Control);
}
std::string Float::getIODescription(bool is_inlet, size_t index) const
{
std::string description = "";
if (is_inlet)
{
if (index == 0)
{
description = "Store and output value. Bang to ouput";
}
else if(index == 1)
{
description = "Store value without output";
}
}
else
{
if (index == 0)
{
description = "Ouput stored value";
}
}
return description;
}
}}
| 3,018
|
C++
|
.cpp
| 68
| 33.602941
| 90
| 0.478292
|
Musicoll/Kiwi
| 134
| 11
| 7
|
GPL-3.0
|
9/20/2024, 9:42:21 PM (Europe/Amsterdam)
| false
| false
| false
| false
| false
| false
| false
| false
|
754,218
|
KiwiModel_Print.cpp
|
Musicoll_Kiwi/Modules/KiwiModel/KiwiModel_Objects/KiwiModel_Print.cpp
|
/*
==============================================================================
This file is part of the KIWI library.
- Copyright (c) 2014-2016, Pierre Guillot & Eliott Paris.
- Copyright (c) 2016-2019, CICM, ANR MUSICOLL, Eliott Paris, Pierre Guillot, Jean Millot.
Permission is granted to use this software under the terms of the GPL v3
(or any later version). Details can be found at: www.gnu.org/licenses
KIWI 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.
------------------------------------------------------------------------------
Contact : [email protected]
==============================================================================
*/
#include <KiwiModel/KiwiModel_Objects/KiwiModel_Print.h>
#include <KiwiModel/KiwiModel_Factory.h>
namespace kiwi
{
namespace model
{
// ================================================================================ //
// OBJECT PRINT //
// ================================================================================ //
void Print::declare()
{
std::unique_ptr<ObjectClass> print_class(new ObjectClass("print",
&Print::create));
// data model
flip::Class<Print> & print_model = DataModel::declare<Print>()
.name(print_class->getModelName().c_str())
.inherit<Object>();
Factory::add<Print>(std::move(print_class), print_model);
}
std::unique_ptr<Object> Print::create(std::vector<tool::Atom> const& args)
{
return std::make_unique<Print>(args);
}
Print::Print(std::vector<tool::Atom> const& args):
Object()
{
if (args.size() > 1)
{
throw Error("print takes 1 or 0 arguments");
}
pushInlet({PinType::IType::Control});
}
std::string Print::getIODescription(bool is_inlet, size_t index) const
{
return "Message to post in the Kiwi console";
}
}
}
| 2,507
|
C++
|
.cpp
| 52
| 36.538462
| 94
| 0.463435
|
Musicoll/Kiwi
| 134
| 11
| 7
|
GPL-3.0
|
9/20/2024, 9:42:21 PM (Europe/Amsterdam)
| false
| false
| false
| false
| false
| false
| false
| false
|
754,219
|
KiwiModel_Modulo.cpp
|
Musicoll_Kiwi/Modules/KiwiModel/KiwiModel_Objects/KiwiModel_Modulo.cpp
|
/*
==============================================================================
This file is part of the KIWI library.
- Copyright (c) 2014-2016, Pierre Guillot & Eliott Paris.
- Copyright (c) 2016-2019, CICM, ANR MUSICOLL, Eliott Paris, Pierre Guillot, Jean Millot.
Permission is granted to use this software under the terms of the GPL v3
(or any later version). Details can be found at: www.gnu.org/licenses
KIWI 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.
------------------------------------------------------------------------------
Contact : [email protected]
==============================================================================
*/
#include <KiwiModel/KiwiModel_Objects/KiwiModel_Modulo.h>
#include <KiwiModel/KiwiModel_Factory.h>
namespace kiwi { namespace model {
// ================================================================================ //
// OBJECT MODULO //
// ================================================================================ //
void Modulo::declare()
{
if (!DataModel::has<model::Operator>())
{
Operator::declare();
}
std::unique_ptr<ObjectClass> modulo_class(new ObjectClass("%",
&Modulo::create));
flip::Class<Modulo> & modulo_model = DataModel::declare<Modulo>()
.name(modulo_class->getModelName().c_str())
.inherit<Operator>();
Factory::add<Modulo>(std::move(modulo_class), modulo_model);
}
std::unique_ptr<Object> Modulo::create(std::vector<tool::Atom> const& args)
{
return std::make_unique<Modulo>(args);
}
Modulo::Modulo(std::vector<tool::Atom> const& args):
Operator(args)
{
}
}}
| 2,145
|
C++
|
.cpp
| 42
| 41.666667
| 90
| 0.480609
|
Musicoll/Kiwi
| 134
| 11
| 7
|
GPL-3.0
|
9/20/2024, 9:42:21 PM (Europe/Amsterdam)
| false
| false
| false
| false
| false
| false
| false
| false
|
754,220
|
KiwiModel_OSCSend.cpp
|
Musicoll_Kiwi/Modules/KiwiModel/KiwiModel_Objects/KiwiModel_OSCSend.cpp
|
/*
==============================================================================
This file is part of the KIWI library.
- Copyright (c) 2014-2016, Pierre Guillot & Eliott Paris.
- Copyright (c) 2016-2019, CICM, ANR MUSICOLL, Eliott Paris, Pierre Guillot, Jean Millot.
Permission is granted to use this software under the terms of the GPL v3
(or any later version). Details can be found at: www.gnu.org/licenses
KIWI 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.
------------------------------------------------------------------------------
Contact : [email protected]
==============================================================================
*/
#include <KiwiModel/KiwiModel_Objects/KiwiModel_OSCSend.h>
#include <KiwiModel/KiwiModel_Factory.h>
namespace kiwi { namespace model {
// ================================================================================ //
// OSC.send //
// ================================================================================ //
void OSCSend::declare()
{
auto object_class = std::make_unique<ObjectClass>("OSC.send", &OSCSend::create);
auto& model = DataModel::declare<OSCSend>()
.name(object_class->getModelName().c_str())
.inherit<Object>();
Factory::add<OSCSend>(std::move(object_class), model);
}
std::unique_ptr<Object> OSCSend::create(std::vector<tool::Atom> const& args)
{
return std::make_unique<OSCSend>(args);
}
OSCSend::OSCSend(std::vector<tool::Atom> const& args)
{
pushInlet({PinType::IType::Control});
}
std::string OSCSend::getIODescription(bool is_inlet, size_t index) const
{
if(is_inlet && index == 0)
{
return "(atoms) send messages, connect msg to set host and port to listen to";
}
return {};
}
}}
| 2,166
|
C++
|
.cpp
| 45
| 41.711111
| 90
| 0.520976
|
Musicoll/Kiwi
| 134
| 11
| 7
|
GPL-3.0
|
9/20/2024, 9:42:21 PM (Europe/Amsterdam)
| false
| false
| false
| false
| false
| false
| false
| false
|
754,221
|
KiwiModel_MinusTilde.cpp
|
Musicoll_Kiwi/Modules/KiwiModel/KiwiModel_Objects/KiwiModel_MinusTilde.cpp
|
/*
==============================================================================
This file is part of the KIWI library.
- Copyright (c) 2014-2016, Pierre Guillot & Eliott Paris.
- Copyright (c) 2016-2019, CICM, ANR MUSICOLL, Eliott Paris, Pierre Guillot, Jean Millot.
Permission is granted to use this software under the terms of the GPL v3
(or any later version). Details can be found at: www.gnu.org/licenses
KIWI 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.
------------------------------------------------------------------------------
Contact : [email protected]
==============================================================================
*/
#include <KiwiModel/KiwiModel_Objects/KiwiModel_MinusTilde.h>
#include <KiwiModel/KiwiModel_Factory.h>
namespace kiwi { namespace model {
// ================================================================================ //
// OBJECT -~ //
// ================================================================================ //
void MinusTilde::declare()
{
if (!DataModel::has<model::OperatorTilde>())
{
OperatorTilde::declare();
}
std::unique_ptr<ObjectClass> minustilde_class(new ObjectClass("-~", &MinusTilde::create));
flip::Class<MinusTilde> & plustilde_model = DataModel::declare<MinusTilde>()
.name(minustilde_class->getModelName().c_str())
.inherit<OperatorTilde>();
Factory::add<MinusTilde>(std::move(minustilde_class), plustilde_model);
}
std::unique_ptr<Object> MinusTilde::create(std::vector<tool::Atom> const& args)
{
return std::make_unique<MinusTilde>(args);
}
MinusTilde::MinusTilde(std::vector<tool::Atom> const& args):
OperatorTilde(args)
{
}
}}
| 2,174
|
C++
|
.cpp
| 41
| 44.634146
| 99
| 0.508466
|
Musicoll/Kiwi
| 134
| 11
| 7
|
GPL-3.0
|
9/20/2024, 9:42:21 PM (Europe/Amsterdam)
| false
| false
| false
| false
| false
| false
| false
| false
|
754,222
|
KiwiModel_PhasorTilde.cpp
|
Musicoll_Kiwi/Modules/KiwiModel/KiwiModel_Objects/KiwiModel_PhasorTilde.cpp
|
/*
==============================================================================
This file is part of the KIWI library.
- Copyright (c) 2014-2016, Pierre Guillot & Eliott Paris.
- Copyright (c) 2016-2019, CICM, ANR MUSICOLL, Eliott Paris, Pierre Guillot, Jean Millot.
Permission is granted to use this software under the terms of the GPL v3
(or any later version). Details can be found at: www.gnu.org/licenses
KIWI 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.
------------------------------------------------------------------------------
Contact : [email protected]
==============================================================================
*/
#include <KiwiModel/KiwiModel_Objects/KiwiModel_PhasorTilde.h>
#include <KiwiModel/KiwiModel_DataModel.h>
#include <KiwiModel/KiwiModel_Factory.h>
namespace kiwi { namespace model {
// ================================================================================ //
// PHASOR~ //
// ================================================================================ //
void PhasorTilde::declare()
{
std::unique_ptr<ObjectClass> phasortilde_class(new ObjectClass("phasor~", &PhasorTilde::create));
flip::Class<PhasorTilde> & phasortilde_model = DataModel::declare<PhasorTilde>()
.name(phasortilde_class->getModelName().c_str())
.inherit<Object>();
Factory::add<PhasorTilde>(std::move(phasortilde_class), phasortilde_model);
}
std::unique_ptr<Object> PhasorTilde::create(std::vector<tool::Atom> const& args)
{
return std::make_unique<PhasorTilde>(args);
}
PhasorTilde::PhasorTilde(std::vector<tool::Atom> const& args)
{
if (args.size() > 1)
{
throw Error("phasor~ too many arguments");
}
if (args.size() == 1 && !args[0].isNumber())
{
throw Error("phasor~ frequency must be a number");
}
pushInlet({PinType::IType::Control, PinType::IType::Signal});
pushInlet({PinType::IType::Control});
pushOutlet(PinType::IType::Signal);
}
std::string PhasorTilde::getIODescription(bool is_inlet, size_t index) const
{
if(is_inlet)
{
if(index == 0)
{
return "(signal/float) Set frequency";
}
else if(index == 1)
{
return "(signal/float) Set phase (0-1)";
}
}
else
{
return "(signal) Output";
}
return {};
}
}}
| 2,985
|
C++
|
.cpp
| 67
| 34.880597
| 105
| 0.501773
|
Musicoll/Kiwi
| 134
| 11
| 7
|
GPL-3.0
|
9/20/2024, 9:42:21 PM (Europe/Amsterdam)
| false
| false
| false
| false
| false
| false
| false
| false
|
754,223
|
KiwiModel_Trigger.cpp
|
Musicoll_Kiwi/Modules/KiwiModel/KiwiModel_Objects/KiwiModel_Trigger.cpp
|
/*
==============================================================================
This file is part of the KIWI library.
- Copyright (c) 2014-2016, Pierre Guillot & Eliott Paris.
- Copyright (c) 2016-2019, CICM, ANR MUSICOLL, Eliott Paris, Pierre Guillot, Jean Millot.
Permission is granted to use this software under the terms of the GPL v3
(or any later version). Details can be found at: www.gnu.org/licenses
KIWI 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.
------------------------------------------------------------------------------
Contact : [email protected]
==============================================================================
*/
#include <KiwiModel/KiwiModel_Objects/KiwiModel_Trigger.h>
#include <KiwiModel/KiwiModel_Factory.h>
namespace kiwi { namespace model {
// ================================================================================ //
// TRIGGER //
// ================================================================================ //
void Trigger::declare()
{
std::unique_ptr<ObjectClass> trigger_class(new ObjectClass("trigger", &Trigger::create));
trigger_class->addAlias("t");
flip::Class<Trigger> & trigger_model = DataModel::declare<Trigger>()
.name(trigger_class->getModelName().c_str())
.inherit<Object>();
Factory::add<Trigger>(std::move(trigger_class), trigger_model);
}
std::unique_ptr<Object> Trigger::create(std::vector<tool::Atom> const& args)
{
return std::make_unique<Trigger>(args);
}
Trigger::Trigger(std::vector<tool::Atom> const& args)
{
pushInlet({PinType::IType::Control});
for(size_t i = 0; i < args.size(); ++i)
{
pushOutlet(PinType::IType::Control);
}
}
std::string Trigger::getTypeDescription(tool::Atom const& atom)
{
if(atom.isInt())
return std::to_string(atom.getInt());
if(atom.isFloat())
return std::to_string(atom.getFloat());
if(atom.isString())
{
const std::string str = atom.getString();
if(str == "b") return "bang";
if(str == "i") return "int";
if(str == "f") return "float";
if(str == "s") return "symbol";
if(str == "l") return "list";
return str;
}
return {"??"};
}
std::string Trigger::getIODescription(bool is_inlet, size_t index) const
{
if(is_inlet)
{
return "(anything) Message to be fanned to multiple outputs";
}
auto args = tool::AtomHelper::parse(getText());
args.erase(args.cbegin());
const auto size = args.size();
if(!args.empty() && index < size)
{
return ("Output order " + std::to_string(size - index)
+ " (" + getTypeDescription(args[index]) + ")");
}
return {};
}
}}
| 3,429
|
C++
|
.cpp
| 76
| 34.802632
| 97
| 0.498432
|
Musicoll/Kiwi
| 134
| 11
| 7
|
GPL-3.0
|
9/20/2024, 9:42:21 PM (Europe/Amsterdam)
| false
| false
| false
| false
| false
| false
| false
| false
|
754,224
|
KiwiModel_LessEqual.cpp
|
Musicoll_Kiwi/Modules/KiwiModel/KiwiModel_Objects/KiwiModel_LessEqual.cpp
|
/*
==============================================================================
This file is part of the KIWI library.
- Copyright (c) 2014-2016, Pierre Guillot & Eliott Paris.
- Copyright (c) 2016-2019, CICM, ANR MUSICOLL, Eliott Paris, Pierre Guillot, Jean Millot.
Permission is granted to use this software under the terms of the GPL v3
(or any later version). Details can be found at: www.gnu.org/licenses
KIWI 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.
------------------------------------------------------------------------------
Contact : [email protected]
==============================================================================
*/
#include <KiwiModel/KiwiModel_Objects/KiwiModel_LessEqual.h>
#include <KiwiModel/KiwiModel_Factory.h>
namespace kiwi { namespace model {
// ================================================================================ //
// OBJECT LESS //
// ================================================================================ //
void LessEqual::declare()
{
if (!DataModel::has<model::Operator>())
{
Operator::declare();
}
std::unique_ptr<ObjectClass> lessequal_class(new ObjectClass("<=",
&LessEqual::create));
flip::Class<LessEqual> & lessequal_model = DataModel::declare<LessEqual>()
.name(lessequal_class->getModelName().c_str())
.inherit<Operator>();
Factory::add<LessEqual>(std::move(lessequal_class), lessequal_model);
}
std::unique_ptr<Object> LessEqual::create(std::vector<tool::Atom> const& args)
{
return std::make_unique<LessEqual>(args);
}
LessEqual::LessEqual(std::vector<tool::Atom> const& args):
Operator(args)
{
}
}}
| 2,208
|
C++
|
.cpp
| 42
| 42.761905
| 97
| 0.486667
|
Musicoll/Kiwi
| 134
| 11
| 7
|
GPL-3.0
|
9/20/2024, 9:42:21 PM (Europe/Amsterdam)
| false
| false
| false
| false
| false
| false
| false
| false
|
754,225
|
KiwiModel_Equal.cpp
|
Musicoll_Kiwi/Modules/KiwiModel/KiwiModel_Objects/KiwiModel_Equal.cpp
|
/*
==============================================================================
This file is part of the KIWI library.
- Copyright (c) 2014-2016, Pierre Guillot & Eliott Paris.
- Copyright (c) 2016-2019, CICM, ANR MUSICOLL, Eliott Paris, Pierre Guillot, Jean Millot.
Permission is granted to use this software under the terms of the GPL v3
(or any later version). Details can be found at: www.gnu.org/licenses
KIWI 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.
------------------------------------------------------------------------------
Contact : [email protected]
==============================================================================
*/
#include <KiwiModel/KiwiModel_Objects/KiwiModel_Equal.h>
#include <KiwiModel/KiwiModel_Factory.h>
namespace kiwi { namespace model {
// ================================================================================ //
// OBJECT EQUAL //
// ================================================================================ //
void Equal::declare()
{
if (!DataModel::has<model::Operator>())
{
Operator::declare();
}
std::unique_ptr<ObjectClass> equal_class(new ObjectClass("==",
&Equal::create));
flip::Class<Equal> & equal_model = DataModel::declare<Equal>()
.name(equal_class->getModelName().c_str())
.inherit<Operator>();
Factory::add<Equal>(std::move(equal_class), equal_model);
}
std::unique_ptr<Object> Equal::create(std::vector<tool::Atom> const& args)
{
return std::make_unique<Equal>(args);
}
Equal::Equal(std::vector<tool::Atom> const& args):
Operator(args)
{
}
}}
| 2,128
|
C++
|
.cpp
| 42
| 41.333333
| 90
| 0.476733
|
Musicoll/Kiwi
| 134
| 11
| 7
|
GPL-3.0
|
9/20/2024, 9:42:21 PM (Europe/Amsterdam)
| false
| false
| false
| false
| false
| false
| false
| false
|
754,226
|
KiwiModel_Times.cpp
|
Musicoll_Kiwi/Modules/KiwiModel/KiwiModel_Objects/KiwiModel_Times.cpp
|
/*
==============================================================================
This file is part of the KIWI library.
- Copyright (c) 2014-2016, Pierre Guillot & Eliott Paris.
- Copyright (c) 2016-2019, CICM, ANR MUSICOLL, Eliott Paris, Pierre Guillot, Jean Millot.
Permission is granted to use this software under the terms of the GPL v3
(or any later version). Details can be found at: www.gnu.org/licenses
KIWI 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.
------------------------------------------------------------------------------
Contact : [email protected]
==============================================================================
*/
#include <KiwiModel/KiwiModel_Objects/KiwiModel_Times.h>
#include <KiwiModel/KiwiModel_Factory.h>
namespace kiwi { namespace model {
// ================================================================================ //
// OBJECT TIMES //
// ================================================================================ //
void Times::declare()
{
if (!DataModel::has<model::Operator>())
{
Operator::declare();
}
std::unique_ptr<ObjectClass> time_class(new ObjectClass("*",
&Times::create));
flip::Class<Times> & time_model = DataModel::declare<Times>()
.name(time_class->getModelName().c_str())
.inherit<Operator>();
Factory::add<Times>(std::move(time_class), time_model);
}
std::unique_ptr<Object> Times::create(std::vector<tool::Atom> const& args)
{
return std::make_unique<Times>(args);
}
Times::Times(std::vector<tool::Atom> const& args):
Operator(args)
{
}
}}
| 2,118
|
C++
|
.cpp
| 42
| 41.190476
| 90
| 0.476854
|
Musicoll/Kiwi
| 134
| 11
| 7
|
GPL-3.0
|
9/20/2024, 9:42:21 PM (Europe/Amsterdam)
| false
| false
| false
| false
| false
| false
| false
| false
|
754,227
|
KiwiModel_NewBox.cpp
|
Musicoll_Kiwi/Modules/KiwiModel/KiwiModel_Objects/KiwiModel_NewBox.cpp
|
/*
==============================================================================
This file is part of the KIWI library.
- Copyright (c) 2014-2016, Pierre Guillot & Eliott Paris.
- Copyright (c) 2016-2019, CICM, ANR MUSICOLL, Eliott Paris, Pierre Guillot, Jean Millot.
Permission is granted to use this software under the terms of the GPL v3
(or any later version). Details can be found at: www.gnu.org/licenses
KIWI 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.
------------------------------------------------------------------------------
Contact : [email protected]
==============================================================================
*/
#include <KiwiModel/KiwiModel_Objects/KiwiModel_NewBox.h>
#include <KiwiModel/KiwiModel_ObjectClass.h>
#include <KiwiModel/KiwiModel_Factory.h>
namespace kiwi { namespace model {
// ================================================================================ //
// NEWBOX //
// ================================================================================ //
void NewBox::declare()
{
std::unique_ptr<ObjectClass> object_class(new ObjectClass("newbox",
&NewBox::create));
object_class->setFlag(ObjectClass::Flag::DefinedSize);
object_class->setFlag(ObjectClass::Flag::Internal);
flip::Class<NewBox> & data_model = DataModel::declare<NewBox>()
.name(object_class->getModelName().c_str())
.inherit<Object>();
Factory::add<NewBox>(std::move(object_class), data_model);
}
std::unique_ptr<Object> NewBox::create(std::vector<tool::Atom> const& args)
{
return std::make_unique<NewBox>();
}
NewBox::NewBox()
{
setWidth(80);
setHeight(20);
pushInlet({PinType::IType::Control});
}
std::string NewBox::getIODescription(bool is_inlet, size_t index) const
{
return "(nothing here)";
}
}}
| 2,368
|
C++
|
.cpp
| 47
| 41.361702
| 90
| 0.504224
|
Musicoll/Kiwi
| 134
| 11
| 7
|
GPL-3.0
|
9/20/2024, 9:42:21 PM (Europe/Amsterdam)
| false
| false
| false
| false
| false
| false
| false
| false
|
754,228
|
KiwiModel_Number.cpp
|
Musicoll_Kiwi/Modules/KiwiModel/KiwiModel_Objects/KiwiModel_Number.cpp
|
/*
==============================================================================
This file is part of the KIWI library.
- Copyright (c) 2014-2016, Pierre Guillot & Eliott Paris.
- Copyright (c) 2016-2019, CICM, ANR MUSICOLL, Eliott Paris, Pierre Guillot, Jean Millot.
Permission is granted to use this software under the terms of the GPL v3
(or any later version). Details can be found at: www.gnu.org/licenses
KIWI 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.
------------------------------------------------------------------------------
Contact : [email protected]
==============================================================================
*/
#include <KiwiModel/KiwiModel_Factory.h>
#include <KiwiModel/KiwiModel_ObjectClass.h>
#include <KiwiModel/KiwiModel_Objects/KiwiModel_Number.h>
namespace kiwi { namespace model {
// ================================================================================ //
// OBJECT NUMBER //
// ================================================================================ //
void Number::declare()
{
std::unique_ptr<ObjectClass> number_class(new ObjectClass("number",
&Number::create));
// parameters
std::unique_ptr<ParameterClass> param_value(new ParameterClass(tool::Parameter::Type::Float));
number_class->addParameter("value", std::move(param_value));
// flags
number_class->setFlag(ObjectClass::Flag::DefinedSize);
// data model
flip::Class<Number> & number_model = DataModel::declare<Number>()
.name(number_class->getModelName().c_str())
.inherit<Object>();
Factory::add<Number>(std::move(number_class), number_model);
}
std::unique_ptr<Object> Number::create(std::vector<tool::Atom> const& args)
{
return std::make_unique<Number>(args);
}
Number::Number(std::vector<tool::Atom> const& args):
Object()
{
if (!args.empty())
{
throw Error("number doesn't take any arguments");
}
addSignal<>(Signal::OutputValue, *this);
setWidth(50.);
setHeight(20.);
pushInlet({PinType::IType::Control});
pushOutlet(PinType::IType::Control);
}
Number::Number(flip::Default& d):
Object(d)
{
addSignal<>(Signal::OutputValue, *this);
}
std::string Number::getIODescription(bool is_inlet, size_t index) const
{
if (is_inlet && index == 0)
{
return "Sets number value.";
}
else if(!is_inlet && index == 0)
{
return "Outputs number value";
}
else
{
return "";
}
}
}}
| 3,192
|
C++
|
.cpp
| 74
| 33.472973
| 102
| 0.507831
|
Musicoll/Kiwi
| 134
| 11
| 7
|
GPL-3.0
|
9/20/2024, 9:42:21 PM (Europe/Amsterdam)
| false
| false
| false
| false
| false
| false
| false
| false
|
754,229
|
KiwiModel_Mtof.cpp
|
Musicoll_Kiwi/Modules/KiwiModel/KiwiModel_Objects/KiwiModel_Mtof.cpp
|
/*
==============================================================================
This file is part of the KIWI library.
- Copyright (c) 2014-2016, Pierre Guillot & Eliott Paris.
- Copyright (c) 2016-2019, CICM, ANR MUSICOLL, Eliott Paris, Pierre Guillot, Jean Millot.
Permission is granted to use this software under the terms of the GPL v3
(or any later version). Details can be found at: www.gnu.org/licenses
KIWI 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.
------------------------------------------------------------------------------
Contact : [email protected]
==============================================================================
*/
#include <KiwiModel/KiwiModel_Objects/KiwiModel_Mtof.h>
#include <KiwiModel/KiwiModel_Factory.h>
namespace kiwi { namespace model {
// ================================================================================ //
// MTOF //
// ================================================================================ //
void Mtof::declare()
{
std::unique_ptr<ObjectClass> mtof_class(new ObjectClass("mtof", &Mtof::create));
flip::Class<Mtof> & mtof_model = DataModel::declare<Mtof>()
.name(mtof_class->getModelName().c_str())
.inherit<Object>();
Factory::add<Mtof>(std::move(mtof_class), mtof_model);
}
std::unique_ptr<Object> Mtof::create(std::vector<tool::Atom> const& args)
{
return std::make_unique<Mtof>(args);
}
Mtof::Mtof(std::vector<tool::Atom> const& args)
{
if (!args.empty())
throw Error("mtof doesn't take any argument");
pushInlet({PinType::IType::Control});
pushOutlet(PinType::IType::Control);
}
std::string Mtof::getIODescription(bool is_inlet, size_t index) const
{
std::string description = "";
if (is_inlet)
{
if (index == 0)
{
description = "midi note to convert";
}
}
else
{
if (index == 0)
{
description = "ouputs converted midi note";
}
}
return description;
}
}}
| 2,588
|
C++
|
.cpp
| 59
| 34.525424
| 90
| 0.483937
|
Musicoll/Kiwi
| 134
| 11
| 7
|
GPL-3.0
|
9/20/2024, 9:42:21 PM (Europe/Amsterdam)
| false
| false
| false
| false
| false
| false
| false
| false
|
754,230
|
KiwiModel_GreaterTilde.cpp
|
Musicoll_Kiwi/Modules/KiwiModel/KiwiModel_Objects/KiwiModel_GreaterTilde.cpp
|
/*
==============================================================================
This file is part of the KIWI library.
- Copyright (c) 2014-2016, Pierre Guillot & Eliott Paris.
- Copyright (c) 2016-2019, CICM, ANR MUSICOLL, Eliott Paris, Pierre Guillot, Jean Millot.
Permission is granted to use this software under the terms of the GPL v3
(or any later version). Details can be found at: www.gnu.org/licenses
KIWI 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.
------------------------------------------------------------------------------
Contact : [email protected]
==============================================================================
*/
#include <KiwiModel/KiwiModel_Objects/KiwiModel_GreaterTilde.h>
#include <KiwiModel/KiwiModel_Factory.h>
namespace kiwi { namespace model {
// ================================================================================ //
// OBJECT >~ //
// ================================================================================ //
void GreaterTilde::declare()
{
if (!DataModel::has<model::OperatorTilde>())
{
OperatorTilde::declare();
}
std::unique_ptr<ObjectClass> greatertilde_class(new ObjectClass(">~", &GreaterTilde::create));
flip::Class<GreaterTilde> & greatertilde_model = DataModel::declare<GreaterTilde>()
.name(greatertilde_class->getModelName().c_str())
.inherit<OperatorTilde>();
Factory::add<GreaterTilde>(std::move(greatertilde_class), greatertilde_model);
}
std::unique_ptr<Object> GreaterTilde::create(std::vector<tool::Atom> const& args)
{
return std::make_unique<GreaterTilde>(args);
}
GreaterTilde::GreaterTilde(std::vector<tool::Atom> const& args):
OperatorTilde(args)
{
}
}}
| 2,230
|
C++
|
.cpp
| 41
| 45.414634
| 113
| 0.510127
|
Musicoll/Kiwi
| 134
| 11
| 7
|
GPL-3.0
|
9/20/2024, 9:42:21 PM (Europe/Amsterdam)
| false
| false
| false
| false
| false
| false
| false
| false
|
754,231
|
KiwiModel_LineTilde.cpp
|
Musicoll_Kiwi/Modules/KiwiModel/KiwiModel_Objects/KiwiModel_LineTilde.cpp
|
/*
==============================================================================
This file is part of the KIWI library.
- Copyright (c) 2014-2016, Pierre Guillot & Eliott Paris.
- Copyright (c) 2016-2019, CICM, ANR MUSICOLL, Eliott Paris, Pierre Guillot, Jean Millot.
Permission is granted to use this software under the terms of the GPL v3
(or any later version). Details can be found at: www.gnu.org/licenses
KIWI 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.
------------------------------------------------------------------------------
Contact : [email protected]
==============================================================================
*/
#include <KiwiModel/KiwiModel_Objects/KiwiModel_LineTilde.h>
#include <KiwiModel/KiwiModel_Factory.h>
namespace kiwi { namespace model {
// ================================================================================ //
// LINE~ //
// ================================================================================ //
void LineTilde::declare()
{
std::unique_ptr<ObjectClass> linetilde_class(new ObjectClass("line~", &LineTilde::create));
flip::Class<LineTilde> & linetilde_model = DataModel::declare<LineTilde>()
.name(linetilde_class->getModelName().c_str())
.inherit<Object>();
Factory::add<LineTilde>(std::move(linetilde_class), linetilde_model);
}
std::unique_ptr<Object> LineTilde::create(std::vector<tool::Atom> const& args)
{
return std::make_unique<LineTilde>(args);
}
LineTilde::LineTilde(std::vector<tool::Atom> const& args)
{
if (args.size() > 1)
{
throw Error("line~ too many arguments");
}
if (args.size() == 1 && !args[0].isNumber())
{
throw Error("line~ initial value shall be a number");
}
pushInlet({PinType::IType::Control});
pushInlet({PinType::IType::Control});
pushOutlet(PinType::IType::Signal);
pushOutlet(PinType::IType::Control);
}
std::string LineTilde::getIODescription(bool is_inlet, size_t index) const
{
if(is_inlet)
{
if(index == 0)
{
return "(number/list) Destination value";
}
else if(index == 1)
{
return "(float) Ramp time";
}
}
else
{
if(index == 0)
{
return "(signal) Output ramp";
}
else if(index == 1)
{
return "(bang) When the ramp reached its destination";
}
}
return {};
}
}}
| 3,099
|
C++
|
.cpp
| 74
| 31.891892
| 99
| 0.482453
|
Musicoll/Kiwi
| 134
| 11
| 7
|
GPL-3.0
|
9/20/2024, 9:42:21 PM (Europe/Amsterdam)
| false
| false
| false
| false
| false
| false
| false
| false
|
754,232
|
KiwiModel_Toggle.cpp
|
Musicoll_Kiwi/Modules/KiwiModel/KiwiModel_Objects/KiwiModel_Toggle.cpp
|
/*
==============================================================================
This file is part of the KIWI library.
- Copyright (c) 2014-2016, Pierre Guillot & Eliott Paris.
- Copyright (c) 2016-2019, CICM, ANR MUSICOLL, Eliott Paris, Pierre Guillot, Jean Millot.
Permission is granted to use this software under the terms of the GPL v3
(or any later version). Details can be found at: www.gnu.org/licenses
KIWI 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.
------------------------------------------------------------------------------
Contact : [email protected]
==============================================================================
*/
#include <KiwiModel/KiwiModel_Objects/KiwiModel_Toggle.h>
#include <KiwiModel/KiwiModel_Factory.h>
#include <KiwiModel/KiwiModel_DataModel.h>
namespace kiwi { namespace model {
// ================================================================================ //
// OBJECT TOGGLE //
// ================================================================================ //
void Toggle::declare()
{
std::unique_ptr<ObjectClass> toggle_class(new ObjectClass("toggle", &Toggle::create));
toggle_class->setFlag(ObjectClass::Flag::DefinedSize);
std::unique_ptr<ParameterClass> param_value(new ParameterClass(tool::Parameter::Type::Int));
toggle_class->addParameter("value", std::move(param_value));
flip::Class<Toggle> & toggle_model = DataModel::declare<Toggle>()
.name(toggle_class->getModelName().c_str())
.inherit<Object>();
Factory::add<Toggle>(std::move(toggle_class), toggle_model);
}
std::unique_ptr<Object> Toggle::create(std::vector<tool::Atom> const& args)
{
return std::make_unique<Toggle>(args);
}
Toggle::Toggle(std::vector<tool::Atom> const& args):
Object()
{
if (!args.empty())
{
throw Error("toggle too many arguments");
}
addSignal<>(Signal::OutputValue, *this);
setWidth(20);
pushInlet({PinType::IType::Control});
pushOutlet(PinType::IType::Control);
}
Toggle::Toggle(flip::Default& d):
Object(d)
{
addSignal<>(Signal::OutputValue, *this);
}
std::string Toggle::getIODescription(bool is_inlet, size_t index) const
{
if (is_inlet && index == 0)
{
return "Switches the toggle on or of";
}
else if(!is_inlet && index == 0)
{
return "Sends 0 or 1 when toggle is switched on or off";
}
else
{
return "";
}
}
}}
| 3,047
|
C++
|
.cpp
| 69
| 35.536232
| 100
| 0.523478
|
Musicoll/Kiwi
| 134
| 11
| 7
|
GPL-3.0
|
9/20/2024, 9:42:21 PM (Europe/Amsterdam)
| false
| false
| false
| false
| false
| false
| false
| false
|
754,233
|
KiwiModel_GateTilde.cpp
|
Musicoll_Kiwi/Modules/KiwiModel/KiwiModel_Objects/KiwiModel_GateTilde.cpp
|
/*
==============================================================================
This file is part of the KIWI library.
- Copyright (c) 2014-2016, Pierre Guillot & Eliott Paris.
- Copyright (c) 2016-2019, CICM, ANR MUSICOLL, Eliott Paris, Pierre Guillot, Jean Millot.
Permission is granted to use this software under the terms of the GPL v3
(or any later version). Details can be found at: www.gnu.org/licenses
KIWI 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.
------------------------------------------------------------------------------
Contact : [email protected]
==============================================================================
*/
#include <string>
#include <KiwiModel/KiwiModel_Factory.h>
#include <KiwiModel/KiwiModel_Objects/KiwiModel_GateTilde.h>
namespace kiwi { namespace model {
// ================================================================================ //
// GATE~ //
// ================================================================================ //
void GateTilde::declare()
{
std::unique_ptr<ObjectClass> gatetilde_class(new ObjectClass("gate~", &GateTilde::create));
flip::Class<GateTilde> & gatetilde_model = DataModel::declare<GateTilde>()
.name(gatetilde_class->getModelName().c_str())
.inherit<Object>();
Factory::add<GateTilde>(std::move(gatetilde_class), gatetilde_model);
}
std::unique_ptr<Object> GateTilde::create(std::vector<tool::Atom> const& args)
{
return std::make_unique<GateTilde>(args);
}
GateTilde::GateTilde(std::vector<tool::Atom> const& args)
{
if (args.size() <= 0)
throw Error("gate~ number of gates must be specified");
if (args.size() > 2)
throw Error("gate~ takes at most 2 arguments");
if (args.size() > 1 && !args[1].isNumber())
throw Error("gate~ 2nd argument must be a number");
if (args.size() > 0)
{
if (!args[0].isInt())
{
throw Error("gate~ 1rst argument must be an integer");
}
else if(args[0].getInt() < 0)
{
throw Error("gate~ 1rst argument must be greater than 0");
}
}
pushInlet({PinType::IType::Control, PinType::IType::Signal});
pushInlet({PinType::IType::Signal});
for(int outlet = 0; outlet < args[0].getInt(); ++outlet)
{
pushOutlet(PinType::IType::Signal);
}
}
std::string GateTilde::getIODescription(bool is_inlet, size_t index) const
{
std::string description = "";
if (is_inlet)
{
if (index == 0)
{
description = "Int Open/Close output";
}
else if(index == 1)
{
description = "Sends signal to opened output";
}
}
else
{
description = "Output " + std::to_string(index) + " receives signal if opened";
}
return description;
}
}}
| 3,538
|
C++
|
.cpp
| 80
| 33.75
| 99
| 0.496243
|
Musicoll/Kiwi
| 134
| 11
| 7
|
GPL-3.0
|
9/20/2024, 9:42:21 PM (Europe/Amsterdam)
| false
| false
| false
| false
| false
| false
| false
| false
|
754,234
|
KiwiModel_Less.cpp
|
Musicoll_Kiwi/Modules/KiwiModel/KiwiModel_Objects/KiwiModel_Less.cpp
|
/*
==============================================================================
This file is part of the KIWI library.
- Copyright (c) 2014-2016, Pierre Guillot & Eliott Paris.
- Copyright (c) 2016-2019, CICM, ANR MUSICOLL, Eliott Paris, Pierre Guillot, Jean Millot.
Permission is granted to use this software under the terms of the GPL v3
(or any later version). Details can be found at: www.gnu.org/licenses
KIWI 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.
------------------------------------------------------------------------------
Contact : [email protected]
==============================================================================
*/
#include <KiwiModel/KiwiModel_Objects/KiwiModel_Less.h>
#include <KiwiModel/KiwiModel_Factory.h>
namespace kiwi { namespace model {
// ================================================================================ //
// OBJECT LESS //
// ================================================================================ //
void Less::declare()
{
if (!DataModel::has<model::Operator>())
{
Operator::declare();
}
std::unique_ptr<ObjectClass> less_class(new ObjectClass("<",
&Less::create));
flip::Class<Less> & less_model = DataModel::declare<Less>()
.name(less_class->getModelName().c_str())
.inherit<Operator>();
Factory::add<Less>(std::move(less_class), less_model);
}
std::unique_ptr<Object> Less::create(std::vector<tool::Atom> const& args)
{
return std::make_unique<Less>(args);
}
Less::Less(std::vector<tool::Atom> const& args):
Operator(args)
{
}
}}
| 2,108
|
C++
|
.cpp
| 42
| 40.952381
| 90
| 0.4735
|
Musicoll/Kiwi
| 134
| 11
| 7
|
GPL-3.0
|
9/20/2024, 9:42:21 PM (Europe/Amsterdam)
| false
| false
| false
| false
| false
| false
| false
| false
|
754,235
|
KiwiModel_Clip.cpp
|
Musicoll_Kiwi/Modules/KiwiModel/KiwiModel_Objects/KiwiModel_Clip.cpp
|
/*
==============================================================================
This file is part of the KIWI library.
- Copyright (c) 2014-2016, Pierre Guillot & Eliott Paris.
- Copyright (c) 2016-2019, CICM, ANR MUSICOLL, Eliott Paris, Pierre Guillot, Jean Millot.
Permission is granted to use this software under the terms of the GPL v3
(or any later version). Details can be found at: www.gnu.org/licenses
KIWI 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.
------------------------------------------------------------------------------
Contact : [email protected]
==============================================================================
*/
#include <KiwiModel/KiwiModel_Objects/KiwiModel_Clip.h>
#include <KiwiModel/KiwiModel_Factory.h>
namespace kiwi { namespace model {
// ================================================================================ //
// CLIP //
// ================================================================================ //
void Clip::declare()
{
std::unique_ptr<ObjectClass> clip_class(new ObjectClass("clip", &Clip::create));
flip::Class<Clip> & clip_model = DataModel::declare<Clip>()
.name(clip_class->getModelName().c_str())
.inherit<Object>();
Factory::add<Clip>(std::move(clip_class), clip_model);
}
std::unique_ptr<Object> Clip::create(std::vector<tool::Atom> const& args)
{
return std::make_unique<Clip>(args);
}
Clip::Clip(std::vector<tool::Atom> const& args):
Object()
{
if (args.size() > 2)
throw Error("clip only takes two arguments");
if (args.size() > 1 && !args[1].isNumber())
throw Error("clip maximum must be a number");
if(args.size() > 0 && !args[0].isNumber())
throw Error("clip minimum value must be a number");
pushInlet({PinType::IType::Control});
pushInlet({PinType::IType::Control});
pushInlet({PinType::IType::Control});
pushOutlet(PinType::IType::Control);
}
std::string Clip::getIODescription(bool is_inlet, size_t index) const
{
std::string description = "";
if (is_inlet)
{
if (index == 0)
{
description = "float to be clipped";
}
else if (index == 1)
{
description = "float minimum value";
}
else if(index == 2)
{
description = "float maximum value";
}
}
else
{
description = "clipped values";
}
return description;
}
}}
| 3,027
|
C++
|
.cpp
| 71
| 33.619718
| 90
| 0.500353
|
Musicoll/Kiwi
| 134
| 11
| 7
|
GPL-3.0
|
9/20/2024, 9:42:21 PM (Europe/Amsterdam)
| false
| false
| false
| false
| false
| false
| false
| false
|
754,236
|
KiwiModel_LessTilde.cpp
|
Musicoll_Kiwi/Modules/KiwiModel/KiwiModel_Objects/KiwiModel_LessTilde.cpp
|
/*
==============================================================================
This file is part of the KIWI library.
- Copyright (c) 2014-2016, Pierre Guillot & Eliott Paris.
- Copyright (c) 2016-2019, CICM, ANR MUSICOLL, Eliott Paris, Pierre Guillot, Jean Millot.
Permission is granted to use this software under the terms of the GPL v3
(or any later version). Details can be found at: www.gnu.org/licenses
KIWI 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.
------------------------------------------------------------------------------
Contact : [email protected]
==============================================================================
*/
#include <KiwiModel/KiwiModel_Objects/KiwiModel_LessTilde.h>
#include <KiwiModel/KiwiModel_Factory.h>
namespace kiwi { namespace model {
// ================================================================================ //
// OBJECT <~ //
// ================================================================================ //
void LessTilde::declare()
{
if (!DataModel::has<model::OperatorTilde>())
{
OperatorTilde::declare();
}
std::unique_ptr<ObjectClass> lesstilde_class(new ObjectClass("<~", &LessTilde::create));
flip::Class<LessTilde> & lesstilde_model = DataModel::declare<LessTilde>()
.name(lesstilde_class->getModelName().c_str())
.inherit<OperatorTilde>();
Factory::add<LessTilde>(std::move(lesstilde_class), lesstilde_model);
}
std::unique_ptr<Object> LessTilde::create(std::vector<tool::Atom> const& args)
{
return std::make_unique<LessTilde>(args);
}
LessTilde::LessTilde(std::vector<tool::Atom> const& args):
OperatorTilde(args)
{
}
}}
| 2,185
|
C++
|
.cpp
| 41
| 44.317073
| 110
| 0.499519
|
Musicoll/Kiwi
| 134
| 11
| 7
|
GPL-3.0
|
9/20/2024, 9:42:21 PM (Europe/Amsterdam)
| false
| false
| false
| false
| false
| false
| false
| false
|
754,237
|
KiwiModel_Comment.cpp
|
Musicoll_Kiwi/Modules/KiwiModel/KiwiModel_Objects/KiwiModel_Comment.cpp
|
/*
==============================================================================
This file is part of the KIWI library.
- Copyright (c) 2014-2016, Pierre Guillot & Eliott Paris.
- Copyright (c) 2016-2019, CICM, ANR MUSICOLL, Eliott Paris, Pierre Guillot, Jean Millot.
Permission is granted to use this software under the terms of the GPL v3
(or any later version). Details can be found at: www.gnu.org/licenses
KIWI 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.
------------------------------------------------------------------------------
Contact : [email protected]
==============================================================================
*/
#include <KiwiModel/KiwiModel_Objects/KiwiModel_Comment.h>
#include <KiwiModel/KiwiModel_Factory.h>
namespace kiwi { namespace model {
// ================================================================================ //
// OBJECT COMMENT //
// ================================================================================ //
void Comment::declare()
{
// Objectclass
std::unique_ptr<ObjectClass> comment_class(new ObjectClass("comment", &Comment::create));
// Parameters
std::unique_ptr<ParameterClass> param_text(new ParameterClass(tool::Parameter::Type::String));
comment_class->addAttribute("text", std::move(param_text));
// Flags
comment_class->setFlag(ObjectClass::Flag::DefinedSize);
// DataModel
flip::Class<Comment> & comment_model = DataModel::declare<Comment>()
.name(comment_class->getModelName().c_str())
.inherit<Object>()
.member<flip::String, &Comment::m_comment_text>("comment_text");
Factory::add<Comment>(std::move(comment_class), comment_model);
}
std::unique_ptr<Object> Comment::create(std::vector<tool::Atom> const& args)
{
return std::make_unique<Comment>(args);
}
Comment::Comment(std::vector<tool::Atom> const& args)
: Object()
, m_comment_text("")
{
if (args.size() > 0)
throw Error("comment too many arguments");
setWidth(120.);
setHeight(20.);
}
Comment::Comment(flip::Default& d)
: Object(d)
, m_comment_text("")
{}
void Comment::writeAttribute(std::string const& name, tool::Parameter const& parameter)
{
if (name == "text")
{
m_comment_text = parameter[0].getString();
}
}
void Comment::readAttribute(std::string const& name, tool::Parameter & parameter) const
{
std::string const& message = m_comment_text;
parameter = tool::Parameter(tool::Parameter::Type::String, {message});
}
bool Comment::attributeChanged(std::string const& name) const
{
bool changed = false;
if (name == "text" && m_comment_text.changed())
{
changed = true;
}
return changed;
}
std::string Comment::getIODescription(bool is_inlet, size_t index) const
{
return "";
}
}}
| 3,565
|
C++
|
.cpp
| 79
| 35.481013
| 122
| 0.528392
|
Musicoll/Kiwi
| 134
| 11
| 7
|
GPL-3.0
|
9/20/2024, 9:42:21 PM (Europe/Amsterdam)
| false
| false
| false
| false
| false
| false
| false
| false
|
754,238
|
KiwiModel_Pipe.cpp
|
Musicoll_Kiwi/Modules/KiwiModel/KiwiModel_Objects/KiwiModel_Pipe.cpp
|
/*
==============================================================================
This file is part of the KIWI library.
- Copyright (c) 2014-2016, Pierre Guillot & Eliott Paris.
- Copyright (c) 2016-2019, CICM, ANR MUSICOLL, Eliott Paris, Pierre Guillot, Jean Millot.
Permission is granted to use this software under the terms of the GPL v3
(or any later version). Details can be found at: www.gnu.org/licenses
KIWI 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.
------------------------------------------------------------------------------
Contact : [email protected]
==============================================================================
*/
#include <KiwiModel/KiwiModel_Objects/KiwiModel_Pipe.h>
#include <KiwiModel/KiwiModel_DataModel.h>
#include <KiwiModel/KiwiModel_Factory.h>
namespace kiwi { namespace model {
// ================================================================================ //
// OBJECT PIPE //
// ================================================================================ //
void Pipe::declare()
{
std::unique_ptr<ObjectClass> pipe_class(new ObjectClass("pipe", &Pipe::create));
flip::Class<Pipe> & pipe_model = DataModel::declare<Pipe>()
.name(pipe_class->getModelName().c_str())
.inherit<Object>();
Factory::add<Pipe>(std::move(pipe_class), pipe_model);
}
std::unique_ptr<Object> Pipe::create(std::vector<tool::Atom> const& args)
{
return std::make_unique<Pipe>(args);
}
Pipe::Pipe(std::vector<tool::Atom> const& args)
{
if (args.size() > 1)
throw Error("pipe too many arguments");
if(args.size() == 1 && !args[0].isNumber())
throw Error("pipe argument must be a number");
pushInlet({PinType::IType::Control});
if (args.empty())
{
pushInlet({PinType::IType::Control});
}
pushOutlet(PinType::IType::Control);
}
std::string Pipe::getIODescription(bool is_inlet, size_t index) const
{
if(is_inlet)
{
if(index == 0)
{
return "Anything to be delayed";
}
else if(index == 1)
{
return "Set delay time";
}
}
else
{
return "Delayed messages";
}
return {};
}
}}
| 2,805
|
C++
|
.cpp
| 66
| 33.106061
| 90
| 0.487102
|
Musicoll/Kiwi
| 134
| 11
| 7
|
GPL-3.0
|
9/20/2024, 9:42:21 PM (Europe/Amsterdam)
| false
| false
| false
| false
| false
| false
| false
| false
|
754,239
|
KiwiModel_OperatorTilde.cpp
|
Musicoll_Kiwi/Modules/KiwiModel/KiwiModel_Objects/KiwiModel_OperatorTilde.cpp
|
/*
==============================================================================
This file is part of the KIWI library.
- Copyright (c) 2014-2016, Pierre Guillot & Eliott Paris.
- Copyright (c) 2016-2019, CICM, ANR MUSICOLL, Eliott Paris, Pierre Guillot, Jean Millot.
Permission is granted to use this software under the terms of the GPL v3
(or any later version). Details can be found at: www.gnu.org/licenses
KIWI 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.
------------------------------------------------------------------------------
Contact : [email protected]
==============================================================================
*/
#include <KiwiModel/KiwiModel_Objects/KiwiModel_OperatorTilde.h>
#include <KiwiModel/KiwiModel_Factory.h>
#include <KiwiModel/KiwiModel_DataModel.h>
namespace kiwi { namespace model {
// ================================================================================ //
// OPERATOR TILDE //
// ================================================================================ //
void OperatorTilde::declare()
{
DataModel::declare<OperatorTilde>()
.name("cicm.kiwi.object.operatortilde")
.inherit<Object>();
}
OperatorTilde::OperatorTilde(std::vector<tool::Atom> const& args):
Object()
{
if (args.size() > 1)
{
throw Error("operator~ too many arguments");
}
if (args.size() == 1 && !args[0].isNumber())
{
throw Error("operator~ argument must be a number");
}
pushInlet({PinType::IType::Signal});
if (args.empty())
{
pushInlet({PinType::IType::Signal, PinType::IType::Control});
}
pushOutlet(PinType::IType::Signal);
}
std::string OperatorTilde::getIODescription(bool is_inlet, size_t index) const
{
return is_inlet ? (index == 0) ? "Left operand" : "Right operand" : "Result";
}
}}
| 2,296
|
C++
|
.cpp
| 50
| 38.66
| 90
| 0.512868
|
Musicoll/Kiwi
| 134
| 11
| 7
|
GPL-3.0
|
9/20/2024, 9:42:21 PM (Europe/Amsterdam)
| false
| false
| false
| false
| false
| false
| false
| false
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.