~ubuntu-branches/debian/sid/jackd2/sid

« back to all changes in this revision

Viewing changes to macosx/JackMachServerNotifyChannel.cpp

  • Committer: Bazaar Package Importer
  • Author(s): Adrian Knoth
  • Date: 2011-03-31 13:54:50 UTC
  • mfrom: (1.1.3 upstream) (2.1.4 experimental)
  • Revision ID: james.westby@ubuntu.com-20110331135450-zafc1di024kzeu31
Tags: 1.9.7~dfsg-1
* New upstream version 1.9.7 (ALSA resume, new latency API)
* Build with --mixed on i386 to be compatible with amd64.
* Don't patch jack_connect for fast consecutive calls anymore, it's now
  using the same code as in jackd1 and waits for the port connection to
  appear.

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
/*
2
 
Copyright (C) 2004-2008 Grame
3
 
 
4
 
This program is free software; you can redistribute it and/or modify
5
 
it under the terms of the GNU Lesser General Public License as published by
6
 
the Free Software Foundation; either version 2.1 of the License, or
7
 
(at your option) any later version.
8
 
 
9
 
This program is distributed in the hope that it will be useful,
10
 
but WITHOUT ANY WARRANTY; without even the implied warranty of
11
 
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
12
 
GNU Lesser General Public License for more details.
13
 
 
14
 
You should have received a copy of the GNU Lesser General Public License
15
 
along with this program; if not, write to the Free Software 
16
 
Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
17
 
 
18
 
*/
19
 
 
20
 
#include "JackMachServerNotifyChannel.h"
21
 
#include "JackRPCEngineUser.c"
22
 
#include "JackNotification.h"
23
 
#include "JackTools.h"
24
 
#include "JackConstants.h"
25
 
#include "JackError.h"
26
 
#include <stdio.h>
27
 
 
28
 
namespace Jack
29
 
{
30
 
 
31
 
int JackMachServerNotifyChannel::Open(const char* server_name)
32
 
{
33
 
    jack_log("JackMachServerChannel::Open");
34
 
    char jack_server_entry_name[512];
35
 
    snprintf(jack_server_entry_name, sizeof(jack_server_entry_name), "%s.%d_%s", jack_server_entry, JackTools::GetUID(), server_name);
36
 
 
37
 
    if (!fClientPort.ConnectPort(jack_server_entry_name)) {
38
 
        jack_error("Cannot connect to server port");
39
 
        return -1;
40
 
    } else {
41
 
        return 0;
42
 
    }
43
 
}
44
 
 
45
 
void JackMachServerNotifyChannel::Close()
46
 
{}
47
 
 
48
 
void JackMachServerNotifyChannel::Notify(int refnum, int notify, int value)
49
 
{
50
 
    kern_return_t res = rpc_jack_client_rt_notify(fClientPort.GetPort(), refnum, notify, value, 0);
51
 
    if (res != KERN_SUCCESS) {
52
 
        jack_error("Could not write request ref = %d notify = %d err = %s", refnum, notify, mach_error_string(res));
53
 
    }
54
 
}
55
 
    
56
 
void JackMachServerNotifyChannel::NotifyQuit()
57
 
{
58
 
 #ifdef MAC_OS_X_VERSION_10_5
59
 
    // Nothing : since exception does not work in this case on pre Snow Loopard systems, see JackMachServerChannel::Close()
60
 
 #else
61
 
    kern_return_t res = rpc_jack_client_rt_notify(fClientPort.GetPort(), -1, kQUIT, 0, 0);
62
 
    if (res != KERN_SUCCESS) {
63
 
        jack_error("Could not write request ref = %d notify = %d err = %s", -1, kQUIT, mach_error_string(res));
64
 
    }
65
 
#endif
66
 
}
67
 
 
68
 
} // end of namespace
69
 
 
70