mirror of
https://gitlab.com/then-try-this/samplebrain.git
synced 2025-05-12 10:37:20 +00:00
interface rework, started record stuff, exit crash fix
This commit is contained in:
parent
37eba6d3e1
commit
20b9b3d112
@ -7,14 +7,14 @@
|
||||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>724</width>
|
||||
<height>603</height>
|
||||
<height>613</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="windowTitle">
|
||||
<string>samplebrain 0.0.3</string>
|
||||
<string>samplebrain 0.0.4</string>
|
||||
</property>
|
||||
<widget class="QWidget" name="centralwidget">
|
||||
<layout class="QHBoxLayout" name="horizontalLayout">
|
||||
<layout class="QVBoxLayout" name="verticalLayout_7">
|
||||
<item>
|
||||
<widget class="QTabWidget" name="tabWidget">
|
||||
<property name="font">
|
||||
@ -49,41 +49,6 @@
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<layout class="QHBoxLayout" name="horizontalLayout_12">
|
||||
<item>
|
||||
<widget class="QPushButton" name="pushButtonPlay">
|
||||
<property name="font">
|
||||
<font>
|
||||
<family>Comic Sans MS</family>
|
||||
<weight>75</weight>
|
||||
<bold>true</bold>
|
||||
</font>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Start</string>
|
||||
</property>
|
||||
<property name="flat">
|
||||
<bool>false</bool>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QPushButton" name="pushButtonStop">
|
||||
<property name="font">
|
||||
<font>
|
||||
<family>Comic Sans MS</family>
|
||||
<weight>75</weight>
|
||||
<bold>true</bold>
|
||||
</font>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Stop</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
<item>
|
||||
<layout class="QHBoxLayout" name="horizontalLayout_16">
|
||||
<item>
|
||||
@ -101,27 +66,24 @@
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QDial" name="dialRatio">
|
||||
<property name="enabled">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="Preferred" vsizetype="Preferred">
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<property name="minimumSize">
|
||||
<size>
|
||||
<width>60</width>
|
||||
<height>60</height>
|
||||
</size>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QSlider" name="sliderRatio">
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="Preferred" vsizetype="Fixed">
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<property name="value">
|
||||
<number>50</number>
|
||||
</property>
|
||||
<property name="orientation">
|
||||
<enum>Qt::Horizontal</enum>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QDoubleSpinBox" name="doubleSpinBoxRatio">
|
||||
<property name="maximum">
|
||||
@ -263,44 +225,18 @@
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QLabel" name="label_13">
|
||||
<property name="font">
|
||||
<font>
|
||||
<family>Comic Sans MS</family>
|
||||
<weight>75</weight>
|
||||
<bold>true</bold>
|
||||
</font>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Volume</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<layout class="QHBoxLayout" name="horizontalLayout_17">
|
||||
<item>
|
||||
<widget class="QDial" name="dialVolume">
|
||||
<property name="value">
|
||||
<number>99</number>
|
||||
<spacer name="verticalSpacer_3">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Vertical</enum>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QPushButton" name="pushButtonRestartAudio">
|
||||
<property name="font">
|
||||
<font>
|
||||
<family>Comic Sans MS</family>
|
||||
<weight>75</weight>
|
||||
<bold>true</bold>
|
||||
</font>
|
||||
<property name="sizeHint" stdset="0">
|
||||
<size>
|
||||
<width>20</width>
|
||||
<height>40</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>restart audio</string>
|
||||
</property>
|
||||
</widget>
|
||||
</spacer>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
@ -792,13 +728,143 @@
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
<widget class="QWidget" name="logTab">
|
||||
<attribute name="title">
|
||||
<string>log</string>
|
||||
</attribute>
|
||||
<layout class="QHBoxLayout" name="horizontalLayout_15">
|
||||
<item>
|
||||
<widget class="QPlainTextEdit" name="plainTextEdit"/>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<layout class="QHBoxLayout" name="horizontalLayout_12">
|
||||
<item>
|
||||
<widget class="QPushButton" name="pushButtonPlay">
|
||||
<property name="font">
|
||||
<font>
|
||||
<family>Comic Sans MS</family>
|
||||
<weight>75</weight>
|
||||
<bold>true</bold>
|
||||
</font>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string/>
|
||||
</property>
|
||||
<property name="icon">
|
||||
<iconset resource="../qt/samplebrain.qrc">
|
||||
<normaloff>:/images/images/play.png</normaloff>:/images/images/play.png</iconset>
|
||||
</property>
|
||||
<property name="iconSize">
|
||||
<size>
|
||||
<width>64</width>
|
||||
<height>64</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="flat">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QPushButton" name="pushButtonStop">
|
||||
<property name="font">
|
||||
<font>
|
||||
<family>Comic Sans MS</family>
|
||||
<weight>75</weight>
|
||||
<bold>true</bold>
|
||||
</font>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string/>
|
||||
</property>
|
||||
<property name="icon">
|
||||
<iconset resource="../qt/samplebrain.qrc">
|
||||
<normaloff>:/images/images/pause.png</normaloff>:/images/images/pause.png</iconset>
|
||||
</property>
|
||||
<property name="iconSize">
|
||||
<size>
|
||||
<width>64</width>
|
||||
<height>64</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="flat">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QPushButton" name="pushButtonRecord">
|
||||
<property name="text">
|
||||
<string/>
|
||||
</property>
|
||||
<property name="icon">
|
||||
<iconset resource="../qt/samplebrain.qrc">
|
||||
<normaloff>:/images/images/record.png</normaloff>:/images/images/record.png</iconset>
|
||||
</property>
|
||||
<property name="iconSize">
|
||||
<size>
|
||||
<width>64</width>
|
||||
<height>64</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="flat">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QPushButton" name="pushButtonStopRecord">
|
||||
<property name="text">
|
||||
<string/>
|
||||
</property>
|
||||
<property name="icon">
|
||||
<iconset resource="../qt/samplebrain.qrc">
|
||||
<normaloff>:/images/images/stop.png</normaloff>:/images/images/stop.png</iconset>
|
||||
</property>
|
||||
<property name="iconSize">
|
||||
<size>
|
||||
<width>64</width>
|
||||
<height>64</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="flat">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<spacer name="horizontalSpacer">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Horizontal</enum>
|
||||
</property>
|
||||
<property name="sizeHint" stdset="0">
|
||||
<size>
|
||||
<width>40</width>
|
||||
<height>20</height>
|
||||
</size>
|
||||
</property>
|
||||
</spacer>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QDial" name="dialVolume">
|
||||
<property name="value">
|
||||
<number>99</number>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
<widget class="QStatusBar" name="statusbar"/>
|
||||
</widget>
|
||||
<resources/>
|
||||
<resources>
|
||||
<include location="../qt/samplebrain.qrc"/>
|
||||
</resources>
|
||||
<connections>
|
||||
<connection>
|
||||
<sender>pushButtonPlay</sender>
|
||||
@ -832,22 +898,6 @@
|
||||
</hint>
|
||||
</hints>
|
||||
</connection>
|
||||
<connection>
|
||||
<sender>dialRatio</sender>
|
||||
<signal>sliderMoved(int)</signal>
|
||||
<receiver>MainWindow</receiver>
|
||||
<slot>ratio_slot(int)</slot>
|
||||
<hints>
|
||||
<hint type="sourcelabel">
|
||||
<x>109</x>
|
||||
<y>154</y>
|
||||
</hint>
|
||||
<hint type="destinationlabel">
|
||||
<x>399</x>
|
||||
<y>301</y>
|
||||
</hint>
|
||||
</hints>
|
||||
</connection>
|
||||
<connection>
|
||||
<sender>doubleSpinBoxRatio</sender>
|
||||
<signal>valueChanged(double)</signal>
|
||||
@ -1104,22 +1154,6 @@
|
||||
</hint>
|
||||
</hints>
|
||||
</connection>
|
||||
<connection>
|
||||
<sender>pushButtonRestartAudio</sender>
|
||||
<signal>released()</signal>
|
||||
<receiver>MainWindow</receiver>
|
||||
<slot>restart_audio()</slot>
|
||||
<hints>
|
||||
<hint type="sourcelabel">
|
||||
<x>274</x>
|
||||
<y>533</y>
|
||||
</hint>
|
||||
<hint type="destinationlabel">
|
||||
<x>361</x>
|
||||
<y>301</y>
|
||||
</hint>
|
||||
</hints>
|
||||
</connection>
|
||||
<connection>
|
||||
<sender>radioButton_bartlett</sender>
|
||||
<signal>toggled(bool)</signal>
|
||||
@ -1376,6 +1410,54 @@
|
||||
</hint>
|
||||
</hints>
|
||||
</connection>
|
||||
<connection>
|
||||
<sender>sliderRatio</sender>
|
||||
<signal>valueChanged(int)</signal>
|
||||
<receiver>MainWindow</receiver>
|
||||
<slot>ratio_slot(int)</slot>
|
||||
<hints>
|
||||
<hint type="sourcelabel">
|
||||
<x>189</x>
|
||||
<y>141</y>
|
||||
</hint>
|
||||
<hint type="destinationlabel">
|
||||
<x>361</x>
|
||||
<y>306</y>
|
||||
</hint>
|
||||
</hints>
|
||||
</connection>
|
||||
<connection>
|
||||
<sender>pushButtonStop</sender>
|
||||
<signal>released()</signal>
|
||||
<receiver>MainWindow</receiver>
|
||||
<slot>stop_record()</slot>
|
||||
<hints>
|
||||
<hint type="sourcelabel">
|
||||
<x>144</x>
|
||||
<y>543</y>
|
||||
</hint>
|
||||
<hint type="destinationlabel">
|
||||
<x>361</x>
|
||||
<y>306</y>
|
||||
</hint>
|
||||
</hints>
|
||||
</connection>
|
||||
<connection>
|
||||
<sender>pushButtonRecord</sender>
|
||||
<signal>released()</signal>
|
||||
<receiver>MainWindow</receiver>
|
||||
<slot>record()</slot>
|
||||
<hints>
|
||||
<hint type="sourcelabel">
|
||||
<x>236</x>
|
||||
<y>543</y>
|
||||
</hint>
|
||||
<hint type="destinationlabel">
|
||||
<x>361</x>
|
||||
<y>306</y>
|
||||
</hint>
|
||||
</hints>
|
||||
</connection>
|
||||
</connections>
|
||||
<slots>
|
||||
<slot>play_slot()</slot>
|
||||
@ -1417,5 +1499,7 @@
|
||||
<slot>window_target_hamming(bool)</slot>
|
||||
<slot>window_target_hann(bool)</slot>
|
||||
<slot>window_target_rectangle(bool)</slot>
|
||||
<slot>record()</slot>
|
||||
<slot>stop_record()</slot>
|
||||
</slots>
|
||||
</ui>
|
||||
|
@ -12,4 +12,6 @@ MainWindow::MainWindow()
|
||||
|
||||
m_audio_address = lo_address_new_from_url("osc.udp://localhost:8888");
|
||||
m_process_address = lo_address_new_from_url("osc.udp://localhost:8889");
|
||||
m_save_wav="";
|
||||
m_record_id=0;
|
||||
}
|
||||
|
@ -3,6 +3,7 @@
|
||||
|
||||
#include <iostream>
|
||||
#include <lo/lo.h>
|
||||
#include <string>
|
||||
#include "window.h"
|
||||
|
||||
using namespace std;
|
||||
@ -22,7 +23,7 @@ protected:
|
||||
private slots:
|
||||
|
||||
void play_slot() { lo_send(m_audio_address,"/start",""); }
|
||||
void stop_slot() { lo_send(m_audio_address,"/stop",""); }
|
||||
void stop_slot() { lo_send(m_audio_address,"/pause",""); }
|
||||
void ratio_slot(int s) { lo_send(m_audio_address,"/ratio","f",s/100.0f); }
|
||||
void ratio_slot(double s) { lo_send(m_audio_address,"/ratio","f",s); }
|
||||
void fft1_start_slot(int s) { lo_send(m_audio_address,"/fft1_start","i",s); }
|
||||
@ -91,7 +92,36 @@ private slots:
|
||||
void window_target_hann(bool s) { if (s) lo_send(m_process_address,"/target_window_type","i",window::HANN); }
|
||||
void window_target_rectangle(bool s) { if (s) lo_send(m_process_address,"/target_window_type","i",window::RECTANGLE); }
|
||||
|
||||
void record() {
|
||||
if (m_save_wav=="") {
|
||||
QString s=QFileDialog::getSaveFileName(
|
||||
this,
|
||||
QString("Select an wav file"),
|
||||
".",
|
||||
QString("Sounds (*.wav)"));
|
||||
m_save_wav = s.toStdString();
|
||||
// chop off .wav
|
||||
size_t pos = m_save_wav.find_last_of(".");
|
||||
if (pos!=string::npos) {
|
||||
m_save_wav = m_save_wav.substr(0,pos);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
char fn[1024];
|
||||
snprintf(fn,1024,"%s-%i.wav",m_save_wav.c_str(),m_record_id);
|
||||
lo_send(m_process_address,"/record","s",fn);
|
||||
cerr<<fn<<endl;
|
||||
m_record_id++;
|
||||
}
|
||||
|
||||
void stop_record() {
|
||||
lo_send(m_process_address,"/stop","");
|
||||
}
|
||||
|
||||
private:
|
||||
string m_save_wav;
|
||||
u32 m_record_id;
|
||||
Ui_MainWindow m_Ui;
|
||||
lo_address m_audio_address;
|
||||
lo_address m_process_address;
|
||||
|
@ -1,6 +1,6 @@
|
||||
#############################################################################
|
||||
# Makefile for building: samplebrain
|
||||
# Generated by qmake (2.01a) (Qt 4.8.1) on: Tue Jul 14 18:13:16 2015
|
||||
# Generated by qmake (2.01a) (Qt 4.8.1) on: Sun Jul 19 11:22:53 2015
|
||||
# Project: samplebrain.pro
|
||||
# Template: app
|
||||
# Command: /usr/bin/qmake -o Makefile samplebrain.pro
|
||||
@ -46,12 +46,14 @@ OBJECTS_DIR = ./
|
||||
SOURCES = MainWindow.cpp \
|
||||
audio_thread.cpp \
|
||||
process_thread.cpp \
|
||||
qtmain.cpp moc_MainWindow.cpp
|
||||
qtmain.cpp moc_MainWindow.cpp \
|
||||
qrc_samplebrain.cpp
|
||||
OBJECTS = MainWindow.o \
|
||||
audio_thread.o \
|
||||
process_thread.o \
|
||||
qtmain.o \
|
||||
moc_MainWindow.o
|
||||
moc_MainWindow.o \
|
||||
qrc_samplebrain.o
|
||||
DIST = /usr/share/qt4/mkspecs/common/unix.conf \
|
||||
/usr/share/qt4/mkspecs/common/linux.conf \
|
||||
/usr/share/qt4/mkspecs/common/gcc-base.conf \
|
||||
@ -166,7 +168,7 @@ qmake: FORCE
|
||||
|
||||
dist:
|
||||
@$(CHK_DIR_EXISTS) .tmp/samplebrain1.0.0 || $(MKDIR) .tmp/samplebrain1.0.0
|
||||
$(COPY_FILE) --parents $(SOURCES) $(DIST) .tmp/samplebrain1.0.0/ && $(COPY_FILE) --parents MainWindow.h generated/ui_samplebrain.h .tmp/samplebrain1.0.0/ && $(COPY_FILE) --parents MainWindow.cpp audio_thread.cpp process_thread.cpp qtmain.cpp .tmp/samplebrain1.0.0/ && (cd `dirname .tmp/samplebrain1.0.0` && $(TAR) samplebrain1.0.0.tar samplebrain1.0.0 && $(COMPRESS) samplebrain1.0.0.tar) && $(MOVE) `dirname .tmp/samplebrain1.0.0`/samplebrain1.0.0.tar.gz . && $(DEL_FILE) -r .tmp/samplebrain1.0.0
|
||||
$(COPY_FILE) --parents $(SOURCES) $(DIST) .tmp/samplebrain1.0.0/ && $(COPY_FILE) --parents MainWindow.h generated/ui_samplebrain.h .tmp/samplebrain1.0.0/ && $(COPY_FILE) --parents samplebrain.qrc .tmp/samplebrain1.0.0/ && $(COPY_FILE) --parents MainWindow.cpp audio_thread.cpp process_thread.cpp qtmain.cpp .tmp/samplebrain1.0.0/ && (cd `dirname .tmp/samplebrain1.0.0` && $(TAR) samplebrain1.0.0.tar samplebrain1.0.0 && $(COMPRESS) samplebrain1.0.0.tar) && $(MOVE) `dirname .tmp/samplebrain1.0.0`/samplebrain1.0.0.tar.gz . && $(DEL_FILE) -r .tmp/samplebrain1.0.0
|
||||
|
||||
|
||||
clean:compiler_clean
|
||||
@ -194,8 +196,16 @@ moc_MainWindow.cpp: generated/ui_samplebrain.h \
|
||||
MainWindow.h
|
||||
/usr/bin/moc-qt4 $(DEFINES) $(INCPATH) MainWindow.h -o moc_MainWindow.cpp
|
||||
|
||||
compiler_rcc_make_all:
|
||||
compiler_rcc_make_all: qrc_samplebrain.cpp
|
||||
compiler_rcc_clean:
|
||||
-$(DEL_FILE) qrc_samplebrain.cpp
|
||||
qrc_samplebrain.cpp: samplebrain.qrc \
|
||||
images/stop.png \
|
||||
images/play.png \
|
||||
images/record.png \
|
||||
images/pause.png
|
||||
/usr/bin/rcc -name samplebrain samplebrain.qrc -o qrc_samplebrain.cpp
|
||||
|
||||
compiler_image_collection_make_all: qmake_image_collection.cpp
|
||||
compiler_image_collection_clean:
|
||||
-$(DEL_FILE) qmake_image_collection.cpp
|
||||
@ -209,7 +219,7 @@ compiler_yacc_impl_make_all:
|
||||
compiler_yacc_impl_clean:
|
||||
compiler_lex_make_all:
|
||||
compiler_lex_clean:
|
||||
compiler_clean: compiler_moc_header_clean
|
||||
compiler_clean: compiler_moc_header_clean compiler_rcc_clean
|
||||
|
||||
####### Compile
|
||||
|
||||
@ -233,6 +243,9 @@ qtmain.o: qtmain.cpp MainWindow.h \
|
||||
moc_MainWindow.o: moc_MainWindow.cpp
|
||||
$(CXX) -c $(CXXFLAGS) $(INCPATH) -o moc_MainWindow.o moc_MainWindow.cpp
|
||||
|
||||
qrc_samplebrain.o: qrc_samplebrain.cpp
|
||||
$(CXX) -c $(CXXFLAGS) $(INCPATH) -o qrc_samplebrain.o qrc_samplebrain.cpp
|
||||
|
||||
####### Install
|
||||
|
||||
install: FORCE
|
||||
|
@ -17,6 +17,11 @@ audio_thread::audio_thread(process_thread &p) :
|
||||
m_osc.run();
|
||||
}
|
||||
|
||||
audio_thread::~audio_thread() {
|
||||
delete m_renderer;
|
||||
if (m_audio_device!=NULL) delete m_audio_device;
|
||||
}
|
||||
|
||||
void audio_thread::start_audio() {
|
||||
if (m_audio_device!=NULL) delete m_audio_device;
|
||||
m_audio_device = new audio_device("samplebrain",44100,2048);
|
||||
@ -39,7 +44,7 @@ void audio_thread::process(sample &s, sample &s2) {
|
||||
if (name=="/start") {
|
||||
m_renderer->set_playing(true);
|
||||
}
|
||||
if (name=="/stop") {
|
||||
if (name=="/pause") {
|
||||
m_renderer->set_playing(false);
|
||||
}
|
||||
if (name=="/ratio") {
|
||||
|
@ -10,6 +10,8 @@ namespace spiralcore {
|
||||
class audio_thread {
|
||||
public:
|
||||
audio_thread(process_thread &p);
|
||||
~audio_thread();
|
||||
|
||||
void process(sample &left, sample &right);
|
||||
|
||||
static void run_audio(void* c, unsigned int frames);
|
||||
|
@ -1,14 +1,14 @@
|
||||
/********************************************************************************
|
||||
** Form generated from reading UI file 'samplebrainSB4993.ui'
|
||||
** Form generated from reading UI file 'samplebrainMg4993.ui'
|
||||
**
|
||||
** Created: Sat Jul 18 19:57:06 2015
|
||||
** Created: Sun Jul 19 11:35:24 2015
|
||||
** by: Qt User Interface Compiler version 4.8.1
|
||||
**
|
||||
** WARNING! All changes made in this file will be lost when recompiling UI file!
|
||||
********************************************************************************/
|
||||
|
||||
#ifndef SAMPLEBRAINSB4993_H
|
||||
#define SAMPLEBRAINSB4993_H
|
||||
#ifndef SAMPLEBRAINMG4993_H
|
||||
#define SAMPLEBRAINMG4993_H
|
||||
|
||||
#include <QtCore/QVariant>
|
||||
#include <QtGui/QAction>
|
||||
@ -22,8 +22,10 @@
|
||||
#include <QtGui/QLabel>
|
||||
#include <QtGui/QListWidget>
|
||||
#include <QtGui/QMainWindow>
|
||||
#include <QtGui/QPlainTextEdit>
|
||||
#include <QtGui/QPushButton>
|
||||
#include <QtGui/QRadioButton>
|
||||
#include <QtGui/QSlider>
|
||||
#include <QtGui/QSpacerItem>
|
||||
#include <QtGui/QSpinBox>
|
||||
#include <QtGui/QStatusBar>
|
||||
@ -37,18 +39,15 @@ class Ui_MainWindow
|
||||
{
|
||||
public:
|
||||
QWidget *centralwidget;
|
||||
QHBoxLayout *horizontalLayout;
|
||||
QVBoxLayout *verticalLayout_7;
|
||||
QTabWidget *tabWidget;
|
||||
QWidget *controlTab;
|
||||
QHBoxLayout *horizontalLayout_8;
|
||||
QVBoxLayout *verticalLayout_3;
|
||||
QLabel *label_19;
|
||||
QHBoxLayout *horizontalLayout_12;
|
||||
QPushButton *pushButtonPlay;
|
||||
QPushButton *pushButtonStop;
|
||||
QHBoxLayout *horizontalLayout_16;
|
||||
QLabel *label_6;
|
||||
QDial *dialRatio;
|
||||
QSlider *sliderRatio;
|
||||
QDoubleSpinBox *doubleSpinBoxRatio;
|
||||
QVBoxLayout *verticalLayout_4;
|
||||
QLabel *label_7;
|
||||
@ -66,10 +65,7 @@ public:
|
||||
QHBoxLayout *horizontalLayout_11;
|
||||
QLabel *label_12;
|
||||
QSpinBox *spinBoxFFT2End;
|
||||
QLabel *label_13;
|
||||
QHBoxLayout *horizontalLayout_17;
|
||||
QDial *dialVolume;
|
||||
QPushButton *pushButtonRestartAudio;
|
||||
QSpacerItem *verticalSpacer_3;
|
||||
QVBoxLayout *verticalLayout_6;
|
||||
QLabel *label_16;
|
||||
QLabel *label_15;
|
||||
@ -124,17 +120,27 @@ public:
|
||||
QPushButton *pushButtonLoadSound;
|
||||
QPushButton *pushButtonDeleteSound;
|
||||
QPushButton *pushButtonClearBrain;
|
||||
QWidget *logTab;
|
||||
QHBoxLayout *horizontalLayout_15;
|
||||
QPlainTextEdit *plainTextEdit;
|
||||
QHBoxLayout *horizontalLayout_12;
|
||||
QPushButton *pushButtonPlay;
|
||||
QPushButton *pushButtonStop;
|
||||
QPushButton *pushButtonRecord;
|
||||
QPushButton *pushButtonStopRecord;
|
||||
QSpacerItem *horizontalSpacer;
|
||||
QDial *dialVolume;
|
||||
QStatusBar *statusbar;
|
||||
|
||||
void setupUi(QMainWindow *MainWindow)
|
||||
{
|
||||
if (MainWindow->objectName().isEmpty())
|
||||
MainWindow->setObjectName(QString::fromUtf8("MainWindow"));
|
||||
MainWindow->resize(724, 603);
|
||||
MainWindow->resize(724, 613);
|
||||
centralwidget = new QWidget(MainWindow);
|
||||
centralwidget->setObjectName(QString::fromUtf8("centralwidget"));
|
||||
horizontalLayout = new QHBoxLayout(centralwidget);
|
||||
horizontalLayout->setObjectName(QString::fromUtf8("horizontalLayout"));
|
||||
verticalLayout_7 = new QVBoxLayout(centralwidget);
|
||||
verticalLayout_7->setObjectName(QString::fromUtf8("verticalLayout_7"));
|
||||
tabWidget = new QTabWidget(centralwidget);
|
||||
tabWidget->setObjectName(QString::fromUtf8("tabWidget"));
|
||||
QFont font;
|
||||
@ -159,24 +165,6 @@ public:
|
||||
|
||||
verticalLayout_3->addWidget(label_19);
|
||||
|
||||
horizontalLayout_12 = new QHBoxLayout();
|
||||
horizontalLayout_12->setObjectName(QString::fromUtf8("horizontalLayout_12"));
|
||||
pushButtonPlay = new QPushButton(controlTab);
|
||||
pushButtonPlay->setObjectName(QString::fromUtf8("pushButtonPlay"));
|
||||
pushButtonPlay->setFont(font);
|
||||
pushButtonPlay->setFlat(false);
|
||||
|
||||
horizontalLayout_12->addWidget(pushButtonPlay);
|
||||
|
||||
pushButtonStop = new QPushButton(controlTab);
|
||||
pushButtonStop->setObjectName(QString::fromUtf8("pushButtonStop"));
|
||||
pushButtonStop->setFont(font);
|
||||
|
||||
horizontalLayout_12->addWidget(pushButtonStop);
|
||||
|
||||
|
||||
verticalLayout_3->addLayout(horizontalLayout_12);
|
||||
|
||||
horizontalLayout_16 = new QHBoxLayout();
|
||||
horizontalLayout_16->setObjectName(QString::fromUtf8("horizontalLayout_16"));
|
||||
label_6 = new QLabel(controlTab);
|
||||
@ -190,21 +178,21 @@ public:
|
||||
|
||||
horizontalLayout_16->addWidget(label_6);
|
||||
|
||||
dialRatio = new QDial(controlTab);
|
||||
dialRatio->setObjectName(QString::fromUtf8("dialRatio"));
|
||||
dialRatio->setEnabled(true);
|
||||
QSizePolicy sizePolicy(QSizePolicy::Preferred, QSizePolicy::Preferred);
|
||||
sizePolicy.setHorizontalStretch(0);
|
||||
sizePolicy.setVerticalStretch(0);
|
||||
sizePolicy.setHeightForWidth(dialRatio->sizePolicy().hasHeightForWidth());
|
||||
dialRatio->setSizePolicy(sizePolicy);
|
||||
dialRatio->setMinimumSize(QSize(60, 60));
|
||||
|
||||
horizontalLayout_16->addWidget(dialRatio);
|
||||
|
||||
|
||||
verticalLayout_3->addLayout(horizontalLayout_16);
|
||||
|
||||
sliderRatio = new QSlider(controlTab);
|
||||
sliderRatio->setObjectName(QString::fromUtf8("sliderRatio"));
|
||||
QSizePolicy sizePolicy(QSizePolicy::Preferred, QSizePolicy::Fixed);
|
||||
sizePolicy.setHorizontalStretch(0);
|
||||
sizePolicy.setVerticalStretch(0);
|
||||
sizePolicy.setHeightForWidth(sliderRatio->sizePolicy().hasHeightForWidth());
|
||||
sliderRatio->setSizePolicy(sizePolicy);
|
||||
sliderRatio->setValue(50);
|
||||
sliderRatio->setOrientation(Qt::Horizontal);
|
||||
|
||||
verticalLayout_3->addWidget(sliderRatio);
|
||||
|
||||
doubleSpinBoxRatio = new QDoubleSpinBox(controlTab);
|
||||
doubleSpinBoxRatio->setObjectName(QString::fromUtf8("doubleSpinBoxRatio"));
|
||||
doubleSpinBoxRatio->setMaximum(1);
|
||||
@ -298,32 +286,13 @@ public:
|
||||
|
||||
verticalLayout_5->addLayout(horizontalLayout_11);
|
||||
|
||||
verticalSpacer_3 = new QSpacerItem(20, 40, QSizePolicy::Minimum, QSizePolicy::Expanding);
|
||||
|
||||
verticalLayout_5->addItem(verticalSpacer_3);
|
||||
|
||||
|
||||
verticalLayout_3->addLayout(verticalLayout_5);
|
||||
|
||||
label_13 = new QLabel(controlTab);
|
||||
label_13->setObjectName(QString::fromUtf8("label_13"));
|
||||
label_13->setFont(font);
|
||||
|
||||
verticalLayout_3->addWidget(label_13);
|
||||
|
||||
horizontalLayout_17 = new QHBoxLayout();
|
||||
horizontalLayout_17->setObjectName(QString::fromUtf8("horizontalLayout_17"));
|
||||
dialVolume = new QDial(controlTab);
|
||||
dialVolume->setObjectName(QString::fromUtf8("dialVolume"));
|
||||
dialVolume->setValue(99);
|
||||
|
||||
horizontalLayout_17->addWidget(dialVolume);
|
||||
|
||||
pushButtonRestartAudio = new QPushButton(controlTab);
|
||||
pushButtonRestartAudio->setObjectName(QString::fromUtf8("pushButtonRestartAudio"));
|
||||
pushButtonRestartAudio->setFont(font);
|
||||
|
||||
horizontalLayout_17->addWidget(pushButtonRestartAudio);
|
||||
|
||||
|
||||
verticalLayout_3->addLayout(horizontalLayout_17);
|
||||
|
||||
|
||||
horizontalLayout_8->addLayout(verticalLayout_3);
|
||||
|
||||
@ -619,8 +588,75 @@ public:
|
||||
horizontalLayout_5->addLayout(verticalLayout);
|
||||
|
||||
tabWidget->addTab(sampleTab, QString());
|
||||
logTab = new QWidget();
|
||||
logTab->setObjectName(QString::fromUtf8("logTab"));
|
||||
horizontalLayout_15 = new QHBoxLayout(logTab);
|
||||
horizontalLayout_15->setObjectName(QString::fromUtf8("horizontalLayout_15"));
|
||||
plainTextEdit = new QPlainTextEdit(logTab);
|
||||
plainTextEdit->setObjectName(QString::fromUtf8("plainTextEdit"));
|
||||
|
||||
horizontalLayout->addWidget(tabWidget);
|
||||
horizontalLayout_15->addWidget(plainTextEdit);
|
||||
|
||||
tabWidget->addTab(logTab, QString());
|
||||
|
||||
verticalLayout_7->addWidget(tabWidget);
|
||||
|
||||
horizontalLayout_12 = new QHBoxLayout();
|
||||
horizontalLayout_12->setObjectName(QString::fromUtf8("horizontalLayout_12"));
|
||||
pushButtonPlay = new QPushButton(centralwidget);
|
||||
pushButtonPlay->setObjectName(QString::fromUtf8("pushButtonPlay"));
|
||||
pushButtonPlay->setFont(font);
|
||||
QIcon icon;
|
||||
icon.addFile(QString::fromUtf8(":/images/images/play.png"), QSize(), QIcon::Normal, QIcon::Off);
|
||||
pushButtonPlay->setIcon(icon);
|
||||
pushButtonPlay->setIconSize(QSize(64, 64));
|
||||
pushButtonPlay->setFlat(true);
|
||||
|
||||
horizontalLayout_12->addWidget(pushButtonPlay);
|
||||
|
||||
pushButtonStop = new QPushButton(centralwidget);
|
||||
pushButtonStop->setObjectName(QString::fromUtf8("pushButtonStop"));
|
||||
pushButtonStop->setFont(font);
|
||||
QIcon icon1;
|
||||
icon1.addFile(QString::fromUtf8(":/images/images/pause.png"), QSize(), QIcon::Normal, QIcon::Off);
|
||||
pushButtonStop->setIcon(icon1);
|
||||
pushButtonStop->setIconSize(QSize(64, 64));
|
||||
pushButtonStop->setFlat(true);
|
||||
|
||||
horizontalLayout_12->addWidget(pushButtonStop);
|
||||
|
||||
pushButtonRecord = new QPushButton(centralwidget);
|
||||
pushButtonRecord->setObjectName(QString::fromUtf8("pushButtonRecord"));
|
||||
QIcon icon2;
|
||||
icon2.addFile(QString::fromUtf8(":/images/images/record.png"), QSize(), QIcon::Normal, QIcon::Off);
|
||||
pushButtonRecord->setIcon(icon2);
|
||||
pushButtonRecord->setIconSize(QSize(64, 64));
|
||||
pushButtonRecord->setFlat(true);
|
||||
|
||||
horizontalLayout_12->addWidget(pushButtonRecord);
|
||||
|
||||
pushButtonStopRecord = new QPushButton(centralwidget);
|
||||
pushButtonStopRecord->setObjectName(QString::fromUtf8("pushButtonStopRecord"));
|
||||
QIcon icon3;
|
||||
icon3.addFile(QString::fromUtf8(":/images/images/stop.png"), QSize(), QIcon::Normal, QIcon::Off);
|
||||
pushButtonStopRecord->setIcon(icon3);
|
||||
pushButtonStopRecord->setIconSize(QSize(64, 64));
|
||||
pushButtonStopRecord->setFlat(true);
|
||||
|
||||
horizontalLayout_12->addWidget(pushButtonStopRecord);
|
||||
|
||||
horizontalSpacer = new QSpacerItem(40, 20, QSizePolicy::Expanding, QSizePolicy::Minimum);
|
||||
|
||||
horizontalLayout_12->addItem(horizontalSpacer);
|
||||
|
||||
dialVolume = new QDial(centralwidget);
|
||||
dialVolume->setObjectName(QString::fromUtf8("dialVolume"));
|
||||
dialVolume->setValue(99);
|
||||
|
||||
horizontalLayout_12->addWidget(dialVolume);
|
||||
|
||||
|
||||
verticalLayout_7->addLayout(horizontalLayout_12);
|
||||
|
||||
MainWindow->setCentralWidget(centralwidget);
|
||||
statusbar = new QStatusBar(MainWindow);
|
||||
@ -630,7 +666,6 @@ public:
|
||||
retranslateUi(MainWindow);
|
||||
QObject::connect(pushButtonPlay, SIGNAL(released()), MainWindow, SLOT(play_slot()));
|
||||
QObject::connect(pushButtonStop, SIGNAL(released()), MainWindow, SLOT(stop_slot()));
|
||||
QObject::connect(dialRatio, SIGNAL(sliderMoved(int)), MainWindow, SLOT(ratio_slot(int)));
|
||||
QObject::connect(doubleSpinBoxRatio, SIGNAL(valueChanged(double)), MainWindow, SLOT(ratio_slot(double)));
|
||||
QObject::connect(spinBoxFFT1Start, SIGNAL(valueChanged(int)), MainWindow, SLOT(fft1_start_slot(int)));
|
||||
QObject::connect(spinBoxFFT1End, SIGNAL(valueChanged(int)), MainWindow, SLOT(fft1_end_slot(int)));
|
||||
@ -647,7 +682,6 @@ public:
|
||||
QObject::connect(doubleSpinBoxBlockOverlapTarget, SIGNAL(valueChanged(double)), MainWindow, SLOT(target_block_overlap(double)));
|
||||
QObject::connect(pushButtonClearBrain, SIGNAL(released()), MainWindow, SLOT(clear_brain()));
|
||||
QObject::connect(pushButtonDeleteSound, SIGNAL(released()), MainWindow, SLOT(delete_sound()));
|
||||
QObject::connect(pushButtonRestartAudio, SIGNAL(released()), MainWindow, SLOT(restart_audio()));
|
||||
QObject::connect(radioButton_bartlett, SIGNAL(toggled(bool)), MainWindow, SLOT(window_bartlett(bool)));
|
||||
QObject::connect(radioButton_blackman, SIGNAL(toggled(bool)), MainWindow, SLOT(window_blackman(bool)));
|
||||
QObject::connect(radioButton_dodgy, SIGNAL(toggled(bool)), MainWindow, SLOT(window_dodgy(bool)));
|
||||
@ -664,6 +698,9 @@ public:
|
||||
QObject::connect(radioButton_hammingTarget, SIGNAL(toggled(bool)), MainWindow, SLOT(window_target_hamming(bool)));
|
||||
QObject::connect(radioButton_hannTarget, SIGNAL(toggled(bool)), MainWindow, SLOT(window_target_hann(bool)));
|
||||
QObject::connect(radioButton_rectangleTarget, SIGNAL(toggled(bool)), MainWindow, SLOT(window_target_rectangle(bool)));
|
||||
QObject::connect(sliderRatio, SIGNAL(valueChanged(int)), MainWindow, SLOT(ratio_slot(int)));
|
||||
QObject::connect(pushButtonStop, SIGNAL(released()), MainWindow, SLOT(stop_record()));
|
||||
QObject::connect(pushButtonRecord, SIGNAL(released()), MainWindow, SLOT(record()));
|
||||
|
||||
tabWidget->setCurrentIndex(0);
|
||||
|
||||
@ -673,10 +710,8 @@ public:
|
||||
|
||||
void retranslateUi(QMainWindow *MainWindow)
|
||||
{
|
||||
MainWindow->setWindowTitle(QApplication::translate("MainWindow", "samplebrain 0.0.3", 0, QApplication::UnicodeUTF8));
|
||||
MainWindow->setWindowTitle(QApplication::translate("MainWindow", "samplebrain 0.0.4", 0, QApplication::UnicodeUTF8));
|
||||
label_19->setText(QApplication::translate("MainWindow", "tweakage", 0, QApplication::UnicodeUTF8));
|
||||
pushButtonPlay->setText(QApplication::translate("MainWindow", "Start", 0, QApplication::UnicodeUTF8));
|
||||
pushButtonStop->setText(QApplication::translate("MainWindow", "Stop", 0, QApplication::UnicodeUTF8));
|
||||
label_6->setText(QApplication::translate("MainWindow", "fft <-> mfcc ratio", 0, QApplication::UnicodeUTF8));
|
||||
label_7->setText(QApplication::translate("MainWindow", "fft subsection 1", 0, QApplication::UnicodeUTF8));
|
||||
label_9->setText(QApplication::translate("MainWindow", "Start", 0, QApplication::UnicodeUTF8));
|
||||
@ -684,8 +719,6 @@ public:
|
||||
label_8->setText(QApplication::translate("MainWindow", "fft subsection 2", 0, QApplication::UnicodeUTF8));
|
||||
label_11->setText(QApplication::translate("MainWindow", "Start", 0, QApplication::UnicodeUTF8));
|
||||
label_12->setText(QApplication::translate("MainWindow", "End", 0, QApplication::UnicodeUTF8));
|
||||
label_13->setText(QApplication::translate("MainWindow", "Volume", 0, QApplication::UnicodeUTF8));
|
||||
pushButtonRestartAudio->setText(QApplication::translate("MainWindow", "restart audio", 0, QApplication::UnicodeUTF8));
|
||||
label_16->setText(QApplication::translate("MainWindow", "target sound", 0, QApplication::UnicodeUTF8));
|
||||
label_15->setText(QApplication::translate("MainWindow", "no sound yet...", 0, QApplication::UnicodeUTF8));
|
||||
pushButtonLoadTarget->setText(QApplication::translate("MainWindow", "load target", 0, QApplication::UnicodeUTF8));
|
||||
@ -722,6 +755,11 @@ public:
|
||||
pushButtonDeleteSound->setText(QApplication::translate("MainWindow", "delete selected", 0, QApplication::UnicodeUTF8));
|
||||
pushButtonClearBrain->setText(QApplication::translate("MainWindow", "clear brain", 0, QApplication::UnicodeUTF8));
|
||||
tabWidget->setTabText(tabWidget->indexOf(sampleTab), QApplication::translate("MainWindow", "brain", 0, QApplication::UnicodeUTF8));
|
||||
tabWidget->setTabText(tabWidget->indexOf(logTab), QApplication::translate("MainWindow", "log", 0, QApplication::UnicodeUTF8));
|
||||
pushButtonPlay->setText(QString());
|
||||
pushButtonStop->setText(QString());
|
||||
pushButtonRecord->setText(QString());
|
||||
pushButtonStopRecord->setText(QString());
|
||||
} // retranslateUi
|
||||
|
||||
};
|
||||
@ -732,4 +770,4 @@ namespace Ui {
|
||||
|
||||
QT_END_NAMESPACE
|
||||
|
||||
#endif // SAMPLEBRAINSB4993_H
|
||||
#endif // SAMPLEBRAINMG4993_H
|
||||
|
@ -24,9 +24,13 @@ process_thread::process_thread() :
|
||||
m_osc.run();
|
||||
|
||||
// start the processing thread
|
||||
pthread_t *thread = new pthread_t;
|
||||
pthread_create(thread,NULL,(void*(*)(void*))_process,this);
|
||||
m_thread = new pthread_t;
|
||||
pthread_create(m_thread,NULL,(void*(*)(void*))_process,this);
|
||||
}
|
||||
|
||||
process_thread::~process_thread() {
|
||||
pthread_cancel(*m_thread);
|
||||
delete m_brain_mutex;
|
||||
}
|
||||
|
||||
void process_thread::process() {
|
||||
|
@ -9,6 +9,7 @@ namespace spiralcore {
|
||||
class process_thread {
|
||||
public:
|
||||
process_thread();
|
||||
~process_thread();
|
||||
|
||||
brain m_source, m_target;
|
||||
pthread_mutex_t* m_brain_mutex;
|
||||
@ -23,6 +24,7 @@ private:
|
||||
float m_target_overlap;
|
||||
window::type m_window_type;
|
||||
window::type m_target_window_type;
|
||||
pthread_t *m_thread;
|
||||
};
|
||||
|
||||
}
|
||||
|
@ -19,7 +19,7 @@ SOURCES += MainWindow.cpp \
|
||||
qtmain.cpp
|
||||
|
||||
INCLUDEPATH += ../src
|
||||
LIBS += -L.. -lsamplebrain -ljellyfish -lportaudio -lfftw3 -lsndfile -llo -ldl -lpthread -lm
|
||||
LIBS += -L.. -lsamplebrain -ljellyfish -lportaudio -lfftw3 -lsndfile -llo -ldl -lpthread -lm
|
||||
|
||||
# assets
|
||||
#RESOURCES = application.qrc
|
||||
RESOURCES = samplebrain.qrc
|
||||
|
Loading…
x
Reference in New Issue
Block a user