elhacker.net cabecera Bienvenido(a), Visitante. Por favor Ingresar o Registrarse
¿Perdiste tu email de activación?.

 

 


Tema destacado: Los 10 CVE más críticos (peligrosos) de 2020


+  Foro de elhacker.net
|-+  Programación
| |-+  Programación C/C++ (Moderadores: Eternal Idol, Littlehorse, K-YreX)
| | |-+  Problema de ejecucuion con teclado musical y gstreamer y c++
0 Usuarios y 1 Visitante están viendo este tema.
Páginas: [1] Ir Abajo Respuesta Imprimir
Autor Tema: Problema de ejecucuion con teclado musical y gstreamer y c++  (Leído 2,754 veces)
mtoledo

Desconectado Desconectado

Mensajes: 4


Ver Perfil
Problema de ejecucuion con teclado musical y gstreamer y c++
« en: 20 Noviembre 2019, 00:37 am »

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!


En línea

kub0x
Enlightenment Seeker
Colaborador
***
Desconectado Desconectado

Mensajes: 1.486


S3C M4NI4C


Ver Perfil
Re: Problema de ejecucuion con teclado musical y gstreamer y c++
« Respuesta #1 en: 20 Noviembre 2019, 02:39 am »

Cada vez que creas un MediaObject este a su vez crea un descriptor en el OS. Si no destruyes o deleteas el objeto las referencias siguen activas y es por eso que obtienes ese error. Por lo tanto en todas las funciones OnX haz delete del puntero y nos comentas que tal te fue ;)

Saludos.


En línea

Viejos siempre viejos,
Ellos tienen el poder,
Y la juventud,
¡En el ataúd! Criaturas Al poder.

Visita mi perfil en ResearchGate

mtoledo

Desconectado Desconectado

Mensajes: 4


Ver Perfil
Re: Problema de ejecucuion con teclado musical y gstreamer y c++
« Respuesta #2 en: 20 Noviembre 2019, 03:21 am »

Estuve viendo esta pagina:

https://doc.qt.io/archives/qt-4.8/phonon-mediaobject.html

Probe clear(), clearQueue(), finished(), stop() y

connect( .. mSIGNAL(aboutToFinish()),..)

estoy pensando usar enqueue con aboutToFinish(), pero estoy bien cansado, así gracias y nos vemos mañana, que estes bien!
En línea

kub0x
Enlightenment Seeker
Colaborador
***
Desconectado Desconectado

Mensajes: 1.486


S3C M4NI4C


Ver Perfil
Re: Problema de ejecucuion con teclado musical y gstreamer y c++
« Respuesta #3 en: 20 Noviembre 2019, 14:19 pm »

Estuve viendo esta pagina:

https://doc.qt.io/archives/qt-4.8/phonon-mediaobject.html

Probe clear(), clearQueue(), finished(), stop() y

connect( .. mSIGNAL(aboutToFinish()),..)

estoy pensando usar enqueue con aboutToFinish(), pero estoy bien cansado, así gracias y nos vemos mañana, que estes bien!

Hola ¿qué tal?

El verdadero problema causante de que pare la ejecucción de tu programa es:

Citar
shared memfd open() failed: Demasiados archivos abiertos
Failed to create secure directory (/run/user/1000/pulse): Demasiados archivos abiertos
socket(): Demasiados archivos abiertos

Quisiera transmitirte que se puede arreglar como dije arriba. Cada vez que creas un objeto con new() en C++ se reserva una región de memoria asociada al puntero del objeto, por lo tanto el programador, es decir, tú, eres el único responsable de gestionar/eliminar dichas referencias o memoria.

En consecuencia, cada vez que pulsas una tecla en tu teclado creas un objeto y lo sigues manteniendo en memoria, si pulso 20 veces "LA" se crean 20 objetos y seguirá en aumento. Para solucionar el error lo mejor es hacer una sóla clase con el patrón Singleton y llamar a los métodos desde esa clase. 1 única clase con 1 objeto por nota musical y 1 función/método por cada nota musical, sólo que no haces new() dentro de estas funciones, sino en el constructor de la clase y con un for o algo iterativo así que tus .wav seguirían un patrón de stings.

Si todo esto te queda grande, añade un "delete mediaObject;" abajo de cada Play() de esta forma eliminarás el objeto por completo y el sistema operativo ya no cerrará tu aplicación. No es óptimo pues creas y destruyes objetos en cada llamada, ya te dije como hacerlo eficiente y solucionarlo, espero que vengan buenas noticias.

Saludos.
« Última modificación: 20 Noviembre 2019, 14:21 pm por kub0x » En línea

Viejos siempre viejos,
Ellos tienen el poder,
Y la juventud,
¡En el ataúd! Criaturas Al poder.

Visita mi perfil en ResearchGate

mtoledo

Desconectado Desconectado

Mensajes: 4


Ver Perfil
Re: Problema de ejecucuion con teclado musical y gstreamer y c++
« Respuesta #4 en: 21 Noviembre 2019, 05:15 am »

Hola, kub0x

Me ayudaste mucho a entender el problema, asi que gracias por eso. pero use:

void multiteclado::OnX() {
   Phonon::MediaObject *mediaObject = Phonon::createPlayer(Phonon::NoCategory,Phonon::MediaSource("./teclados/teclado1/nota1.wav"));
   mediaObject->play();
   delete mediaObject;
}

-> en este caso pasa lo mismo que con mediaObject-> stop(); no emite ningún sonido

Tambien use:

void multiteclado::OnX() {
   Phonon::MediaObject *mediaObject = Phonon::createPlayer(Phonon::NoCategory,Phonon::MediaSource("./teclados/teclado1/nota1.wav"));
   mediaObject->play();
   mediaObject = NULL;
}

con la misma salida:

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


Ya estuve intentando "1 única clase con 1 objeto por nota musical y 1 función/método por cada nota musical". Seguiré trabajando en esto último, que este bien!
En línea

mtoledo

Desconectado Desconectado

Mensajes: 4


Ver Perfil
Re: Problema de ejecucuion con teclado musical y gstreamer y c++
« Respuesta #5 en: 21 Noviembre 2019, 14:37 pm »

Hola,

Leyendo encontré que alguien dijo que Phonon::MediaIbject no puede tocar varios audio al mismo tiempo, que era el problema: "Demasiados archivos", pero SDL-mixer si puede. Originalmente solo he aprendido python, pero quería incursionar en c++. Asi que usé python-sdl2 mixer y acabo de hacer 5minutos sin perturbaciones y sin corte. Sin embargo la ventaja de c++ es que corre mas rapida la ejecución, y se me presenta la siguiente situación, para correr sin Phonon, deberia usar:

qmake-qt4 -project
qmake-qt4
make

pero para sdl-mixer una cosa como esta:

cc -c `sdl-config --cflags` wav.c

estuve pensando usar un Makefile como este:

#OBJS specifies which files to compile as part of the project
OBJS = openicon.c

#CC specifies which compiler we're using
CC = g++

#COMPILER_FLAGS specifies the additional compilation options we're using
# -w suppresses all warnings
COMPILER_FLAGS = -w

#LINKER_FLAGS specifies the libraries we're linking against
LINKER_FLAGS = -lSDL2 -lSDL2_image

#OBJ_NAME specifies the name of our exectuable
OBJ_NAME = windo1

#This is the target that compiles our executable
all : $(OBJS)
   $(CC) $(OBJS) $(COMPILER_FLAGS) $(LINKER_FLAGS) -o $(OBJ_NAME)

cuando uso qmake en el terminal aparece esto:

g++ -c -m64 -pipe -O2 -Wall -W -D_REENTRANT -DQT_NO_DEBUG -DQT_PHONON_LIB -DQT_GUI_LIB -DQT_CORE_LIB -DQT_SHARED -I/usr/share/qt4/mkspecs/linux-g++-64 -I. -I/usr/include/qt4/QtCore -I/usr/include/qt4/QtGui -I/usr/include/phonon -I/usr/include/qt4 -I. -I/usr/include/qt4/phonon_compat -I. -o prueba.o prueba.cpp

use

g++ -c -m64 -pipe -O2 -Wall -W -D_REENTRANT -DQT_NO_DEBUG -DQT_PHONON_LIB -DQT_GUI_LIB -DQT_CORE_LIB -DQT_SHARED -I/usr/share/qt4/mkspecs/linux-g++-64 -I. -I/usr/include/qt4/QtCore -I/usr/include/qt4/QtGui  -o prueba.o prueba.cpp

en lugar de CC = g++

pero presenta un problema con qt.

Por ahora doy por resuelto con python-sdl2 el tema. Muchas gracias!


« Última modificación: 21 Noviembre 2019, 14:45 pm por mtoledo » En línea

kub0x
Enlightenment Seeker
Colaborador
***
Desconectado Desconectado

Mensajes: 1.486


S3C M4NI4C


Ver Perfil
Re: Problema de ejecucuion con teclado musical y gstreamer y c++
« Respuesta #6 en: 22 Noviembre 2019, 19:17 pm »

Hola,

Leyendo encontré que alguien dijo que Phonon::MediaIbject no puede tocar varios audio al mismo tiempo, que era el problema: "Demasiados archivos", pero SDL-mixer si puede.
Vaya, pensaba que era un error de descriptores ya que al crear objetos en cada llamada y no destruirlos va acumulando referencias hasta que agotas la memoria o el Framework de QT se da cuenta y te corta el programa. Bueno, está bien saber que era una limitación del mismo framework. SDL lleva con nosotros muchos años y seguirá estándolo ya que es muy práctico para cosas no demasiado grandes.

En C++ lo mejor es hacerlo con Gstreamer a "pelo" es decir al puro estilo C. Seguro que existen wrappers para C++ pero bueno no se que tal serán. Quizá algún día lo puedas portar a C/C++ y subirlo al foro.

Suerte con tu proyecto, saludos!
En línea

Viejos siempre viejos,
Ellos tienen el poder,
Y la juventud,
¡En el ataúd! Criaturas Al poder.

Visita mi perfil en ResearchGate

Páginas: [1] Ir Arriba Respuesta Imprimir 

Ir a:  

Mensajes similares
Asunto Iniciado por Respuestas Vistas Último mensaje
[0day] [PoC] Fixeo incorrecto del decoder gstreamer FLIC (CESA-2016-0004)
Bugs y Exploits
MCKSys Argentina 0 2,162 Último mensaje 30 Noviembre 2016, 15:23 pm
por MCKSys Argentina
Orden de ejecucuion de sentencias
Programación C/C++
digimikeh 4 1,667 Último mensaje 18 Enero 2019, 19:13 pm
por digimikeh
WAP2 - Aviso Legal - Powered by SMF 1.1.21 | SMF © 2006-2008, Simple Machines