mirror of
https://github.com/tildearrow/furnace.git
synced 2024-11-23 21:15:11 +00:00
GUI: more to it
This commit is contained in:
parent
277396ff44
commit
dfc8706f5a
2 changed files with 7 additions and 6 deletions
|
@ -23,6 +23,7 @@
|
||||||
#include "imgui_internal.h"
|
#include "imgui_internal.h"
|
||||||
|
|
||||||
#define FURNACE_FFT_SIZE 8192
|
#define FURNACE_FFT_SIZE 8192
|
||||||
|
#define FURNACE_FFT_RATE 80.0
|
||||||
|
|
||||||
void FurnaceGUI::drawChanOsc() {
|
void FurnaceGUI::drawChanOsc() {
|
||||||
if (nextWindow==GUI_WINDOW_CHAN_OSC) {
|
if (nextWindow==GUI_WINDOW_CHAN_OSC) {
|
||||||
|
@ -128,7 +129,7 @@ void FurnaceGUI::drawChanOsc() {
|
||||||
} else {
|
} else {
|
||||||
unsigned short needlePos=buf->needle;
|
unsigned short needlePos=buf->needle;
|
||||||
if (chanOscWaveCorr) {
|
if (chanOscWaveCorr) {
|
||||||
double fftDataRate=(FURNACE_FFT_SIZE*80.0)/((double)buf->rate);
|
double fftDataRate=(FURNACE_FFT_SIZE*FURNACE_FFT_RATE)/((double)buf->rate);
|
||||||
while (buf->readNeedle!=needlePos) {
|
while (buf->readNeedle!=needlePos) {
|
||||||
fft->inBufPosFrac+=fftDataRate;
|
fft->inBufPosFrac+=fftDataRate;
|
||||||
while (fft->inBufPosFrac>=1.0) {
|
while (fft->inBufPosFrac>=1.0) {
|
||||||
|
@ -149,7 +150,7 @@ void FurnaceGUI::drawChanOsc() {
|
||||||
for (unsigned short i=1; i<512; i++) {
|
for (unsigned short i=1; i<512; i++) {
|
||||||
fftw_complex& f=fft->outBuf[i];
|
fftw_complex& f=fft->outBuf[i];
|
||||||
// AMPLITUDE
|
// AMPLITUDE
|
||||||
double amp=sqrt(pow(f[0],2.0)+pow(f[1],2.0))/(double)i;
|
double amp=sqrt(pow(f[0],2.0)+pow(f[1],2.0))/pow((double)i,0.8);
|
||||||
if (amp>candAmp) {
|
if (amp>candAmp) {
|
||||||
point=i;
|
point=i;
|
||||||
candAmp=amp;
|
candAmp=amp;
|
||||||
|
@ -158,10 +159,10 @@ void FurnaceGUI::drawChanOsc() {
|
||||||
|
|
||||||
// PHASE
|
// PHASE
|
||||||
fftw_complex& candPoint=fft->outBuf[point];
|
fftw_complex& candPoint=fft->outBuf[point];
|
||||||
double phase=((double)buf->rate/80.0)*(atan2(candPoint[1],candPoint[0])/(M_PI*4));
|
double phase=((double)buf->rate/(FURNACE_FFT_RATE*point))*(0.5+(atan2(candPoint[1],candPoint[0])/(M_PI*2)));
|
||||||
|
|
||||||
//printf("%d cphase: %f\n",ch,phase*((double)buf->rate/80.0));
|
//printf("%d cphase: %f\n",ch,phase*((double)buf->rate/FURNACE_FFT_RATE));
|
||||||
String cPhase=fmt::sprintf("%d cphase: %f\n",ch,phase);
|
String cPhase=fmt::sprintf("%d cphase: %f\n",point,phase);
|
||||||
dl->AddText(inRect.Min,0xffffffff,cPhase.c_str());
|
dl->AddText(inRect.Min,0xffffffff,cPhase.c_str());
|
||||||
|
|
||||||
needlePos=fft->needle;
|
needlePos=fft->needle;
|
||||||
|
|
|
@ -4435,7 +4435,7 @@ FurnaceGUI::FurnaceGUI():
|
||||||
oscZoomSlider(false),
|
oscZoomSlider(false),
|
||||||
chanOscCols(3),
|
chanOscCols(3),
|
||||||
chanOscWindowSize(20.0f),
|
chanOscWindowSize(20.0f),
|
||||||
chanOscWaveCorr(false),
|
chanOscWaveCorr(true),
|
||||||
followLog(true),
|
followLog(true),
|
||||||
#ifdef IS_MOBILE
|
#ifdef IS_MOBILE
|
||||||
pianoOctaves(7),
|
pianoOctaves(7),
|
||||||
|
|
Loading…
Reference in a new issue