简体   繁体   English

Jack2 服务器未正确启动 -self-connect-mode 为“不限制自连接请求”

[英]Jack2 server doesn't start approppriately -self-connect-mode is “Don't restrict self connect requests”

I started developing a simple guitar looper using C++ in windows 10 by using the jackaudio's api.我开始使用 jackaudio 的 api 在 windows 10 中使用 C++ 开发一个简单的吉他 Looper。 I am no really sure if starting and closing the server should be implemented by using the API functions, but since I found it convenient to both start the server and set the parameters with a single command, I made a script for it.我不确定是否应该使用 API 函数来实现启动和关闭服务器,但由于我发现使用单个命令启动服务器和设置参数都很方便,因此我为其编写了一个脚本。

ECHO HELLO JACK!
cd C:\Program Files\JACK2
jackd.exe -S -X winmme -v -r -t10000 -dportaudio -d"ASIO::ASIO4ALL v2" -r44100 -p512
:: /jackd.exe -S -X winmme -v -t10000 -dportaudio -d"ASIO::Komplete Audio 6" -r44100 -p512  this is for when audio interface is selected. Not used in this script.
PAUSE

While developing, the way of testing my code was to compile it, and before start running it, I had to start the server first, which in most cases I preferred to do it using the qjackctl.在开发时,测试我的代码的方法是编译它,在开始运行它之前,我必须先启动服务器,在大多数情况下我更喜欢使用 qjackctl 来完成它。 However this way proved to be error prone since lots of issues has occurred, especially when "the appropriate way of shutting down the server" comes in. For instance, stopping the server via qjackctl forces my running program to exit normaly, but closing my running program without having stoped the server corrupts jack-audio behavior, ie.然而,这种方式被证明容易出错,因为发生了很多问题,尤其是当“关闭服务器的适当方式”出现时。例如,通过 qjackctl 停止服务器会强制我正在运行的程序正常退出,但关闭我正在运行的程序没有停止服务器的程序会破坏插孔音频行为,即。 qjackctl sometimes hangs, crashes, and even if I restart my computer, or ever reinstall jack doesn't resolve the issue. qjackctl 有时会挂起、崩溃,即使我重新启动计算机或重新安装 jack 也无法解决问题。

The log window messages are the following…日志 window 消息如下……

12:19:37.459 JACK was started with PID=8044.
jackdmp 1.9.17
Copyright 2001-2005 Paul Davis and others.
Copyright 2004-2016 Grame.
Copyright 2016-2021 Filipe Coelho.
jackdmp comes with ABSOLUTELY NO WARRANTY
This is free software, and you are welcome to redistribute it
under certain conditions; see the file COPYING for details
Drivers/internals found in : C:\Program Files\JACK2
Drivers/internals found in : C:\Program Files\JACK2
JACK server starting in realtime mode with priority 10
self-connect-mode is "Don't restrict self connect requests"

…then it stays there, and sometimes after 20~30 seconds (some others don't – if freezes there forever.) it prints: …然后它会停留在那里,有时会在 20~30 秒后(有些人不会——如果永远冻结在那里。)它会打印:

BDB1546 unable to join the environment
cannot open DB environment: Resource temporarily unavailable
Jack: JackWinThread::StartImp : create non RT thread
Jack: JackWinThread::ThreadHandler : start
Jack: Initializing PortAudio...
BDB1546 unable to join the environment
cannot open DB environment: Resource temporarily unavailable
Cannot connect to named pipe after wait = \\.\pipe\server_jack_default_0 err = 2
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
jack_deactivate called with a NULL client
jack_deactivate called with a NULL client
jack_client_close called with a NULL client
Jack: JackPortAudioDriver::Open nframes = 512 in = 0 out = 0 capture name = ASIO::ASIO4ALL v2 playback name = ASIO::ASIO4ALL v2 samplerate = 44100
Jack: JackDriver::Open capture_driver_name = ASIO::ASIO4ALL v2
Jack: JackDriver::Open playback_driver_name = ASIO::ASIO4ALL v2
Jack: Check protocol client = 8 server = 8
Jack: JackEngine::ClientInternalOpen: name = system
Jack: JackEngine::AllocateRefNum ref = 0
Jack: JackWinSemaphore::Allocate name = jack_pipe.default_system val = 0
Jack: JackEngine::NotifyAddClient: name = system
Jack: JackGraphManager::SetBufferSize size = 512
Jack: JackConnectionManager::DirectConnect first: ref1 = 0 ref2 = 0
Jack: JackGraphManager::ConnectRefNum cur_index = 0 ref1 = 0 ref2 = 0
Jack: JackDriver::SetupDriverSync driver sem in normal mode
Jack: JackPortAudioDriver::Open fInputDevice = 8, fOutputDevice 8
Jack: JackPortAudioDriver::Open setup max in channels = 2
Jack: JackPortAudioDriver::Open setup max out channels = 2
Jack: JackPortAudioDriver::OpenStream buffer_size = 512
Jack: JackWinNamedPipeServerChannel::Open
Jack: JackWinNamedPipeServer::BindAux : fName \\.\pipe\server_jack_default_0
Jack: JackEngine::Open
Jack: JackWinNamedPipeClient::ConnectAux : fName \\.\pipe\server_jack_default_0
Jack: JackEngine::ClientInternalOpen: name = freewheel
Jack: JackEngine::AllocateRefNum ref = 1
Jack: JackWinSemaphore::Allocate name = jack_pipe.default_freewheel val = 0
Jack: JackEngine::NotifyAddClient: name = freewheel
Jack: JackDriver::ClientNotify ref = 1 driver = system name = freewheel notify = 0
Jack: JackDriver::ClientNotify ref = 0 driver = freewheel name = system notify = 0
Jack: JackConnectionManager::DirectConnect first: ref1 = 1 ref2 = 1
Jack: JackGraphManager::ConnectRefNum cur_index = 0 ref1 = 1 ref2 = 1
Jack: JackDriver::SetupDriverSync driver sem in normal mode
Jack: JackAudioDriver::Attach fBufferSize = 512 fSampleRate = 44100
Jack: JackEngine::PortRegister ref = 0 name = system:capture_1 type = 32 bit float mono audio flags = 22 buffer_size = 512
Jack: JackGraphManager::AllocatePortAux port_index = 1 name = system:capture_1 type = 32 bit float mono audio
Jack: JackConnectionManager::AddOutputPort ref = 0 port = 1
Jack: JackEngine::ClientNotify: no callback for notification = 9
Jack: JackEngine::ClientNotify: no callback for notification = 9
Jack: JackAudioDriver::Attach fCapturePortList[i] port_index = 1
Jack: JackEngine::PortRegister ref = 0 name = system:capture_2 type = 32 bit float mono audio flags = 22 buffer_size = 512
Jack: JackGraphManager::AllocatePortAux port_index = 2 name = system:capture_2 type = 32 bit float mono audio
Jack: JackConnectionManager::AddOutputPort ref = 0 port = 2
Jack: JackEngine::ClientNotify: no callback for notification = 9
Jack: JackEngine::ClientNotify: no callback for notification = 9
Jack: JackAudioDriver::Attach fCapturePortList[i] port_index = 2
Jack: JackEngine::PortRegister ref = 0 name = system:playback_1 type = 32 bit float mono audio flags = 21 buffer_size = 512
Jack: JackGraphManager::AllocatePortAux port_index = 3 name = system:playback_1 type = 32 bit float mono audio
Jack: JackConnectionManager::AddInputPort ref = 0 port = 3
Jack: JackEngine::ClientNotify: no callback for notification = 9
Jack: JackEngine::ClientNotify: no callback for notification = 9
Jack: JackAudioDriver::Attach fPlaybackPortList[i] port_index = 3
Jack: JackEngine::PortRegister ref = 0 name = system:playback_2 type = 32 bit float mono audio flags = 21 buffer_size = 512
Jack: JackGraphManager::AllocatePortAux port_index = 4 name = system:playback_2 type = 32 bit float mono audio
Jack: JackConnectionManager::AddInputPort ref = 0 port = 4
Jack: JackEngine::ClientNotify: no callback for notification = 9
Jack: JackEngine::ClientNotify: no callback for notification = 9
Jack: JackAudioDriver::Attach fPlaybackPortList[i] port_index = 4
Jack: InitTime : multimedia timer resolution set to 1 milliseconds
Jack: JackServer::IsRunning
Jack: JackWinMMEDriver::Open - num_potential_inputs 0
Jack: JackWinMMEDriver::Open - num_potential_outputs 1
Jack: JackWinMMEDriver::Open - multimedia timer resolution set to 1 milliseconds.
JackWinMMEDriver::Open - while creating output port: Undefined external error. | winmme, system_midi, out
Jack: JackWinMMEDriver::Open - input_count 0
Jack: JackWinMMEDriver::Open - output_count 0
Jack: JackDriver::Open capture_driver_name = in
Jack: JackDriver::Open playback_driver_name = out
Jack: Check protocol client = 8 server = 8
Jack: JackEngine::ClientInternalOpen: name = system_midi
Jack: JackEngine::AllocateRefNum ref = 2
Jack: JackWinSemaphore::Allocate name = jack_pipe.default_system_midi val = 0
Jack: JackEngine::NotifyAddClient: name = system_midi
Jack: JackDriver::ClientNotify ref = 2 driver = system name = system_midi notify = 0
Jack: JackDriver::ClientNotify ref = 0 driver = system_midi name = system notify = 0
Jack: JackDriver::ClientNotify ref = 2 driver = freewheel name = system_midi notify = 0
Jack: JackDriver::ClientNotify ref = 1 driver = system_midi name = freewheel notify = 0
Jack: JackGraphManager::SetBufferSize size = 512
Jack: JackConnectionManager::DirectConnect first: ref1 = 2 ref2 = 2
Jack: JackGraphManager::ConnectRefNum cur_index = 0 ref1 = 2 ref2 = 2
Jack: JackDriver::SetupDriverSync driver sem in normal mode
Jack: JackWinMMEDriver::Attach - fCaptureChannels 0
Jack: JackWinMMEDriver::Attach - fPlaybackChannels 0
Jack: JackServer::Start
Jack: JackPortAudioDriver::Start
Jack: JackWinMMEDriver::Start - Starting driver.
Jack: JackWinMMEDriver::Start - Enabling input ports.
Jack: JackWinMMEDriver::Start - Enabling output ports.
Jack: JackWinMMEDriver::Start - Driver started.
Jack: JackWinThread::StartImp : create non RT thread
Jack: JackWinThread::ThreadHandler : start
Jack: JackWinNamedPipeServerChannel::Init
Jack: JackWinNamedPipeServerChannel::ClientAdd size 0
Jack: JackWinThread::StartImp : create non RT thread
Jack: JackWinNamedPipeServer::BindAux : fName \\.\pipe\server_jack_default_0
Jack: JackWinThread::ThreadHandler : start
Jack: JackClientPipeThread::Execute 2c272f0
Jack: JackRequest::Notification
Jack: JackDriver::ClientNotify ref = 1 driver = freewheel name = freewheel notify = 18
Jack: JackDriver::ClientNotify ref = 1 driver = freewheel name = freewheel notify = 18
Jack: JackDriver::ClientNotify ref = 1 driver = freewheel name = freewheel notify = 18
Jack: JackDriver::ClientNotify ref = 1 driver = freewheel name = freewheel notify = 18
Jack: JackEngine::ClientNotify: no callback for notification = 4
Jack: JackEngine::ClientNotify: no callback for notification = 4
Jack: JackEngine::ClientNotify: no callback for notification = 4
Jack: JackClientPipeThread::Execute 2c272f0

And despite the fact that it seems to have started, a qjackctl notification window appears with the message:尽管它似乎已经开始,但 qjackctl 通知 window 出现以下消息:

Could not connect to Jack server as client.
-Overall operation failed.
-Unable to connect to server.
Please check the messages window for more info.

Without pressing “Cancel”, once in twice I am able to have my program running, just like as if the server functioned normally, and pressing “Cancel” makes the server stop.如果不按“取消”,我可以两次运行我的程序,就像服务器正常运行一样,按“取消”会使服务器停止。 But only once between two recurrent attempts.但在两次反复尝试之间只有一次。 As for code, I also tested ready-to-use examples from jack audio docs, to check if any difference will be noticed but nothing.至于代码,我还测试了 jack 音频文档中的现成示例,以检查是否会注意到任何差异,但什么也没有。

I am really clueless of how to debug this, since most solutions found in the internet are concerning Linux environment and apart from that, I find my implementation practice anorthodox, and I am pretty sure that I probably have to get my hands dirty with the API commands instead of searching for a ready to use- scripting solutions.我真的不知道如何调试这个,因为在互联网上找到的大多数解决方案都与 Linux 环境有关,除此之外,我发现我的实现实践是非正统的,我很确定我可能不得不用 API 弄脏我的手命令而不是搜索即用型脚本解决方案。 However, debugging the server comes first for now.但是,现在首先要调试服务器。

so If anyone has an idea of how should I make jack server running appropriately again it would be great!所以如果有人知道我应该如何让杰克服务器再次正常运行,那就太好了!

EDIT 10 minutes after posting the question, I managed to debug this, however I leave the post open, so as to help others that face a similar issue.编辑发布问题 10 分钟后,我设法调试了这个,但是我让帖子保持打开状态,以帮助其他面临类似问题的人。 The solution that worked for me is by running the following C++ code modified by the server_control example:对我有用的解决方案是运行以下由 server_control 示例修改的 C++ 代码:

#include <iostream>
#include <jack/jack.h>
#include <jack/types.h>
#include <jack/control.h>

static jackctl_driver_t * jackctl_server_get_driver(jackctl_server_t *server, const char *driver_name)
{
    const JSList * node_ptr = jackctl_server_get_drivers_list(server);

    while (node_ptr) {
        if (strcmp(jackctl_driver_get_name((jackctl_driver_t *)node_ptr->data), driver_name) == 0) {
            return (jackctl_driver_t *)node_ptr->data;
        }
        node_ptr = jack_slist_next(node_ptr);
    }

    return NULL;
}

int main(int argc, char *argv[])
{
    jackctl_server_t * server;
    const char* driver_name = "portaudio";//You could probably change the driver name accordingly 


    server = jackctl_server_create2(NULL, NULL, NULL);

    jackctl_server_open(server, jackctl_server_get_driver(server, driver_name));
    jackctl_server_start(server);

    jackctl_server_stop(server);
    jackctl_server_close(server);
    jackctl_server_destroy(server);
    return 0;
}

Your windows audio bit rate probably needs to be matched to what jack is requesting.您的 windows 音频比特率可能需要与插孔请求的匹配。 Otherwise, something is consuming your interface in exclusive mode.否则,某些东西会以独占模式消耗您的界面。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM