File: yoscillo.c

package info (click to toggle)
lebiniou 3.18-1
  • links: PTS
  • area: main
  • in suites: wheezy
  • size: 5,396 kB
  • sloc: ansic: 20,369; sh: 4,169; makefile: 834; awk: 194
file content (87 lines) | stat: -rw-r--r-- 1,743 bytes parent folder | download
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
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
/*
 *  Copyright 1994-2012 Olivier Girondel
 *
 *  This file is part of lebiniou.
 *
 *  lebiniou is free software: you can redistribute it and/or modify
 *  it under the terms of the GNU General Public License as published by
 *  the Free Software Foundation, either version 2 of the License, or
 *  (at your option) any later version.
 *
 *  lebiniou is distributed in the hope that it will be useful,
 *  but WITHOUT ANY WARRANTY; without even the implied warranty of
 *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 *  GNU General Public License for more details.
 *
 *  You should have received a copy of the GNU General Public License
 *  along with lebiniou. If not, see <http://www.gnu.org/licenses/>.
 */

#include "oscillo.h"


u_long id = 946482111;
u_long options = BE_SFX2D;
char dname[] = "Y oscillo";
u_long mode = OVERLAY;
char desc[] = "Vertical mono oscilloscope";

static Porteuse_t *P = NULL;
static int connect = 1;


static void
init()
{
  int i;
  Transform_t t;

  memset(&t, 0, sizeof(t));

  P->origin.x = CENTERX;
  P->origin.y = 0;
  
  t.v_j_factor = HMAXX * 0.85;
  t.v_i.y = 1.0 / (float)(P->size - 1) * (float)MAXY;
  
  for (i = 0; i < P->size; i++)
    P->trans[i] = t;

  Porteuse_init_alpha(P);
}


void
create(Context_t *ctx)
{
  if (ctx->input != NULL) {
    P = Porteuse_new(ctx->input->size, A_MONO);
    init();
  } else
    options |= BEQ_DISABLED;
}


void
destroy(__attribute__ ((unused)) Context_t *ctx)
{
  if (P != NULL)
    Porteuse_delete(P);
}


void
on_switch_on(__attribute__ ((unused)) Context_t *ctx)
{
  /* connect = b_rand_boolean(); */
}


void
run(Context_t *ctx)
{
  if (P != NULL) {
    Buffer8_clear(passive_buffer(ctx));
    Porteuse_draw(P, ctx, connect);
  }
}