mirror of
https://github.com/tildearrow/furnace.git
synced 2024-11-26 22:43:01 +00:00
GUI: add audio load meter to statistics
This commit is contained in:
parent
3d541682e6
commit
b8a2c90b61
4 changed files with 19 additions and 2 deletions
1
TODO.md
1
TODO.md
|
@ -28,6 +28,5 @@
|
|||
- store edit/followOrders/followPattern state in config
|
||||
- add ability to select a column by double clicking
|
||||
- add ability to move selection by dragging
|
||||
- settings: OK/Cancel buttons should be always visible
|
||||
- Apply button in settings
|
||||
- find and replace
|
|
@ -26,6 +26,7 @@
|
|||
#include "safeWriter.h"
|
||||
#include "../audio/taAudio.h"
|
||||
#include "blip_buf.h"
|
||||
#include <atomic>
|
||||
#include <functional>
|
||||
#include <initializer_list>
|
||||
#include <thread>
|
||||
|
@ -416,6 +417,7 @@ class DivEngine {
|
|||
float oscSize;
|
||||
int oscReadPos, oscWritePos;
|
||||
int tickMult;
|
||||
std::atomic<size_t> processTime;
|
||||
|
||||
void runExportThread();
|
||||
void nextBuf(float** in, float** out, int inChans, int outChans, unsigned int size);
|
||||
|
@ -923,7 +925,8 @@ class DivEngine {
|
|||
oscSize(1),
|
||||
oscReadPos(0),
|
||||
oscWritePos(0),
|
||||
tickMult(1) {
|
||||
tickMult(1),
|
||||
processTime(0) {
|
||||
memset(isMuted,0,DIV_MAX_CHANS*sizeof(bool));
|
||||
memset(keyHit,0,DIV_MAX_CHANS*sizeof(bool));
|
||||
memset(dispatchChanOfChan,0,DIV_MAX_CHANS*sizeof(int));
|
||||
|
|
|
@ -17,6 +17,7 @@
|
|||
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
|
||||
*/
|
||||
|
||||
#include <chrono>
|
||||
#define _USE_MATH_DEFINES
|
||||
#include "dispatch.h"
|
||||
#include "engine.h"
|
||||
|
@ -1060,6 +1061,8 @@ void DivEngine::nextBuf(float** in, float** out, int inChans, int outChans, unsi
|
|||
}
|
||||
got.bufsize=size;
|
||||
|
||||
std::chrono::steady_clock::time_point ts_processBegin=std::chrono::steady_clock::now();
|
||||
|
||||
// process MIDI events (TODO: everything)
|
||||
if (output) if (output->midiIn) while (!output->midiIn->queue.empty()) {
|
||||
TAMidiMessage& msg=output->midiIn->queue.front();
|
||||
|
@ -1338,4 +1341,8 @@ void DivEngine::nextBuf(float** in, float** out, int inChans, int outChans, unsi
|
|||
}
|
||||
}
|
||||
isBusy.unlock();
|
||||
|
||||
std::chrono::steady_clock::time_point ts_processEnd=std::chrono::steady_clock::now();
|
||||
|
||||
processTime=std::chrono::duration_cast<std::chrono::nanoseconds>(ts_processEnd-ts_processBegin).count();
|
||||
}
|
||||
|
|
|
@ -19,6 +19,7 @@
|
|||
|
||||
#include "gui.h"
|
||||
#include <fmt/printf.h>
|
||||
#include <imgui.h>
|
||||
|
||||
void FurnaceGUI::drawStats() {
|
||||
if (nextWindow==GUI_WINDOW_STATS) {
|
||||
|
@ -28,6 +29,13 @@ void FurnaceGUI::drawStats() {
|
|||
}
|
||||
if (!statsOpen) return;
|
||||
if (ImGui::Begin("Statistics",&statsOpen)) {
|
||||
size_t lastProcTime=e->processTime;
|
||||
double maxGot=1000000000.0*(double)e->getAudioDescGot().bufsize/(double)e->getAudioDescGot().rate;
|
||||
String procStr=fmt::sprintf("%.1f%%",100.0*((double)lastProcTime/(double)maxGot));
|
||||
ImGui::Text("Audio load");
|
||||
ImGui::SameLine();
|
||||
ImGui::ProgressBar((double)lastProcTime/maxGot,ImVec2(-FLT_MIN,0),procStr.c_str());
|
||||
ImGui::Separator();
|
||||
for (int i=0; i<e->song.systemLen; i++) {
|
||||
DivDispatch* dispatch=e->getDispatch(i);
|
||||
for (int j=0; dispatch!=NULL && dispatch->getSampleMemCapacity(j)>0; j++) {
|
||||
|
|
Loading…
Reference in a new issue