mirror of
https://gitlab.com/then-try-this/samplebrain.git
synced 2025-05-12 10:37:20 +00:00
streaming stereo status, fixes: #74
This commit is contained in:
parent
edf2071467
commit
13ee3ed817
@ -113,8 +113,8 @@ void MainWindow::init_from_session(const string &filename) {
|
||||
ifstream ifs(filename.c_str(),ios::binary);
|
||||
if (!ifs) return;
|
||||
|
||||
brain s,t;
|
||||
u32 version=0;
|
||||
brain s,t,lt;
|
||||
u32 version=1;
|
||||
ifs||version;
|
||||
renderer r(s,t);
|
||||
ifs||r;
|
||||
@ -133,7 +133,14 @@ void MainWindow::init_from_session(const string &filename) {
|
||||
ifs||source_window||target_window;
|
||||
// todo: probably don't need to load all the sample data too :/
|
||||
ifs||s;
|
||||
ifs||t;
|
||||
ifs||t; // left
|
||||
ifs||lt; // right
|
||||
|
||||
if (version>0) {
|
||||
ifs||m_stereo;
|
||||
m_Ui.checkBoxStereo->setChecked(m_stereo);
|
||||
}
|
||||
|
||||
|
||||
// brain tweaks
|
||||
search_params * p = r.get_params();
|
||||
@ -198,8 +205,6 @@ void MainWindow::init_from_session(const string &filename) {
|
||||
m_Ui.sliderAutotune->setValue(r.get_autotune()*100);
|
||||
m_Ui.doubleSpinBoxAutotune->setValue(r.get_autotune());
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
#endif
|
||||
|
@ -393,7 +393,11 @@ private slots:
|
||||
}
|
||||
|
||||
void stereo_mode(bool s) {
|
||||
m_stereo=s;
|
||||
send_audio_osc("/stereo","i",s);
|
||||
// irritating but need to tell process thread about stereo state
|
||||
// just to it can save it to the session file
|
||||
send_process_osc("/stereo","i",s);
|
||||
}
|
||||
|
||||
void net_enable(int id) {
|
||||
@ -469,4 +473,5 @@ private:
|
||||
string m_audio_port;
|
||||
string m_process_port;
|
||||
QString m_format_string;
|
||||
bool m_stereo;
|
||||
};
|
||||
|
@ -140,6 +140,10 @@ void process_thread::process() {
|
||||
if (name=="/save_session") {
|
||||
save_session(cmd.get_string(0));
|
||||
}
|
||||
if (name=="/stereo") {
|
||||
// only for session file save
|
||||
m_stereo=cmd.get_int(0);
|
||||
}
|
||||
}
|
||||
#ifdef WIN32
|
||||
Sleep(1);
|
||||
@ -174,16 +178,7 @@ void process_thread::load_session(const std::string &filename) {
|
||||
m_left_target.clear();
|
||||
m_right_target.clear();
|
||||
ifstream ifs(filename.c_str(),ios::binary);
|
||||
u32 version=0;
|
||||
ifs||version;
|
||||
ifs||(*m_left_renderer);
|
||||
ifs||(*m_right_renderer);
|
||||
ifs||m_source_block_size||m_source_overlap;
|
||||
ifs||m_target_block_size||m_target_overlap;
|
||||
ifs||m_window_type||m_target_window_type;
|
||||
ifs||m_source;
|
||||
ifs||m_left_target;
|
||||
ifs||m_right_target;
|
||||
stream_session(ifs);
|
||||
ifs.close();
|
||||
pthread_mutex_unlock(m_brain_mutex);
|
||||
}
|
||||
@ -191,16 +186,23 @@ void process_thread::load_session(const std::string &filename) {
|
||||
void process_thread::save_session(const std::string &filename) {
|
||||
pthread_mutex_lock(m_brain_mutex);
|
||||
ofstream ofs(filename.c_str(),ios::binary);
|
||||
u32 version=0;
|
||||
ofs||version;
|
||||
ofs||(*m_left_renderer);
|
||||
ofs||(*m_right_renderer);
|
||||
ofs||m_source_block_size||m_source_overlap;
|
||||
ofs||m_target_block_size||m_target_overlap;
|
||||
ofs||m_window_type||m_target_window_type;
|
||||
ofs||m_source;
|
||||
ofs||m_left_target;
|
||||
ofs||m_right_target;
|
||||
stream_session(ofs);
|
||||
ofs.close();
|
||||
pthread_mutex_unlock(m_brain_mutex);
|
||||
}
|
||||
|
||||
void process_thread::stream_session(std::ios &fs) {
|
||||
u32 version=1;
|
||||
fs||version;
|
||||
fs||(*m_left_renderer);
|
||||
fs||(*m_right_renderer);
|
||||
fs||m_source_block_size||m_source_overlap;
|
||||
fs||m_target_block_size||m_target_overlap;
|
||||
fs||m_window_type||m_target_window_type;
|
||||
fs||m_source;
|
||||
fs||m_left_target;
|
||||
fs||m_right_target;
|
||||
if (version>0) {
|
||||
fs||m_stereo;
|
||||
}
|
||||
}
|
||||
|
@ -54,6 +54,8 @@ namespace spiralcore {
|
||||
brain m_source, m_left_target, m_right_target;
|
||||
|
||||
private:
|
||||
void stream_session(std::ios &fs);
|
||||
|
||||
OSC_server m_osc;
|
||||
u32 m_source_block_size;
|
||||
float m_source_overlap;
|
||||
@ -61,6 +63,7 @@ namespace spiralcore {
|
||||
float m_target_overlap;
|
||||
window::type m_window_type;
|
||||
window::type m_target_window_type;
|
||||
bool m_stereo;
|
||||
pthread_t *m_thread;
|
||||
|
||||
// only use in mutex obvs...
|
||||
|
Loading…
x
Reference in New Issue
Block a user