Skip to content
Snippets Groups Projects
Commit 20299383 authored by Florent Berthaut's avatar Florent Berthaut
Browse files

Removed audio output by default

parent 7a3d74eb
Branches
No related tags found
No related merge requests found
......@@ -59,6 +59,7 @@
#include "gui/GuiListener.hpp"
#include "osc/OscManager.hpp"
#include "osc/OscListener.hpp"
#include "audio/AudioManager.hpp"
using namespace std;
......@@ -85,6 +86,13 @@ Reveal::Reveal() : GroupModule() {
Attribute::ACTION_ATTRIBUTE,
quitCallback, this, Attribute::LOCAL,
false));
addAttribute(new Attribute("audio_output",
Attribute::BOOL_ATTRIBUTE,
audioOutputCallback,this,1,Attribute::GLOBAL));
m_audioOut=false;
/*
addAttribute(new Attribute("ressources_folder",
Attribute::FOLDER_OPEN_ATTRIBUTE,
ressourcesCallback, this, Attribute::LOCAL,
......@@ -92,6 +100,7 @@ Reveal::Reveal() : GroupModule() {
addAttribute(new Attribute("ressource_upload",
Attribute::ACTION_STRING_ATTRIBUTE,
uploadCallback,this,2,Attribute::GLOBAL,false));
*/
addAttribute(new Attribute("debug_osc_input",
Attribute::BOOL_ATTRIBUTE,
debugOscCallback,this,1,Attribute::GLOBAL));
......@@ -192,6 +201,12 @@ GLFWwindow* Reveal::getPreviewWindow() {
return m_preview->getWindow();
}
void Reveal::setAudioOutput(const bool& aud) {
if(aud) {
AudioManager::getInstance()->init();
}
}
void Reveal::planOpen(std::string opSt) {
//FIXME find better strategy for delaying text
m_openPlanned=10;
......
......@@ -128,14 +128,18 @@ class Reveal : public GroupModule {
dynamic_cast<Reveal*>(mod)->uploadRessource(vf);
}
void uploadRessource(const std::vector<std::string>& vf);
static void debugOscCallback(Module* mod,
const std::vector<bool>& vf
) {
static void debugOscCallback(Module* mod, const std::vector<bool>& vf) {
dynamic_cast<Reveal*>(mod)->debugOSC(vf[0]);
}
void debugOSC(const bool& deb){m_debugOSC=deb;}
const bool& getDebugOSC() {return m_debugOSC;}
static void audioOutputCallback(Module* mod,
const std::vector<bool>& vf) {
dynamic_cast<Reveal*>(mod)->setAudioOutput(vf[0]);
}
void setAudioOutput(const bool& aud);
virtual void load(xmlNodePtr);
void addUpdateObserver(Module* upObs);
......@@ -218,6 +222,7 @@ class Reveal : public GroupModule {
PreviewModule* m_preview;
OutputManagerModule* m_output;
bool m_debugOSC;
bool m_audioOut;
int m_openPlanned;
std::string m_openPlannedName;
......
......@@ -78,7 +78,7 @@ int AudioManager::rtaudio_callback(void *outbuf, void *inbuf, unsigned int nFram
}
else {
memset(buf, 0, nFrames*data->nChannel*sizeof(float));
cout<<"AudioManager : Could not read buffer"<<endl;
// cout<<"AudioManager : Could not read buffer"<<endl;
}
}
else {
......@@ -96,6 +96,10 @@ int AudioManager::rtaudio_callback(void *outbuf, void *inbuf, unsigned int nFram
}
AudioManager::AudioManager() {
m_init=false;
}
void AudioManager::init() {
//audio = new RtAudio(RtAudio::LINUX_PULSE);
m_rtAudio = new RtAudio(RtAudio::UNIX_JACK);
param = new RtAudio::StreamParameters();
......@@ -128,10 +132,12 @@ AudioManager::AudioManager() {
memset(&data.mixBuffer[0], 0, data.mixSize*sizeof(float));
m_thread = new std::thread(audioThreadFunction, this);
m_init = true;
}
void AudioManager::changeBuf(float* outputBuf, float maxSinValue) {
if(m_init) {
//check if there is space to write the new values
size_t write_space = ringbuffer_write_space(data.ringBuffer);
......@@ -170,5 +176,6 @@ void AudioManager::changeBuf(float* outputBuf, float maxSinValue) {
//cout<<"AudioManager : Could not write buffer"<<endl;
}
}
}
......@@ -66,6 +66,7 @@ class AudioManager {
static AudioManager* getInstance();
~AudioManager();
void init();
void changeBuf(float* outputBuf, float maxSinValue);
int getRate();
int getBufferSize();
......@@ -87,6 +88,7 @@ class AudioManager {
CallbackData data;
std::mutex mtx_audio;
bool m_init;
static int rtaudio_callback(void *outbuf, void *inbuf,
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment