Hola a todos. soy nuevo en c++.
He creado un teclado, en realidad varios instrumentos. Se corren bien, pero después de un rato usándoles se cierran como a los 3 minutos de correr. Estos son los errores que aparecen
(teclado1:9034): GStreamer-CRITICAL **: 20:31:24.970: gst_poll_get_read_gpollfd: assertion 'set != NULL' failed
(teclado1:9034): GStreamer-CRITICAL **: 20:31:24.973: gst_poll_get_read_gpollfd: assertion 'set != NULL' failed
(teclado1:9034): GStreamer-CRITICAL **: 20:31:24.973: gst_poll_get_read_gpollfd: assertion 'set != NULL' failed
(teclado1:9034): GStreamer-CRITICAL **: 20:31:26.482: gst_poll_get_read_gpollfd: assertion 'set != NULL' failed
(teclado1:9034): GStreamer-CRITICAL **: 20:31:26.484: gst_poll_get_read_gpollfd: assertion 'set != NULL' failed
(teclado1:9034): GStreamer-CRITICAL **: 20:31:26.485: gst_poll_get_read_gpollfd: assertion 'set != NULL' failed xcb_connection_has_error() devolvió verdadero shared memfd open() failed: Demasiados archivos abiertos Failed to create secure directory (/run/user/1000/pulse): Demasiados archivos abiertos socket(): Demasiados archivos abiertos
(teclado1:9034): GStreamer-WARNING **: 20:31:27.522: Failed to load plugin '/usr/lib/x86_64-linux-gnu/gstreamer-1.0/libgstoss4.so': /usr/lib/x86_64-linux-gnu/gstreamer-1.0/libgstoss4.so: no se puede abrir el archivo del objeto compartido: Demasiados archivos abiertos
(teclado1:9034): GStreamer-WARNING **: 20:31:27.522: Failed to load plugin '/usr/lib/x86_64-linux-gnu/gstreamer-1.0/libgstopenal.so': /usr/lib/x86_64-linux-gnu/gstreamer-1.0/libgstopenal.so: no se puede abrir el archivo del objeto compartido: Demasiados archivos abiertos
(teclado1:9034): GStreamer-WARNING **: 20:31:27.522: Failed to load plugin '/usr/lib/x86_64-linux-gnu/gstreamer-1.0/libgstossaudio.so': /usr/lib/x86_64-linux-gnu/gstreamer-1.0/libgstossaudio.so: no se puede abrir el archivo del objeto compartido: Demasiados archivos abiertos
(teclado1:9034): GStreamer-CRITICAL **: 20:31:27.526: gst_poll_write_control: assertion 'set != NULL' failed
(teclado1:9034): GStreamer-CRITICAL **: 20:31:27.526: gst_poll_free: assertion 'set != NULL' failed The per-process limit on the number of open file descriptors has been reached. ERROR: cannot create wakeup pipe
(teclado1:9034): GStreamer-WARNING **: 20:31:27.530: Failed to load plugin '/usr/lib/x86_64-linux-gnu/gstreamer-1.0/libgstoss4.so': /usr/lib/x86_64-linux-gnu/gstreamer-1.0/libgstoss4.so: no se puede abrir el archivo del objeto compartido: Demasiados archivos abiertos
(teclado1:9034): GStreamer-WARNING **: 20:31:27.530: Failed to load plugin '/usr/lib/x86_64-linux-gnu/gstreamer-1.0/libgstopenal.so': /usr/lib/x86_64-linux-gnu/gstreamer-1.0/libgstopenal.so: no se puede abrir el archivo del objeto compartido: Demasiados archivos abiertos
(teclado1:9034): GStreamer-WARNING **: 20:31:27.530: Failed to load plugin '/usr/lib/x86_64-linux-gnu/gstreamer-1.0/libgstossaudio.so': /usr/lib/x86_64-linux-gnu/gstreamer-1.0/libgstossaudio.so: no se puede abrir el archivo del objeto compartido: Demasiados archivos abiertos
(teclado1:9034): GStreamer-CRITICAL **: 20:31:27.530: gst_poll_write_control: assertion 'set != NULL' failed
(teclado1:9034): GStreamer-CRITICAL **: 20:31:27.530: gst_poll_free: assertion 'set != NULL' failed
(teclado1:9034): GStreamer-CRITICAL **: 20:31:27.530: gst_poll_write_control: assertion 'set != NULL' failed
(teclado1:9034): GStreamer-CRITICAL **: 20:31:27.530: gst_poll_free: assertion 'set != NULL' failed
(teclado1:9034): GStreamer-CRITICAL **: 20:31:27.991: gst_poll_get_read_gpollfd: assertion 'set != NULL' failed
(teclado1:9034): GStreamer-CRITICAL **: 20:31:27.993: gst_poll_write_control: assertion 'set != NULL' failed
(teclado1:9034): GStreamer-CRITICAL **: 20:31:27.993: gst_poll_free: assertion 'set != NULL' failed The per-process limit on the number of open file descriptors has been reached. ERROR: cannot create wakeup pipe The per-process limit on the number of open file descriptors has been reached. ERROR: cannot create wakeup pipe The per-process limit on the number of open file descriptors has been reached. ERROR: cannot create wakeup pipe ALSA lib conf.c:799:(get_char_skip_comments) Cannot access file /usr/share/alsa/pcm/default.conf ALSA lib conf.c:1852:(snd_config_load1) _toplevel_:59:26:Demasiados archivos abiertos ALSA lib conf.c:3615:(config_file_open) /usr/share/alsa/cards/aliases.conf may be old or corrupted: consider to remove or fix it ALSA lib conf.c:3537:(snd_config_hooks_call) function snd_config_hook_load returned error: Demasiados archivos abiertos ALSA lib pcm.c:2495:(snd_pcm_open_noupdate) Unknown PCM cards.pcm.default AL lib: (EE) ALCplaybackAlsa_open: Could not open playback device 'default': No existe el archivo o el directorio
(teclado1:9034): GStreamer-CRITICAL **: 20:31:28.059: gst_poll_get_read_gpollfd: assertion 'set != NULL' failed
(teclado1:9034): GStreamer-CRITICAL **: 20:31:28.060: gst_poll_get_read_gpollfd: assertion 'set != NULL' failed
(teclado1:9034): GStreamer-CRITICAL **: 20:31:28.060: gst_poll_get_read_gpollfd: assertion 'set != NULL' failed
(teclado1:9034): GStreamer-CRITICAL **: 20:31:28.061: gst_poll_write_control: assertion 'set != NULL' failed
(teclado1:9034): GStreamer-CRITICAL **: 20:31:28.061: gst_poll_free: assertion 'set != NULL' failed The per-process limit on the number of open file descriptors has been reached. ERROR: cannot create wakeup pipe Cannot connect to server socket err = No existe el archivo o el directorio Cannot connect to server request channel jack server is not running or cannot be started JackShmReadWritePtr::~JackShmReadWritePtr - Init not done for -1, skipping unlock JackShmReadWritePtr::~JackShmReadWritePtr - Init not done for -1, skipping unlock ALSA lib pcm.c:2495:(snd_pcm_open_noupdate) Unknown PCM cards.pcm.default AL lib: (EE) ALCplaybackAlsa_open: Could not open playback device 'default': No existe el archivo o el directorio
El codigo del programa principal "multiteclado.cpp" es:
#include "multiteclado.h" #include <QGridLayout> //https://stackoverflow.com/questions/4473608/how-to-play-sound-with-qt //https://stackoverflow.com/questions/20585795/how-to-connect-the-signal-valuechanged-from-qlineedit-to-a-custom-slot-in-qt //https://stackoverflow.com/questions/17637734/get-value-as-integer-from-qlineedit-and-bindit-in-sqlite
multiteclado::multiteclado(QWidget *parent) : QWidget(parent) {
const QSize btnSize = QSize(80, 150); const QSize imgSize = QSize(730, 100);
QPushButton *doBtn = new QPushButton("Do", this); doBtn->setFixedSize(btnSize); doBtn->setGeometry(10, 270, 80, 150); doBtn->setStyleSheet("* {font-family:DejaVu Math TeX Gyre;font-size: 22px; color: #300104; background: qlineargradient( x1:0 y1:0, x2:1 y2:0, stop:0 cyan, stop:1 blue);}"); QPushButton *reBtn = new QPushButton("Re", this); reBtn->setFixedSize(btnSize); reBtn->setGeometry(100, 270, 80, 150); reBtn->setStyleSheet("* {font-family:DejaVu Math TeX Gyre;font-size: 22px; color: #300104; background: qlineargradient( x1:0 y1:0, x2:1 y2:0, stop:0 cyan, stop:1 blue);}"); QPushButton *miBtn = new QPushButton("Mi", this); miBtn->setFixedSize(btnSize); miBtn->setGeometry(190, 270, 80, 150); miBtn->setStyleSheet("* {font-family:DejaVu Math TeX Gyre;font-size: 22px; color: #300104; background: qlineargradient( x1:0 y1:0, x2:1 y2:0, stop:0 cyan, stop:1 blue);}"); QPushButton *faBtn = new QPushButton("Fa", this); faBtn->setFixedSize(btnSize); faBtn->setGeometry(280, 270, 80, 150); faBtn->setStyleSheet("* {font-family:DejaVu Math TeX Gyre;font-size: 22px; color: #300104; background: qlineargradient( x1:0 y1:0, x2:1 y2:0, stop:0 cyan, stop:1 blue);}"); QPushButton *solBtn = new QPushButton("Sol", this); solBtn->setFixedSize(btnSize); solBtn->setGeometry(370, 270, 80, 150); solBtn->setStyleSheet("* {font-family:DejaVu Math TeX Gyre;font-size: 22px; color: #300104; background: qlineargradient( x1:0 y1:0, x2:1 y2:0, stop:0 cyan, stop:1 blue);}"); QPushButton *laBtn = new QPushButton("La", this); laBtn->setFixedSize(btnSize); laBtn->setGeometry(460, 270, 80, 150); laBtn->setStyleSheet("* {font-family:DejaVu Math TeX Gyre;font-size: 22px; color: #300104; background: qlineargradient( x1:0 y1:0, x2:1 y2:0, stop:0 cyan, stop:1 blue);}"); QPushButton *siBtn = new QPushButton("Si", this); siBtn->setFixedSize(btnSize); siBtn->setGeometry(550, 270, 80, 150); siBtn->setStyleSheet("* {font-family:DejaVu Math TeX Gyre;font-size: 22px; color: #300104; background: qlineargradient( x1:0 y1:0, x2:1 y2:0, stop:0 cyan, stop:1 blue);}"); QPushButton *dobBtn = new QPushButton("Do", this); dobBtn->setFixedSize(btnSize); dobBtn->setGeometry(640, 270, 80, 150); dobBtn->setStyleSheet("* {font-family:DejaVu Math TeX Gyre;font-size: 22px; color:#300104; background: qlineargradient( x1:0 y1:0, x2:1 y2:0, stop:0 cyan, stop:1 blue);}");
QPushButton *dogBtn = new QPushButton("Do#", this); dogBtn->setFixedSize(btnSize); dogBtn->setGeometry(55, 110, 80, 150); dogBtn->setStyleSheet("* {font-family:DejaVu Math TeX Gyre;font-size: 22px; color: #ffdf2b; background: qlineargradient( x1:0 y1:0, x2:1 y2:0, stop:0 #004687, stop:1 #002152);}"); QPushButton *mibBtn = new QPushButton("Mib", this); mibBtn->setFixedSize(btnSize); mibBtn->setGeometry(145, 110, 80, 150); mibBtn->setStyleSheet("* {font-family:DejaVu Math TeX Gyre;font-size: 22px; color: #ffdf2b; background: qlineargradient( x1:0 y1:0, x2:1 y2:0, stop:0 #004687, stop:1 #002152);}"); QPushButton *fagBtn = new QPushButton("Fa#", this); fagBtn->setFixedSize(btnSize); fagBtn->setGeometry(325, 110, 80, 150); fagBtn->setStyleSheet("* {font-family:DejaVu Math TeX Gyre;font-size: 22px; color: #ffdf2b; background: qlineargradient( x1:0 y1:0, x2:1 y2:0, stop:0 #004687, stop:1 #002152);}"); QPushButton *solgBtn = new QPushButton("Sol#", this); solgBtn->setFixedSize(btnSize); solgBtn->setGeometry(415, 110, 80, 150); solgBtn->setStyleSheet("* {font-family:DejaVu Math TeX Gyre;font-size: 22px; color: #ffdf2b; background: qlineargradient( x1:0 y1:0, x2:1 y2:0, stop:0 #004687, stop:1 #002152);}"); QPushButton *sibBtn = new QPushButton("Sib", this); sibBtn->setFixedSize(btnSize); sibBtn->setGeometry(505, 110, 80, 150); sibBtn->setStyleSheet("* {font-family:DejaVu Math TeX Gyre;font-size: 22px; color: #ffdf2b; background: qlineargradient( x1:0 y1:0, x2:1 y2:0, stop:0 #004687, stop:1 #002152);}");
QLabel *cabecera = new QLabel(" Electroma", this); cabecera->setFixedSize(imgSize); // cabecera->setStyleSheet("QFrame {background-image: url('./images/titulo3.png');}"); cabecera->setStyleSheet("font-family:DejaVu Math TeX Gyre;font-size: 72px; color: #ffdf2b; border: 2px solid white; background: #0066ff");
QHBoxLayout *hbox = new QHBoxLayout(this); QHBoxLayout *hbox2 = new QHBoxLayout(this); QHBoxLayout *hbox3 = new QHBoxLayout(this);
QVBoxLayout *vbox = new QVBoxLayout(this);
hbox->addWidget(cabecera); hbox2->addWidget(dogBtn); hbox2->addWidget(mibBtn); hbox2->addWidget(fagBtn); hbox2->addWidget(solgBtn); hbox2->addWidget(sibBtn);
hbox3->addWidget(doBtn); hbox3->addWidget(reBtn); hbox3->addWidget(miBtn); hbox3->addWidget(faBtn); hbox3->addWidget(solBtn); hbox3->addWidget(laBtn); hbox3->addWidget(siBtn); hbox3->addWidget(dobBtn);
vbox->addWidget(cabecera); vbox->addLayout(hbox2); vbox->addLayout(hbox3);
setLayout(vbox);
connect(dogBtn, SIGNAL(clicked()), this, SLOT(Ondog())); connect(mibBtn, SIGNAL(clicked()), this, SLOT(Onmib())); connect(fagBtn, SIGNAL(clicked()), this, SLOT(Onfag())); connect(solgBtn, SIGNAL(clicked()), this, SLOT(Onsolg())); connect(sibBtn, SIGNAL(clicked()), this, SLOT(Onsib()));
connect(doBtn, SIGNAL(clicked()), this, SLOT(Ondo())); connect(reBtn, SIGNAL(clicked()), this, SLOT(Onre())); connect(miBtn, SIGNAL(clicked()), this, SLOT(Onmi())); connect(faBtn, SIGNAL(clicked()), this, SLOT(Onfa())); connect(solBtn, SIGNAL(clicked()), this, SLOT(Onsol())); connect(laBtn, SIGNAL(clicked()), this, SLOT(Onla())); connect(siBtn, SIGNAL(clicked()), this, SLOT(Onsi())); connect(dobBtn, SIGNAL(clicked()), this, SLOT(Ondob())); }
void multiteclado::Ondo() { Phonon::MediaObject *mediaObject = Phonon::createPlayer(Phonon::NoCategory,Phonon::MediaSource("./teclados/teclado1/nota1.wav")); mediaObject->play(); }
void multiteclado::Ondog() { Phonon::MediaObject *mediaObject = Phonon::createPlayer(Phonon::NoCategory,Phonon::MediaSource("./teclados/teclado1/nota2.wav")); mediaObject->play(); }
void multiteclado::Onre() { Phonon::MediaObject *mediaObject = Phonon::createPlayer(Phonon::NoCategory,Phonon::MediaSource("./teclados/teclado1/nota3.wav")); mediaObject->play(); }
void multiteclado::Onmib() { Phonon::MediaObject *mediaObject = Phonon::createPlayer(Phonon::NoCategory,Phonon::MediaSource("./teclados/teclado1/nota4.wav")); mediaObject->play(); }
void multiteclado::Onmi() { Phonon::MediaObject *mediaObject = Phonon::createPlayer(Phonon::NoCategory,Phonon::MediaSource("./teclados/teclado1/nota5.wav")); mediaObject->play(); }
void multiteclado::Onfa() { Phonon::MediaObject *mediaObject = Phonon::createPlayer(Phonon::NoCategory,Phonon::MediaSource("./teclados/teclado1/nota6.wav")); mediaObject->play(); }
void multiteclado::Onfag() { Phonon::MediaObject *mediaObject = Phonon::createPlayer(Phonon::NoCategory,Phonon::MediaSource("./teclados/teclado1/nota7.wav")); mediaObject->play(); }
void multiteclado::Onsol() { Phonon::MediaObject *mediaObject = Phonon::createPlayer(Phonon::NoCategory,Phonon::MediaSource("./teclados/teclado1/nota8.wav")); mediaObject->play(); }
void multiteclado::Onsolg() { Phonon::MediaObject *mediaObject = Phonon::createPlayer(Phonon::NoCategory,Phonon::MediaSource("./teclados/teclado1/nota9.wav")); mediaObject->play(); }
void multiteclado::Onla() { Phonon::MediaObject *mediaObject = Phonon::createPlayer(Phonon::NoCategory,Phonon::MediaSource("./teclados/teclado1/nota10.wav")); mediaObject->play(); }
void multiteclado::Onsib() { Phonon::MediaObject *mediaObject = Phonon::createPlayer(Phonon::NoCategory,Phonon::MediaSource("./teclados/teclado1/nota11.wav")); mediaObject->play(); }
void multiteclado::Onsi() { Phonon::MediaObject *mediaObject = Phonon::createPlayer(Phonon::NoCategory,Phonon::MediaSource("./teclados/teclado1/nota12.wav")); mediaObject->play(); }
void multiteclado::Ondob() { Phonon::MediaObject *mediaObject = Phonon::createPlayer(Phonon::NoCategory,Phonon::MediaSource("./teclados/teclado1/nota13.wav")); mediaObject->play(); }
Muchas garcias por cualquier ayuda y que les vaya muy bien!
|