annotate data/midi/MIDIInput.h @ 1196:c7b9c902642f spectrogram-minor-refactor

Fix threshold in spectrogram -- it wasn't working in the last release. There is a new protocol for this. Formerly the threshold parameter had a range from -50dB to 0 with the default at -50, and -50 treated internally as "no threshold". However, there was a hardcoded, hidden internal threshold for spectrogram colour mapping at -80dB with anything below this being rounded to zero. Now the threshold parameter has range -81 to -1 with the default at -80, -81 is treated internally as "no threshold", and there is no hidden internal threshold. So the default behaviour is the same as before, an effective -80dB threshold, but it is now possible to change this in both directions. Sessions reloaded from prior versions may look slightly different because, if the session says there should be no threshold, there will now actually be no threshold instead of having the hidden internal one. Still need to do something in the UI to make it apparent that the -81dB setting removes the threshold entirely. This is at least no worse than the previous, also obscured, magic -50dB setting.
author Chris Cannam
date Mon, 01 Aug 2016 16:21:01 +0100
parents 59e7fe1b1003
children ad5f892c0c4d
rev   line source
Chris@559 1 /* -*- c-basic-offset: 4 indent-tabs-mode: nil -*- vi:set ts=8 sts=4 sw=4: */
Chris@559 2
Chris@559 3 /*
Chris@559 4 Sonic Visualiser
Chris@559 5 An audio file viewer and annotation editor.
Chris@559 6 Centre for Digital Music, Queen Mary, University of London.
Chris@559 7 This file copyright 2006-2009 Chris Cannam and QMUL.
Chris@559 8
Chris@559 9 This program is free software; you can redistribute it and/or
Chris@559 10 modify it under the terms of the GNU General Public License as
Chris@559 11 published by the Free Software Foundation; either version 2 of the
Chris@559 12 License, or (at your option) any later version. See the file
Chris@559 13 COPYING included with this distribution for more information.
Chris@559 14 */
Chris@559 15
Chris@559 16 #ifndef _MIDI_INPUT_H_
Chris@559 17 #define _MIDI_INPUT_H_
Chris@559 18
Chris@559 19 #include <QObject>
Chris@559 20 #include "MIDIEvent.h"
Chris@559 21
Chris@560 22 #include <vector>
Chris@560 23 #include "base/RingBuffer.h"
Chris@567 24 #include "base/FrameTimer.h"
Chris@560 25
Chris@561 26 class RtMidiIn;
Chris@559 27
Chris@559 28 class MIDIInput : public QObject
Chris@559 29 {
Chris@559 30 Q_OBJECT
Chris@559 31
Chris@559 32 public:
Chris@567 33 MIDIInput(QString name, FrameTimer *timer);
Chris@559 34 virtual ~MIDIInput();
Chris@559 35
Chris@561 36 bool isOK() const { return m_rtmidi != 0; }
Chris@559 37
Chris@559 38 bool isEmpty() const { return getEventsAvailable() == 0; }
Chris@929 39 int getEventsAvailable() const { return m_buffer.getReadSpace(); }
Chris@559 40 MIDIEvent readEvent();
Chris@559 41
Chris@559 42 signals:
Chris@559 43 void eventsAvailable();
Chris@559 44
Chris@559 45 protected:
Chris@561 46 RtMidiIn *m_rtmidi;
Chris@567 47 FrameTimer *m_frameTimer;
Chris@559 48
Chris@561 49 static void staticCallback(double, std::vector<unsigned char> *, void *);
Chris@559 50 void callback(double, std::vector<unsigned char> *);
Chris@559 51
Chris@559 52 void postEvent(MIDIEvent);
Chris@559 53 RingBuffer<MIDIEvent *> m_buffer;
Chris@559 54 };
Chris@559 55
Chris@559 56 #endif
Chris@559 57