• Announcements

    • khawk

      Download the Game Design and Indie Game Marketing Freebook   07/19/17

      GameDev.net and CRC Press have teamed up to bring a free ebook of content curated from top titles published by CRC Press. The freebook, Practices of Game Design & Indie Game Marketing, includes chapters from The Art of Game Design: A Book of Lenses, A Practical Guide to Indie Game Marketing, and An Architectural Approach to Level Design. The GameDev.net FreeBook is relevant to game designers, developers, and those interested in learning more about the challenges in game development. We know game development can be a tough discipline and business, so we picked several chapters from CRC Press titles that we thought would be of interest to you, the GameDev.net audience, in your journey to design, develop, and market your next game. The free ebook is available through CRC Press by clicking here. The Curated Books The Art of Game Design: A Book of Lenses, Second Edition, by Jesse Schell Presents 100+ sets of questions, or different lenses, for viewing a game’s design, encompassing diverse fields such as psychology, architecture, music, film, software engineering, theme park design, mathematics, anthropology, and more. Written by one of the world's top game designers, this book describes the deepest and most fundamental principles of game design, demonstrating how tactics used in board, card, and athletic games also work in video games. It provides practical instruction on creating world-class games that will be played again and again. View it here. A Practical Guide to Indie Game Marketing, by Joel Dreskin Marketing is an essential but too frequently overlooked or minimized component of the release plan for indie games. A Practical Guide to Indie Game Marketing provides you with the tools needed to build visibility and sell your indie games. With special focus on those developers with small budgets and limited staff and resources, this book is packed with tangible recommendations and techniques that you can put to use immediately. As a seasoned professional of the indie game arena, author Joel Dreskin gives you insight into practical, real-world experiences of marketing numerous successful games and also provides stories of the failures. View it here. An Architectural Approach to Level Design This is one of the first books to integrate architectural and spatial design theory with the field of level design. The book presents architectural techniques and theories for level designers to use in their own work. It connects architecture and level design in different ways that address the practical elements of how designers construct space and the experiential elements of how and why humans interact with this space. Throughout the text, readers learn skills for spatial layout, evoking emotion through gamespaces, and creating better levels through architectural theory. View it here. Learn more and download the ebook by clicking here. Did you know? GameDev.net and CRC Press also recently teamed up to bring GDNet+ Members up to a 20% discount on all CRC Press books. Learn more about this and other benefits here.

Archived

This topic is now archived and is closed to further replies.

grinder

DirectSound

7 posts in this topic

Create a notification event that sets a flag when the wave file is done playing. During your main loop, just check the status of the flag and flip pages if needed.

Jim

0

Share this post


Link to post
Share on other sites
I don't think DirectX provides you with any way to let you
know when a DirectSound sound buffer has finished playing
by notification.

As the last person pointed out, you probably should just
rely on Win32 API functions for notification.

For example, let's say you want to call a function after 2 seconds
has passed. This will setup a simple callout function:


SetTimer(hMainWindow, ID_MY_TIMER, 2000, (TIMERPROC)MyTimerProc);


So, after 2000 milliseconds have passed, it will call your MyTimerProc
function, which is setup like this:


VOID CALLBACK
MyTimerProc(HWND hWnd, UINT timer_msg, UINT timer_id, DWORD dwSysTime) {

// do something, like flip a page
}


If you know the time length of all 6 voice WAVs, you can probably
call SetTimer six different times with a different time delay for
each voice.

Scruff

0

Share this post


Link to post
Share on other sites
Oh, I forgot to mention that the above method is not really
accurate. Here's another way. Continually poll the sound
buffer status in your main loop.

DWORD dwStatus;
BOOL done_flag;

// get the playing status
sound_buffer->GetStatus(&dwStatus);

// sound has stopped
if(dwStatus != DSBSTATUS_PLAYING) {
done_flag = 1;
}

If it is done, set a flag. This might be even easier, since
you don't even have to know the time lengths of any sound buffers.

Scruff

0

Share this post


Link to post
Share on other sites
DirectSound notifications, when correctly setup, WILL notify you when a sound is finished playing. That's one of the reasons for them. It will work with static and streaming buffers, and very easily at that. Here's how:

1)Setup your notification interface.

2)If the sound is static, then it fits into one buffer. Setup the ONLY notification position as DSBPN_OFFSETSTOP, and only one event being triggered. If the sound is streamed, setup 3 positions, one midstream, one endstream, and the last that marks where the end of the sound would be.

3) In the notification routine, just keep track of which notification position has been triggered. If the sound is static, there's only one notification - sound stopped/completed.


I have a half-finished article I was writing on using DirectX and notifications that I can finish up if anybody shows some interest in it. It talks about all the above.

------------------
Jim Adams
Co-Designer 'The Light Befallen'
tcm@pobox.com
http://www.lightbefallen.com

0

Share this post


Link to post
Share on other sites
Actually Direct Sound does have this capability. Read up on:

IDirectSoundNotify::SetNotificationPositions()

Works like a hot-damn.

0

Share this post


Link to post
Share on other sites
Sure, I don't mind reading a tutorial on DirectSound notifications.

Step (2) is a big confusing step if you don't know a thing about
threads and events. I can't find a complete DirectX example
in the docs, since they have it hacked up everywhere in little
bits.

Scruff

0

Share this post


Link to post
Share on other sites
I'm currently working on an interactive storybook. I have a voice reading the text and when the wav file end I want the page to flip.
I have the voice in 6 different languages so i cant make a timer that flips the page. I have to have the program tell the flipfunction when to start.

I know this is possible in DirectX but I can't figure out how to.

I'm using DX6.1 and VC++ 6.0

Cheers
_grinder_

------------------

0

Share this post


Link to post
Share on other sites
Oops, step (1), you know what I mean

If you have six different sound buffers, you probably have
to create six different event handles like:

HANDLE hEvent[6];

Then create a windows thread, etc..ugh. Too confusing for me
at the moment.

Scruff

0

Share this post


Link to post
Share on other sites