Author Topic: Direct Stream Digital (DSD) add-on  (Read 27897 times)

Ian @ un4seen

  • Administrator
  • Posts: 20400
Re: Direct Stream Digital (DSD) add-on
« Reply #75 on: 30 Jun '15 - 17:58 »
To get some info on the crash, please upload a dump file for it. You can generate a dump file using the ProcDump tool. For example, run "procdump -e -ma -x . dsdtest file.dsf". Then upload the generated dump file to have a look at here:

   ftp.un4seen.com/incoming/

djagab

  • Posts: 35
Re: Direct Stream Digital (DSD) add-on
« Reply #76 on: 30 Jun '15 - 19:55 »
Thanks. I will give it at try.

djagab

  • Posts: 35
Re: Direct Stream Digital (DSD) add-on
« Reply #77 on: 1 Jul '15 - 09:50 »
I have just uploaded a zipped dump file with the results of the crash/hang.  I selected the BRAVO-HD asio device. I'm curious to know the outcome. Thanks in advance for your help.


djagab

  • Posts: 35
Re: Direct Stream Digital (DSD) add-on
« Reply #78 on: 1 Jul '15 - 09:53 »
Another question about "hw" device: When querying the list of devices with bass, how do I know it's a "hw" device, like eg hw:0,1?

Ian @ un4seen

  • Administrator
  • Posts: 20400
Re: Direct Stream Digital (DSD) add-on
« Reply #79 on: 1 Jul '15 - 16:24 »
I have just uploaded a zipped dump file with the results of the crash/hang.  I selected the BRAVO-HD asio device. I'm curious to know the outcome. Thanks in advance for your help.

Thanks for the dump. It appears to be the ASIO driver (BravoHDASIO.dll) that's crashed when it's being freed within a BASS_ASIO_Free call. To check whether the crash only happens when trying to play DSD data, please see if you get the crash with the BASSASIO CONTEST example too. Please also see whether it happens with any of the GUI (rather than console) examples. Btw, does the fact that it crashed when freeing mean that the DSD file was playing and it only crashed once you pressed a key to stop playback? If so, did the playback sound OK?

So that you can try DSD-over-PCM playback (instead of raw DSD) with it, I have put a modified version of the DSDTEST example with a "-p" option to request DSD-over-PCM playback. So please re-download BASSASIO to get that and see what happens when you try that option.

Another question about "hw" device: When querying the list of devices with bass, how do I know it's a "hw" device, like eg hw:0,1?

That info (the ALSA device name) is given in the BASS_DEVICEINFO "driver" member.

djagab

  • Posts: 35
Re: Direct Stream Digital (DSD) add-on
« Reply #80 on: 2 Jul '15 - 08:08 »
Thanks. I performed the requested actions. See the results in the zipped file I just uploaded on the ftp location.
testresults_DSD_DOP_MP3_ASIO_CONSOLE_WINFORMS_uploadattempt2.zip
The zip file shows screen shots of every action performed. In all cases procdump was not able to output anything.
Reasons:  Access violation errors in one case. No crash in the others.

Quote
To check whether the crash only happens when trying to play DSD data, please see if you get the crash with the BASSASIO CONTEST example too.

Yes. the crash happens with contest, too.
See the screen shots I just uploaded on the ftp location.
I used a regular mp3 file. So it's not just DSD related.

Quote
Please also see whether it happens with any of the GUI (rather than console) examples.

I used the simpleAsio winfoms example radio42 provides in the example package. It plays (ok) at every selected buffersize (in bytes) except 0. I used the same asio and bass dlls as with contest and dsdtest. Could this have something to do with the need for a valid window handle in stead of zero for console? Is directX involded somehow?
After closing the simpleAsio winforms gracefully, the bravo-hd control panel unloads as it is suppose to.

Quote
Btw, does the fact that it crashed when freeing mean that the DSD file was playing and it only crashed once you pressed a key to stop playback? If so, did the playback sound OK?

No, sorry no sound. Again, see the screenshots. Playback stucks at 000 right after start, given the above mentioned results, this might not be DSD related at all!

Quote
So that you can try DSD-over-PCM playback (instead of raw DSD) with it, I have put a modified version of the DSDTEST example with a "-p" option to request DSD-over-PCM playback. So please re-download BASSASIO to get that and see what happens when you try that option.

Thanks for this. I performed the tests. Similar results to RAW DSD playback: sound stucks at 000, except it was able to unload the application gracefully when pressing enter or control-c. The Bravo-HD control panel showed an unloaded status as it is suppose to show.

Given the above results, there might be something else going on here. What do you think?

Ian @ un4seen

  • Administrator
  • Posts: 20400
Re: Direct Stream Digital (DSD) add-on
« Reply #81 on: 2 Jul '15 - 15:28 »
Quote
Please also see whether it happens with any of the GUI (rather than console) examples.

I used the simpleAsio winfoms example radio42 provides in the example package. It plays (ok) at every selected buffersize (in bytes) except 0. I used the same asio and bass dlls as with contest and dsdtest. Could this have something to do with the need for a valid window handle in stead of zero for console? Is directX involded somehow?
After closing the simpleAsio winforms gracefully, the bravo-hd control panel unloads as it is suppose to.

It sounds like that ASIO driver may need to be hosted in the main thread. The console examples use the BASS_ASIO_THREAD flag to tell BASS_ASIO_Init to create a thread to host the ASIO driver (beacuse they don't have a message queue in the main thread), while the GUI examples don't do that. I'll send you a debug BASSASIO version to get more info.

Quote
Btw, does the fact that it crashed when freeing mean that the DSD file was playing and it only crashed once you pressed a key to stop playback? If so, did the playback sound OK?

No, sorry no sound. Again, see the screenshots. Playback stucks at 000 right after start, given the above mentioned results, this might not be DSD related at all!

Yep, I don't think this particular problem is related to DSD. Still, it'd be nice to solve it if possible :)

djagab

  • Posts: 35
Re: Direct Stream Digital (DSD) add-on
« Reply #82 on: 2 Jul '15 - 15:53 »
Ok, thanks for the info. I had to modify the radoi42 simpleasio slightly because it did not contain the 'number of threads' to enter in the init section.
I put a value of 10 and built the app.

Quote
Yep, I don't think this particular problem is related to DSD. Still, it'd be nice to solve it if possible

Agree, please send me the debug asio version. Then I will perform some more tests.

netxing

  • Guest
Re: Direct Stream Digital (DSD) add-on
« Reply #83 on: 21 Sep '16 - 08:43 »
please help me,
my code is playing *.Dsf file in ASIO/DOP mode,
function BASS_ChannelGetAttribute(dsd, BASS_ATTRIB_DSD_RATE, &rate) runs OK.
the returned value 'rate' is 2822400,
function BASS_ASIO_SetRate(2822400) can not work,but BASS_ASIO_SetRate(44100) OK?


my code:
BASS_ASIO_SetDSD(TRUE); // switch the ASIO device to DSD mode
dsd=BASS_DSD_StreamCreateFile(FALSE, filename, 0, 0, BASS_DSD_RAW|BASS_STREAM_DECODE, 0); // open a DSD file in RAW mode
float rate;
BASS_ChannelGetAttribute(dsd, BASS_ATTRIB_DSD_RATE, &rate); // get the DSD rate
BASS_ASIO_SetRate(rate); // set the device to that rate
BASS_CHANNELINFO ci;
BASS_ChannelGetInfo(dsd, &ci); // get the sample format (for channel count)
BASS_ASIO_ChannelEnable(0, 0, AsioProc, 0); // enable 1st output channel...

Ian @ un4seen

  • Administrator
  • Posts: 20400
Re: Direct Stream Digital (DSD) add-on
« Reply #84 on: 21 Sep '16 - 17:39 »
Please run the pre-compiled LIST.EXE example in the BASSASIO package (C\BIN folder) and post the output from that.

netxing

  • Guest
Re: Direct Stream Digital (DSD) add-on
« Reply #85 on: 22 Sep '16 - 18:40 »
thanks for your reply, the following are output of list.exe
I installed 2 ASIO driver, then BRAVO-HD drv is for a little usb DAC!

C:\Users\Administrator\Desktop\Media\bass\bassasio13\c\bin>list.exe
dev 0: ASIO4ALL v2
driver: C:\Program Files (x86)\ASIO4ALL v2\asio4all.dll

        in 0: HD Audio 麦克风 2 1 (group 0, format 18)
        in 1: HD Audio 麦克风 2 2 (group 0, format 18)
        out 0: HD Audio SPDIF 输出 1 (group 0, format 18)
        out 1: HD Audio SPDIF 输出 2 (group 0, format 18)
        out 2: HD Audio SPDIF 输出 3 (group 0, format 18)
        out 3: HD Audio SPDIF 输出 4 (group 0, format 18)
dev 1: BRAVO-HD
driver: C:\Program Files (x86)\SaviAudio\BRAVO-HD\BravoHDASIO.dll

=====================================================

Code: [Select]
  ext := uppercase(extractFileExt(afileName));
  isDSD := (ext = '.DSF') or (ext = '.DFF');
  if isDSD then
  begin
    if isASIO then
    begin
      if aDSDMode = DOP then
        flag := BASS_DSD_DOP or BASS_STREAM_DECODE or BASS_UNICODE or
          BASS_SAMPLE_FLOAT
      else if aDSDMode = RAW then
        flag := BASS_DSD_RAW or BASS_STREAM_DECODE or BASS_UNICODE
      else if aDSDMode = PCM then
        flag := BASS_SAMPLE_FLOAT or BASS_STREAM_DECODE or BASS_UNICODE;
    end
    else
      flag := BASS_UNICODE or BASS_SAMPLE_FLOAT or BASS_STREAM_AUTOFREE;
    sr := 88200; // default
  end
  else // not DSD
  begin
    if isASIO then
      flag := BASS_UNICODE or BASS_SAMPLE_FLOAT or BASS_STREAM_DECODE
    else
      flag := BASS_UNICODE or BASS_SAMPLE_FLOAT or BASS_STREAM_AUTOFREE;

    sr := max(44100,getAudioInfo(afileName, 'SamplingRate'));
  end;


  if isASIO then
  begin

    BASS_SetConfig(BASS_CONFIG_UPDATEPERIOD, 0);

    if not BASS_Init(0, sr, 0, 0, nil) then
    begin
      Bass_Free();
      exit;
     end;

    if isDSD then
      ch := BASS_DSD_StreamCreateFile(false, PChar(afileName), 0, 0, flag, 0)
    else
      ch := BASS_StreamCreateFile(false, PChar(afileName), 0, 0, flag);
    if ch = 0 then
    begin
      BASS_ASIO_Free();
      Bass_Free();
      exit;
    end;

    dev := max(0, min(aDevice, getASIODeviceCount - 1));
    if not BASS_ASIO_Init(dev, 0) then
    begin
      BASS_ASIO_Free();
      Bass_Free();
      exit;
    end;
 
    if isDSD and (aDSDMode <> 'PCM') then
    begin
      if not BASS_ASIO_SetDSD(true) then
      begin
        BASS_ASIO_Free();
        Bass_Free();
        exit;
      end;

      if aDSDMode = 'DOP' then
        BASS_ChannelGetAttribute(ch, BASS_ATTRIB_FREQ, rate)
      else if aDSDMode = 'RAW' then
        BASS_ChannelGetAttribute(ch, BASS_ATTRIB_DSD_RATE, rate);

      if not BASS_ASIO_SetRate(rate) then // set the device to that rate
      begin
        BASS_ASIO_Free();
        Bass_Free();
        exit;
      end;
     
      BASS_ASIO_ChannelEnable(false, 0, @AsioProc, Pointer(ch));
      BASS_ASIO_ChannelJoin(false, 1, 0);
      BASS_ASIO_ChannelSetFormat(false, 0, BASS_ASIO_FORMAT_DSD_MSB);
    end
    else
    begin
 
      BASS_ASIO_ChannelEnable(false, 0, @AsioProc, Pointer(ch));
      BASS_ASIO_ChannelJoin(false, 1, 0);
      BASS_ASIO_ChannelSetFormat(false, 0, BASS_ASIO_FORMAT_FLOAT);

      BASS_ChannelGetAttribute(ch, BASS_ATTRIB_FREQ, rate);
      BASS_ASIO_ChannelSetRate(false, 0, rate);
      BASS_ASIO_SetRate(rate);
    end;

    if BASS_ASIO_Start(0, 0) then
    begin
      chanelInfo.update(ch, (aDSDMode = 'RAW'));
    end
    else
    begin
      BASS_ASIO_Free();
      Bass_Free();
      exit;
    end;
  end
  else // normal
  begin
    dev := max(0, min(aDevice, getDeviceCount - 1));
    BASS_SetConfig(BASS_CONFIG_UPDATEPERIOD, 100);
    BASS_Init(dev + 1, sr, 0, 0, nil);
    ch := BASS_StreamCreateFile(false, PwideChar(afileName), 0, 0, flag);
    if BASS_ChannelPlay(ch, true) then
    begin
      chanelInfo.update(ch, false);
    end
    else
    begin
      BASS_ASIO_Free();
      Bass_Free();
      exit;
    end;
  end;



netxing

  • Guest
Re: Direct Stream Digital (DSD) add-on
« Reply #86 on: 22 Sep '16 - 18:46 »
All codes above runs OK,but Dop and RAW mode.
when set dsd mode or set rate,ERROR appear!

Ian @ un4seen

  • Administrator
  • Posts: 20400
Re: Direct Stream Digital (DSD) add-on
« Reply #87 on: 23 Sep '16 - 16:58 »
From that, it looks like the device and/or driver doesn't support DSD. Are you sure that it does, and do you have the correct ASIO driver from the manufacturer installed?

djagab

  • Posts: 35
Hi Ian,

I managed to get DSD playback on linux working with bass a while ago with your help and Radio42's, however only with DSD DoP. The last line of code contained ChannelPlay(stream,false) preceded by a setattribute that prevented rampin because of my USB DAC needing a valid DoP marker right from the start.

Now, enabling raw DSD by adding the RAW flag to the streamcreate function did not do the trick, for ChannelPlay only accepts streams that are playable, so without the decoding flag.
My questions is: Could you provide a code sample (C or alike) that actually shows how to play DSD RAW on a linux platform that has ALSA 1.0.29 installed?  The ALSA version that is supposed to support DSD RAW. Thanks in advance for your reply.

Ian @ un4seen

  • Administrator
  • Posts: 20400
Re: Direct Stream Digital (DSD) add-on
« Reply #89 on: 27 Sep '16 - 14:04 »
It isn't possible to play raw DSD data through BASS. So you would need to initialize the ALSA DSD output yourself and then send the raw DSD data (from BASS_ChannelGetData) to it, like when using DSD output with ASIO/BASSASIO.