Skip to main content
GameDev.net gamedev.net
🔒 Locked

DXutil methods not declared in header?

Started by HeWhoDarez Feb 25, 2009 at 8:52 AM 7 replies 800+ views
Original Post
HeWhoDarez
HeWhoDarez
Hi guys, I am working through some dsound tuts from book. I have hacked together a little app that will eventually playback voice information in 3D. This problem has had me stifled for a while now so any help will be much appreciated. Error 1 error C3861: 'DXUtil_ConvertGenericStringToWide': identifier not found c:\uwe\virtual voices\application\communicate\communicate\audiomanager.cpp 133 On the surface it seems simple - a function is not declared properly. And from going through its respective header, none of the methods in it are. (why?) How come the other instances of this call are not giving errors? and... Is there any good documentation to read about string type conversion in dx? Thanks in advance files located at: http://www.stephenhack.net/misc_files/MSdxutils.cpp http://www.stephenhack.net/misc_files/MSdxutils.h
Perfection is a product of progress not an alternative.

Evil Steve
Evil Steve
I'd guess that whatever header that function is declared in is included in the other files (Probably through another header).

Having said that, I've no idea what header you're supposed to include for these functions.
HeWhoDarez
HeWhoDarez
Inspired by your response Ifound a thread that claims I need to include
"stdafx.h" in the cpp file.

It sounds like this works, but I have no idea where to find the file atmm.

Can anyone point me to it or another solution?
Perfection is a product of progress not an alternative.

Evil Steve
Evil Steve
Quote:
Original post by HeWhoDarez
Inspired by your response Ifound a thread that claims I need to include
"stdafx.h" in the cpp file.

It sounds like this works, but I have no idea where to find the file atmm.

Can anyone point me to it or another solution?
stdafx.h is only used if you're using precompiled headers. If you're not using precompiled headers, this is irrelevant.
HeWhoDarez
HeWhoDarez
I understand that dxutil is no longer used.

Whats the modern alternative or more importantly how do you usually convert to wide strings?

ty
Perfection is a product of progress not an alternative.

brekehan
brekehan
Converting string to wstring and wstring to string:

// Standard Includes#include <locale>#include <string>#include <cstdlib>//----------------------------------------------------------------------------std::wstring StringToWString(const std::string & s){   size_t size         = s.length() + 1;   wchar_t * temp      = new wchar_t[size];   size_t numConverted = 0;   mbstowcs_s(&numConverted, temp, size, s.c_str(), size);   std::wstring wide(temp);   delete [] temp;   return wide; }//----------------------------------------------------------------------------std::string WStringToString(const std::wstring & s){   size_t size         = s.length() + 1;   char * temp         = new char[size];   size_t numConverted = 0;   wcstombs_s(&numConverted, temp, size, s.c_str(), size);   std::string multibyte(temp);   delete [] temp;   return multibyte; }


I've also tried the narrow() and wide() methods from my iostream book, but it caused problems. wcstombs and mbstowcs seem to be more widely accepted. Be warely of wide characters that do not convert if you application handles anything that is not your current locale.

HeWhoDarez
HeWhoDarez
Thanks, I think I am on track now.

It seems that IDirectMusicLoader8::LoadObjectFromFile requires the filename as a WCHAR[]

I know this seems a bit long winded but how would I set about populating it using either the wstring that brekehan has created or the std::string I started with originally.

This kind of thing must be covered somewhere - google being a bit lazy methinks.

ta
Perfection is a product of progress not an alternative.

Evil Steve
Evil Steve
Quote:
Original post by HeWhoDarez
Thanks, I think I am on track now.

It seems that IDirectMusicLoader8::LoadObjectFromFile requires the filename as a WCHAR[]

I know this seems a bit long winded but how would I set about populating it using either the wstring that brekehan has created or the std::string I started with originally.

This kind of thing must be covered somewhere - google being a bit lazy methinks.

ta
You can get a const WCHAR* from a std::wstring by using the c_str() function.

E.g.
std::wstring str = L"C:/foo.wav";HRESULT hResult = pLoader->LoadObjectFromFile(classID, interfaceID, str.c_str(), foo);

I'd also highly recommend reading over This Journal Entry by MJP for information about different character sets.
HeWhoDarez
HeWhoDarez
Thanks again Evil Steve, interesting read as well.

I am loving the tuts btw, great work.
Perfection is a product of progress not an alternative.

Topic Locked

This topic has been locked by a moderator. New replies are not allowed.

Sign in to reply to this topic.