I have problems with new versions of FMOD Ex
In my Sound Engine with older versions could call a function for reseting the audio system for example:
set initial sound system at 44100HZ and 16 bits
load and plays a sound (stream mp3 o s3m, xm. etc…)
call a function for reseting (call FMOD_Sound_Close) and change sound system (ie: 22050 rate and 8 bits), automatically the sound plays stops correctly, after i call the play function and without free the sounds, this runs correctly
Now this is not possible if reset the sound system the playback stops correctly but when call play function the program enter in infinte loop, is neessary call FMOD_Sound_Release before FMOD_System_Close and after FMOD_System_Init recall FMOD_System_CreateSound.
For final is call FMOD_Sound_Release after FMOD_System_Close for free sound, FMOD_Sound_Release CRASH (and is impossible rescue the FMOD_RESULT)
- CicTec asked 12 years ago
older versions of FMOD run perfectly with this system
i choose FMOD for my game engine for this feature
with the older versions in my game i load the sounds (songs, sound, etc…)
and have a option for changing the system quality (rate, bits, etc…) when select this are called 2 functions
reset_sound() and play_song(cur_song)
the result is that the quality of reproductions of audio is changed, but run all correctly
why with this new version for play already the song is necessary reload this ?
Ok very thanks, at final for you direction my function reset_sound call in order:
IF IS FIRST_INIT :
for setting and chaging the bits, rate, speaker and number of channels used internally
this parameters are settings changing members of a global struct and calling reset_sound function
thanks for trying
yes is true but the FMOD sound objects are puer DirectSound Object or are FMOD exclusive object attached to “wrapped directsound objects” ?
in this last case is possible free the “wrapped directsound objects” and recreate it without invaliding the FMOD sound objects (that are loaded a sound resource type WAV, XM, etc…) this allow change and restarting audio system (setting new bits, rate, etc… and calls FMOD_System_Close and FMOS_System_Init) without invaliding and freeing the loaded sounds
(i use this tecnique with a engine2D with DirectDraw, creating “Wrapped DirectDraw Surfaces called Client Surface” and attach really data image surface, when changing for example the system resolution the engine automatically free and created only “Wrapped surfaces” allowing to continue use of image previous allocated
the reference of “wrapped surface in directdraw is this”
define WIDTH 64 // in pixels
define HEIGHT 64
define DEPTH 3 // in bytes (3bytes == 24 bits)
HRESULT hr; LPVOID lpSurface = NULL; HLOCAL hMemHandle = NULL; DDSURFACEDESC2 ddsd2; LPDIRECTDRAWSURFACE7 lpDDS; // Allocate memory for a 64 by 64, 24-bit per pixel buffer. // REMEMBER: The application is responsible for freeing this // buffer when it is no longer needed. if (lpSurface = malloc((size_t)WIDTH*HEIGHT*DEPTH)) ZeroMemory(lpSurface, (DWORD)WIDTH*HEIGHT*DEPTH); else return DDERR_OUTOFMEMORY; // Initialize the surface description. ZeroMemory(&ddsd2, sizeof(DDSURFACEDESC2)); ZeroMemory(&ddsd2.ddpfPixelFormat, sizeof(DDPIXELFORMAT)); ddsd2.dwSize = sizeof(ddsd2); ddsd2.dwFlags = DDSD_WIDTH | DDSD_HEIGHT | DDSD_LPSURFACE | DDSD_PITCH | DDSD_PIXELFORMAT | DDSD_CAPS; ddsd2.ddsCaps.dwCaps = DDSCAPS_OFFSCREENPLAIN | DDSCAPS_SYSTEMMEMORY; ddsd2.dwWidth = WIDTH; ddsd2.dwHeight= HEIGHT; ddsd2.lPitch = (LONG)DEPTH * WIDTH; ddsd2.lpSurface = lpSurface; // Set up the pixel format for 24-bit RGB (8-8-8). ddsd2.ddpfPixelFormat.dwSize = sizeof(DDPIXELFORMAT); ddsd2.ddpfPixelFormat.dwFlags= DDPF_RGB; ddsd2.ddpfPixelFormat.dwRGBBitCount = (DWORD)DEPTH*8; ddsd2.ddpfPixelFormat.dwRBitMask = 0x00FF0000; ddsd2.ddpfPixelFormat.dwGBitMask = 0x0000FF00; ddsd2.ddpfPixelFormat.dwBBitMask = 0x000000FF; // Create the surface hr = g_lpDD->CreateSurface(&ddsd2, &lpDDS, NULL); return hr;
the real memory image data is allocated from malloc, not from CreateSurface, CreateSurface create “wrap” for use with DirectDraw, when the system is changed (resolution, with SetDiplayMode in fullscreen) DirectDraw free and invalidate automatically all surfaces, is surface is “Really surface with image data” this is will be freed, is “wrap” surface the real resoruce image data exists in memory until call to FREE function, with this tecnique is necessary that the program recreate only “wrap” surface (see up) and reassign the image data (ddsd2.lpSurface = lpSurface;)
DirectSound Allow This with sound data ?, the sound data is alloced from FMOD Ex and assigned to DirectSound Object ?
Why i use all SOFTWARE with FMOD
My intencion is emulate old sound API used in a lenguaje thar allow load all resource 1 time and call more time is necessary RESET_SOUND with new parameters bits, rate, etc.. (for example in a game that allow change the rate and bits in a game options during runtime) without necessary free and reload the resource sound (S3M, WAV, etc…) before the change
thanks for you patient
is necessary for emulate 100% compatibility with a old audio engine (named “judas” for dos) use into a system for creating games, this library allows change bit, rate and mixer quality in runtime, without freeing previous sound resource loadeds, for this i have choose FMOD for emulate the sound library and this work into previouse versions (4.00.34 or later) i am sure why during the develpoment i have tested this, now during test of a game tha use this feature (changing audio) the game crash
if you could pass me older versions of FMOD Ex i could test it (i not remember if my test of this, is with beta versions of FMOD Ex or with 4.00.XX, but i’am sure that previous FMOD Ex allow it)
Please login first to submit.