mirror of
https://github.com/Ardour/ardour.git
synced 2025-12-18 20:56:28 +01:00
StandardMIDIFile -> MIDIFile.
git-svn-id: svn://localhost/ardour2/branches/3.0@4533 d708f5d6-7413-0410-9779-e7cbd77b26cf
This commit is contained in:
parent
33bbc5cd84
commit
9579ea0801
5 changed files with 10 additions and 10 deletions
|
|
@ -21,7 +21,7 @@
|
||||||
#define EVORAL_LIB_SMF_HPP
|
#define EVORAL_LIB_SMF_HPP
|
||||||
|
|
||||||
#include <cassert>
|
#include <cassert>
|
||||||
#include "evoral/StandardMIDIFile.hpp"
|
#include "evoral/MIDIFile.hpp"
|
||||||
|
|
||||||
struct smf_struct;
|
struct smf_struct;
|
||||||
struct smf_track_struct;
|
struct smf_track_struct;
|
||||||
|
|
@ -36,7 +36,7 @@ template<typename Time> class EventRingBuffer;
|
||||||
/** Standard Midi File (Type 0)
|
/** Standard Midi File (Type 0)
|
||||||
*/
|
*/
|
||||||
template<typename Time>
|
template<typename Time>
|
||||||
class LibSMF : public StandardMIDIFile<Time> {
|
class LibSMF : public MIDIFile<Time> {
|
||||||
public:
|
public:
|
||||||
LibSMF() : _last_ev_time(0), _smf(0), _smf_track(0), _empty(true) {};
|
LibSMF() : _last_ev_time(0), _smf(0), _smf_track(0), _empty(true) {};
|
||||||
virtual ~LibSMF();
|
virtual ~LibSMF();
|
||||||
|
|
|
||||||
|
|
@ -28,12 +28,12 @@ namespace Evoral {
|
||||||
template<typename Time> class Event;
|
template<typename Time> class Event;
|
||||||
template<typename Time> class EventRingBuffer;
|
template<typename Time> class EventRingBuffer;
|
||||||
|
|
||||||
#define THROW_FILE_ERROR throw(typename StandardMIDIFile<Time>::FileError)
|
#define THROW_FILE_ERROR throw(typename MIDIFile<Time>::FileError)
|
||||||
|
|
||||||
/** Standard MIDI File interface
|
/** Standard MIDI File interface
|
||||||
*/
|
*/
|
||||||
template<typename Time>
|
template<typename Time>
|
||||||
class StandardMIDIFile {
|
class MIDIFile {
|
||||||
public:
|
public:
|
||||||
class FileError : public std::exception {
|
class FileError : public std::exception {
|
||||||
const char* what() const throw() { return "libsmf error"; }
|
const char* what() const throw() { return "libsmf error"; }
|
||||||
|
|
@ -19,7 +19,7 @@
|
||||||
#ifndef EVORAL_SMF_HPP
|
#ifndef EVORAL_SMF_HPP
|
||||||
#define EVORAL_SMF_HPP
|
#define EVORAL_SMF_HPP
|
||||||
|
|
||||||
#include "evoral/StandardMIDIFile.hpp"
|
#include "evoral/MIDIFile.hpp"
|
||||||
|
|
||||||
namespace Evoral {
|
namespace Evoral {
|
||||||
|
|
||||||
|
|
@ -30,7 +30,7 @@ template<typename Time> class EventRingBuffer;
|
||||||
/** Standard Midi File (Type 0)
|
/** Standard Midi File (Type 0)
|
||||||
*/
|
*/
|
||||||
template<typename Time>
|
template<typename Time>
|
||||||
class SMF : public StandardMIDIFile<Time> {
|
class SMF : public MIDIFile<Time> {
|
||||||
public:
|
public:
|
||||||
SMF();
|
SMF();
|
||||||
virtual ~SMF();
|
virtual ~SMF();
|
||||||
|
|
|
||||||
|
|
@ -56,7 +56,7 @@ LibSMF<Time>::open(const std::string& path) THROW_FILE_ERROR
|
||||||
if (!_smf) {
|
if (!_smf) {
|
||||||
_smf = smf_new();
|
_smf = smf_new();
|
||||||
if (smf_set_ppqn(_smf, _ppqn) != 0) {
|
if (smf_set_ppqn(_smf, _ppqn) != 0) {
|
||||||
throw typename StandardMIDIFile<Time>::FileError();
|
throw typename MIDIFile<Time>::FileError();
|
||||||
}
|
}
|
||||||
|
|
||||||
if(_smf == NULL) {
|
if(_smf == NULL) {
|
||||||
|
|
@ -81,7 +81,7 @@ LibSMF<Time>::close() THROW_FILE_ERROR
|
||||||
assert(false);
|
assert(false);
|
||||||
if (_smf) {
|
if (_smf) {
|
||||||
if (smf_save(_smf, _path.c_str()) != 0) {
|
if (smf_save(_smf, _path.c_str()) != 0) {
|
||||||
throw typename StandardMIDIFile<Time>::FileError();
|
throw typename MIDIFile<Time>::FileError();
|
||||||
}
|
}
|
||||||
smf_delete(_smf);
|
smf_delete(_smf);
|
||||||
_smf = 0;
|
_smf = 0;
|
||||||
|
|
@ -185,7 +185,7 @@ void
|
||||||
LibSMF<Time>::end_write() THROW_FILE_ERROR
|
LibSMF<Time>::end_write() THROW_FILE_ERROR
|
||||||
{
|
{
|
||||||
if (smf_save(_smf, _path.c_str()) != 0)
|
if (smf_save(_smf, _path.c_str()) != 0)
|
||||||
throw typename StandardMIDIFile<Time>::FileError();
|
throw typename MIDIFile<Time>::FileError();
|
||||||
}
|
}
|
||||||
|
|
||||||
template class LibSMF<double>;
|
template class LibSMF<double>;
|
||||||
|
|
|
||||||
|
|
@ -312,7 +312,7 @@ SMF<Time>::begin_write(FrameTime start_frame)
|
||||||
|
|
||||||
template<typename Time>
|
template<typename Time>
|
||||||
void
|
void
|
||||||
SMF<Time>::end_write() throw(typename StandardMIDIFile<Time>::FileError)
|
SMF<Time>::end_write() throw(typename MIDIFile<Time>::FileError)
|
||||||
{
|
{
|
||||||
flush_header();
|
flush_header();
|
||||||
flush_footer();
|
flush_footer();
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue