gearmulator

Emulation of classic VA synths of the late 90s/2000s that are based on Motorola 56300 family DSPs
Log | Files | Refs | Submodules | README | LICENSE

commandReader.h (626B)


      1 #pragma once
      2 
      3 #include "commands.h"
      4 
      5 #include "baseLib/binarystream.h"
      6 
      7 namespace networkLib
      8 {
      9 	class Stream;
     10 }
     11 
     12 namespace bridgeLib
     13 {
     14 	class CommandReader
     15 	{
     16 	public:
     17 		using CommandCallback = std::function<void(Command, baseLib::BinaryStream&)>;
     18 
     19 		CommandReader(CommandCallback&& _callback);
     20 		virtual ~CommandReader() = default;
     21 
     22 		void read(networkLib::Stream& _stream);
     23 		void read(baseLib::BinaryStream& _in);
     24 
     25 		virtual void handleCommand(Command _command, baseLib::BinaryStream& _in)
     26 		{
     27 			m_commandCallback(_command, _in);
     28 		}
     29 
     30 	private:
     31 		baseLib::BinaryStream m_stream;
     32 		CommandCallback m_commandCallback;
     33 	};
     34 }