Updating built in Io code to use += instead of x = x + y
[io/quag.git] / addons / PortAudio / source / new / IoAudioMixer.h
blobc92f9134de17936ef902ab280af634085505f422
1 /* copyright: Steve Dekorte, 2002
2 * All rights reserved. See _BSDLicense.txt.
3 */
5 #ifndef IOAUDIOMIXER_DEFINED
6 #define IOAUDIOMIXER_DEFINED 1
8 #include "IoAudioDevice.h"
9 #include "IoSound.h"
10 #include "IoObject.h"
11 #include "IoSeq.h"
12 #include "IoSeq.h"
14 #define ISAUDIOMIXER(self) IoObject_hasCloneFunc_(self, (IoTagCloneFunc *)IoAudioMixer_rawClone)
16 #define AUDIOEVENT_ADD 0
17 #define AUDIOEVENT_REMOVE 1
19 typedef struct
21 IoSound *ioTriggerSound;
22 long sample;
23 IoSound *ioPlaySound;
24 char etype;
25 } AudioEvent;
27 typedef IoObject IoAudioMixer;
29 typedef struct
31 IoSeq *ioBuffer;
32 UArray *buffer;
33 UArray *mixBuffer;
34 float tempo;
35 float pitch;
36 int sampleRate;
37 List *sounds;
38 List *events;
39 List *activeEvents;
40 List *soundsToRemove;
41 IoAudioDevice *ioAudioDevice;
42 IoMessage *writeMessage;
43 IoMessage *nonBlockingWriteMessage;
44 char isRunning;
45 float scale;
46 int samplesPerBuffer;
47 double volume;
48 void *soundTouch;
49 } IoAudioMixerData;
51 IoAudioMixer *IoAudioMixer_proto(void *state);
52 IoAudioMixer *IoAudioMixer_new(void *state);
53 IoAudioMixer *IoAudioMixer_rawClone(IoAudioMixer *self);
55 void IoAudioMixer_free(IoAudioMixer *self);
56 void IoAudioMixer_mark(IoAudioMixer *self);
58 /* ----------------------------------------------------------- */
59 void IoAudioMixer_updateBufferSize(IoAudioMixer *self);
60 IoObject *IoAudioMixer_setAudioDevice(IoAudioMixer *self, IoObject *locals, IoMessage *m);
61 IoObject *IoAudioMixer_setSamplesPerBuffer(IoAudioMixer *self, IoObject *locals, IoMessage *m);
62 IoObject *IoAudioMixer_setVolume(IoAudioMixer *self, IoObject *locals, IoMessage *m);
64 IoObject *IoAudioMixer_addSound_(IoAudioMixer *self, IoObject *locals, IoMessage *m);
65 IoObject *IoAudioMixer_addSound_onSample_ofSound_(IoAudioMixer *self, IoObject *locals, IoMessage *m);
66 IoObject *IoAudioMixer_removeSound_(IoAudioMixer *self, IoObject *locals, IoMessage *m);
67 IoObject *IoAudioMixer_removeSound_onSample_ofSound_(IoAudioMixer *self, IoObject *locals, IoMessage *m);
68 IoObject *IoAudioMixer_removeAllSounds(IoAudioMixer *self, IoObject *locals, IoMessage *m);
69 IoObject *IoAudioMixer_sounds(IoAudioMixer *self, IoObject *locals, IoMessage *m);
71 IoObject *IoAudioMixer_start(IoAudioMixer *self, IoObject *locals, IoMessage *m);
72 IoObject *IoAudioMixer_stop(IoAudioMixer *self, IoObject *locals, IoMessage *m);
73 void IoAudioMixer_processActiveEvents(IoAudioMixer *self);
74 int IoAudioMixer_mixOneChunk(IoAudioMixer *self, IoObject *locals, IoMessage *m);
76 IoObject *IoAudioMixer_setTempo(IoAudioMixer *self, IoObject *locals, IoMessage *m);
77 IoObject *IoAudioMixer_setSampleRate(IoAudioMixer *self, IoObject *locals, IoMessage *m);
78 IoObject *IoAudioMixer_setPitchSemiTones(IoAudioMixer *self, IoObject *locals, IoMessage *m);
80 #endif