root/branches/transport_redesign/libs/hydrogen/include/hydrogen/Transport.h @ 866

Revision 866, 2.8 KB (checked in by gabriel@…, 4 years ago)

Add base files for new transport frontends and backends.

Includes the file TRANSPORT_READESIGN_NOTES.gmb which is a
chronological collections of e-mails, ramblings, and thoughts about
how the transport ought to be done. The stuff at the bottom is more
relevant than the stuff at the top.

Line 
1/*
2 * Hydrogen
3 * Copyright(c) 2002-2008 by Alex >Comix< Cominu [comix@users.sourceforge.net]
4 *
5 * http://www.hydrogen-music.org
6 *
7 * This program is free software; you can redistribute it and/or modify
8 * it under the terms of the GNU General Public License as published by
9 * the Free Software Foundation; either version 2 of the License, or
10 * (at your option) any later version.
11 *
12 * This program is distributed in the hope that it will be useful,
13 * but WITHOUT ANY WARRANTY, without even the implied warranty of
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 * GNU General Public License for more details.
16 *
17 * You should have received a copy of the GNU General Public License
18 * along with this program; if not, write to the Free Software
19 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
20 *
21 */
22#ifndef TRANSPORT_H
23#define TRANSPORT_H
24
25#include <hydrogen/TransportMasterInterface.h>
26
27namespace H2Core
28{
29    class TransportPrivate;
30    class Song;
31
32    /**
33     * This is the only transport that Hydrogen shall directly interact with.
34     * It shall manage all transport backends (Internal, Jack, whatever).
35     *
36     * From the sequencer's point of view, it is expected to be used like this:
37     *
38     * int process(uint32_t nFrames) {
39     *     TransportPosition pos;        // Defined in TransportMasterInterface.h
40     *     Transport* xport = Transport::get_instance();
41     *     xport->get_position(&pos);
42     *
43     *     // Sequence notes based on [Bar:beat.tick] + bbt_offset
44     *     // and **NOT** based on the frame number.
45     *
46     *     // Tell the transport to move to the next cycle
47     *     xport->processed_frames(nFrames);
48     * }
49     */
50    class Transport : public TransportMasterInterface
51    {
52    public:
53        // Singleton access
54        static Transport* get_instance();
55
56        // Normal transport controls
57        virtual int locate(uint32_t frame);
58        virtual int locate(uint32_t bar, uint32_t beat, uint32_t tick);
59        virtual void start(void);
60        virtual void stop(void);
61        virtual void get_position(TransportPosition* pos);
62
63        // Interface for sequencer.  At the end of process(), declare the number
64        // of frames processed.  This is needed so that the internal transport
65        // master can keep track of time.
66        virtual void processed_frames(uint32_t nFrames);
67        virtual void set_current_song(Song* s);
68
69        // Convenience interface (mostly for GUI)
70        virtual uint32_t get_current_frame(void);
71
72        // Interface for application (i.e. GUI)
73        // * get list of transport models
74        // * set current transport model
75        // * possibly set parameters on transport models.
76
77    private:
78        Transport();
79        virtual ~Transport();
80
81        static Transport* _instance;
82        TransportPrivate* d;
83    };
84
85
86}
87
88#endif // TRANSPORT_H
Note: See TracBrowser for help on using the browser.