~artfwo/ubuntu/precise/jackd2/jackd2-fix-911342

« back to all changes in this revision

Viewing changes to example-clients/midisine.c

  • Committer: Artem Popov
  • Date: 2012-01-03 15:45:46 UTC
  • mfrom: (1.2.4 upstream)
  • Revision ID: artfwo@ubuntu.com-20120103154546-2qwp637mmowe8gtm
Copied over JackControlAPI.cpp from Debian branch.

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
1
/*
2
2
    Copyright (C) 2004 Ian Esten
3
 
    
 
3
 
4
4
    This program is free software; you can redistribute it and/or modify
5
5
    it under the terms of the GNU General Public License as published by
6
6
    the Free Software Foundation; either version 2 of the License, or
76
76
                if ((in_event.time == i) && (event_index < event_count))
77
77
                {
78
78
                        if (((*(in_event.buffer) & 0xf0)) == 0x90)
79
 
                        {   
 
79
                        {
80
80
                /* note on */
81
81
                note = *(in_event.buffer + 1);
82
82
                if (*(in_event.buffer + 2) == 0) {
99
99
                ramp = (ramp > 1.0) ? ramp - 2.0 : ramp;
100
100
                out[i] = note_on*sin(2*M_PI*ramp);
101
101
        }
102
 
        return 0;      
 
102
        return 0;
103
103
}
104
104
 
105
105
static int srate(jack_nframes_t nframes, void *arg)
111
111
 
112
112
static void jack_shutdown(void *arg)
113
113
{
 
114
    fprintf(stderr, "JACK shut down, exiting ...\n");
114
115
        exit(1);
115
116
}
116
117
 
118
119
{
119
120
        if ((client = jack_client_open("midisine", JackNullOption, NULL)) == 0)
120
121
        {
121
 
                fprintf(stderr, "jack server not running?\n");
 
122
                fprintf(stderr, "JACK server not running?\n");
122
123
                return 1;
123
124
        }
124
 
        
 
125
 
125
126
        calc_note_frqs(jack_get_sample_rate (client));
126
127
 
127
128
        jack_set_process_callback (client, process, 0);
138
139
                fprintf(stderr, "cannot activate client");
139
140
                return 1;
140
141
        }
141
 
    
 
142
 
142
143
    /* install a signal handler to properly quits jack client */
143
144
    signal(SIGQUIT, signal_handler);
144
145
        signal(SIGTERM, signal_handler);