BASS_SampleGetChannels

Retrieves all a sample's existing channels.

DWORD BASS_SampleGetChannels(
    HSAMPLE handle,
    HCHANNEL *channels
);

Parameters

handleThe sample handle.
channelsAn array to put the sample's channel handles in. The array should be the same size as the sample's max setting when the sample was created, which can be retrieved using BASS_SampleGetInfo. NULL can be used to just check how many channels exist.

Return value

If successful, the number of existing channels is returned, else -1 is returned. Use BASS_ErrorGetCode to get the error code.

Error codes

BASS_ERROR_HANDLEhandle is not a valid sample handle.

Remarks

To determine whether a particular sample channel still exists, it is simplest to just try it in a function call.

Example

Set the sample rate of all a sample's channels to 10000 Hz.
BASS_SAMPLE info;
HCHANNEL *channels;
DWORD a, count;
BASS_SampleGetInfo(sample, &info); // get sample info for "max" value
channels = (HCHANNEL*)malloc(info.max * sizeof(HCHANNEL)); // allocate channels array
count = BASS_SampleGetChannels(sample, channels); // get the channels
for (a = 0; a < count; a++) // go through them all and...
    BASS_ChannelSetAttribute(channels[a], BASS_ATTRIB_FREQ, 10000); // set the sample rate to 10000
free(channels); // free the channels array

See also

BASS_SampleGetChannel, BASS_SampleGetInfo