Sounds and Audio Decoding/ Drive Access

This is a discussion on Sounds and Audio Decoding/ Drive Access within the Windows Programming forums, part of the Platform Specific Boards category; I have not been able to find a resource for sending raw audio data to a sound device. I figure ...

  1. #1
    Registered User
    Join Date
    Feb 2005
    Posts
    15

    Sounds and Audio Decoding/ Drive Access

    I have not been able to find a resource for sending raw audio data to a sound device. I figure that the code would have to flow like this....

    Enumerate Sound Devices
    Connect or Talk to Device
    Set Correct Command Registers or Options
    Send Data

    However, I didn't want to make it windows only and wonder if there isn't some ASM I could do as well... Then if someone could point me in the direction of sending raw sound information to the soundcard/onboard chip would be great. Also appreciated would be any resource to decode WAV, MIDI, MP3, etc. Or Accessing a drive directly to access raw audio data on a cd, dvd, etc.

    I know this isn't a subject that you normally see here, but it was worth a shot... Thanks guys
    -Sean

  2. #2
    and the hat of int overfl Salem's Avatar
    Join Date
    Aug 2001
    Location
    The edge of the known universe
    Posts
    32,824
    I'm guessing this is a windows specific question.
    If you dance barefoot on the broken glass of undefined behaviour, you've got to expect the occasional cut.
    If at first you don't succeed, try writing your phone number on the exam paper.
    I support http://www.ukip.org/ as the first necessary step to a free Europe.

  3. #3
    Registered User
    Join Date
    Feb 2005
    Posts
    15
    I didn't want it to be, but it can. I'm not talking about using SndPlaySound or anything like that. I am wanting to know how to access sound devices for raw audio output.
    -Sean

  4. #4
    Yes, my avatar is stolen anonytmouse's Avatar
    Join Date
    Dec 2002
    Posts
    2,544
    For Win32, it sounds like you are looking for either Waveform Audio API or DirectSound. There are cross-platform libraries available that abstract the platform specific calls. One you could check out is fmod.
    Last edited by anonytmouse; 03-03-2005 at 01:47 PM.

  5. #5
    Registered User
    Join Date
    Feb 2005
    Posts
    15
    Ok, I figured out the following code form the references you posted.

    Code:
    	unsigned int NumDevs = 0;
    	WAVEOUTCAPS wResult;
    	char cGet = 0;
    
    	NumDevs = waveOutGetNumDevs();
    
    	if(NumDevs >0 && NumDevs != 1)
    	{
    		printf("Please Select 1 of the following %d devices.\n",NumDevs);
    		for(int i = 0; i < (int)NumDevs; i++)
    		{
    			waveOutGetDevCaps(i,&wResult,sizeof(wResult));
    			printf("Device %d: %s\n",i,wResult.szPname);
    		}
    
    		printf("Use Device Number: ");
    		cin.get(cGet);
    		waveOutGetDevCaps((int)cGet,&wResult,sizeof(wResult));
    		printf("Using Wave Device %d: %s\n",(int)cGet,wResult.szPname);
    	}
    	else
    	{
    		waveOutGetDevCaps(0,&wResult,sizeof(wResult));
    		printf("Using Wave Device 0: %s\n",wResult.szPname);
    	}
    Now, any help on playing the actual file?
    -Sean

Popular pages Recent additions subscribe to a feed

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21