Miles Sound System SDK 7.2a

AIL_set_file_callbacks

The function AIL_set_file_callbacks replaces the synchronous (blocking) file I/O functions that Miles uses for AIL_file_read, AIL_file_size, and the high-level streaming functions.

void AIL_set_file_callbacks(
  AIL_file_open_callback opencb,
  AIL_file_close_callback closecb,
  AIL_file_seek_callback seekcb,
  AIL_file_read_callback readcb
);

In Parameters

opencb
specifies the callback function to be called when opening a file.
closecb
specifies the callback function to be called when closing a file.
seekcb
specifies the callback function to be called when seeking in a file.
readcb
specifies the callback function to be called when reading from a file.

Discussion

Under Win32, Win64, Xbox, Xbox 360 and PS3, the Miles streaming API can call these routines from a background thread. So, your I/O routines must be thread-safe if you use the high-level streaming API.

Miles uses asynchronous reads on MacOS 9, Wii and PS2 by default. If you call AIL_set_file_callbacks on either of these platforms, Miles will fall back to synchronous I/O, potentially degrading performance. On these platforms, you should normally use AIL_set_file_async_callbacks rather than AIL_set_file_callbacks.

Most applications should allow Miles to perform its own file access. Allowing Miles to maintain its own (possibly-redundant) handles to your audio data files imposes very little system overhead, and eliminates many potential bugs. Note that you do not need to provide file callbacks simply to stream from a packed file; see the AIL_open_stream function for details on how to pass existing file handles and offsets to Miles.


Group: Memory and File Services
Related Functions: AIL_file_close_callback, AIL_file_fss_read, AIL_file_open_callback, AIL_file_read, AIL_file_read_callback, AIL_file_seek_callback, AIL_file_size, AIL_open_stream, AIL_set_file_async_callbacks, AIL_set_file_callbacks
Related Basic Types: void
Related FAQs: How do I access files from a big packed file?

For technical support, e-mail Miles3@radgametools.com
© Copyright 1991-2007 RAD Game Tools, Inc. All Rights Reserved.