summaryrefslogtreecommitdiff
path: root/plugins/dumb/dumb-kode54/src/core/rawsig.c
blob: 75c41eb0687ceb39d2bd575ea93dcd15f43a9909 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
/*  _______         ____    __         ___    ___
 * \    _  \       \    /  \  /       \   \  /   /       '   '  '
 *  |  | \  \       |  |    ||         |   \/   |         .      .
 *  |  |  |  |      |  |    ||         ||\  /|  |
 *  |  |  |  |      |  |    ||         || \/ |  |         '  '  '
 *  |  |  |  |      |  |    ||         ||    |  |         .      .
 *  |  |_/  /        \  \__//          ||    |  |
 * /_______/ynamic    \____/niversal  /__\  /____\usic   /|  .  . ibliotheque
 *                                                      /  \
 *                                                     / .  \
 * rawsig.c - Function to retrieve raw signal         / / \  \
 *            data from a DUH provided you know      | <  /   \_
 *            what type of signal it is.             |  \/ /\   /
 *                                                    \_  /  > /
 * By entheh.                                           | \ / /
 *                                                      |  ' /
 *                                                       \__/
 */

#include <stdlib.h>

#include "dumb.h"
#include "internal/dumb.h"



/* You have to specify the type of sigdata, proving you know what to do with
 * the pointer. If you get it wrong, you can expect NULL back.
 */
sigdata_t *duh_get_raw_sigdata(DUH *duh, int sig, long type)
{
	DUH_SIGNAL *signal;

	if (!duh) return NULL;

	if ((unsigned int)sig >= (unsigned int)duh->n_signals) return NULL;

	signal = duh->signal[sig];

	if (signal && signal->desc->type == type)
		return signal->sigdata;

	return NULL;
}