Page 2 of 4 FirstFirst 1234 LastLast
Results 11 to 20 of 34

Thread: DirectSound and output ILDA to sound card

  1. #11
    Join Date
    Jul 2008
    Posts
    768

    Default

    OK, I just thought I would mention the fact that I can play multi-channel waves in Win XP (up to 8 channels) no problem using DirectSound, but no luck with anything beyond 2ch in later versions
    of Windows... WTF???

  2. #12
    Join Date
    Mar 2006
    Posts
    2,478

    Default

    Quote Originally Posted by dchammonds View Post
    OK, I just thought I would mention the fact that I can play multi-channel waves in Win XP (up to 8 channels) no problem using DirectSound, but no luck with anything beyond 2ch in later versions
    of Windows... WTF???
    No idea, maybe the hardware driver for newer OS's isn't written to handle it? or maybe M$ are ripping out anything their majority users don't demand, just as they allegedy decided to do with MIDI? (That may have been a Windows Mobile thing, rather than desktop OS's, I can't remember).

    I decided long ago that as two-channel waves would be in high demand while other more complex multichannel formats were at the mercy of the establishments that brought them into being, that I'd never use them. If I ever have to I'll break them open and stream stereo pairs. That way I'm guaranteed that only the hardware-specific driver is likely to fail, and that would be unlikely! Imagine a maker of professional audio interfaces with 4 or more stereo channels failing to make a driver than can run more than one.

    If you look at the professional studio gear you'll notice that the makers make the same decision I do. If you want more channels, add more stereo pairs and use standard low level drivers, avoid more elaborate methods. That way things stay working. Instead of trying to make impossible support for hardware we can't predict, or user's habits we can't predict, or the whims of Microsoft that we can't predict (or do anything about) it's better to code for older professional interfaces. Stuff that cost a grand can now be picked up on eBay for 20 quid or so. All of it having ASIO drivers, or otherwise excellent wave drivers, multiple pairs, and a lot of other good things. If I were programming for other people to use the program, I'd do that, and give them a list of known good devices so they can pick one they like. Layla 24 is especially good, for example! Low jitter WDM driver, and outputs capable of DC coupling by simple replacement of one capacitor with a shorting link per channel. It makes a bit of delicate work for someone but the result is worth the price of gear a hundred times the cost of what you'll spend.
    Last edited by The_Doctor; 07-23-2013 at 02:14.

  3. #13
    Join Date
    Mar 2010
    Location
    Raleigh, NC
    Posts
    2,292

    Default

    Dean, DirectSound certainly supports multiple channel audio in post XP systems. You probably have something not configured properly. I can look over your code if you want me to.

    Doctor, I don't think the Win32 media APIs are any lower level than DirectSound. They could be in the original implementations (which might apply on your Win98 system) but I don't think that is the case any longer. Here is a link to a website with an overview of the options. Take a look at the Core audio apis. For anything where you want minimal latency, they recommend that: http://msdn.microsoft.com/en-us/libr...(v=vs.85).aspx . I don't see a noticeable delay using DirectSound.

  4. #14
    Join Date
    Mar 2006
    Posts
    2,478

    Default

    Quote Originally Posted by JohnYayas View Post
    Doctor, I don't think the Win32 media APIs are any lower level than DirectSound. They could be in the original implementations (which might apply on your Win98 system) but I don't think that is the case any longer. Here is a link to a website with an overview of the options. Take a look at the Core audio apis. For anything where you want minimal latency, they recommend that: http://msdn.microsoft.com/en-us/libr...(v=vs.85).aspx . I don't see a noticeable delay using DirectSound.
    Thanks. I will check out Core Audio API. I will want the best low level API in whatever I port my program to. For now I'm ok with W98 and Wave API because it's very low in demands, you can take a W98 so minimised it will occupy a few tens of MB, add Winmm.dll and the hardware driver support, and it works. Maybe even in W9X it's not technically lower (certianly isn't in later OS's) than DirectSound is, but given how little I have to add, and how easy it is to use, I think it was a great thing, more easily broken than improved on! That said, if Core Audio includes MIDI as Winmm does, and can be imported into Windows 98 to replace what I need Winmm for, that would be very nice. It could mean I need write only one audio access method to get wider portability, and improve latency in W98 core at same time. There are people who know more about adding proper USB, 48 bit LBA access, and KernelEx support for programs demanding later OS's, to W98 than I'll ever know, and if any of them have made Core Audio work in it too I'll make it a priority to try it. A quick look suggests I might have trouble adding it though, and it doesn't do MIDI.

    Given that later OS's have made it harder to reach the hardware I don't doubt that Wave API might not work so well in WXP and so forth.. BUT, given that a dedicated laser control or music synthesiser system might best be built on an older machine with W98, saving massively on software licensing, hardware costs, etc, I'd be ok with programming with that in mind. There will always be people who won't buy because it won't run on the latest OS, but I doubt it would stop those who recognise that great performance at low cost can be had this way.

    My current latency is about 12.5 ms. This is better than the 24 ms Cakewalk was giving me, and that wasn't bad. Audio response to keyboard played live is demanding, ears and brains detect anything more than about 30 ms easily. I'm not sure about this but I imagine that as eyes are ok with cinema frame rates of 25 per second, anything less than 40ms latency ought to be good. More important would be timing offset and accurate sync.

    EDIT. Screw that last part.. Given how far lasers can project, a big show will mess that up due to differences in sound and light speed. Maybe the most important thing is consistency.
    Last edited by The_Doctor; 07-23-2013 at 05:06.

  5. #15
    Join Date
    Dec 2008
    Location
    Austin, TX
    Posts
    61

    Default

    Have you checked out Dr. Lava's ezauddac.dll? It provides a nice link between your laser software and the sound output. It also has a nice little config file that let's you adjust blanking delay, invert, and mapping on a per-channel basis. It's what I switched over to using in my software. I'm not sure what kind of buffering magic he uses (I assume some sort of ring buffer) but it works like a champ and I get fast response and buttery-smooth output. I don't recall what sort of license is attached to ezauddac.dll, so you might want to check that.

    On not being able to output more than 2 channels, you may need to double check your sound card configuration. On windows 7, I initially couldn't get more than 2 channels. I had to go into the control panel->hardware and sound->sound->manage audio devices. Pick your device and hit configure. It may only be setup for stereo. You'll need to select 5.1 or 7.1 as appropriate. After that, the OS should present all the channels present.

    BTW. I'm back - hi to all the bit-pushers.

  6. #16
    Join Date
    Mar 2012
    Location
    Akron, Ohio USA
    Posts
    2,197

    Default

    HEY! There's a blast from the past! How have you been? Are you still in Cleveland?

    James.
    Creator of LaserBoy!
    LaserBoy is free and runs in Windows, MacOS and Linux (including Raspberry Pi!).
    Download LaserBoy!
    YouTube Tutorials
    Ask me about my LaserBoy Correction Amp Kit for sale!
    All software has a learning curve usually proportional to its capabilities and unique features. Pointing with a mouse is in no way easier than tapping a key.

  7. #17
    Join Date
    Jul 2008
    Posts
    768

    Default

    Hey Agent C! Good to hear from you...

    I was experimenting with some sample wave playback code for VB 2010 a couple years back when I ran into the multi-ch problem with DirectSound- it was the same
    issue that I had run into with VB6 some time earlier... Anyway, by that time I had already learned EasyAudDAC & Bass.dll so I didn't pursue the problem any further.

  8. #18
    Join Date
    Mar 2010
    Location
    Raleigh, NC
    Posts
    2,292

    Default

    Quote Originally Posted by dchammonds View Post
    Hey Agent C! Good to hear from you...

    I was experimenting with some sample wave playback code for VB 2010 a couple years back when I ran into the multi-ch problem with DirectSound- it was the same
    issue that I had run into with VB6 some time earlier... Anyway, by that time I had already learned EasyAudDAC & Bass.dll so I didn't pursue the problem any further.
    Bass.dll is a wrapper around DirectSound, I think. Anyway, without checking, I am almost certain that the base WAVEFORM structure in the Win32 API doesn't support multichannels. But, there is an extended version that does. Maybe that is where you got tripped up.

  9. #19
    Join Date
    Mar 2006
    Posts
    2,478

    Default

    Quote Originally Posted by JohnYayas View Post
    Bass.dll is a wrapper around DirectSound, I think. Anyway, without checking, I am almost certain that the base WAVEFORM structure in the Win32 API doesn't support multichannels. But, there is an extended version that does. Maybe that is where you got tripped up.
    Do you mean WAVEFORMAT and WAVEFORMATEX? WAVEFORM doesn't exist (in my API reference, anyway). The EX variant supersedes the other, and as far as I know, neither of them handle more than 2 channels. That is why I emphasise using pairs, as many as you need, with hardware (and maker's driver) to match. Anything else is tempting fate. Stereo channels are the one thing you can guarantee that will remain widely supported. Even Cakewalk and Cubase and such do this. They will pack data in their own proprietary bundle formats for user convenience and project integrity, but ultimately it all gets unpacked internally and done in either mono or stereo as native API supports. They never use 5.1 or 7.1 or anything else likely to run into trouble with hardware support.

    EDIT, Been reading...
    WAVEFORMATEXTENSIBLE exists since W98, which does the 5.1 and a heap of others. I'd stay away from it though, unless (see question post below) some box won't let me access its ports without this. If you can get at ports with WAVEFORMATEX it's better that way. Less risk of incompatibility. I *might* (see below) use it if I need a three-byte (24 bit) format though, because apparently WAVEFORMATEX will only take 8 or 16. (Actually it seems WAVEFORMATEX can be told to use 24 but I'll have to experiment sometime tricking it into using three-byte samples to see if it means it. I suspect it does, it just doesn't make it easy or obvious, and pointer arithmetic tricks might be needed rather than native data types.

    MORE EDIT:
    Standard WAVEFORMATEX can definitely take 24 bits, even though the API doc doesn't say so. Just make buffer size divisible by three, step through with pointer arthmetic and use memcpy(B,&X,3) where B is a char* to the buffer location, stepped by three each sample. X is 32 bit integer passed by its address. I'm not sure if laser control ever needs 24 bits but if so, and you want to rule out incompatibility, and can coerce standard API methods in this way, do it. That way you get more control of it. It saves resources too. I get to avoid at least one extra included header file, if nothing else. A test of my signal generator test program shows no decrease in efficiency either.
    Last edited by The_Doctor; 07-24-2013 at 08:49. Reason: Experiment worked.

  10. #20
    Join Date
    Mar 2006
    Posts
    2,478

    Default

    Got a question.. About those little cheap 5.1 thingers like I bought from eBay once. Cirrus IC's in, I think... Do they present as stereo pairs if handled appropriately, or do their drivers ONLY allow access to extra ports via 5.1 and such? If so that's a big mark down. Which would be a shame because Cirrus IC's are usually great, it's why I originally hoped to do good things with a 15 quid box off eBay! Cirrus chips are in the top end stuff too, so they all ought to be good. In the end I went with Layla because a second hand Layla at 20 to 30 quid wipes the floor with whole boxes of 15 quid boxes. But despite going with a twice-priced box that was once worth a grand, I'm still curious, because there will always be little cheap boxes while the better top end stuff will likely only get rarer. So the question is: Can the entire even-numbered count of ports on a cheap USB sound box be accessed as stereo pairs using Win32 Wave API, despite the labelled intentions of use as part of a 5.1 setup, or is such access prevented by the device driver?

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •