NEST main@caf0ae8
 
Loading...
Searching...
No Matches
music_manager.h
Go to the documentation of this file.
1/*
2 * music_manager.h
3 *
4 * This file is part of NEST.
5 *
6 * Copyright (C) 2004 The NEST Initiative
7 *
8 * NEST is free software: you can redistribute it and/or modify
9 * it under the terms of the GNU General Public License as published by
10 * the Free Software Foundation, either version 2 of the License, or
11 * (at your option) any later version.
12 *
13 * NEST is distributed in the hope that it will be useful,
14 * but WITHOUT ANY WARRANTY; without even the implied warranty of
15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16 * GNU General Public License for more details.
17 *
18 * You should have received a copy of the GNU General Public License
19 * along with NEST. If not, see <http://www.gnu.org/licenses/>.
20 *
21 */
22
23#ifndef MUSIC_MANAGER_H
24#define MUSIC_MANAGER_H
25
26#include "config.h"
27
28#ifdef HAVE_MUSIC
29#include <music.hh>
30#endif
31#include <string>
32
33// Includes from nestkernel:
34#include "manager_interface.h"
35#include "nest_types.h"
36
37#ifdef HAVE_MUSIC
38#include "music_event_handler.h"
40#endif
41
42namespace nest
43{
44
49{
50public:
51 void initialize( const bool ) override;
52 void finalize( const bool ) override;
53 void set_status( const Dictionary& ) override;
54 void get_status( Dictionary& ) override;
55
57
58 void init_music( int* argc, char** argv[] );
59
68 void enter_runtime( double h_min_delay );
69
74
75 void music_finalize(); // called from MPIManager::mpi_finalize
76
77#ifdef HAVE_MUSIC
78 MPI_Comm communicator();
79
80 MUSIC::Setup* get_music_setup();
81 MUSIC::Runtime* get_music_runtime();
82
89 void register_music_in_port( std::string portname );
90
97 void unregister_music_in_port( std::string portname );
98
106 void register_music_event_in_proxy( std::string portname, int channel, Node* mp );
107
115 void register_music_rate_in_proxy( std::string portname, int channel, Node* mp );
116
120 void set_music_in_port_acceptable_latency( std::string portname, double latency );
121 void set_music_in_port_max_buffered( std::string portname, int maxbuffered );
125 struct MusicPortData
126 {
127 MusicPortData( size_t n, double latency, int m )
128 : n_input_proxies( n )
129 , acceptable_latency( latency )
130 , max_buffered( m )
131 {
132 }
133 MusicPortData()
134 {
135 }
136 size_t n_input_proxies; // Counter for number of music_input proxies
137 // connected to this port
138 double acceptable_latency;
139 int max_buffered;
140 };
141
149 std::map< std::string, MusicPortData > music_in_portlist_;
150
155 std::map< std::string, MusicEventHandler > music_event_in_portmap_;
156 std::map< std::string, MusicRateInHandler > music_rate_in_portmap_;
157
162 void publish_music_in_ports_();
163
168 void update_music_event_handlers( Time const&, const long, const long );
169#endif
170
171private:
172#ifdef HAVE_MUSIC
173 MUSIC::Setup* music_setup;
174 MUSIC::Runtime* music_runtime;
175#endif
176};
177}
178
179
180#endif /* MUSIC_MANAGER_H */
Dictionary class for interface to Python and C++ API.
Definition dictionary.h:213
Encapsulate all calls to MUSIC.
Definition music_manager.h:49
void initialize(const bool) override
Prepare manager for operation.
Definition music_manager.cpp:49
MUSICManager()
Definition music_manager.cpp:39
void music_finalize()
Definition music_manager.cpp:108
void advance_music_time()
Advance the time of music by 1 simulation step.
void finalize(const bool) override
Take down manager after operation.
Definition music_manager.cpp:54
void get_status(Dictionary &) override
Retrieve the status of the manager.
Definition music_manager.cpp:64
void enter_runtime(double h_min_delay)
Enter the runtime mode.
Definition music_manager.cpp:101
void set_status(const Dictionary &) override
Set the status of the manager.
Definition music_manager.cpp:59
void init_music(int *argc, char **argv[])
Definition music_manager.cpp:96
Interface for kernel manager classes.
Definition manager_interface.h:46
Base class for all NEST network objects.
Definition node.h:99
Namespace for the NEST simulation kernel.
Definition beta_normalization_factor.h:33