Logo Search packages:      
Sourcecode: csound version File versions  Download package

PUBLIC int csoundGetChannelPtr ( CSOUND csound,
MYFLT **  p,
const char *  name,
int  type 

Stores a pointer to the specified channel of the bus in *p, creating the channel first if it does not exist yet. 'type' must be the bitwise OR of exactly one of the following values, CSOUND_CONTROL_CHANNEL control data (one MYFLT value) CSOUND_AUDIO_CHANNEL audio data (csoundGetKsmps(csound) MYFLT values) CSOUND_STRING_CHANNEL string data (MYFLT values with enough space to store csoundGetStrVarMaxLen(csound) characters, including the NULL character at the end of the string) and at least one of these: CSOUND_INPUT_CHANNEL CSOUND_OUTPUT_CHANNEL If the channel already exists, it must match the data type (control, audio, or string), however, the input/output bits are OR'd with the new value. Note that audio and string channels can only be created after calling csoundCompile(), because the storage size is not known until then. Return value is zero on success, or a negative error code, CSOUND_MEMORY there is not enough memory for allocating the channel CSOUND_ERROR the specified name or type is invalid or, if a channel with the same name but incompatible type already exists, the type of the existing channel. In the case of any non-zero return value, *p is set to NULL. Note: to find out the type of a channel without actually creating or changing it, set 'type' to zero, so that the return value will be either the type of the channel, or CSOUND_ERROR if it does not exist.

Definition at line 545 of file bus.c.

References csoundGetChannelPtr().

Referenced by csoundGetChannelPtr().

    channelEntry_t  *pp;

    *p = (MYFLT*) NULL;
    if (name == NULL)
      return CSOUND_ERROR;
    pp = find_channel(csound, name);
    if (pp != NULL) {
      if ((pp->type ^ type) & CSOUND_CHANNEL_TYPE_MASK)
        return pp->type;
      pp->type |= (type & (CSOUND_INPUT_CHANNEL | CSOUND_OUTPUT_CHANNEL));
      *p = pp->data;
      return CSOUND_SUCCESS;
    return create_new_channel(csound, p, name, type);

Generated by  Doxygen 1.6.0   Back to index