diff options
author | David Robillard <d@drobilla.net> | 2009-02-14 17:39:49 +0000 |
---|---|---|
committer | David Robillard <d@drobilla.net> | 2009-02-14 17:39:49 +0000 |
commit | d4394595896e2f4c91079fa66f15a4e88f66f1d3 (patch) | |
tree | 9ee5fec478cb0bba368c9c2f8c9eabe70a4e5d77 /libs | |
parent | 5ffdf1857eec24e37a4164b6ec61e188dbbd4cac (diff) |
Remove abstract MIDIFile interface (maintaining interface with old crap was getting annoying).
git-svn-id: svn://localhost/ardour2/branches/3.0@4553 d708f5d6-7413-0410-9779-e7cbd77b26cf
Diffstat (limited to 'libs')
-rw-r--r-- | libs/evoral/evoral/MIDIFile.hpp | 68 | ||||
-rw-r--r-- | libs/evoral/evoral/OldSMF.hpp | 4 | ||||
-rw-r--r-- | libs/evoral/evoral/SMF.hpp | 9 | ||||
-rw-r--r-- | libs/evoral/src/OldSMF.cpp | 2 | ||||
-rw-r--r-- | libs/evoral/src/SMF.cpp | 6 |
5 files changed, 12 insertions, 77 deletions
diff --git a/libs/evoral/evoral/MIDIFile.hpp b/libs/evoral/evoral/MIDIFile.hpp deleted file mode 100644 index b605b8af60..0000000000 --- a/libs/evoral/evoral/MIDIFile.hpp +++ /dev/null @@ -1,68 +0,0 @@ -/* This file is part of Evoral. - * Copyright(C) 2008 Dave Robillard <http://drobilla.net> - * Copyright(C) 2000-2008 Paul Davis - * Author: Hans Baier - * - * Evoral is free software; you can redistribute it and/or modify it under the - * terms of the GNU General Public License as published by the Free Software - * Foundation; either version 2 of the License, or(at your option) any later - * version. - * - * Evoral is distributed in the hope that it will be useful, but WITHOUT ANY - * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS - * FOR A PARTICULAR PURPOSE. See the GNU General Public License for details. - * - * You should have received a copy of the GNU General Public License along - * with this program; if not, write to the Free Software Foundation, Inc., - * 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA - */ - -#ifndef EVORAL_STANDARD_MIDI_FILE_HPP -#define EVORAL_STANDARD_MIDI_FILE_HPP - -#include <string> -#include "evoral/types.hpp" - -namespace Evoral { - -template<typename Time> class Event; -template<typename Time> class EventRingBuffer; - -#define THROW_FILE_ERROR throw(typename MIDIFile<Time>::FileError) - -/** Standard MIDI File interface - */ -template<typename Time> -class MIDIFile { -public: - class FileError : public std::exception { - const char* what() const throw() { return "libsmf error"; } - }; - - virtual void seek_to_start() const = 0; - - virtual uint16_t ppqn() const = 0; - virtual bool is_empty() const = 0; - virtual bool eof() const = 0; - - virtual Time last_event_time() const = 0; - - virtual void begin_write() = 0; - virtual void append_event_delta(uint32_t delta_t, const Event<Time>& ev) = 0; - virtual void end_write() throw(FileError) = 0; - - virtual void flush() = 0; - virtual int flush_header() = 0; - virtual int flush_footer() = 0; - -protected: - virtual int open(const std::string& path) throw(FileError) = 0; - virtual void close() throw(FileError) = 0; - - virtual int read_event(uint32_t* delta_t, uint32_t* size, uint8_t** buf) const = 0; -}; - -}; /* namespace Evoral */ - -#endif /* EVORAL_STANDARD_MIDI_FILE_HPP */ - diff --git a/libs/evoral/evoral/OldSMF.hpp b/libs/evoral/evoral/OldSMF.hpp index 9e204be82e..6f265cc313 100644 --- a/libs/evoral/evoral/OldSMF.hpp +++ b/libs/evoral/evoral/OldSMF.hpp @@ -19,8 +19,6 @@ #ifndef EVORAL_OLD_SMF_HPP #define EVORAL_OLD_SMF_HPP -#include "evoral/MIDIFile.hpp" - namespace Evoral { template<typename Time> class Event; @@ -30,7 +28,7 @@ template<typename Time> class EventRingBuffer; /** Standard Midi File (Type 0) */ template<typename Time> -class SMF : public MIDIFile<Time> { +class SMF { public: SMF(); virtual ~SMF(); diff --git a/libs/evoral/evoral/SMF.hpp b/libs/evoral/evoral/SMF.hpp index be1ed667cc..f45719cdab 100644 --- a/libs/evoral/evoral/SMF.hpp +++ b/libs/evoral/evoral/SMF.hpp @@ -21,7 +21,6 @@ #define EVORAL_SMF_HPP #include <cassert> -#include "evoral/MIDIFile.hpp" struct smf_struct; struct smf_track_struct; @@ -33,11 +32,17 @@ namespace Evoral { template<typename Time> class Event; template<typename Time> class EventRingBuffer; +#define THROW_FILE_ERROR throw(typename SMF<Time>::FileError) + /** Standard Midi File (Type 0) */ template<typename Time> -class SMF : public MIDIFile<Time> { +class SMF { public: + class FileError : public std::exception { + const char* what() const throw() { return "Unknown SMF error"; } + }; + SMF() : _last_ev_time(0), _smf(0), _smf_track(0), _empty(true) {}; virtual ~SMF(); diff --git a/libs/evoral/src/OldSMF.cpp b/libs/evoral/src/OldSMF.cpp index 3e396cff96..1440e3e128 100644 --- a/libs/evoral/src/OldSMF.cpp +++ b/libs/evoral/src/OldSMF.cpp @@ -312,7 +312,7 @@ SMF<Time>::begin_write() template<typename Time> void -SMF<Time>::end_write() throw(typename MIDIFile<Time>::FileError) +SMF<Time>::end_write() { flush_header(); flush_footer(); diff --git a/libs/evoral/src/SMF.cpp b/libs/evoral/src/SMF.cpp index b0f5a86495..ece9fc4c1e 100644 --- a/libs/evoral/src/SMF.cpp +++ b/libs/evoral/src/SMF.cpp @@ -59,7 +59,7 @@ SMF<Time>::open(const std::string& path) THROW_FILE_ERROR if (!_smf) { _smf = smf_new(); if (smf_set_ppqn(_smf, _ppqn) != 0) { - throw typename MIDIFile<Time>::FileError(); + throw FileError(); } if(_smf == NULL) { @@ -88,7 +88,7 @@ SMF<Time>::close() THROW_FILE_ERROR { if (_smf) { if (smf_save(_smf, _path.c_str()) != 0) { - throw typename MIDIFile<Time>::FileError(); + throw FileError(); } smf_delete(_smf); _smf = 0; @@ -192,7 +192,7 @@ void SMF<Time>::end_write() THROW_FILE_ERROR { if (smf_save(_smf, _path.c_str()) != 0) - throw typename MIDIFile<Time>::FileError(); + throw FileError(); } template class SMF<double>; |