Author Topic: Bass_fx tempo and mixer channels with speaker matrix  (Read 362 times)

dbaxter

  • Posts: 57
Having trouble getting the right sequence of calls to allow tempo setting of a channel that is 1) Opened, 2) set to a mixer channel, and then 3) has a speaker matrix applied. I've tried adding CChan := BASS_FX_TempoCreate(cchan, BASS_FX_FREESOURCE); at the various stages and the channel always turns into 0.
Is it doable to use a matrix with Bass_fx, or am I just not doing it right?
Thanks.

Ian @ un4seen

  • Administrator
  • Posts: 21133
Re: Bass_fx tempo and mixer channels with speaker matrix
« Reply #1 on: 21 May '18 - 17:21 »
What is the error code from the failed BASS_FX_TempoCreate call? Use BASS_ErrorGetCode to check that. It may be BASS_ERROR_DECODE, in which case, you need to set the BASS_STREAM_DECODE flag on the source channel.

dbaxter

  • Posts: 57
Re: Bass_fx tempo and mixer channels with speaker matrix
« Reply #2 on: 22 May '18 - 05:08 »
The error is indeed #38, but it appears whether or not BASS_STREAM_DECODE is in the call to  tempo_create.
Perhaps the sequence of building the stream would be helpful. The stream is started with:
        CChan := BASS_StreamCreateFile(FALSE, PChar(FileName), 0, 0, BASS_STREAM_DECODE or BASS_SAMPLE_FLOAT or BASS_STREAM_PRESCAN {$IFDEF UNICODE} or BASS_UNICODE {$ENDIF});
followed by:
        BASS_Mixer_StreamAddChannel(Cmixer, CChan, BASS_MIXER_MATRIX or BASS_STREAM_AUTOFREE or BASS_MIXER_BUFFER);
and then the speaker matrix is built:
  oops := BASS_Mixer_ChannelSetMatrix(cchan, matrix);     // apply the matrix
and then finally, the tempo added:
       Cmixer := BASS_FX_TempoCreate(Cmixer, BASS_FX_FREESOURCE or BASS_STREAM_AUTOFREE);   // add tempo control
With or without " or BASS_STREAM_DECODE" in the tempo call, the #38 error happens and Cmixer becomes 0.
Should I take the decode out of the streamcreatefile call? But then what does the mixer work on?
Thank you.

Chris

  • Posts: 1853
Re: Bass_fx tempo and mixer channels with speaker matrix
« Reply #3 on: 22 May '18 - 13:42 »
That makes not sense
because you are mixing here Channel(s) and Mixers
CMixer ist not a Mixer its a Channel!!
so do something like this

Code: [Select]
CChan := BASS_StreamCreateFile(FALSE, PChar(FileName), 0, 0, BASS_STREAM_DECODE or BASS_SAMPLE_FLOAT or BASS_STREAM_PRESCAN  or BASS_UNICODE );
if CChan <> 0 then
CChan:= BASS_FX_TempoCreate(CChan, BASS_FX_FREESOURCE or BASS_STREAM_AUTOFREE or BASS_STREAM_DECODE);   // add tempo control
if CChan <> 0 // valide Chan now do the Rest
.......
Cmixer := BASS_Mixer.create(.......);

 BASS_Mixer_StreamAddChannel(Cmixer, CChan, BASS_MIXER_MATRIX or BASS_STREAM_AUTOFREE or BASS_MIXER_BUFFER);

 BASS_Mixer_ChannelSetMatrix(Cmixer, matrix);     // apply the matrix


if in your example the CMixer is it a Mixer or a CHannel? (I didnt seen Mixer creation in your source ) and you want to add to the Mixer Tempo the Mixer must be decoded so something like this

Code: [Select]
cMixer := BASS_Mixer_StreamCreate(44100,Nr_of_Your_Channels,Bass_Stream_Decode);
Cmixer := BASS_FX_TempoCreate(Cmixer, BASS_FX_FREESOURCE or BASS_STREAM_AUTOFREE);   // add tempo control





« Last Edit: 22 May '18 - 13:52 by Chris »

dbaxter

  • Posts: 57
Re: Bass_fx tempo and mixer channels with speaker matrix
« Reply #4 on: 24 May '18 - 15:41 »
I do realize the difference between a mixer and a channel. MY error in typing
Code: [Select]
BASS_Mixer_ChannelSetMatrix(Cmixer, matrix);     // apply the matrixwhen it should have been
Code: [Select]
BASS_Mixer_ChannelSetMatrix(Cchan, matrix);     // apply the matrix
End result is I was never able to get tempo to work via a mixer, however, I was able to get my speaker selection using
Code: [Select]
        CChan := BASS_StreamCreateFile(FALSE, PChar(FileName), 0, 0, BASS_STREAM_DECODE or BASS_SAMPLE_FLOAT or BASS_STREAM_PRESCAN {$IFDEF UNICODE} or BASS_UNICODE {$ENDIF});
    CChan := BASS_FX_TempoCreate(cchan, speakers or BASS_FX_FREESOURCE or BASS_STREAM_AUTOFREE);   // add tempo control
and not using a mixer and matrix at all. Which makes things simpler all around.

dbaxter

  • Posts: 57
Re: Bass_fx tempo and mixer channels with speaker matrix
« Reply #5 on: 24 May '18 - 19:57 »
OK, not so fast, Dave. I think I go back to rookie status because the way I was thinking of using the speaker flags doesn't seem to work the way I want. The example is this - there are three check boxes. One for FRONT, one for REAR, and one for CENTER. If the user clicks all three, I was creating a speaker flag:
Code: [Select]
speakers := BASS_SPEAKER_FRONT or BASS_SPEAKER_REAR or BASS_SPEAKER_CENLFE;that I would then use in:
Code: [Select]
CChan := BASS_FX_TempoCreate(cchan, speakers or BASS_FX_FREESOURCE or BASS_STREAM_AUTOFREE);   // add tempo controlProblem is doing that, sound only comes from CENLFE as it's value is the OR of FRONT and REAR. It's not like creating a flag set like 1,2,4,8,etc where you can identify the individual flags.
Or am I completely missing something? Sorry.

Ian @ un4seen

  • Administrator
  • Posts: 21133
Re: Bass_fx tempo and mixer channels with speaker matrix
« Reply #6 on: 25 May '18 - 13:44 »
Yep, it isn't possible to combine the SPEAKER flags like that (only BASS_SPEAKER_LEFT/RIGHT can be combined with others). You can use the BASSmix add-on's matrix mixing feature to achieve that, like you were originally. Going back to that, you should do something like Chris suggested, which is to create the tempo stream on the file decoder, and then plug that into the mixer. Note that the BASS_STREAM_DECODE flag is set on both the file decoder and the tempo stream. Another option is to apply the tempo processing to the mixer output, in which case the BASS_STREAM_DECODE flag would be set on the mixer instead of the tempo stream. Basically, the BASS_STREAM_DECODE flag should be set on all but the final stream (the one used in the BASS_ChannelPlay call).
« Last Edit: 25 May '18 - 17:21 by Ian @ un4seen »

Chris

  • Posts: 1853
Re: Bass_fx tempo and mixer channels with speaker matrix
« Reply #7 on: 25 May '18 - 22:33 »
Here is a short delphi demo.
 its a modified version of the orginal speaker example of the bassmix-speaker demo with tempo processing.
In this Demo the Tempo Stream is decoded and the tempo processing is done on the decoded tempo channel.
Of course its also possible to do the tempo-processing on the mixer channel.

dbaxter

  • Posts: 57
Re: Bass_fx tempo and mixer channels with speaker matrix
« Reply #8 on: 25 May '18 - 22:51 »
Thanks, folks. Let me go back and work with those suggestions.

dbaxter

  • Posts: 57
All is working! I want to especially thank Chris for the very helpful re-do of the Speakers example. It showed that having both BASS_STREAM_AUTOFREE and BASS_FX_FREESOURCE in the TempoCreate call was not a good thing. And thanks to Ian for pointing out that BASS_STREAM_DECODE needs to be in both Stream and Tempo creation.