PortMonitor.cxx
Go to the documentation of this file.00001 #include "PortMonitor.hxx"
00002 #include "ProcessingFactory.hxx"
00003
00004 namespace CLAM
00005 {
00006
00007 template <>
00008 bool PortMonitor<Audio,AudioInPort>::Do()
00009 {
00010 if(!AbleToExecute()) return true;
00011 unsigned whichDataToWrite = mWhichDataToRead?0:1;
00012 mData[whichDataToWrite] = mInput.GetAudio();
00013 mSigNewData.Emit();
00014 {
00015 TryMutex::ScopedTryLock lock(mSwitchMutex,true);
00016 if (lock.Locked())
00017 mWhichDataToRead = whichDataToWrite;
00018 }
00019 mInput.Consume();
00020 return true;
00021 }
00022
00023 template <>
00024 PortMonitor<Audio,AudioInPort>::PortMonitor(const Config& cfg)
00025 : mInput("Input", this)
00026 , mWhichDataToRead(0)
00027 {
00028 Configure(cfg);
00029 }
00030 #ifndef QT_PLUGIN
00031 static const char * metadataPeaks[] = {
00032 "key", "PeaksPortMonitor",
00033
00034
00035 0
00036 };
00037 static FactoryRegistrator<ProcessingFactory, PeaksPortMonitor> regPeaks = metadataPeaks;
00038
00039 static const char * metadataSpectrum[] = {
00040 "key", "SpectrumPortMonitor",
00041
00042
00043 0
00044 };
00045 static FactoryRegistrator<ProcessingFactory, SpectrumPortMonitor> regSpectrum = metadataSpectrum;
00046
00047 static const char * metadataAudio[] = {
00048 "key", "AudioPortMonitor",
00049
00050
00051 0
00052 };
00053 static FactoryRegistrator<ProcessingFactory, AudioPortMonitor> regAudio = metadataAudio;
00054
00055 static const char * metadataFundamental[] = {
00056 "key", "FundamentalPortMonitor",
00057
00058
00059 0
00060 };
00061 static FactoryRegistrator<ProcessingFactory, FundamentalPortMonitor> regFundamental = metadataFundamental;
00062
00063 static const char * metadataAudioBuff[] = {
00064 "key", "AudioBuffPortMonitor",
00065
00066
00067 0
00068 };
00069 static FactoryRegistrator<ProcessingFactory, AudioBuffPortMonitor> regAudioBuff = metadataAudioBuff;
00070
00071 static const char * metadataSpecgram[] = {
00072 "key", "SpecgramPortMonitor",
00073
00074
00075 0
00076 };
00077 static FactoryRegistrator<ProcessingFactory, SpecgramPortMonitor> regSpecgram = metadataSpecgram;
00078
00079 static const char * metadataFundTrack[] = {
00080 "key", "FundTrackPortMonitor",
00081
00082
00083 0
00084 };
00085 static FactoryRegistrator<ProcessingFactory, FundTrackPortMonitor> regFundTrack = metadataFundTrack;
00086
00087 static const char * metadataSinTracks[] = {
00088 "key", "SinTracksPortMonitor",
00089
00090
00091 0
00092 };
00093 static FactoryRegistrator<ProcessingFactory, SinTracksPortMonitor> regSinTracks = metadataSinTracks;
00094 #endif
00095
00096 }
00097