Beispiel #1
0
// Call the DSP process function to retrieve the output signal format for a DSP based on input values.
//
// inmask: Channel bitmask representing the speakers enabled for the incoming signal.
// For example a 5.1 signal could have inchannels 2 that represent CHANNELMASK_SURROUND_LEFT and CHANNELMASK_SURROUND_RIGHT.
//
// inchannels: Number of channels for the incoming signal.
//
// inspeakermode: Speaker mode for the incoming signal.
//
// A DSP unit may be an up mixer or down mixer for example. In this case if you specified 6 in for a downmixer, it may provide you with 2 out for example.
// Generally the input values will be reproduced for the output values, but some DSP units will want to alter the output format.
func (d *DSP) OutputChannelFormat(inmask ChannelMask, inchannels int, inspeakermode SpeakerMode) (ChannelMask, int, SpeakerMode, error) {
	var outmask C.FMOD_CHANNELMASK
	var outchannels C.int
	var outspeakermode C.FMOD_SPEAKERMODE
	res := C.FMOD_DSP_GetOutputChannelFormat(d.cptr, C.FMOD_CHANNELMASK(inmask), C.int(inchannels), C.FMOD_SPEAKERMODE(inspeakermode), &outmask, &outchannels, &outspeakermode)
	return ChannelMask(outmask), int(outchannels), SpeakerMode(outspeakermode), errs[res]
}
Beispiel #2
0
// Sets the signal format of a dsp unit so that the signal is processed on the speakers specified.
// Also defines the number of channels in the unit that a read callback will process, and the output signal of the unit.
//
// channelmask: A series of bits specified by "ChannelMask" to determine which speakers are represented by the channels in the signal.
//
// numchannels: The number of channels to be processed on this unit and sent to the outputs connected to it. Maximum of FMOD_MAX_CHANNEL_WIDTH.
//
// source_speakermode: The source speaker mode where the signal came from.
//
// Setting the number of channels on a unit will force a down or up mix to that channel count before processing the DSP read callback.
// This channelcount is then sent to the outputs of the unit.
// source_speakermode is informational, when channelmask describes what bits are active, and numchannels describes how many channels are in a buffer,
// source_speakermode describes where the channels originated from.
// For example if numchannels = 2 then this could describe for the DSP if the original signal started from a stereo signal or a 5.1 signal.
// It could also describe the signal as all monaural, for example if numchannels was 16 and the speakermode was FMOD_SPEAKERMODE_MONO.
func (d *DSP) SetChannelFormat(channelmask ChannelMask, numchannels int, source_speakermode SpeakerMode) error {
	res := C.FMOD_DSP_SetChannelFormat(d.cptr, C.FMOD_CHANNELMASK(channelmask), C.int(numchannels), C.FMOD_SPEAKERMODE(source_speakermode))
	return errs[res]
}