andrew@16: /* andrew@16: * AccompanimentSynchroniser.h andrew@16: * MultipleAudioMathcher andrew@16: * andrew@16: * Created by Andrew on 06/02/2012. andrew@16: * Copyright 2012 QMUL. All rights reserved. andrew@16: * andrew@16: */ andrew@16: andrew@16: andrew@16: #ifndef ACCOMPANIMENT_SYNCHRONISER_H andrew@16: #define ACCOMPANIMENT_SYNCHRONISER_H andrew@16: andrew@16: #include "ofxOsc.h" andrew@16: #define HOST "localhost" andrew@16: #define SENDER_PORT 10875 andrew@16: andrew@16: #include "ofMain.h" andrew@16: andrew@16: andrew@16: class AccompanimentSynchroniser{ andrew@16: andrew@16: public: andrew@16: AccompanimentSynchroniser(); andrew@16: andrew@17: void reset(); andrew@17: andrew@16: void setPlayingRatio(const double& ratio, const double& timePlayed); andrew@16: void setRecordedPosition(); andrew@17: void updateRecordedPosition(const double& currentAlignmentPosition, const double& timeSent); andrew@16: andrew@16: void updateOutputSpeed(); andrew@16: andrew@17: int counter ; andrew@17: andrew@16: double fileLengthSamples; andrew@16: andrew@16: andrew@16: andrew@16: double playingPositionRatio; andrew@16: double playingPositionSamples; andrew@16: double playingPositionMillis; andrew@16: double playingPositionTimeSent; andrew@16: andrew@17: double recordedPositionMillis; andrew@39: double recordedPositionTimeSent; andrew@53: andrew@53: double speed, smoothedSpeedOutput; andrew@53: double movingAverageWeighting, difference; andrew@53: andrew@16: private: andrew@16: andrew@53: andrew@16: ofxOscSender sender; andrew@16: void sendSpeed(double const& val); andrew@16: andrew@16: }; andrew@16: #endif