From 604ae996d625b6f9eb309337ebb06b89f76e20de Mon Sep 17 00:00:00 2001 From: petern Date: Thu, 23 Jul 2009 19:33:01 +0000 Subject: [PATCH] -Add: Get client name from jack and show in title. Reuse the name when reconnecting to jack. git-svn-id: http://svn.fuzzle.org/mloop/trunk@30 ba049829-c6ef-42ef-81ac-908dd8d2e907 --- src/jack.cpp | 4 +++- src/jack.h | 2 ++ src/ui.cpp | 2 +- 3 files changed, 6 insertions(+), 2 deletions(-) diff --git a/src/jack.cpp b/src/jack.cpp index 6bb0719..11961d5 100644 --- a/src/jack.cpp +++ b/src/jack.cpp @@ -13,6 +13,7 @@ Jack::Jack() m_recording = false; m_loop_buffer = new RingBuffer(2048); m_notecache.Reset(); + m_client_name = "mloop"; } Jack::~Jack() @@ -26,7 +27,7 @@ bool Jack::Connect() if (m_connected) return true; jack_status_t status; - m_client = jack_client_open("mloop", JackNoStartServer, &status); + m_client = jack_client_open(m_client_name, JackNoStartServer, &status); if (m_client == NULL) { if (status & JackServerFailed) { fprintf(stderr, "JACK server not running\n"); @@ -38,6 +39,7 @@ bool Jack::Connect() m_connected = true; + m_client_name = jack_get_client_name(m_client); m_sample_rate = jack_get_sample_rate(m_client); jack_on_shutdown(m_client, &ShutdownCallbackHandler, this); diff --git a/src/jack.h b/src/jack.h index 27873a0..6086049 100644 --- a/src/jack.h +++ b/src/jack.h @@ -46,6 +46,8 @@ public: Jack(); ~Jack(); + const char *m_client_name; + bool Connect(); void Disconnect(); bool Run(); diff --git a/src/ui.cpp b/src/ui.cpp index 9003bb5..b8b2097 100644 --- a/src/ui.cpp +++ b/src/ui.cpp @@ -60,7 +60,7 @@ bool UI::Run(Jack &j) bkgdset(color_map[1]); attrset(color_map[1]); - mvaddstr(y_offs, 0, " mloop "); + mvprintw(y_offs, 0, " mloop - %s", j.m_client_name); clrtoeol(); y_offs++;