Giter Club home page Giter Club logo

fanfaresimulator's Introduction

Fanfare Simulator

UNIX Build Status Windows Build status

Setup

Dependencies:

Linux

On Debian-based systems:

sudo apt install qtbase5-dev libfluidsynth-dev

In the project directory:

mkdir build
cd build
cmake ..

macOS

brew install qt fluidsynth

In the project directory:

mkdir build
cd build
cmake ..

MSYS2/MinGW-w64

Assuming you have already setup MSYS2 and a MinGW-w64 C/C++ toolchain:

pacman -Syu mingw-w64-x86_64-qt5 mingw-w64-x86_64-fluidsynth mingw-w64-x86_64-cmake

In the project directory:

mkdir build
cd build
cmake -G "MSYS Makefiles" ..

Windows

  • If you don't have Visual Studio, install Visual C++ Build Tools
  • Install Qt
  • Install pre-built Fluidsynth
  • Install CMake
  • Run CMake
    • If you have Visual Studio
      • Launch CMake (cmake-gui)
      • Select source directory
      • Create a new directory "build" and select it as build directory
      • Configure
      • Select "Visual Studio 14 2015 Win64"
      • Generate
      • Open project (or open fanfaresimulator.sln with Visual Studio)
      • Build
    • If you don't have Visual Studio, from the CLI:
      mkdir build
      cd build
      cmake .. -G "Visual Studio 14 2015 Win64" -DCMAKE_PREFIX_PATH=C:\Qt\5.9.2\msvc2015_64
      msbuild fanfaresimulator.sln

And you're done!

Build

cd build # If you're not there already
make

Usage

Start the server and some clients:

./fanfaresimulator-server
./fanfaresimulator-client

If you want to select a custom MIDI file:

./fanfaresimulator-server <midi-file>

If you want to change the number of players (put 0 to just play the partition):

./fanfaresimulator-server --players-nbr=4

Cleanup build directory

rm -rf build
mkdir build
cd build
cmake ..

fanfaresimulator's People

Contributors

anth2o avatar delthas avatar eliamazzoni avatar emersion avatar foob4r avatar giuliogargantini avatar jmorane avatar luciegillet avatar pablolh avatar sathouel avatar tbellotti avatar vincentx15 avatar zapashcanon avatar

Stargazers

 avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar

Forkers

delthas

fanfaresimulator's Issues

Segfault in engine

@fanfaresimulator/engine On master:

Thread 1 "fanfaresimulato" received signal SIGSEGV, Segmentation fault.
std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >::~basic_string (this=0xffffffffffffffd8, __in_chrg=<optimized out>)
    at /build/gcc-multilib/src/gcc-build/x86_64-pc-linux-gnu/libstdc++-v3/include/bits/basic_string.h:620
620	/build/gcc-multilib/src/gcc-build/x86_64-pc-linux-gnu/libstdc++-v3/include/bits/basic_string.h: No such file or directory.
(gdb) bt
#0  0x00007ffff613d0e0 in std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >::~basic_string() (this=0xffffffffffffffd8, __in_chrg=<optimized out>)
    at /build/gcc-multilib/src/gcc-build/x86_64-pc-linux-gnu/libstdc++-v3/include/bits/basic_string.h:620
#1  0x0000555555599fe9 in Instrument::~Instrument() (this=0xffffffffffffffd0) at /home/simon/src/fanfaresimulator/include/instrument.hpp:5
#2  0x0000555555599f39 in Pupitre::~Pupitre() (this=0xffffffffffffffc8) at /home/simon/src/fanfaresimulator/include/pupitre.hpp:6
#3  0x000055555559a719 in Note::~Note() (this=0xffffffffffffffb8) at /home/simon/src/fanfaresimulator/include/note.hpp:6
#4  0x00005555555a0889 in __gnu_cxx::new_allocator<Note>::destroy<Note>(Note*) (this=0x7fffffffd210, __p=0xffffffffffffffb8)
    at /usr/bin/../lib64/gcc/x86_64-pc-linux-gnu/7.2.0/../../../../include/c++/7.2.0/ext/new_allocator.h:140
#5  0x00005555555a03f8 in std::allocator_traits<std::allocator<Note> >::destroy<Note>(std::allocator<Note>&, Note*) (__a=..., __p=0xffffffffffffffb8)
    at /usr/bin/../lib64/gcc/x86_64-pc-linux-gnu/7.2.0/../../../../include/c++/7.2.0/bits/alloc_traits.h:487
#6  0x00005555555a2880 in std::vector<Note, std::allocator<Note> >::_M_erase(__gnu_cxx::__normal_iterator<Note*, std::vector<Note, std::allocator<Note> > >) (this=0x7fffffffd210, __position=non-dereferenceable iterator for std::vector) at /usr/bin/../lib64/gcc/x86_64-pc-linux-gnu/7.2.0/../../../../include/c++/7.2.0/bits/vector.tcc:159
#7  0x000055555559d738 in std::vector<Note, std::allocator<Note> >::erase(__gnu_cxx::__normal_iterator<Note const*, std::vector<Note, std::allocator<Note> > >) (this=0x7fffffffd210, __position=non-dereferenceable iterator for std::vector) at /usr/bin/../lib64/gcc/x86_64-pc-linux-gnu/7.2.0/../../../../include/c++/7.2.0/bits/stl_vector.h:1180
#8  0x000055555559c809 in Partition::buildPartitionInFrame(double, double, std::vector<Note, std::allocator<Note> >) (this=0x7fffffffd560, startTime=0.125, endTime=2.4754692928867739, noteSet=std::vector of length -1, capacity 0 = {...}) at /home/simon/src/fanfaresimulator/synth/partition.cpp:127
#9  0x00005555555a2db2 in PartitionGlobale::PartitionGlobale(Partition) (this=0x7fffffffd590, mypartition=...)
    at /home/simon/src/fanfaresimulator/synth/partitionglobale.cpp:32
#10 0x00005555555b15ed in Client::loadPartition(Partition) (this=0x7fffffffe4d0, partition=...) at /home/simon/src/fanfaresimulator/engine/client.cpp:68
#11 0x00005555555b4eb9 in QtPrivate::FunctorCall<QtPrivate::IndexesList<0>, QtPrivate::List<Partition>, void, void (Client::*)(Partition)>::call(void (Client::*)(Partition), Client*, void**) (f=(void (Client::*)(Client * const, Partition)) 0x5555555b1570 <Client::loadPartition(Partition)>, o=0x7fffffffe4d0, arg=0x7fffffffd9e0)
    at /usr/include/qt/QtCore/qobjectdefs_impl.h:136
#12 0x00005555555b4dd3 in QtPrivate::FunctionPointer<void (Client::*)(Partition)>::call<QtPrivate::List<Partition>, void>(void (Client::*)(Partition), Client*, void**) (f=
    (void (Client::*)(Client * const, Partition)) 0x5555555b1570 <Client::loadPartition(Partition)>, o=0x7fffffffe4d0, arg=0x7fffffffd9e0)
    at /usr/include/qt/QtCore/qobjectdefs_impl.h:169
#13 0x00005555555b4cf6 in QtPrivate::QSlotObject<void (Client::*)(Partition), QtPrivate::List<Partition>, void>::impl(int, QtPrivate::QSlotObjectBase*, QObject*, void**, bool*) (which=1, this_=0x555555bc10b0, r=0x7fffffffe4d0, a=0x7fffffffd9e0, ret=0x0) at /usr/include/qt/QtCore/qobject_impl.h:120
#14 0x00007ffff665f24f in QMetaObject::activate(QObject*, int, int, void**) () at /usr/lib/libQt5Core.so.5
#15 0x00005555555bc82b in NetworkClient::partitionRecv(Partition) (this=0x7fffe4001c00, _t1=...)
    at /home/simon/src/fanfaresimulator/build/fanfaresimulator_autogen/D7R3QBVKFK/moc_client.cpp:153
#16 0x00005555555abd2b in NetworkClient::handleJsonDoc(QJsonDocument) (this=0x7fffe4001c00, doc=...) at /home/simon/src/fanfaresimulator/network/client.cpp:35
#17 0x00005555555ac18f in NetworkClient::readyRead() (this=0x7fffe4001c00) at /home/simon/src/fanfaresimulator/network/client.cpp:59
#18 0x00005555555ae01b in QtPrivate::FunctorCall<QtPrivate::IndexesList<>, QtPrivate::List<>, void, void (NetworkClient::*)()>::call(void (NetworkClient::*)(), NetworkClient*, void**) (f=(void (NetworkClient::*)(NetworkClient * const)) 0x5555555abec0 <NetworkClient::readyRead()>, o=0x7fffe4001c00, arg=0x7fffffffdf20)
    at /usr/include/qt/QtCore/qobjectdefs_impl.h:136
#19 0x00005555555adf73 in QtPrivate::FunctionPointer<void (NetworkClient::*)()>::call<QtPrivate::List<>, void>(void (NetworkClient::*)(), NetworkClient*, void**) (f=(void (NetworkClient::*)(NetworkClient * const)) 0x5555555abec0 <NetworkClient::readyRead()>, o=0x7fffe4001c00, arg=0x7fffffffdf20) at /usr/include/qt/QtCore/qobjectdefs_impl.h:169
#20 0x00005555555ade56 in QtPrivate::QSlotObject<void (NetworkClient::*)(), QtPrivate::List<>, void>::impl(int, QtPrivate::QSlotObjectBase*, QObject*, void**, bool*) (which=1, this_=0x555555e59ff0, r=0x7fffe4001c00, a=0x7fffffffdf20, ret=0x0) at /usr/include/qt/QtCore/qobject_impl.h:120
#21 0x00007ffff665f24f in QMetaObject::activate(QObject*, int, int, void**) () at /usr/lib/libQt5Core.so.5
#22 0x00007ffff72e52c4 in  () at /usr/lib/libQt5Network.so.5
#23 0x00007ffff72e5374 in  () at /usr/lib/libQt5Network.so.5
#24 0x00007ffff72f6522 in  () at /usr/lib/libQt5Network.so.5
#25 0x00007ffff76d4f5c in QApplicationPrivate::notify_helper(QObject*, QEvent*) () at /usr/lib/libQt5Widgets.so.5

Note display and repartition

After a while on many partitions, these appear :

bug

bug2

Partition is only playable on one track. The track on which there are still notes changes it's key (the piano keyboard equivalent) so that the song can now be played, but only on one key.

Use initializer lists in constructors

e.g.

State::State(vector<NoteGlobale>::iterator &it) {
    itPartitionGlobal = it;

    key = 0;
    stateChanged = false;
    signal=false;
    timeLastEvent = 0.0;
    blockTime = 0.0;

}

->

State::State(vector<NoteGlobale>::iterator &it) 
    : itPartitionGlobal{it}
    , key{0}
    , stateChanged{false}
    , signal{false}
    , timeLastEvent{0.0}
    , blockTime{0.0}
{}

some change for network

@FooB4r @emersion
1 - please replace signal partitionChoiceRecv by pupitreChoiceRecv in server.hpp
2 - please replace method void sendInstrumentChoice(Instrument instrument); by
void sendPupitreChoice(Pupitre pupitre); in client.hpp

Audio volume controller

Make an interface so that the server can in real time controle for each instrument

  • the volume
  • the balance
  • anything that you want / can implement

I'm thinking of something like this:
audiolevel

Network client segfaults

@fanfaresimulator/network

#0  0x00007ffff57318a0 in raise () at /usr/lib/libc.so.6
#1  0x00007ffff5732f09 in abort () at /usr/lib/libc.so.6
#2  0x00007ffff60a6d77 in __gnu_cxx::__verbose_terminate_handler() () at /build/gcc-multilib/src/gcc/libstdc++-v3/libsupc++/vterminate.cc:95
#3  0x00007ffff60a48e6 in __cxxabiv1::__terminate(void (*)()) (handler=<optimized out>) at /build/gcc-multilib/src/gcc/libstdc++-v3/libsupc++/eh_terminate.cc:47
#4  0x00007ffff60a4933 in std::terminate() () at /build/gcc-multilib/src/gcc/libstdc++-v3/libsupc++/eh_terminate.cc:57
#5  0x00007ffff60a4b88 in __cxxabiv1::__cxa_throw(void*, std::type_info*, void (*)(void*)) (obj=<optimized out>, tinfo=0x7ffff63917e0 <typeinfo for char const*>, dest=0x0)
    at /build/gcc-multilib/src/gcc/libstdc++-v3/libsupc++/eh_throw.cc:93
#6  0x00005555555a6808 in arrayFromJson(QJsonValue) ()
#7  0x00005555555b030f in NetworkClient::handleJsonDoc(QJsonDocument) ()
#8  0x00005555555b094d in NetworkClient::readyRead() ()
#9  0x00005555555b1dab in QtPrivate::FunctorCall<QtPrivate::IndexesList<>, QtPrivate::List<>, void, void (NetworkClient::*)()>::call(void (NetworkClient::*)(), NetworkClient*, void**) ()
#10 0x00005555555b1d13 in void QtPrivate::FunctionPointer<void (NetworkClient::*)()>::call<QtPrivate::List<>, void>(void (NetworkClient::*)(), NetworkClient*, void**) ()
#11 0x00005555555b1c36 in QtPrivate::QSlotObject<void (NetworkClient::*)(), QtPrivate::List<>, void>::impl(int, QtPrivate::QSlotObjectBase*, QObject*, void**, bool*) ()
#12 0x00007ffff665f24f in QMetaObject::activate(QObject*, int, int, void**) () at /usr/lib/libQt5Core.so.5
#13 0x00007ffff72e52c4 in  () at /usr/lib/libQt5Network.so.5
#14 0x00007ffff72e5374 in  () at /usr/lib/libQt5Network.so.5
#15 0x00007ffff72f6522 in  () at /usr/lib/libQt5Network.so.5
#16 0x00007ffff76d4f5c in QApplicationPrivate::notify_helper(QObject*, QEvent*) () at /usr/lib/libQt5Widgets.so.5
#17 0x00007ffff76dca36 in QApplication::notify(QObject*, QEvent*) () at /usr/lib/libQt5Widgets.so.5
#18 0x00007ffff662f570 in QCoreApplication::notifyInternal2(QObject*, QEvent*) () at /usr/lib/libQt5Core.so.5
#19 0x00007ffff668ae7e in  () at /usr/lib/libQt5Core.so.5
#20 0x00007ffff306c270 in g_main_context_dispatch () at /usr/lib/libglib-2.0.so.0
#21 0x00007ffff306df69 in  () at /usr/lib/libglib-2.0.so.0
#22 0x00007ffff306dfae in g_main_context_iteration () at /usr/lib/libglib-2.0.so.0
#23 0x00007ffff668a1e1 in QEventDispatcherGlib::processEvents(QFlags<QEventLoop::ProcessEventsFlag>) () at /usr/lib/libQt5Core.so.5
#24 0x00005555555b815d in GameWindow::run(QApplication&) ()
#25 0x00005555555abc01 in main ()

Partition, Note, Instrument Interfaces to implement getters

In order to send information on the network I need to transform our objects into QJson /Json.
One way of doing it is to have getters for every object field. If you chose to use getters, you don't have anything else to do, I will create the Json inside my classes.
These would apply for partition, note and instrument classes.

Please debug all your code so that we can merge your branch into master (and get all the methods !)
Merge as frequently as possible especially when it concerns interface changes.

To be totally honest : If you don't do it fast enough I'll do it myself on my branch then merge and you'll have conflict to resolve ๐Ÿ‘…

edit : already Ok for partition !

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.