Mailing List
Home
Forum Home
Mac Game - Mac game development
Rivers of MUD - a Diku and Merc based multiuser dungeon
SMAUG
Subjects
Getting UDP through NAT/firewalls/whatever for a game
Getting UDP through NAT/firewalls/whatever for a game
QuickTime errors
Python script as stand alone MUD server
Subject: Various sound problems
Fragment Shaders & GL TEXTURE RECTANGLE EXT
Subject: Timers and global variables
Re: Language and platform for Text MUD server
Apparent acquisition of Yantis (mysupersales) by IDE
HID keyboard
Getting UDP through NAT/firewalls/whatever for a game
Microsoft Sparkle
Subject: Director MX
Congratulations Horizons
Yet more problems fullscreen mode
Apple Dev Kitchen Them 's tasty vittles, Maw!
NSOpenGLContext, Pbuffers, and drawables
More DCR "theft " naughtiness
dynamic sprite creation and imaging lingo
Re: Find stuff in Flash array?
Effects of skill imbalances?
QuickTime errors
Rom 2 4/Quickmud Enhancement/Bug fix
Subject: Working with XML files/CFURL
smooth scrolling/subpixel tweening
RE: (Ron help me?) Flash text
Subject: Flash Racing
Subject: MudDev FAQ 2
Browser based games
Installing GLUT
Special character in Flash XML
 
Quicktime Sound Glitch

Quicktime Sound Glitch

2007-11-14       - By zmorris@(protected)

 Back
Reply:     1     2     3     4     5     6     7     8     9     10     >>  

Hi, we are having an mp3 playback glitch in Quicktime in 10.4.10.  I  
asked the Quicktime group and got no response, so I thought I'd try  
here.  Here is that email:

-- --

Hi All, we are having a problem with a looping mp3 stuttering at  
certain points in our game.  We think it's related to MoviesTask(),  
but we are calling it 30 times per second.  I have searched the  
archives, but no luck.  We load and start a movie with code similar  
to the following:

////////////////////////////////////////

#define kMusicTaskTime     30

FSSpec     fileSpec;   // spec to your movie file

Movie     movie;
TimeValue   timeNow, duration;
Fixed     playRate;
Media     media;

QTCallBackUPP   callbackUpp;
QTCallBack     callback;

pascal void     EndCallback( QTCallBack callback, long refCon )
{
  GoToBeginningOfMovie( movie );
 
  CallMeWhen( callback, callbackUpp, 0, triggerAtStop, 0, 0 );
 
  StartMovie( movie );
}

pascal void MusicProcess( EventLoopTimerRef theTimer, void *userData )
{
  MoviesTask( movie, nil );
}

EventLoopTimerUPP   MusicProcessUPP = NewEventLoopTimerUPP
( MusicProcess );
EventLoopTimerRef   MusicProcessRef;

/*TMTask     musicTask;

pascal void     MusicProcess( TMTask *myPtr )
{
  MoviesTask( movie, nil );
 
  PrimeTime( ( QElemPtr ) myPtr, kMusicTaskTime );
}*/

int     main()
{
  short     refNum = 1;

  // note: set up fileSpec here to point to your file

  OpenMovieFile( &fileSpec, &refNum, fsRdPerm );
  NewMovieFromFile( &movie, refNum, nil, nil, newMovieActive &  
newMovieDontAskUnresolvedDataRefs, nil );
  CloseMovieFile( refNum );

  GoToBeginningOfMovie( movie );

  // turn these hints off  
  SetMoviePlayHints( movie, 0, hintsUseSoundInterp | hintsHighQuality );  

  // set the loop hint to enhance performance
  SetMoviePlayHints( movie, hintsLoop, hintsLoop );  

  timeNow = GetMovieTime( movie, nil );
  duration = GetMovieDuration( movie );
  playRate = GetMoviePreferredRate( movie );
  media = GetTrackMedia( GetMovieIndTrack( movie, 1 ) );    

  //***LoadMovieIntoRam( movie, timeNow, duration, keepInRam );
  //***LoadMediaIntoRam( media, timeNow, duration, keepInRam );
  //***SetMediaPreferredChunkSize( media, 16384 );
  //***FlattenMovie(...)

  PrePrerollMovie( movie, timeNow, playRate, nil, nil );
  PrerollMovie( movie, timeNow, playRate );

  // turn on looping
  {
    TimeBase   timebase = GetMovieTimeBase( movie );

    callback = NewCallBack( timebase, callBackAtExtremes );
    callbackUpp = NewQTCallBackUPP( EndCallback );

    CallMeWhen( callback, callbackUpp, 0, triggerAtStop, 0, 0 );
  }

  StartMovie( movie );

  InstallEventLoopTimer
  (
    GetCurrentEventLoop(),
    kEventDurationNoWait,
    kMusicTaskTime * kEventDurationMillisecond,
    MusicProcessUPP,
    nil,
    &MusicProcessRef
  );

  /*musicTask.tmAddr = NewTimerUPP( MusicProcess );
  musicTask.tmWakeUp = 0;
  musicTask.tmReserved = 0;
  InsTime( ( QElemPtr ) &musicTask );
  PrimeTime( (QElemPtr ) &musicTask, kMusicTaskTime );*/
}

////////////////////////////////////////

We have also tried running MoviesTask() in a timer task, of course,  
it makes no difference.  Unfortunately the test machine is an iMac G4  
1GHz across the country, so there is a day's turnaround time whenever  
we send an update for them to try.  We don't see the issue on our  
G4.  Specifically:

1. Will SetMediaPreferredChunkSize() really get QT to process the  
sound in bigger chunks, or is there another call that is better?
2. Is there a way to raise the priority of the mp3 movie?
3. Is there a tool of some sort that can tell us whenever quicktime  
stutters, and why?

We think the load on the machine is pretty low, so we can't figure  
out why quicktime isn't getting enough time to process the song.  
There is an outside chance they just have a corrupt OS install.  Has  
anyone seen this problem?

-- --

SetMediaPreferredChunkSize() didn't fix it.  We have since tried it  
on an iMac G3 400 and it plays fine.  We are sure it's not a  
performance issue.  Does anyone know of a tool like Spotlight for OS  
9, that we can use on OS X to make sure that the quicktime memory is  
ok?  Or is there a tool to test quicktime, like for audio units/core  
audio or whatever?

We are really in a pinch here with the holidays coming and for the  
life of us, can't solve this problem.

Thank you for your help,

--Zack
__ ____ ____ ____ ____ ____ ____ ____ ____ ____
Do not post admin requests to the list. They will be ignored.
Mac-games-dev mailing list      (Mac-games-dev@(protected))
Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/mac-games-dev/junlu%405341.com

This email sent to junlu@(protected)