22 May '13 - 14:38 *
Welcome, Guest. Please login or register.
Did you miss your activation email?

Login with username, password and session length
 
  Home Help Search Login Register  
  Show Posts
Pages: [1]
1  Developments / BASS / Re: Retrieve supported sample rates for a ASIO device on: 25 Sep '12 - 18:25
Awesome, thanks.
ReplyReply Reply with quoteQuote
2  Developments / BASS / Re: Is the mixer good for DAW-style track mixing? on: 25 Sep '12 - 16:22
From my personal experience using Bass.NET with C#:

BASSmix is required to get the sort of functionality you're looking for.  I haven't noticed any explicit protection against clipping, but when using 32-bit floating-point sampling for the input channels and mixer, clipping will only occur at the inputs of your audio interface/AD converter and at the stage where BASSmix resamples the data to the output format, e.g. 24 or 16-bit integer.  This means that no clipping will occur internal to the mixer or your application, giving you the opportunity to re-scale the data (adjust volume) before output.  Technically, you could also mix-down audio that would exhibit clipping on the outputs, but without actual data loss, but I wouldn't consider that good practice.  Again, all of this requires that you set the BASS_SAMPLE_FLOAT flag when creating your audio streams and mixer(s).

As to balancing CPU time vs. quality of the mix, I would not think that this is necessary, as BASSmix appears to be performing quite well for me.  I haven't looked into it deeply, but I haven't noticed any degradation in performance or increase in audio throughput latency when using BASSmix.  Using the same sample size as your inputs are using would decrease the computing resources required, because resampling would not be necessary, but I am skeptical that the performance increase would be worth trading off the advantages of 32-bit float mixing.  Also, depending on how BASS is written and compiled, it may make use of SIMD instructions, which allow a single operation (like multiplication) to be performed on multiple data at once; if this is so, BASSmix calculations, though voluminous, would be essentially trivial to processing time.  Bottom line: If you're using a processor from the past 5 years, I wouldn't even worry about it.

I do not believe there is any control offered over the mixing algorithm.
ReplyReply Reply with quoteQuote
3  Developments / BASS / Re: Retrieve supported sample rates for a ASIO device on: 24 Sep '12 - 18:01
Hey there,

Could I get an x64 version of the DLL with this function?  I need to enumerate device supported sample rates and right now I'm actually setting sample rates to test if they are supported, which really sucks.

Thanks
ReplyReply Reply with quoteQuote
4  Developments / BASS / Re: BASSASIO Input to BassMix Mixer with Bass.NET on: 29 Aug '12 - 19:14
Oy.... I feel like an idiot.  The problem was that I was returning 0 from the ASIOPROC unconditionally.  I think I had copied an ASIO input example in which this was done because the return value is ignored for input, and I had failed to realize that this will not work for ASIO output (which is why my input worked, but no output).  It seems so obvious now that BassAsio would need that information to write to the ASIO driver buffer.

The moral of the story: return the number of bytes you copied to the ASIO output buffer!

Thanks for your help.
ReplyReply Reply with quoteQuote
5  Developments / BASS / Re: BASSASIO Input to BassMix Mixer with Bass.NET on: 28 Aug '12 - 20:44
Also, I see that the ASIOPROC callback is actually being called with the correct length.  I must have been pretty tired when I calculated what the length should have been the first time - I was thinking in bits instead of bytes.
ReplyReply Reply with quoteQuote
6  Developments / BASS / Re: BASSASIO Input to BassMix Mixer with Bass.NET on: 28 Aug '12 - 20:27
I compiled the "contest" sample (had to compile it because I'm on an x64 sytem) and it ran perfectly. 

In my own code, I tried dumping the ASIO output buffer to file after each BASS_ChannelGetData call and I can see that non-zero data is being successfully copied to the buffer.  During execution, I am getting nothing but silence on the outputs of the interface when my code runs.  I know the data is coming in and mixing correctly, as the .wav file I'm recording to is being written correctly and plays back as it should.  It almost seems like the output channels aren't running/enabled, but the check I run against (BassAsio.BASS_ASIO_IsStarted() && BassAsio.BASS_ASIO_ChannelIsActive(false, 0) == BASSASIOActive.BASS_ASIO_ACTIVE_ENABLED) passes every time.
ReplyReply Reply with quoteQuote
7  Developments / BASS / Re: BASSASIO Input to BassMix Mixer with Bass.NET on: 25 Aug '12 - 18:22
Still can't figure out the problem, and I need to get this thing running rather urgently.  Can anyone at least offer ideas on what to check for?  I can see that the data is being copied to the ASIO output buffer, so I don't know where to look after that.
ReplyReply Reply with quoteQuote
8  Developments / BASS / Re: BASSASIO Input to BassMix Mixer with Bass.NET on: 20 Aug '12 - 19:31
Ok. Now I'm having trouble getting ASIO output. Here's my ASIOPROC callback at the moment:

        private int AsioProcessor(bool input, int channel, IntPtr buffer, int length, IntPtr user)
        {
            if (input)
            {
                // Get the ASIO data and copy it to the associated stream
                // Note: 'user' is not actually a pointer in this instance, it's being used to store an Int32 value
                Bass.BASS_StreamPutData(user.ToInt32(), buffer, length);
                if (channel == Info.InputChannels[Info.InputChannels.Count - 1]) // All channels processed for this cycle
                {
                    // Pull data from the mixer to force processing (because these are all decoder streams)
                    //byte[] temp = new byte[20000];
                    //Bass.BASS_ChannelGetData(m_MixerHandle, temp, temp.Length);
                }
            }
            else
            {
                if (Bass.BASS_ChannelGetData(m_MixerHandle, buffer, length) < 1)
                    Info.WriteDebug("Bass Error: " + Bass.BASS_ErrorGetCode());
            }
            return 0;
        }

Is it incorrect to attempt to copy the mixer output stream to the ASIO output?  The mixer output stream is stereo and the ASIO output is two-channel, created like so:

            // Enable ASIO output(s)
            HandleBassAsioError(BassAsio.BASS_ASIO_ChannelEnable(false, 0, m_AsioProcessor, new IntPtr(m_MixerHandle)));
            HandleBassAsioError(BassAsio.BASS_ASIO_ChannelJoin(false, 1, 0));
            HandleBassAsioError(BassAsio.BASS_ASIO_ChannelSetFormat(false, 0, BASSASIOFormat.BASS_ASIO_FORMAT_FLOAT));
            HandleBassAsioError(BassAsio.BASS_ASIO_ChannelSetRate(false, 0, Info.SampleRate));
            HandleBassAsioError(BassAsio.BASS_ASIO_ChannelSetVolume(false, 0, 1f));

I've tried changing the order of everything and changing sample formats to no avail.  I can see that the ChannelGetData call is actually being made to transfer data from the mixer stream to the ASIO output buffer, and it returns the correct number of bytes.  I do notice the ASIOPROC is being called with length = 48 samples.  The ASIO buffer should be 192 samples, is this normal?  Also, if I have the ASIO channels set to a format the device doesn't support (i.e. 32-bit float), will it be resampled before output or just break?
ReplyReply Reply with quoteQuote
9  Developments / BASS / Re: BASSASIO Input to BassMix Mixer with Bass.NET on: 16 Aug '12 - 21:46
*sigh* Hard to believe it was that simple, thanks.
ReplyReply Reply with quoteQuote
10  Developments / BASS / BASSASIO Input to BassMix Mixer with Bass.NET on: 15 Aug '12 - 23:25
Hello,

Sorry if this problem is a stupid one, but I'm at my wit's end here and extensive searching didn't seem to solve the problem.  I'm using Bass to get input from an ASIO device (up to 14 ins, 4 outs); I'd like to be able to mix an arbitrary number of input streams into a stereo stream to be recorded to a WAV file.  Here is my code (C#.NET):

        private void StartAudioRecordingWithMixer()
        {
            HandleBassError(BassAsio.BASS_ASIO_Free());
            HandleBassError(BassAsio.BASS_ASIO_Init(Info.AsioDevice, BASSASIOInit.BASS_ASIO_DEFAULT));
            m_AsioProcessor = new ASIOPROC(AsioProcessor);
            m_MixerHandle = BassMix.BASS_Mixer_StreamCreate(48000, 2, BASSFlag.BASS_SAMPLE_FLOAT | BASSFlag.BASS_STREAM_DECODE);
            if (m_MixerHandle == 0)
                throw new Exception("Could not create mixer: " + Bass.BASS_ErrorGetCode());
            List<int> channelStreams = new List<int>(1);
            foreach (int i in Info.InputChannels)
            {
                int channelStream = Bass.BASS_StreamCreatePush(48000, 1, BASSFlag.BASS_STREAM_DECODE | BASSFlag.BASS_SAMPLE_FLOAT, IntPtr.Zero);
                HandleBassError(BassAsio.BASS_ASIO_ChannelEnable(true, Info.InputChannels[i], m_AsioProcessor, new IntPtr(channelStream)));
                HandleBassError(BassAsio.BASS_ASIO_ChannelSetFormat(true, Info.InputChannels[i], BASSASIOFormat.BASS_ASIO_FORMAT_FLOAT));
                HandleBassError(BassAsio.BASS_ASIO_ChannelSetRate(true, Info.InputChannels[i], 48000));
                channelStreams.Add(channelStream);
            }
            foreach (int i in channelStreams)
                HandleBassError(BassMix.BASS_Mixer_StreamAddChannel(m_MixerHandle, i, BASSFlag.BASS_DEFAULT));

            HandleBassError(BassAsio.BASS_ASIO_Start(0));

            m_WavEncoder = new EncoderWAV(m_MixerHandle);
            m_AudioPath = m_WavEncoder.OutputFile = Path.Combine(".\\Audio", Info.GetNextFilename("test{0}.wav", new DirectoryInfo(".\\Audio")));
            HandleBassError(m_WavEncoder.Start(null, IntPtr.Zero, false));
        }

        private int AsioProcessor(bool input, int channel, IntPtr buffer, int length, IntPtr user)
        {
            // Get the ASIO data and copy it to the associated stream
            // Note: 'user' is not actually a pointer in this instance, it's being used to store an Int32 value
            return Bass.BASS_StreamPutData(user.ToInt32(), buffer, length);
        }

I hope I'm not way off.  From what I can tell, I'm getting the ASIO input into the push streams, but the push streams are not feeding into the mixer (I was hoping the mixer would pull sample data from them).  I also have no idea whether assigning an EncoderWAV DSP to the mixer output is valid.  Since I have little to no idea how the mixer/streams work internally, I'm having quite a bit of trouble figuring out what I'm doing wrong.

Thanks,
C Del
ReplyReply Reply with quoteQuote
Pages: [1]
Powered by SMF 1.1.18 | SMF © 2013, Simple Machines