root/branches/transport_redesign_2/libs/hydrogen/src/transport/H2Transport.h @ 1088

Revision 1088, 3.0 KB (checked in by gabriel@…, 4 years ago)

Change API for Jack Transport Master. Remove unused methods from H2Core::Hydrogen.

This is a partial changeover. The API is changed, but:

  • H2Transport.cpp does not compile because the EVENT_JACK_MASTER needs to be implemented for the Event Queue.
  • hydrogen.cpp still does not compile.
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 H2CORE_H2TRANSPORT_H
23#define H2CORE_H2TRANSPORT_H
24
25#include <hydrogen/Transport.h>
26
27namespace H2Core
28{
29    class H2TransportPrivate;
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 = Hydrogen::get_instance()->get_transport();
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 H2Transport : public Transport
51    {
52    public:
53        // Normal transport controls
54        virtual int locate(uint32_t frame);
55        virtual int locate(uint32_t bar, uint32_t beat, uint32_t tick);
56        virtual void start(void);
57        virtual void stop(void);
58        virtual void get_position(TransportPosition* pos);
59
60        // Interface for sequencer.  At the end of process(), declare the number
61        // of frames processed.  This is needed so that the internal transport
62        // master can keep track of time.
63        virtual void processed_frames(uint32_t nFrames);
64        virtual void set_current_song(Song* s);
65
66        // Convenience interface (mostly for GUI)
67        virtual uint32_t get_current_frame(void);
68        virtual TransportPosition::State get_state(void);
69
70        // Special Methods for Jack Transport.
71        bool setJackTimeMaster(bool if_none_already = false);
72        void clearJackTimeMaster();
73        bool getJackTimeMaster();
74
75        // Interface for application (i.e. GUI)
76        // * get list of transport models
77        // * set current transport model
78        // * possibly set parameters on transport models.
79
80        H2Transport();
81        virtual ~H2Transport();
82
83    private:
84        H2TransportPrivate* d;
85    };
86
87
88}
89
90#endif // H2CORE_H2TRANSPORT_H
Note: See TracBrowser for help on using the browser.