SampleSndPlay.cp

#include    <Quickdraw.h>
#include    <Windows.h>
#include    <dialogs.h>
#include    <OSEvents.h>
#include    <Packages.h>
#include    <Sound.h>
 
#define TRUE            0xFF
#define FALSE           0
 
main()
{
    Point               where = {20,20};
    OSErr               err;
    SFReply             reply;
    short               refnum;
    char*               string;
    
    InitGraf(&qd.thePort);
    FlushEvents(everyEvent, 0);
    InitWindows();
    InitDialogs(nil);
    InitCursor();
    
    string = (char*) "\pPick a SND File";
 
    SFGetFile (where, (Str255) string, nil, -1, (SFTypeList) nil, nil, &reply);
    err = FSOpen(reply.fName, reply.vRefNum, &refnum);
    if (err != noErr)
        Debugger();
    
    err = SndStartFilePlay (nil, refnum, 0, 74000, nil, nil, nil, FALSE);
    if (err != noErr)
        Debugger();
        
}