aboutsummaryrefslogtreecommitdiff
path: root/src/midi_sequencer.hpp
diff options
context:
space:
mode:
authorVitaly Novichkov <admin@wohlnet.ru>2019-12-04 22:14:32 +0300
committerVitaly Novichkov <admin@wohlnet.ru>2019-12-04 22:14:32 +0300
commitb92112685b1d1ba0ae376069bc42d61300a97fa1 (patch)
treec57a00d8fc8c275c3db23d7d4109161e1d9e6340 /src/midi_sequencer.hpp
parent9b41e9128035a84731ea21f465a328cdf7e6494b (diff)
parente7847d9ff4a71c0f5266d611b5c20988f0709f4f (diff)
downloadlibADLMIDI-b92112685b1d1ba0ae376069bc42d61300a97fa1.tar.gz
libADLMIDI-b92112685b1d1ba0ae376069bc42d61300a97fa1.tar.bz2
libADLMIDI-b92112685b1d1ba0ae376069bc42d61300a97fa1.zip
Merge branch 'wip-new-embedded-banks' of github.com:Wohlstand/libADLMIDI into wip-new-embedded-banks
Diffstat (limited to 'src/midi_sequencer.hpp')
-rw-r--r--src/midi_sequencer.hpp36
1 files changed, 36 insertions, 0 deletions
diff --git a/src/midi_sequencer.hpp b/src/midi_sequencer.hpp
index 1eb5873..6832492 100644
--- a/src/midi_sequencer.hpp
+++ b/src/midi_sequencer.hpp
@@ -511,6 +511,34 @@ private:
//! Common error string
std::string m_errorString;
+ struct SequencerTime
+ {
+ //! Time buffer
+ double timeRest;
+ //! Sample rate
+ uint32_t sampleRate;
+ //! Size of one frame in bytes
+ uint32_t frameSize;
+ //! Minimum possible delay, granuality
+ double minDelay;
+ //! Last delay
+ double delay;
+
+ void init()
+ {
+ sampleRate = 44100;
+ frameSize = 2;
+ reset();
+ }
+
+ void reset()
+ {
+ timeRest = 0.0;
+ minDelay = 1.0 / static_cast<double>(sampleRate);
+ delay = 0.0;
+ }
+ } m_time;
+
public:
BW_MidiSequencer();
virtual ~BW_MidiSequencer();
@@ -522,6 +550,14 @@ public:
void setInterface(const BW_MidiRtInterface *intrf);
/**
+ * @brief Runs ticking in a sync with audio streaming. Use this together with onPcmRender hook to easily play MIDI.
+ * @param stream pointer to the output PCM stream
+ * @param length length of the buffer in bytes
+ * @return Count of recorded data in bytes
+ */
+ int playStream(uint8_t *stream, size_t length);
+
+ /**
* @brief Returns file format type of currently loaded file
* @return File format type enumeration
*/