Thread: Sound worked in XP; not in Vista

  1. #1
    Registered User
    Join Date
    Aug 2008
    Posts
    3

    Sound worked in XP; not in Vista

    First off, I am NOT a programmer. I am seeking advice so that I can manage a project.

    I have a C++ application I inherited that manages sound files. The app works fine in XP. When it runs in Vista, everything looks like it is working, but sound files cannot be recorded or played back. I AM able to use other sound apps in Vista and everything works. I just need to have my app modified so it works in Vista. since this app is intended to be used by clients, I can't make tweaks to the OS, I need to make code changes in the app. I looked at the code in Visual Studio, but it all looks greek to me.

    Here's my question. I have received estimates from programming shops that suggest a partial rewrite at thousands of dollars. I'd like to think it should be a relatively easy tweak to a module or two. I just don't know where to turn. I would love to get a sense of what's involved so I can make an intelligent decision, since I definitely don't have thousands in the budget. I'm even comfortable following instructions and recompiling the code if that's in the cards.

    I'd be happy to share the appropriate section of code if you give me instructions for finding it. If I've done something the wrong way here, please let me know gently. They don't come any greener than me.

    Thanks.

  2. #2
    C++まいる!Cをこわせ!
    Join Date
    Oct 2007
    Location
    Inside my computer
    Posts
    24,654
    There's not much we can do or suggest unless you shed some details. For example, what kind of sound system is it? Is it some API like PlaySound or is it DirectSound or something?
    Some sound support was removed from Vista, so it could likely be a little problem there.
    Quote Originally Posted by Adak View Post
    io.h certainly IS included in some modern compilers. It is no longer part of the standard for C, but it is nevertheless, included in the very latest Pelles C versions.
    Quote Originally Posted by Salem View Post
    You mean it's included as a crutch to help ancient programmers limp along without them having to relearn too much.

    Outside of your DOS world, your header file is meaningless.

  3. #3
    Registered User
    Join Date
    Aug 2008
    Posts
    3
    I have a module titled WaveRecorderCtrl that seems to have nearly 2000 lines to it. I don't think I should post all of that here. There's another titled WaveRecorderDlg that is about the same length.

    Here is an excerpt. Does this help?

    Code:
    int CWaveRecorderCtrl::Record()
    {
    	if (m_bMonitoringInputLevel)
    	{
    		// Set the start recording flag
    		m_bStartRecording = true;
    
    		// Stop monitoring the input level
    		StopInputLevelMonitoring();
    
    		return TRUE;
    	}
    
    	// Make sure we aren't recording
    	if (m_bRecording)
    		return FALSE;
    
    	// Make sure we aren't already playing
    	if (m_bPlaying)
    		return FALSE;
    
    	// Check the handle to the window
    	if (!this->m_hWnd)
    		return FALSE;
    
    	// Allocate buffer memory
    	if (m_pBuffer1)
    		delete [] m_pBuffer1;
    	if (m_pBuffer2)
    		delete [] m_pBuffer2;
    	m_pBuffer1 = new BYTE[INPUT_BUFFER_SIZE];
    	m_pBuffer2 = new BYTE[INPUT_BUFFER_SIZE];
    
    	if (!m_pBuffer1 || !m_pBuffer2)
    	{
    		if (m_pBuffer1) delete [] m_pBuffer1;
    		if (m_pBuffer2) delete [] m_pBuffer2;
    
    		return FALSE;
    	}
    
    	// Open waveform audio device for input
    	m_WaveFormat.wFormatTag = WAVE_FORMAT_PCM;
    	m_WaveFormat.nChannels = 1;
    	m_WaveFormat.nSamplesPerSec = SAMPLE_RATE;
    	m_WaveFormat.nAvgBytesPerSec = SAMPLE_RATE;
    	m_WaveFormat.nBlockAlign = 1;
    	m_WaveFormat.wBitsPerSample = BITS_PER_SAMPLE;
    	m_WaveFormat.cbSize = 0;
    
    	if (waveInOpen(&m_hWaveIn, WAVE_MAPPER, &m_WaveFormat, (DWORD)this->m_hWnd, 0, CALLBACK_WINDOW))
    	{
    		delete [] m_pBuffer1;
    		delete [] m_pBuffer2;
    		return FALSE;
    	}
    
    	// Setup and prepare headers
    	m_pWaveHdr1->lpData = (char *)m_pBuffer1;
    	m_pWaveHdr1->dwBufferLength = INPUT_BUFFER_SIZE;
    	m_pWaveHdr1->dwBytesRecorded = 0;
    	m_pWaveHdr1->dwUser = 0;
    	m_pWaveHdr1->dwFlags = 0;
    	m_pWaveHdr1->dwLoops = 0;
    	m_pWaveHdr1->lpNext = NULL;
    	m_pWaveHdr1->reserved = 0;
    
    	waveInPrepareHeader(m_hWaveIn, m_pWaveHdr1, sizeof(WAVEHDR));
    
    	m_pWaveHdr2->lpData = (char *)m_pBuffer2;
    	m_pWaveHdr2->dwBufferLength = INPUT_BUFFER_SIZE;
    	m_pWaveHdr2->dwBytesRecorded = 0;
    	m_pWaveHdr2->dwUser = 0;
    	m_pWaveHdr2->dwFlags = 0;
    	m_pWaveHdr2->dwLoops = 0;
    	m_pWaveHdr2->lpNext = NULL;
    	m_pWaveHdr2->reserved = 0;
    
    	waveInPrepareHeader(m_hWaveIn, m_pWaveHdr2, sizeof(WAVEHDR));
    
    	// Invalidate the loaded from file flag
    	m_loaded_from_file = FALSE;
    
    	return TRUE;

  4. #4
    Registered User Codeplug's Avatar
    Join Date
    Mar 2003
    Posts
    4,981
    For what it's worth, this may be useful (to a programmer): http://msdn.microsoft.com/en-us/libr...25(VS.85).aspx

    gg

  5. #5
    Registered User
    Join Date
    Aug 2008
    Posts
    3
    Thanks.

    This DOES look helpful. I have done dozens of Google searches to try to learn more about all this and never came up with the one you suggested. There were several in various Microsoft areas, but not this one.

    I will read through the stuff you pointed me to. I know it won't mean much to me, but I'm quite hopeful I can get a better sense if my project should be a series of minor tweaks or some level of rewrite. I still believe it ought to be more the former than the latter.

    If anyone knows how to explain some of this to me in non-programmer language, please chime in.

    Thanks again.

  6. #6
    Registered User VirtualAce's Avatar
    Join Date
    Aug 2001
    Posts
    9,607
    This appears to be a low level mixer using mmio. The problem is that in Vista most of this was completely ripped out. I believe mmio is still around since if it was not it would break everything from RealPlayer to Windows Media Player but it does not have as much functionality as before.

    Also hardware extensions to this layer are absent in Vista. Thus DirectSound 3D, Creative Labs EAX, and other extensions will not work in Vista absent something like OpenAL to compensate.

    I really don't know enough about the underlying Vista sound architecture to help and I'm not sure if they just removed DirectSound extensions or removed everything. Regardless I think that what does remain in Vista is all software based.

    Microsoft may bring this back in their next OS b/c the removal of hardware sound acceleration has brought on a huge number of complaints from end users. Game programmers were already using other APIs to do sound so they are probably not noticing any difference. But the end user will notice a SEVERE degradation of audio and/or video under Vista. This is not good when said end user paid 100 to 200 bucks for a sound card and now gets sound that is worse than onboard sound. The main basis for removing it was that they found it was the biggest source of driver errors in the errors that were reported to them. Also they figured that most modern CPUs wouldn't even flinch while doing sound processing. While all of this is true I still feel it is a step in the wrong direction. The more we can remove from the CPU, the better, and this justs adds something to the CPU that while it can do, IMO should not have to.

    If you don't like the sound in Vista let Microsoft know in an email. Maybe if they get enough of these types of emails they will bring back hardware audio in their next OS. As for me and my computer....we are skipping Vista altogether until we are forced to use it.
    Last edited by VirtualAce; 08-11-2008 at 05:50 PM.

  7. #7
    C++まいる!Cをこわせ!
    Join Date
    Oct 2007
    Location
    Inside my computer
    Posts
    24,654
    If it's bad code (which I never experienced), then stuff it into user mode, just like the graphics was.
    It's better than removing it altogether.
    Really Microsoft
    Quote Originally Posted by Adak View Post
    io.h certainly IS included in some modern compilers. It is no longer part of the standard for C, but it is nevertheless, included in the very latest Pelles C versions.
    Quote Originally Posted by Salem View Post
    You mean it's included as a crutch to help ancient programmers limp along without them having to relearn too much.

    Outside of your DOS world, your header file is meaningless.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Differences between Windows XP and Windows Vista programming
    By nathan3011 in forum Windows Programming
    Replies: 3
    Last Post: 01-15-2009, 10:05 AM
  2. Trying to Install XP over Vista with SATA HD
    By Shamino in forum Tech Board
    Replies: 2
    Last Post: 12-13-2008, 06:56 PM
  3. get "application data" directory in xp, vista
    By sgh in forum Windows Programming
    Replies: 8
    Last Post: 05-12-2008, 02:48 AM
  4. Vista design being forced on XP?
    By Mario F. in forum A Brief History of Cprogramming.com
    Replies: 128
    Last Post: 03-04-2008, 12:56 PM
  5. Another new system thread...
    By Dark_Phoenix in forum Tech Board
    Replies: 25
    Last Post: 01-30-2008, 12:46 PM

Tags for this Thread