mirror of
https://github.com/projectM-visualizer/projectm.git
synced 2026-03-01 13:06:25 +00:00
more faith in this one
git-svn-id: https://projectm.svn.sourceforge.net/svnroot/projectm/trunk@705 6778bc44-b910-0410-a7a0-be141de4315d
This commit is contained in:
@ -86,21 +86,14 @@ QPulseAudioThread::QPulseAudioThread(int _argc, char **_argv, projectM * _projec
|
||||
|
||||
void QPulseAudioThread::init() {
|
||||
|
||||
ss.format = PA_SAMPLE_FLOAT32LE;
|
||||
ss.rate = 44100;
|
||||
ss.channels = 2;
|
||||
int ret = 1;
|
||||
int error;
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
QPulseAudioThread::~QPulseAudioThread()
|
||||
{
|
||||
{
|
||||
cleanup();
|
||||
|
||||
}
|
||||
|
||||
|
||||
@ -126,6 +119,9 @@ void QPulseAudioThread::cleanup() {
|
||||
mainloop_api->time_free(time_event);
|
||||
}
|
||||
|
||||
if (mainloop_api)
|
||||
mainloop_api->quit(mainloop_api, 0);
|
||||
|
||||
if (mainloop) {
|
||||
pa_signal_done();
|
||||
pa_mainloop_free(mainloop);
|
||||
@ -138,21 +134,10 @@ void QPulseAudioThread::cleanup() {
|
||||
pa_xfree(client_name);
|
||||
pa_xfree(stream_name);
|
||||
|
||||
|
||||
return ;
|
||||
}
|
||||
|
||||
|
||||
void QPulseAudioThread::updatePCM() {
|
||||
//qDebug() << "pulse audio loop";
|
||||
float buf[BUFSIZE];
|
||||
ssize_t r;
|
||||
int error;
|
||||
qDebug() << "HERE";
|
||||
/* Record some data ... */
|
||||
qDebug() << "HERE";
|
||||
m_projectM->pcm->addPCMfloat(buf, BUFSIZE);
|
||||
}
|
||||
|
||||
|
||||
|
||||
@ -394,13 +379,12 @@ static void stream_state_callback(pa_stream *s, void *userdata) {
|
||||
ssize_t r;
|
||||
assert(a == mainloop_api && e && stdio_event == e);
|
||||
|
||||
|
||||
if (!buffer) {
|
||||
mainloop_api->io_enable(stdio_event, PA_IO_EVENT_NULL);
|
||||
return;
|
||||
} else {
|
||||
projectM * prjm = static_cast<projectM *>(userdata);
|
||||
prjm->pcm->addPCMfloat(buffer,sizeof(buffer));
|
||||
prjm->pcm->addPCMfloat(buffer+buffer_index, sizeof(buffer));
|
||||
}
|
||||
|
||||
assert(buffer_length);
|
||||
|
||||
@ -26,8 +26,5 @@ class QPulseAudioThread : public QThread
|
||||
pa_simple * s ;
|
||||
projectM * m_projectM;
|
||||
|
||||
public slots:
|
||||
void updatePCM();
|
||||
|
||||
};
|
||||
#endif
|
||||
|
||||
@ -103,6 +103,7 @@ int main ( int argc, char*argv[] )
|
||||
|
||||
//qDebug() << "app exec";
|
||||
int ret = app.exec();
|
||||
|
||||
pulseThread->exit();
|
||||
|
||||
delete(mainWindow);
|
||||
|
||||
Reference in New Issue
Block a user