summaryrefslogtreecommitdiff
path: root/kernel/framework/vmix_core/vmix_import_int.inc
blob: 338078d75fda870cd2f31916cd8c39bf88ad353e (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
45
46
47
48
49
50
51
52
53
54
55
56
/*
 * Purpose: Recording device to local input buffer import routine for vmix (int)
 */
/*
 *
 * This file is part of Open Sound System.
 *
 * Copyright (C) 4Front Technologies 1996-2008.
 *
 * This this source file is released under GPL v2 license (no other versions).
 * See the COPYING file included in the main directory of this source
 * distribution for the license terms and conditions.
 *
 */

int i, ch;
int vol;

vol = vmix_db_table[eng->outvol / 5];

for (ch = 0; ch < channels; ch++)
  {
    int vu;
    int *chbuf;

    vu = eng->vu[ch % 2] * 65536;

    op = (SAMPLE_TYPE *) inbuf;
    op += ch;

    chbuf = chbufs[ch];

    for (i = 0; i < samples; i++)
      {
	int tmp;

	tmp = INT_IMPORT (VMIX_BYTESWAP (*op));
	tmp = (tmp * vol) / VMIX_VOL_SCALE;

	op += channels;

	*chbuf++ = tmp;

	/* VU meter */
	if (tmp < 0)
	  tmp = -tmp;
	if (tmp > vu)
	  vu = tmp;
      }

    if (ch < 2)
      {
	vu = vu / 65536;
	eng->vu[ch] = vu;
      }
  }