comparison plugin/DSSIPluginInstance.cpp @ 66:7afcfe666910

* Modify to use Vamp SDK for proper feature extraction plugins. Requires that the vamp-plugin-sdk directory tree be present below plugin/ (it's separate in Subversion).
author Chris Cannam
date Fri, 31 Mar 2006 15:56:35 +0000
parents 33285f426852
children 163f3428bbe0
comparison
equal deleted inserted replaced
65:e1aad27029e3 66:7afcfe666910
251 #ifdef DEBUG_DSSI_PROCESS 251 #ifdef DEBUG_DSSI_PROCESS
252 std::cerr << "DSSIPluginInstance::getLatency(): m_latencyPort " << m_latencyPort << ", m_run " << m_run << std::endl; 252 std::cerr << "DSSIPluginInstance::getLatency(): m_latencyPort " << m_latencyPort << ", m_run " << m_run << std::endl;
253 #endif 253 #endif
254 254
255 if (m_latencyPort) { 255 if (m_latencyPort) {
256 if (!m_run) run(RealTime::zeroTime); 256 if (!m_run) run(Vamp::RealTime::zeroTime);
257 latency = (size_t)(*m_latencyPort + 0.1); 257 latency = (size_t)(*m_latencyPort + 0.1);
258 } 258 }
259 259
260 #ifdef DEBUG_DSSI_PROCESS 260 #ifdef DEBUG_DSSI_PROCESS
261 std::cerr << "DSSIPluginInstance::getLatency(): latency is " << latency << std::endl; 261 std::cerr << "DSSIPluginInstance::getLatency(): latency is " << latency << std::endl;
848 848
849 return qm; 849 return qm;
850 } 850 }
851 851
852 void 852 void
853 DSSIPluginInstance::sendEvent(const RealTime &eventTime, 853 DSSIPluginInstance::sendEvent(const Vamp::RealTime &eventTime,
854 const void *e) 854 const void *e)
855 { 855 {
856 #ifdef DEBUG_DSSI_PROCESS 856 #ifdef DEBUG_DSSI_PROCESS
857 std::cerr << "DSSIPluginInstance::sendEvent: last was " << m_lastEventSendTime << " (valid " << m_haveLastEventSendTime << "), this is " << eventTime << std::endl; 857 std::cerr << "DSSIPluginInstance::sendEvent: last was " << m_lastEventSendTime << " (valid " << m_haveLastEventSendTime << "), this is " << eventTime << std::endl;
858 #endif 858 #endif
924 924
925 return false; 925 return false;
926 } 926 }
927 927
928 void 928 void
929 DSSIPluginInstance::run(const RealTime &blockTime) 929 DSSIPluginInstance::run(const Vamp::RealTime &blockTime)
930 { 930 {
931 static snd_seq_event_t localEventBuffer[EVENT_BUFFER_SIZE]; 931 static snd_seq_event_t localEventBuffer[EVENT_BUFFER_SIZE];
932 int evCount = 0; 932 int evCount = 0;
933 933
934 bool needLock = false; 934 bool needLock = false;
978 978
979 snd_seq_event_t *ev = localEventBuffer + evCount; 979 snd_seq_event_t *ev = localEventBuffer + evCount;
980 *ev = m_eventBuffer.peekOne(); 980 *ev = m_eventBuffer.peekOne();
981 bool accept = true; 981 bool accept = true;
982 982
983 RealTime evTime(ev->time.time.tv_sec, ev->time.time.tv_nsec); 983 Vamp::RealTime evTime(ev->time.time.tv_sec, ev->time.time.tv_nsec);
984 984
985 int frameOffset = 0; 985 int frameOffset = 0;
986 if (evTime > blockTime) { 986 if (evTime > blockTime) {
987 frameOffset = RealTime::realTime2Frame(evTime - blockTime, m_sampleRate); 987 frameOffset = Vamp::RealTime::realTime2Frame(evTime - blockTime, m_sampleRate);
988 } 988 }
989 989
990 #ifdef DEBUG_DSSI_PROCESS 990 #ifdef DEBUG_DSSI_PROCESS
991 std::cerr << "DSSIPluginInstance::run: evTime " << evTime << ", blockTime " << blockTime << ", frameOffset " << frameOffset 991 std::cerr << "DSSIPluginInstance::run: evTime " << evTime << ", blockTime " << blockTime << ", frameOffset " << frameOffset
992 << ", blockSize " << m_blockSize << std::endl; 992 << ", blockSize " << m_blockSize << std::endl;
1082 m_lastRunTime = blockTime; 1082 m_lastRunTime = blockTime;
1083 m_run = true; 1083 m_run = true;
1084 } 1084 }
1085 1085
1086 void 1086 void
1087 DSSIPluginInstance::runGrouped(const RealTime &blockTime) 1087 DSSIPluginInstance::runGrouped(const Vamp::RealTime &blockTime)
1088 { 1088 {
1089 // If something else in our group has just been called for this 1089 // If something else in our group has just been called for this
1090 // block time (but we haven't) then we should just write out the 1090 // block time (but we haven't) then we should just write out the
1091 // results and return; if we have just been called for this block 1091 // results and return; if we have just been called for this block
1092 // time or nothing else in the group has been, we should run the 1092 // time or nothing else in the group has been, we should run the
1154 1154
1155 snd_seq_event_t *ev = m_groupLocalEventBuffers[index] + counts[index]; 1155 snd_seq_event_t *ev = m_groupLocalEventBuffers[index] + counts[index];
1156 *ev = instance->m_eventBuffer.peekOne(); 1156 *ev = instance->m_eventBuffer.peekOne();
1157 bool accept = true; 1157 bool accept = true;
1158 1158
1159 RealTime evTime(ev->time.time.tv_sec, ev->time.time.tv_nsec); 1159 Vamp::RealTime evTime(ev->time.time.tv_sec, ev->time.time.tv_nsec);
1160 1160
1161 int frameOffset = 0; 1161 int frameOffset = 0;
1162 if (evTime > blockTime) { 1162 if (evTime > blockTime) {
1163 frameOffset = RealTime::realTime2Frame(evTime - blockTime, m_sampleRate); 1163 frameOffset = Vamp::RealTime::realTime2Frame(evTime - blockTime, m_sampleRate);
1164 } 1164 }
1165 1165
1166 #ifdef DEBUG_DSSI_PROCESS 1166 #ifdef DEBUG_DSSI_PROCESS
1167 std::cerr << "DSSIPluginInstance::runGrouped: evTime " << evTime << ", frameOffset " << frameOffset 1167 std::cerr << "DSSIPluginInstance::runGrouped: evTime " << evTime << ", frameOffset " << frameOffset
1168 << ", block size " << m_blockSize << std::endl; 1168 << ", block size " << m_blockSize << std::endl;