Main Page | Modules | Data Structures | File List | Data Fields | Globals

remix_plugin.h

Go to the documentation of this file.
00001 /*
00002  * libremix -- An audio mixing and sequencing library.
00003  *
00004  * Copyright (C) 2001 Commonwealth Scientific and Industrial Research
00005  * Organisation (CSIRO), Australia.
00006  *
00007  * This library is free software; you can redistribute it and/or
00008  * modify it under the terms of the GNU Lesser General Public
00009  * License as published by the Free Software Foundation; either
00010  * version 2 of the License, or (at your option) any later version.
00011  *
00012  * This library is distributed in the hope that it will be useful,
00013  * but WITHOUT ANY WARRANTY; without even the implied warranty of
00014  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
00015  * Lesser General Public License for more details.
00016  *
00017  * You should have received a copy of the GNU Lesser General Public
00018  * License along with this library; if not, write to the Free Software
00019  * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
00020  *
00021  */
00022 
00023 /*
00024  * remix_plugin.h -- libremix internal data types and functions.
00025  *
00026  * Conrad Parker <Conrad.Parker@CSIRO.AU>, August 2001
00027  */
00028 
00029 #ifndef __REMIX_PLUGIN_H__
00030 #define __REMIX_PLUGIN_H__
00031 
00032 /*#define DEBUG*/
00033 
00034 #if defined(__REMIX_PLUGIN__) || defined(__REMIX__)
00035 
00036 #include <stdio.h>
00037 
00038 #include "ctxdata.h"
00039 
00040 #define REMIX_PLUGIN_API_MAJOR 1
00041 #define REMIX_PLUGIN_API_MINOR 0
00042 #define REMIX_PLUGIN_API_REVISION 0
00043 
00044 typedef struct _RemixMetaAuthor RemixMetaAuthor;
00045 typedef struct _RemixMetaText RemixMetaText;
00046 
00047 typedef struct _RemixParameterScheme RemixParameterScheme;
00048 typedef struct _RemixParameterRange RemixParameterRange;
00049 
00050 typedef struct _RemixNamedParameter RemixNamedParameter;
00051 
00052 typedef union _RemixConstraint RemixConstraint;
00053 
00054 typedef struct _RemixMethods RemixMethods;;
00055 
00056 #define REMIX_PLUGIN_WRITEABLE 1<<0
00057 #define REMIX_PLUGIN_SEEKABLE  1<<1
00058 #define REMIX_PLUGIN_CACHEABLE 1<<2
00059 #define REMIX_PLUGIN_CAUSAL    1<<3
00060 
00061 /* A base of a plugin */
00062 typedef struct _RemixPlugin RemixPlugin;
00063 /*typedef struct _RemixBase * RemixBase;*/
00064 
00065 typedef struct _RemixChunk RemixChunk;
00066 
00067 #if defined (__REMIX__)
00068 #include "remix_private.h"
00069 #else
00070 typedef RemixOpaque RemixEnv;
00071 typedef RemixOpaque RemixPoint;
00072 typedef RemixOpaque RemixEnvelope;
00073 typedef RemixOpaque RemixStream;
00074 typedef RemixOpaque RemixChannel;
00075 typedef RemixOpaque RemixDeck;
00076 typedef RemixOpaque RemixTrack;
00077 typedef RemixOpaque RemixLayer;
00078 typedef RemixOpaque RemixSound;
00079 typedef RemixOpaque RemixSquareTone;
00080 typedef RemixOpaque RemixMonitor;
00081 #endif
00082 
00083 
00084 typedef CDList * (*RemixPluginInitFunc) (RemixEnv * env);
00085 
00086 typedef RemixBase * (*RemixInitFunc) (RemixEnv * env, RemixBase * base,
00087                                       CDSet * parameters);
00088 
00089 typedef CDSet * (*RemixSuggestFunc) (RemixEnv * env, RemixPlugin * plugin,
00090                                      CDSet * parameters,
00091                                      void * plugin_data);
00092 
00093 typedef RemixBase * (*RemixCloneFunc) (RemixEnv * env, RemixBase * base);
00094 typedef int (*RemixDestroyFunc) (RemixEnv * env, RemixBase * base);
00095 typedef int (*RemixReadyFunc) (RemixEnv * env, RemixBase * base);
00096 typedef RemixBase * (*RemixPrepareFunc) (RemixEnv * env, RemixBase * base);
00097 typedef RemixCount (*RemixSeekFunc) (RemixEnv * env, RemixBase * base,
00098                                      RemixCount count);
00099 typedef RemixCount (*RemixLengthFunc) (RemixEnv * env, RemixBase * base);
00100 typedef RemixCount (*RemixProcessFunc) (RemixEnv * env, RemixBase * base,
00101                                         RemixCount count,
00102                                         RemixStream * input,
00103                                         RemixStream * output);
00104 typedef int (*RemixFlushFunc) (RemixEnv * env, RemixBase * base);
00105 
00106 #define REMIX_FLAGS_NONE (0)
00107 
00108 #define REMIX_AUTHOR(n,e) ((struct _RemixMetaAuthor){(n),(e)})
00109 #define REMIX_ONE_AUTHOR(n,e) CD_SINGLETON_LIST(CD_POINTER(&(REMIX_AUTHOR((n),(e)))))
00110 
00111 /* ChunkChunkFuncs and all the rest */
00112 
00113 /* RemixChunkFunc: a function to apply to one chunk */
00114 typedef RemixCount (*RemixChunkFunc) (RemixEnv * env, RemixChunk * chunk,
00115                                       RemixCount offset,
00116                                       RemixCount count, int channelname,
00117                                       void * data);
00118 
00119 /* RemixChunkChunkFunc: a function to apply between two chunks :) */
00120 typedef RemixCount (*RemixChunkChunkFunc) (RemixEnv * env,
00121                                            RemixChunk * src,
00122                                            RemixCount src_offset,
00123                                            RemixChunk * dest,
00124                                            RemixCount dest_offset,
00125                                            RemixCount count, int channelname,
00126                                            void * data);
00127 
00128 /* RemixChunkChunkChunkFunc: a function to apply between THREE chunks !! */
00129 typedef RemixCount (*RemixChunkChunkChunkFunc) (RemixEnv * env,
00130                                                 RemixChunk * src1,
00131                                                 RemixCount src1_offset,
00132                                                 RemixChunk * src2,
00133                                                 RemixCount src2_offset,
00134                                                 RemixChunk * dest,
00135                                                 RemixCount dest_offset,
00136                                                 RemixCount count,
00137                                                 int channelname,
00138                                                 void * data);
00139 
00140 struct _RemixMetaAuthor {
00141   char * name;
00142   char * email;
00143 };
00144 
00145 struct _RemixMetaText {
00146   char * identifier;
00147   char * category;
00148   char * description;
00149   char * copyright;
00150   char * url;
00151   CDList * authors;
00152 };
00153 
00154 struct _RemixParameterRange {
00155   RemixFlags valid_mask;
00156   RemixParameter lower;
00157   RemixParameter upper;
00158   RemixParameter step;
00159 };
00160 
00161 struct _RemixNamedParameter {
00162   char * name;
00163   RemixParameter parameter;
00164 };
00165 
00166 #define REMIX_NAMED_PARAMETER(n,p) (&((struct _RemixNamedParameter){(n),(p)}))
00167 
00168 union _RemixConstraint {
00169   CDList * list; /* list of RemixNamedParameter */
00170   RemixParameterRange * range;
00171 };
00172 
00173 struct _RemixParameterScheme {
00174   char * name;
00175   char * description;
00176   RemixParameterType type;
00177   RemixConstraintType constraint_type;
00178   RemixConstraint constraint;
00179   RemixFlags hints;
00180 };
00181 
00182 struct _RemixPlugin {
00183   RemixMetaText * metatext;
00184   RemixFlags flags;
00185   CDSet * init_scheme;
00186   RemixInitFunc init;
00187   CDSet * process_scheme;
00188   RemixSuggestFunc suggest;
00189   void * plugin_data;
00190 };
00191 
00192 struct _RemixMethods {
00193   RemixCloneFunc clone;
00194   RemixDestroyFunc destroy;
00195   RemixReadyFunc ready;
00196   RemixPrepareFunc prepare;
00197   RemixProcessFunc process;
00198   RemixLengthFunc length;
00199   RemixSeekFunc seek;
00200   RemixFlushFunc flush;
00201 };
00202 
00203 
00204 struct _RemixChunk {
00205   RemixCount start_index;
00206   RemixCount length;
00207   RemixPCM * data;
00208 };
00209 
00210 
00211 /* debug */
00212 void remix_dprintf (const char * fmt, ...);
00213 
00214 /* SOUNDRENDER, remix_context */
00215 
00216 RemixError remix_set_error (RemixEnv * env, RemixError error);
00217 
00218 
00219 /* remix_base */
00220 RemixBase * remix_base_new (RemixEnv * env);
00221 
00222 RemixPlugin * remix_base_set_plugin (RemixEnv * env, RemixBase * base,
00223                                      RemixPlugin * plugin);
00224 RemixPlugin * remix_base_get_plugin (RemixEnv * env, RemixBase * base);
00225 RemixMethods * remix_base_set_methods (RemixEnv * env, RemixBase * base,
00226                                        RemixMethods * methods);
00227 void * remix_base_set_instance_data (RemixEnv * env, RemixBase * base,
00228                                      void * data);
00229 void * remix_base_get_instance_data (RemixEnv * env, RemixBase * base);
00230 
00231 RemixCount remix_base_get_mixlength (RemixEnv * env, RemixBase * base);
00232 RemixSamplerate remix_base_get_samplerate (RemixEnv * env, RemixBase * base);
00233 RemixTempo remix_base_get_tempo (RemixEnv * env, RemixBase * base);
00234 CDSet * remix_base_get_channels (RemixEnv * env, RemixBase * base);
00235 
00236 int remix_base_has_samplerate (RemixEnv * env, RemixBase * base);
00237 int remix_base_has_tempo (RemixEnv * env, RemixBase * base);
00238 int remix_base_encompasses_mixlength (RemixEnv * env, RemixBase * base);
00239 int remix_base_encompasses_channels (RemixEnv * env, RemixBase * base);
00240 
00241 
00242 /* remix_meta */
00243 RemixMetaText * remix_meta_text_new (RemixEnv * env);
00244 void remix_meta_text_free (RemixEnv * env, RemixMetaText * mt);
00245 RemixMetaText * remix_get_meta_text (RemixEnv * env, RemixBase * base);
00246 RemixMetaText * remix_set_meta_text (RemixEnv * env, RemixBase * base,
00247                                      RemixMetaText * mt);
00248 
00249 
00250 /* remix_null */
00251 RemixCount remix_null_length (RemixEnv * env, RemixBase * base);
00252 RemixCount remix_null_process (RemixEnv * env, RemixBase * base,
00253                                RemixCount count,
00254                                RemixStream * input, RemixStream * output);
00255 RemixCount remix_null_seek (RemixEnv * env, RemixBase * base,
00256                             RemixCount offset);
00257 
00258 
00259 /* remix_stream */
00260 RemixCount remix_stream_chunkfuncify (RemixEnv * env, RemixStream * stream,
00261                                       RemixCount count,
00262                                       RemixChunkFunc func, void * data);
00263 RemixCount remix_stream_chunkchunkfuncify (RemixEnv * env,
00264                                            RemixStream * src,
00265                                            RemixStream * dest,
00266                                            RemixCount count,
00267                                            RemixChunkChunkFunc func,
00268                                            void * data);
00269 RemixCount remix_stream_chunkchunkchunkfuncify (RemixEnv * env,
00270                                                 RemixStream * src1,
00271                                                 RemixStream * src2,
00272                                                 RemixStream * dest,
00273                                                 RemixCount count,
00274                                                 RemixChunkChunkChunkFunc func,
00275                                                 void * data);
00276 
00277 /* RemixChannel */
00278 RemixCount remix_channel_chunkfuncify (RemixEnv * env, RemixChannel * channel,
00279                                        RemixCount count, RemixChunkFunc func,
00280                                        int channelname, void * data);
00281 RemixCount remix_channel_chunkchunkfuncify (RemixEnv * env,
00282                                             RemixChannel * src,
00283                                             RemixChannel * dest,
00284                                             RemixCount count,
00285                                             RemixChunkChunkFunc func,
00286                                             int channelname, void * data);
00287 RemixCount remix_channel_chunkchunkchunkfuncify (RemixEnv * env,
00288                                                  RemixChannel * src1,
00289                                                  RemixChannel * src2,
00290                                                  RemixChannel * dest,
00291                                                  RemixCount count,
00292                                                  RemixChunkChunkChunkFunc func,
00293                                                  int channelname, void * data);
00294 /* RemixPCM */
00295 
00296 RemixCount _remix_pcm_clear_region (RemixPCM * data, RemixCount count,
00297                                     void * unused);
00298 RemixCount _remix_pcm_set (RemixPCM * data, RemixPCM value, RemixCount count);
00299 RemixCount _remix_pcm_gain (RemixPCM * data, RemixCount count,
00300                             /* (RemixPCM *) */ void * gain);
00301 RemixCount _remix_pcm_copy (RemixPCM * src, RemixPCM * dest, RemixCount count,
00302                             void * unused);
00303 RemixCount _remix_pcm_add (RemixPCM * src, RemixPCM * dest, RemixCount count,
00304                            void * unused);
00305 RemixCount _remix_pcm_mult (RemixPCM * src, RemixPCM * dest, RemixCount count,
00306                             void * unused);
00307 RemixCount _remix_pcm_fade (RemixPCM * src, RemixPCM * dest, RemixCount count,
00308                             void * unused);
00309 RemixCount _remix_pcm_interleave_2 (RemixPCM * src1, RemixPCM * src2, 
00310                                     RemixCount count, void * data);
00311 RemixCount _remix_pcm_deinterleave_2 (RemixPCM * dest1, RemixPCM * dest2,
00312                                       RemixCount count, void * data);
00313 RemixCount _remix_pcm_blend (RemixPCM * src, RemixPCM * blend, RemixPCM * dest,
00314                              RemixCount count, void * unused);
00315 RemixCount _remix_pcm_write_linear (RemixPCM * data, RemixCount x1,
00316                                     RemixPCM y1, RemixCount x2, RemixPCM y2,
00317                                     RemixCount offset, RemixCount count);
00318 
00319 #endif /* defined(__REMIX__) */
00320 
00321 #endif /* __REMIX_PLUGIN_H__ */

Generated on Fri Jan 9 08:44:16 2004 for remix by doxygen 1.3.4