Author Topic: BASSmix beta (mixing & resampling add-on)  (Read 125224 times)

engineeer

  • Posts: 86
Re: BASSmix beta (mixing & resampling add-on)
« Reply #50 on: 3 Mar '06 - 15:11 »
It seems that BASS_Mixer_StreamAddChannelEx makes application crush at the point delayed mixer source channel starts to play. First playing channel is OK, 2nd and following playing channels initiate crash.  ???

Ian @ un4seen

  • Administrator
  • Posts: 20427
Re: BASSmix beta (mixing & resampling add-on)
« Reply #51 on: 3 Mar '06 - 16:02 »
Can you please provide an example that produces the crash? I wasn't able to produce a crash with the simple test I tried, which was a background source and a couple of delayed sources on top.

engineeer

  • Posts: 86
Re: BASSmix beta (mixing & resampling add-on)
« Reply #52 on: 3 Mar '06 - 18:01 »
Can you please provide an example that produces the crash?
Uploaded zip file with exe, drwatson log and delphi source.

Ian @ un4seen

  • Administrator
  • Posts: 20427
Re: BASSmix beta (mixing & resampling add-on)
« Reply #53 on: 5 Mar '06 - 15:01 »
Ah yes, there was the potential for a buffer overrun when starting a delayed channel. An update is now in the BASSmix download.

engineeer

  • Posts: 86
Re: BASSmix beta (mixing & resampling add-on)
« Reply #54 on: 5 Mar '06 - 16:13 »
Another one in BASS_Mixer_StreamAddChannelEx...  ::)
Scenario:
- 2 streams, both with start and length set to eg. 5 secs
- start (add) 1st stream
- while playing 1st stream start (add) 2nd stream
- first plays and stops OK, but 2nd doesn't stop after 5 secs

dr_wrong

  • Posts: 8
Re: BASSmix beta (mixing & resampling add-on)
« Reply #55 on: 5 Mar '06 - 16:50 »
I hope this works, I need a nice resampling tool.




Ian @ un4seen

  • Administrator
  • Posts: 20427
Re: BASSmix beta (mixing & resampling add-on)
« Reply #56 on: 6 Mar '06 - 16:46 »
Another one in BASS_Mixer_StreamAddChannelEx...  ::)
Scenario:
- 2 streams, both with start and length set to eg. 5 secs
- start (add) 1st stream
- while playing 1st stream start (add) 2nd stream
- first plays and stops OK, but 2nd doesn't stop after 5 secs

There's another update to try, in the ZIP now. Let me know if you still have problems with it.

Ian @ un4seen

  • Administrator
  • Posts: 20427
Re: BASSmix beta (mixing & resampling add-on)
« Reply #57 on: 28 Mar '06 - 14:14 »
There have been a few people wanting to upmix stereo streams to 4 or more channels recently. So, in order to make that simple, BASSmix now includes a matrix mixing option. For example, to upmix a stereo stream to 4 channels, you'd do something like this...

Code: [Select]
BASS_CHANNELINFO i;
BASS_ChannelGetInfo(channel, &i);
mixer=BASS_Mixer_StreamCreate(i.freq, 4, 0); // create a 4 channel mixer
BASS_Mixer_StreamAddChannel(mixer, channel, BASS_MIXER_MATRIX); // add the channel with matrix mixing enabled

float matrix[4][2]={ // stereo to quad matrix...
    {1, 0}, // left front out = left in
    {0, 1}, // right front out = right in
    {1, 0}, // left rear out = left in
    {0, 1} // right rear out = right in
};
BASS_Mixer_ChannelSetMatrix(channel, matrix); // apply the matrix

radio42

  • Posts: 4576
Re: BASSmix beta (mixing & resampling add-on)
« Reply #58 on: 29 Mar '06 - 16:50 »
Matrix Mixing is contained in BASS.NET API v2.2.0.14 !
released and uploaded right now ;-)

Interweb

  • Posts: 2
Re: BASSmix beta (mixing & resampling add-on)
« Reply #59 on: 31 Mar '06 - 08:34 »
Is there an OSX version of BASSmix available?

radio42

  • Posts: 4576
Re: BASSmix beta (mixing & resampling add-on)
« Reply #60 on: 31 Mar '06 - 08:38 »
Nop.
BassMix requires Bass to work and Bass is not an OCX.

Interweb

  • Posts: 2
Re: BASSmix beta (mixing & resampling add-on)
« Reply #61 on: 31 Mar '06 - 08:59 »
Perhaps I wasn't clear in my previous post.  I'd like to know if there is a Mac OS version of BASSmix available or in development.  Sorry for the confusion.

Thanks.

Ian @ un4seen

  • Administrator
  • Posts: 20427
Re: BASSmix beta (mixing & resampling add-on)
« Reply #62 on: 31 Mar '06 - 14:41 »
Yes, BASSmix is available for OSX. I've now added it to the first post.

radio42

  • Posts: 4576
Re: BASSmix beta (mixing & resampling add-on)
« Reply #63 on: 31 Mar '06 - 16:13 »
Is there an OSX version of BASSmix available?
Sorry - I did read your post too fast and just saw OCX instead of OSX ;-)

lowspeedchase

  • Posts: 17
Re: BASSmix beta (mixing & resampling add-on)
« Reply #64 on: 31 Mar '06 - 19:12 »
Hey guys,

How do you enter the matrix info into VB?

If I just create an array of the appropriate length I get a Byref argument mismatch (as BASS_Mixer_ChannelSetMatrix is expecting a 'single' value for the matrix, not an array)

Thanks!

Chris

  • Posts: 1810
Re: BASSmix beta (mixing & resampling add-on)
« Reply #65 on: 31 Mar '06 - 20:46 »
There have been a few people wanting to upmix stereo streams to 4 or more channels recently. So, in order to make that simple, BASSmix now includes a matrix mixing option. For example, to upmix a stereo stream to 4 channels, you'd do something like this...

Code: [Select]
BASS_CHANNELINFO i;
BASS_ChannelGetInfo(channel, &i);
mixer=BASS_Mixer_StreamCreate(i.freq, 4, 0); // create a 4 channel mixer
BASS_Mixer_StreamAddChannel(mixer, channel, BASS_MIXER_MATRIX); // add the channel with matrix mixing enabled

float matrix[4][2]={ // stereo to quad matrix...
    {1, 0}, // left front out = left in
    {0, 1}, // right front out = right in
    {1, 0}, // left rear out = left in
    {0, 1} // right rear out = right in
};
BASS_Mixer_ChannelSetMatrix(channel, matrix); // apply the matrix

@ Ian i will see here a little Problem

 matrix is in this example a Array of float...
 and BASS_Mixer_ChannelSetMatrix will need a Varibale of float (and not array of float)
 maybe its better to use a Pointer (and bassmix will convert that array ???
 


Greets Chris

« Last Edit: 31 Mar '06 - 22:25 by Chris »

radio42

  • Posts: 4576
Re: BASSmix beta (mixing & resampling add-on)
« Reply #66 on: 1 Apr '06 - 10:08 »
Just use it as for BASS_ChannelGetData...
...and specify the first array element as the ref.

E.g.
Code: [Select]
float[,] matrix = new float[4,2] { // stereo to quad matrix
            {1, 0}, // left in = left front out
            {0, 1}, // right in = right front out
            {1, 0}, // left in = left rear out
            {0, 1}  // right in = right rear out
    };
// apply the matrix
BassMix.BASS_Mixer_ChannelSetMatrix(_streamA, ref matrix[0,0] );

Ian @ un4seen

  • Administrator
  • Posts: 20427
Re: BASSmix beta (mixing & resampling add-on)
« Reply #67 on: 1 Apr '06 - 15:29 »
@ Ian i will see here a little Problem

 matrix is in this example a Array of float...
 and BASS_Mixer_ChannelSetMatrix will need a Varibale of float (and not array of float)
 maybe its better to use a Pointer (and bassmix will convert that array ???

Yes, the "matrix" parameter is a pointer (float*), but I'm not entirely sure what that is in Delphi :) ... I guess it should be PFLOAT or PSINGLE?

radio42

  • Posts: 4576
Re: BASSmix beta (mixing & resampling add-on)
« Reply #68 on: 1 Apr '06 - 15:56 »
I'am also not sure for Delphi.
But for C# and for VB in the .Net world it is just important to NOT use jagged-arrays.
Since jagged-arrays do not exist in C/C++.
So you should use a standard two-dimentional array of floats.

3delite

  • Posts: 907
Re: BASSmix beta (mixing & resampling add-on)
« Reply #69 on: 1 Apr '06 - 19:06 »
Yes, the "matrix" parameter is a pointer (float*), but I'm not entirely sure what that is in Delphi :) ... I guess it should be PFLOAT or PSINGLE?

I think it's not important. I mean it's a pointer and period. :) You only need the "what type of pointer" inside where you use it.
It should be given in the same manner as the

Code: [Select]
BOOL WINAPI BASS_ChannelGetInfo(
    DWORD handle,
    BASS_CHANNELINFO *info
);
info Pointer to store the channel information at.

So to call it as:

Code: [Select]
var
  Matrix: Array[0..2] of Array[0..1] of Single;
begin
    Matrix[0, 0] := 1;
    Matrix[0, 1] := 0;
    Matrix[1, 0] := 0;
    Matrix[1, 1] := 1;
    Matrix[2, 0] := 0;
    Matrix[2, 1] := 1;
    BASS_Mixer_ChannelSetMatrix(_streamA, @Matrix);

Please help if I am wrong, not tested!

Chris

  • Posts: 1810
Re: BASSmix beta (mixing & resampling add-on)
« Reply #70 on: 1 Apr '06 - 23:03 »
Hi this should be worked

Code: [Select]
const
  Matrix: array[1..4] of array[1..2] of single = (
    (1, 0), // left front out = left in
    (0, 1), // right front out = right in
    (1, 0), // left rear out = left in
    (0, 1)); // right rear out = right in

procedure StartStream;
begin
   BASS_ChannelGetInfo(channel, Chan_Info);
  mixer := BASS_Mixer_StreamCreate(chan_info.freq, 4, 0); // create a 4 channel mixer
  BASS_Mixer_StreamAddChannel(mixer, channel, BASS_MIXER_MATRIX);
    // add the channel with matrix mixing enabled
  BASS_Mixer_ChannelSetMatrix(channel, @matrix); // apply the matrix
  if Mixer <> 0 then
  Bass_ChannelPlay(Mixer,false);
end;

Greets Chris
« Last Edit: 7 May '06 - 22:54 by Chris »

Ian @ un4seen

  • Administrator
  • Posts: 20427
Re: BASSmix beta (mixing & resampling add-on)
« Reply #71 on: 2 Apr '06 - 20:43 »
Ok, the Delphi API has been updated to use "Pointer" now. Let me know if it's still no good :)

lowspeedchase

  • Posts: 17
Re: BASSmix beta (mixing & resampling add-on)
« Reply #72 on: 4 Apr '06 - 13:47 »
Hey guys,

Any idea how to make this work in VB? I have the following code:

Code: [Select]
    g_lngChannel = BASS_StreamCreateFile(BASSFALSE, strFile, 0, 0, BASS_SAMPLE_FLOAT) ' Or BASS_STREAM_DECODE)
    BASS_ChannelGetInfo g_lngChannel, info
   
    mixer = BASS_Mixer_StreamCreate(info.freq, 6, 0) ' create a 6 channel mixer
    BASS_Mixer_StreamAddChannel mixer, g_lngChannel, BASS_MIXER_MATRIX ' add the channel with matrix mixing enabled
   
    matrix(0, 0) = 1
    matrix(0, 1) = 0
    matrix(1, 0) = 0
    matrix(1, 1) = 1
   
    matrix(2, 0) = 1
    matrix(2, 1) = 0
    matrix(3, 0) = 0
    matrix(3, 1) = 1

    matrix(4, 0) = 1
    matrix(4, 1) = 0
    matrix(5, 0) = 0
    matrix(5, 1) = 1

    BASS_Mixer_ChannelSetMatrix g_lngChannel, matrix(0, 0) ' apply the matrix
   
    BASS_ChannelSetSync g_lngChannel, BASS_SYNC_ONETIME Or BASS_SYNC_END, 0, AddressOf BASS_PlaybackEnded, 0

    If g_lngChannel = 0 Then
        HandleError CurrentModule, "PlayFromList", "null", "Selected file couldn't be played by Bass!"
        Exit Sub
    End If

    Call BASS_ChannelPlay(g_lngChannel, BASSFALSE)

This runs fine, but produces only stereo output. The speakers example produces sound from the appropriate speakers... Any thoughts?

Ian @ un4seen

  • Administrator
  • Posts: 20427
Re: BASSmix beta (mixing & resampling add-on)
« Reply #73 on: 4 Apr '06 - 17:06 »
Strange. That looks ok (assuming the VB array stuff is correct :)).

If you play the multi-channel test files in the precompiled CONTEST.EXE example (in C\BIN), do you hear all 6 channels? If not, what soundcard/drivers are you using, and have you got it setup for 5.1 output in both the Windows "Sounds and Audio Devices" control panel and the driver's own control panel? Also, how many speakers does BASS_GetInfo say there are?


lowspeedchase

  • Posts: 17
Re: BASSmix beta (mixing & resampling add-on)
« Reply #74 on: 4 Apr '06 - 17:32 »
I'm not sitting at the device now, but If I remember correctly, the Info struct returns 2 speakers.

But like I said, I can play audio out of all 6 channels using the speakers example.

I will try the 6 channel ogg file when I return to the device,

Thanks!