File: sqUnixCustomSound.c

package info (click to toggle)
squeak-vm 1%3A4.10.2.2614%2B20120917~dfsg-1
  • links: PTS, VCS
  • area: main
  • in suites: bookworm
  • size: 11,144 kB
  • sloc: ansic: 72,193; objc: 5,494; sh: 3,061; asm: 1,533; cpp: 449; pascal: 372; makefile: 300; awk: 103; cs: 11
file content (148 lines) | stat: -rw-r--r-- 2,793 bytes parent folder | download | duplicates (7)
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
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
/* sqUnixCustomSound.c -- sound module for custom sound system
 *
 * Last edited: 2009-08-14 12:44:58 by piumarta on emilia-2.local
 *
 * This is a template for creating your own sound drivers for Squeak:
 * 
 *   - copy the entire contents of this directory to some other name
 *   - rename this file to be something more appropriate
 *   - modify acinclude.m4, Makefile.in, and ../vm/sqUnixMain accordingly
 *   - implement all the stubs in this file that currently do nothing
 */

#include "sq.h"
#include "sqaio.h"

#include <stdio.h>


#define trace() fprintf(stderr, "%s:%d %s\n", __FILE__, __LINE__, __FUNCTION__)


/*** sound output ***/


static sqInt sound_AvailableSpace(void)
{
  trace();
  return 8192;
}

static sqInt sound_InsertSamplesFromLeadTime(sqInt frameCount, void *srcBufPtr, sqInt samplesOfLeadTime)
{
  trace();
  return frameCount;
}

static sqInt sound_PlaySamplesFromAtLength(sqInt frameCount, void *srcBufPtr, sqInt startIndex)
{
  trace();
  return frameCount;
}

static sqInt sound_PlaySilence(void)
{
  trace();
  return 8192;
}

static sqInt sound_Start(sqInt frameCount, sqInt samplesPerSec, sqInt stereo, sqInt semaIndex)
{
  trace();
  return true;
}

static sqInt sound_Stop(void)
{
  trace();
  return 0;
}


/*** sound input ***/


static sqInt sound_StartRecording(sqInt desiredSamplesPerSec, sqInt stereo, sqInt semaIndex)
{
  trace();
  return 0;
}

static sqInt sound_StopRecording(void)
{
  trace();
  return 0;
}

static double sound_GetRecordingSampleRate(void)
{
  trace();
  return 8192;
}

static sqInt sound_RecordSamplesIntoAtLength(void *buf, sqInt startSliceIndex, sqInt bufferSizeInBytes)
{
  trace();
  return 8192;
}

/*** sound mixer ***/

static void sound_Volume(double *left, double *right)
{
  trace();
  *left= 1.0;
  *right= 1.0;
}

static void sound_SetVolume(double left, double right)
{
  trace();
}

static void sound_SetRecordLevel(sqInt level)
{
  trace();
}

static sqInt sound_SetSwitch(sqInt id, sqInt captureFlag, sqInt parameter)
{
  trace();
  return -1;
}

static sqInt sound_GetSwitch(sqInt id, sqInt captureFlag, sqInt channel)
{
  trace();
  return -1;
}

static sqInt sound_SetDevice(sqInt id, char *arg)
{
  trace();
  return -1;
}

#include "SqSound.h"

SqSoundDefine(custom);				/* must match name in makeInterface() below */

#include "SqModule.h"

static void sound_parseEnvironment(void) {}

static int sound_parseArgument(int argc, char **argv)
{
  if (!strcmp(argv[0], "-nosound")) return 1;
  return 0;
}

static void  sound_printUsage(void)		{}
static void  sound_printUsageNotes(void)	{}

static void *sound_makeInterface(void)
{
  return &sound_custom_itf;			/* must match name in SqSoundDefine() above */
}

SqModuleDefine(sound, custom);			/* must match name in sqUnixMain.c's moduleDescriptions */