~ubuntu-branches/ubuntu/oneiric/oss4/oneiric-proposed

« back to all changes in this revision

Viewing changes to kernel/framework/vmix_core/vmix_import.inc

  • Committer: Bazaar Package Importer
  • Author(s): Stefano Rivera
  • Date: 2011-06-16 20:37:48 UTC
  • mfrom: (5.1.3 sid)
  • Revision ID: james.westby@ubuntu.com-20110616203748-jbrxik6ql33z54co
Tags: 4.2-build2004-1ubuntu1
* Merge from Debian unstable.
  - Supports our current kernel (LP: #746048)
  Remaining changes:
  - debian/oss4-dkms.dkms.in: s/source/build/ in Kernel headers paths.
* ld-as-needed.patch: Re-order CC arguments to enable building with ld
  --as-needed (LP: #770972)

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
#ifdef CONFIG_OSS_VMIX_FLOAT
 
2
/*
 
3
 * Purpose: Recording device to local input buffer import routine for vmix
 
4
 */
 
5
/*
 
6
 *
 
7
 * This file is part of Open Sound System.
 
8
 *
 
9
 * Copyright (C) 4Front Technologies 1996-2008.
 
10
 *
 
11
 * This this source file is released under GPL v2 license (no other versions).
 
12
 * See the COPYING file included in the main directory of this source
 
13
 * distribution for the license terms and conditions.
 
14
 *
 
15
 */
 
16
 
 
17
int i, ch;
 
18
float vol;
 
19
 
 
20
vol = vmix_db_table[eng->outvol / 5];
 
21
 
 
22
for (ch = 0; ch < channels; ch++)
 
23
  {
 
24
    float vu;
 
25
    float *chbuf;
 
26
 
 
27
    vu = eng->vu[ch % 2];
 
28
    vu = vu / 255.0;
 
29
 
 
30
    op = (SAMPLE_TYPE *) inbuf;
 
31
    op += ch;
 
32
 
 
33
    chbuf = chbufs[ch];
 
34
 
 
35
    for (i = 0; i < samples; i++)
 
36
      {
 
37
        float tmp;
 
38
 
 
39
#if 0 && defined(SINE_DEBUG)
 
40
        /* Generate internal sine wave test signal */
 
41
        tmp = 0;
 
42
        if (ch < 2)
 
43
          {
 
44
            tmp = sine_table[sine_phase[ch]];
 
45
            sine_phase[ch] = (sine_phase[ch] + 1) % SINE_SIZE;
 
46
          }
 
47
#else
 
48
        tmp = VMIX_BYTESWAP (*op);
 
49
        tmp /= SAMPLE_RANGE;
 
50
        tmp *= vol;
 
51
 
 
52
        if (tmp < -1.0)
 
53
          tmp = -1.0;
 
54
        else if (tmp > 1.0)
 
55
          tmp = 1.0;
 
56
 
 
57
#endif
 
58
        op += channels;
 
59
 
 
60
        *chbuf++ = tmp;
 
61
 
 
62
        /* VU meter */
 
63
        if (tmp < 0.0)
 
64
          tmp = -tmp;
 
65
        if (tmp > vu)
 
66
          vu = tmp;
 
67
      }
 
68
 
 
69
    if (ch < 2)
 
70
      {
 
71
        vu = vu * 255.0;
 
72
        eng->vu[ch] = (int)vu;
 
73
      }
 
74
  }
 
75
#else
 
76
#include "vmix_import_int.inc"
 
77
#endif