Playing Audio With Flic
5 messages in this thread
Hello Brian,
I have a couple of questions regarding the playing of FLC animations:
1) In order to play a WAV file in conjunction with a FLC file, I am using the
following code in conjunction with the "Animation Support Libraries R2.0"
aaSound ( hAAFlicAnim, // Animation Handle
NULL, // This is NULL as we asume MCI
extensions have been setup
lpszFlicAudioFile, // Name of the audio file (
*.wav, *.mid )
AA_SNDFREEZE );
This will sometimes result with a message box appearing with "The Specified
Sound is Invalid". It is also the case that when I use the Animation Player
application and hit "Get Sound" from the FILE menu, I don't get the waveaudio
device listed in the Sound Devices list box and get the same message as above
when I try to select a WAV file. Incidentally, Sequencer and CDAudio always
appear.
Now, if I change the settings for the MCI Sound Drivers from the Windows
Control Panel to different values between 2 and 9 seconds of buffered audio
data, the device "waveaudio" reappears in the Animation Player and my
application plays the FLC and WAV file successfully!! However, this only works
on a random basis across different PC's.
Can you shed any light on this problem?
It is especially important that we resolve this as we intend to include FLC's
with audio on our CD-ROM titles and hence, do not expect the user to have to
manually adjust driver settings. We load mciapp.drv to C:\WINDOWS\SYSTEM and
make the appropriate changes to WIN.INI and SYSTEM.INI in our installation
program for the disc.
2) Can you send a sample of 'C' code which will simply stop a FLC on it's last
frame and hold it on the screen. Again this will be in conjunction with an
audio file which may be longer or shorter than the duration of the animation.
What I've been trying is:
// Load the FLIC File
hAAFlicAnim = aaLoad ( lpszFlicFile, // Animation File
hWnd, // Parent window that
owns the animation
AA_FULLSCREEN, // wMode
ptFlicOrigin.x, // x coord for top left of animation window
ptFlicOrigin.y, // y coord for top left
of animation window
nFlicWidth, // Width of
animation window
nFlicHeight, // Height of
animation window
0, // x coord of
the animation displayed at ul
0 ); // y coord of
the animation displayed at ul
// Set up for play to end on the specified frame
if ( (aaSetParm( hAAFlicAnim,
AA_LOOPS,
NULL,
dwFlicFrames )) == NULL )
return (FLIC_ERR);
This will indeed stop the FLC but the frame on the screen appears with a
"shadow" image of itself.
I've also tried:
// End the animation with the sound.
if ( (aaSetParm( hAAFlicAnim,
AA_LOOPS,
NULL,
MAKELONG(AA_LOOPSOUND, AA_LOOPSOUND) )) == NULL );
return (FLIC_ERR);
This doesn't stop the sound and the FLC from looping. In fact, nothing I've
tried, other setting play to end on a specified frame, has been able to stop
the looping behaviour.
Sorry to ask for so much detail on my first visit to this forum, but I hope you
will be able to give some pointers.
Many Thanks,
Donald MacLeod
First Information Group
U.K.
Donald:
re: Invalid sound,
It sounds like this is more a problem with the drivers associated with your
sound card than a Player problem. I have never gotten that error on any of my
systems. What can you tell me about the sound card and drivers that are being
used in the systems that generate the error? Also, tell me about the seconds of
buffered sound…none of the sound cards I use have that option.
The only thing even close to your problem we have encountered in the past was
when .WAV or .MIDI was not present in the list of available choices for the
Windows player. The reason for this was in the WIN.INI file. In that file there
is a section that reads [aaplay animation] and in that section are lines that
read : WaveAudio=c,522, Midi….etc. Sometimes the c would have an x instead,
and then WaveAudio would not show up in the list of valid choices.
re: indefinite pause
Unfortunatley, I have had the same problem you have, and have never been able
to figure out a way to create an indefinite pause at the end of an animation. (
I get that shadow also.) The best I have done is the pauseatend for 50000
milliseconds. If that is not good enough for the application, then I would
create a seperate GIF file of the last frame of the animation and after the FLC
played display the GIF file as if it were the last frame. I agree this is not
the best workaround, but this particular problem has me stumped as well.
I will take another look at this problem and if I can come up with a solution,
I will post some sample code.
-Brian
Brian,
Thanks for your reply.
I've managed to find a way round the problem of the shadow image at the end of
the animation. As you suggested I paused at the end for some time before
displaying a new window containing a graphic image. This, in itself, was not
sufficient to erradicate the image shift but allowed me to focus my attention
on what the actual fault was.
It seems as though the positioning of the origin for a new window in
CreateWindow() is the key. If I set the origin to (0,0) at creation, then
display this before destroying the FLC window returned by aaGetParm(hAa,
AA_ANIMWND), the last frame is visible and does not shift it's position before
disappearing and the new window taking it's place. Subsequently, as the new
window has a NULL brush, I can reposition it to it's correct coords without any
visible glitch.
Another clue is that before making the above change, the fault could not be
noticed if the display settings were switched from (800 x 600) to (640 x 480).
I hope some of that makes sense, I still need to look at it further to fully
understand what's going on!!
Regarding the "Invalid Sound" problem, I've discovered a rather peculiar querk
as to it's presence. Before changing the display settings to remedy the image
shift behaviour, the application had always run on my machine without any
errors. As soon as I made the change – IT'S BACK – and what's more, I can't ged
rid of it!
Of course, it could be purely coincidental, but the fact that the WIN.INI file
is being written to has some relevance in light of the suggestion you had about
some of the settings in that file. Here are my aaplay animation settings:
[AAPLAY Animation]
WaveAudio=c,19584
Sequencer=c,523
QTWVideo=x,0
AVIVideo=x,0
FullScreen=AAVGA.DLL
DualScreen=no
Int2fSwitch=no
ConfigTime=519665231
CDAudio=s,516
Animation1=x,0
What do the settings "c,19584" pertain to?
The soundcard is a Creative Soundblaster 16MultiCD with "Wave=sb16snd.drv" set
in the [drivers] section of system.ini.
– Donald.
Brian,
Since I posted the last message I've had some progress with the Invalid Sound
problem.
In the [aaplay animation] section of win.ini, I changed the setting
waveaudio=c,19584 to waveaudio=c,522 and ran the application – the audio
plays!! Changing the setting to any other value than 522 results in no audio
and the usual message "The Specified Sound is Invalid".
I've tried this across a range of machines with the same results.
To get some more clues I reinstalled the software and got the following win.ini
entry:
[AAPLAY Animation]
FullScreen=AAVGA.DLL
DualScreen=no
Int2fSwitch=no
After running Animation Player with FLC and WAV combination:
[AAPLAY Animation]
FullScreen=AAVGA.DLL
DualScreen=no
Int2fSwitch=no
ConfigTime=519668693
WaveAudio=c,522
Sequencer=c,523
QTWVideo=x,0
AVIVideo=x,0
CDAudio=s,516
Animation1=x,0
Deleting the "WaveAudio" entry and running my application inserts:
waveaudio=c,19584
in the [AAPLAY Animation] section, and of course gives us the same old problem!
I''ve discovered that the call to:
bResult = aaSound ( hAAFlicAnim, // Animation Handle
NULL, // This is NULL as we asume MCI
extensions have been setup
lpszFlicAudioFile, // Name of the audio file (
*.wav, *.mid )
AA_SNDFREEZE ); // AA_SNDFREEZE prevents the animation
from continuing
// to play while the sound is being
prepared for play.
is what actually inserts this value.
Manually changing it back to 522 and running the application doesn't cause the
setting to be overwritten and the audio plays just fine. It is therefore very
difficult to understand what IS changing this value at certain times.
Any more ideas?
Thanks for your time,
-Donald.
The 522 is actually a capability bit for the wave audio device. AAsound appears
to be polling the Sound driver, and the driver is reporting back some
capabilities that are encoded into that value.
Personally, I run a 16 bit Soundblaster card myself, and have never had this
number altered. Actually, the aasound call will not alter that number at all.
It will only look to see if it exists. If it exists, it reads whatever the
settings are. If it doesn't exist, it will enter the line into the WIN.INI.
But once the line is entered in the WIN.INI it would never be altered by that
call.
I guess the brute force workaround would be to have your code confirm the
WIN.INI setting just before playing the sound. I am not sure why the wrong
capability bit is being generated.
-Brian