| 1 | /* |
|---|
| 2 | * Hydrogen |
|---|
| 3 | * Copyright(c) 2002-2004 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 | |
|---|
| 23 | #ifndef SMF_H |
|---|
| 24 | #define SMF_H |
|---|
| 25 | |
|---|
| 26 | #include <hydrogen/Object.h> |
|---|
| 27 | #include <hydrogen/Song.h> |
|---|
| 28 | |
|---|
| 29 | #include <string> |
|---|
| 30 | #include <cstdio> |
|---|
| 31 | #include <vector> |
|---|
| 32 | |
|---|
| 33 | #include <hydrogen/smf/SMFEvent.h> |
|---|
| 34 | |
|---|
| 35 | namespace H2Core |
|---|
| 36 | { |
|---|
| 37 | |
|---|
| 38 | class SMFHeader : public SMFBase, public Object |
|---|
| 39 | { |
|---|
| 40 | public: |
|---|
| 41 | SMFHeader( int nFormat, int nTracks, int nTPQN ); |
|---|
| 42 | ~SMFHeader(); |
|---|
| 43 | |
|---|
| 44 | int m_nFormat; ///< SMF format |
|---|
| 45 | int m_nTracks; ///< number of tracks |
|---|
| 46 | int m_nTPQN; ///< ticks per quarter note |
|---|
| 47 | |
|---|
| 48 | virtual std::vector<char> getBuffer(); |
|---|
| 49 | }; |
|---|
| 50 | |
|---|
| 51 | |
|---|
| 52 | |
|---|
| 53 | class SMFTrack : public SMFBase, public Object |
|---|
| 54 | { |
|---|
| 55 | public: |
|---|
| 56 | SMFTrack( const QString& sTrackName ); |
|---|
| 57 | ~SMFTrack(); |
|---|
| 58 | |
|---|
| 59 | void addEvent( SMFEvent *pEvent ); |
|---|
| 60 | |
|---|
| 61 | virtual std::vector<char> getBuffer(); |
|---|
| 62 | |
|---|
| 63 | private: |
|---|
| 64 | std::vector<SMFEvent*> m_eventList; |
|---|
| 65 | }; |
|---|
| 66 | |
|---|
| 67 | |
|---|
| 68 | |
|---|
| 69 | class SMF : public SMFBase, public Object |
|---|
| 70 | { |
|---|
| 71 | public: |
|---|
| 72 | SMF(); |
|---|
| 73 | ~SMF(); |
|---|
| 74 | |
|---|
| 75 | void addTrack( SMFTrack *pTrack ); |
|---|
| 76 | virtual std::vector<char> getBuffer(); |
|---|
| 77 | |
|---|
| 78 | private: |
|---|
| 79 | std::vector<SMFTrack*> m_trackList; |
|---|
| 80 | |
|---|
| 81 | SMFHeader* m_pHeader; |
|---|
| 82 | |
|---|
| 83 | }; |
|---|
| 84 | |
|---|
| 85 | |
|---|
| 86 | |
|---|
| 87 | class SMFWriter : Object |
|---|
| 88 | { |
|---|
| 89 | public: |
|---|
| 90 | SMFWriter(); |
|---|
| 91 | ~SMFWriter(); |
|---|
| 92 | |
|---|
| 93 | void save( const QString& sFilename, Song *pSong ); |
|---|
| 94 | |
|---|
| 95 | private: |
|---|
| 96 | FILE *m_file; |
|---|
| 97 | |
|---|
| 98 | }; |
|---|
| 99 | |
|---|
| 100 | }; |
|---|
| 101 | |
|---|
| 102 | #endif |
|---|
| 103 | |
|---|