ALmixer  0.0.5
ALmixer.h
Go to the documentation of this file.
1 /*
2  ALmixer: A library to make playing pre-loaded sounds and streams easier
3  with high performance and potential access to OpenAL effects.
4  Copyright 2002, 2010 Eric Wing <ewing . public @ playcontrol.net>
5 
6  This library is free software; you can redistribute it and/or
7  modify it under the terms of the GNU Library General Public
8  License as published by the Free Software Foundation; either
9  version 2 of the License, or (at your option) any later version.
10 
11  This library is distributed in the hope that it will be useful,
12  but WITHOUT ANY WARRANTY; without even the implied warranty of
13  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14  Library General Public License for more details.
15 
16  You should have received a copy of the GNU Library General Public
17  License along with this library; if not, write to the Free
18  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
19 
20 */
21 
22 
122 #ifndef _SDL_ALMIXER_H_
123 #define _SDL_ALMIXER_H_
124 
125 
126 #ifndef DOXYGEN_SHOULD_IGNORE_THIS
127 
129 /* Note: For Doxygen to produce clean output, you should set the
130  * PREDEFINED option to remove ALMIXER_DECLSPEC, ALMIXER_CALL, and
131  * the DOXYGEN_SHOULD_IGNORE_THIS blocks.
132  * PREDEFINED = DOXYGEN_SHOULD_IGNORE_THIS=1 ALMIXER_DECLSPEC= ALMIXER_CALL=
133  */
134  #if defined(_WIN32)
135  #if defined(ALMIXER_BUILD_LIBRARY)
136  #define ALMIXER_DECLSPEC __declspec(dllexport)
137  #else
138  #define ALMIXER_DECLSPEC
139  #endif
140  #else
141  #if defined(ALMIXER_BUILD_LIBRARY)
142  #if defined (__GNUC__) && __GNUC__ >= 4
143  #define ALMIXER_DECLSPEC __attribute__((visibility("default")))
144  #else
145  #define ALMIXER_DECLSPEC
146  #endif
147  #else
148  #define ALMIXER_DECLSPEC
149  #endif
150  #endif
151 
152  #if defined(_WIN32)
153  #define ALMIXER_CALL __cdecl
154  #else
155  #define ALMIXER_CALL
156  #endif
157 
158 #endif /* DOXYGEN_SHOULD_IGNORE_THIS */
159 
160 
161 
162 /* Needed for OpenAL types since altypes.h was removed in 1.1 */
163 #include "al.h"
164 
165 /* Set up for C function definitions, even when using C++ */
166 #ifdef __cplusplus
167 extern "C" {
168 #endif
169 
179 typedef struct ALmixer_version
180 {
181  ALubyte major;
182  ALubyte minor;
183  ALubyte patch;
185 
186 
187 /* Printable format: "%d.%d.%d", MAJOR, MINOR, PATCHLEVEL
188  */
189 #define ALMIXER_MAJOR_VERSION 0
190 #define ALMIXER_MINOR_VERSION 5
191 #define ALMIXER_PATCHLEVEL 0
192 
193 
216 #define ALMIXER_GET_COMPILED_VERSION(X) \
217  { \
218  (X)->major = ALMIXER_MAJOR_VERSION; \
219  (X)->minor = ALMIXER_MINOR_VERSION; \
220  (X)->patch = ALMIXER_PATCHLEVEL; \
221  }
222 
246 extern ALMIXER_DECLSPEC const ALmixer_version* ALMIXER_CALL ALmixer_GetLinkedVersion(void);
247 
255 extern ALMIXER_DECLSPEC const char* ALMIXER_CALL ALmixer_GetError(void);
263 extern ALMIXER_DECLSPEC void ALMIXER_CALL ALmixer_SetError(const char *fmt, ...);
264 
265 extern ALMIXER_DECLSPEC ALuint ALMIXER_CALL ALmixer_GetTicks(void);
266 extern ALMIXER_DECLSPEC void ALMIXER_CALL ALmixer_Delay(ALuint milliseconds_delay);
267 
268 
274 struct ALmixer_RWops;
275 
276 #define ALMIXER_DEFAULT_FREQUENCY 0
277 #define ALMIXER_DEFAULT_REFRESH 0
278 /* Most of the old sound Windows sound cards that had 16 max are gone. 32 is the current limit on iOS. */
279 #define ALMIXER_DEFAULT_NUM_CHANNELS 32
280 #define ALMIXER_DEFAULT_NUM_SOURCES ALMIXER_DEFAULT_NUM_CHANNELS
281 
309 extern ALMIXER_DECLSPEC ALboolean ALMIXER_CALL ALmixer_Init(ALuint playback_frequency, ALuint num_sources, ALuint refresh_rate);
310 
321 extern ALMIXER_DECLSPEC ALboolean ALMIXER_CALL ALmixer_InitContext(ALuint playback_frequency, ALuint refresh_rate);
322 
336 extern ALMIXER_DECLSPEC ALboolean ALMIXER_CALL ALmixer_InitMixer(ALuint num_sources);
337 
351 extern ALMIXER_DECLSPEC void ALMIXER_CALL ALmixer_BeginInterruption(void);
352 
360 extern ALMIXER_DECLSPEC void ALMIXER_CALL ALmixer_EndInterruption(void);
361 
368 extern ALMIXER_DECLSPEC ALboolean ALmixer_IsInInterruption(void);
369 
370 
376 extern ALMIXER_DECLSPEC void ALMIXER_CALL ALmixer_SuspendUpdates(void);
377 
383 extern ALMIXER_DECLSPEC void ALMIXER_CALL ALmixer_ResumeUpdates(void);
384 
389 extern ALMIXER_DECLSPEC ALboolean ALmixer_AreUpdatesSuspended(void);
390 
391 
404 extern ALMIXER_DECLSPEC void ALMIXER_CALL ALmixer_SuspendPlayingState(void);
405 
415 extern ALMIXER_DECLSPEC void ALMIXER_CALL ALmixer_ResumePlayingState(void);
416 
421 extern ALMIXER_DECLSPEC ALboolean ALmixer_IsPlayingStateSuspended(void);
422 
423 
428 extern ALMIXER_DECLSPEC void ALMIXER_CALL ALmixer_Quit(void);
440 extern ALMIXER_DECLSPEC void ALMIXER_CALL ALmixer_QuitWithoutFreeData(void);
441 
446 extern ALMIXER_DECLSPEC ALboolean ALMIXER_CALL ALmixer_IsInitialized(void);
447 
453 extern ALMIXER_DECLSPEC ALuint ALMIXER_CALL ALmixer_GetFrequency(void);
454 
461 extern ALMIXER_DECLSPEC ALint ALMIXER_CALL ALmixer_AllocateChannels(ALint num_chans);
462 
487 extern ALMIXER_DECLSPEC ALint ALMIXER_CALL ALmixer_ReserveChannels(ALint number_of_reserve_channels);
488 
489 
505 extern ALMIXER_DECLSPEC ALint ALMIXER_CALL ALmixer_Update(void);
506 
519 /*
520 #define ALmixer_AudioInfo Sound_AudioInfo
521 */
522 
523 /*
524 #define ALMIXER_DEFAULT_BUFFERSIZE 32768
525 #define ALMIXER_DEFAULT_BUFFERSIZE 16384
526 */
527 #define ALMIXER_DEFAULT_BUFFERSIZE 16384
528 
529 /* You probably never need to use these macros directly. */
530 #ifndef ALMIXER_DISABLE_PREDECODED_PRECOMPUTE_BUFFER_SIZE_OPTIMIZATION
531  #define ALMIXER_DEFAULT_PREDECODED_BUFFERSIZE ALMIXER_DEFAULT_BUFFERSIZE * 4
532 #else
533  /* I'm picking a smaller buffer because ALmixer will try to create a new larger buffer
534  * based on the length of the audio. So creating a large block up-front might just be a waste.
535  * However, if my attempts fail for some reason, this buffer size becomes a fallback.
536  * Having too small of a buffer might cause performance bottlenecks.
537  */
538  #define ALMIXER_DEFAULT_PREDECODED_BUFFERSIZE 4096
539 #endif
540 
545 /*
546 #define ALMIXER_DEFAULT_QUEUE_BUFFERS 5
547 */
548 #define ALMIXER_DEFAULT_QUEUE_BUFFERS 12
549 
552 #define ALMIXER_DEFAULT_STARTUP_BUFFERS 4
553 /*
554 #define ALMIXER_DEFAULT_STARTUP_BUFFERS 2
555 */
556 #define ALMIXER_DEFAULT_BUFFERS_TO_QUEUE_PER_UPDATE_PASS 2
557 
558 /*
559 #define ALMIXER_DECODE_STREAM 0
560 #define ALMIXER_DECODE_ALL 1
561 */
562 
563 /* This is a trick I picked up from Lua. Doing the typedef separately
564 * (and I guess before the definition) instead of a single
565 * entry: typedef struct {...} YourName; seems to allow me
566 * to use forward declarations. Doing it the other way (like SDL)
567 * seems to prevent me from using forward declarions as I get conflicting
568 * definition errors. I don't really understand why though.
569 */
570 typedef struct ALmixer_Data ALmixer_Data;
571 typedef struct ALmixer_AudioInfo ALmixer_AudioInfo;
572 
588 {
589  ALushort format;
590  ALubyte channels;
591  ALuint rate;
592 };
593 
594 
595 
618 extern ALMIXER_DECLSPEC ALmixer_Data* ALMIXER_CALL ALmixer_LoadSample_RW(struct ALmixer_RWops* rw_ops, const char* file_ext, ALuint buffer_size, ALboolean decode_mode_is_predecoded, ALuint max_queue_buffers, ALuint num_startup_buffers, ALuint suggested_number_of_buffers_to_queue_per_update_pass, ALuint access_data);
619 
639 extern ALMIXER_DECLSPEC ALmixer_Data* ALMIXER_CALL ALmixer_LoadStream_RW(struct ALmixer_RWops* rw_ops, const char* file_ext, ALuint buffer_size, ALuint max_queue_buffers, ALuint num_startup_buffers, ALuint suggested_number_of_buffers_to_queue_per_update_pass, ALuint access_data);
640 
653 extern ALMIXER_DECLSPEC ALmixer_Data* ALMIXER_CALL ALmixer_LoadAll_RW(struct ALmixer_RWops* rw_ops, const char* file_ext, ALuint access_data);
654 
675 extern ALMIXER_DECLSPEC ALmixer_Data * ALMIXER_CALL ALmixer_LoadSample(const char* file_name, ALuint buffer_size, ALboolean decode_mode_is_predecoded, ALuint max_queue_buffers, ALuint num_startup_buffers, ALuint suggested_number_of_buffers_to_queue_per_update_pass, ALuint access_data);
676 
697 extern ALMIXER_DECLSPEC ALmixer_Data* ALMIXER_CALL ALmixer_LoadStream(const char* file_name, ALuint buffer_size, ALuint max_queue_buffers, ALuint num_startup_buffers, ALuint suggested_number_of_buffers_to_queue_per_update_pass, ALuint access_data);
698 
709 extern ALMIXER_DECLSPEC ALmixer_Data* ALMIXER_CALL ALmixer_LoadAll(const char* file_name, ALuint access_data);
710 
735 extern ALMIXER_DECLSPEC ALmixer_Data * ALMIXER_CALL ALmixer_LoadSample_RAW_RW(struct ALmixer_RWops* rw_ops, const char* file_ext, ALmixer_AudioInfo* desired_format, ALuint buffer_size, ALboolean decode_mode_is_predecoded, ALuint max_queue_buffers, ALuint num_startup_buffers, ALuint suggested_number_of_buffers_to_queue_per_update_pass, ALuint access_data);
736 
759 extern ALMIXER_DECLSPEC ALmixer_Data* ALMIXER_CALL ALmixer_LoadStream_RAW_RW(struct ALmixer_RWops* rw_ops, const char* file_ext, ALmixer_AudioInfo* desired_format, ALuint buffer_size, ALuint max_queue_buffers, ALuint num_startup_buffers, ALuint suggested_number_of_buffers_to_queue_per_update_pass, ALuint access_data);
760 
775 extern ALMIXER_DECLSPEC ALmixer_Data* ALMIXER_CALL ALmixer_LoadAll_RAW_RW(struct ALmixer_RWops* rw_ops, const char* file_ext, ALmixer_AudioInfo* desired_format, ALuint access_data);
776 
799 extern ALMIXER_DECLSPEC ALmixer_Data* ALMIXER_CALL ALmixer_LoadSample_RAW(const char* file_name, ALmixer_AudioInfo* desired_format, ALuint buffer_size, ALboolean decode_mode_is_predecoded, ALuint max_queue_buffers, ALuint num_startup_buffers, ALuint suggested_number_of_buffers_to_queue_per_update_pass, ALuint access_data);
800 
821 extern ALMIXER_DECLSPEC ALmixer_Data* ALMIXER_CALL ALmixer_LoadStream_RAW(const char* file_name, ALmixer_AudioInfo* desired_format, ALuint buffer_size, ALuint max_queue_buffers, ALuint num_startup_buffers, ALuint suggested_number_of_buffers_to_queue_per_update_pass, ALuint access_data);
822 
835 extern ALMIXER_DECLSPEC ALmixer_Data* ALMIXER_CALL ALmixer_LoadAll_RAW(const char* file_name, ALmixer_AudioInfo* desired_format, ALuint access_data);
836 
847 extern ALMIXER_DECLSPEC void ALMIXER_CALL ALmixer_FreeData(ALmixer_Data* almixer_data);
848 
849 
856 extern ALMIXER_DECLSPEC ALboolean ALMIXER_CALL ALmixer_IsPredecoded(ALmixer_Data* almixer_data);
857 
899 extern ALMIXER_DECLSPEC void ALMIXER_CALL ALmixer_SetPlaybackFinishedCallback(void (*playback_finished_callback)(ALint which_channel, ALuint al_source, ALmixer_Data* almixer_data, ALboolean finished_naturally, void* user_data), void* user_data);
900 
901 typedef void (*playback_finished_callback)(ALint which_channel, ALuint al_source, ALmixer_Data* almixer_data, ALboolean finished_naturally, void* ALmixer_SetPlaybackFinishedCallbackContainer);
902 
903 
991 extern ALMIXER_DECLSPEC void ALMIXER_CALL ALmixer_SetPlaybackDataCallback(void (*playback_data_callback)(ALint which_channel, ALuint al_source, ALbyte* pcm_data, ALuint num_bytes, ALuint frequency, ALubyte num_channels_in_sample, ALubyte bit_depth, ALboolean is_unsigned, ALboolean decode_mode_is_predecoded, ALuint length_in_msec, void* user_data), void* user_data);
992 
1011 extern ALMIXER_DECLSPEC ALint ALMIXER_CALL ALmixer_GetTotalTime(ALmixer_Data* almixer_data);
1012 
1023 extern ALMIXER_DECLSPEC ALuint ALMIXER_CALL ALmixer_GetSource(ALint which_channel);
1024 
1031 extern ALMIXER_DECLSPEC ALint ALMIXER_CALL ALmixer_GetChannel(ALuint al_source);
1032 
1039 extern ALMIXER_DECLSPEC ALint ALMIXER_CALL ALmixer_FindFreeChannel(ALint start_channel);
1040 
1041 
1042 
1060 extern ALMIXER_DECLSPEC ALint ALMIXER_CALL ALmixer_PlayChannelTimed(ALint which_channel, ALmixer_Data* almixer_data, ALint number_of_loops, ALint number_of_milliseconds);
1061 
1066 extern ALMIXER_DECLSPEC ALint ALMIXER_CALL ALmixer_PlayChannel(ALint which_channel, ALmixer_Data* almixer_data, ALint number_of_loops);
1067 
1068 
1087 extern ALMIXER_DECLSPEC ALuint ALMIXER_CALL ALmixer_PlaySourceTimed(ALuint al_source, ALmixer_Data* almixer_data, ALint number_of_loops, ALint number_of_milliseconds);
1088 
1093 extern ALMIXER_DECLSPEC ALuint ALMIXER_CALL ALmixer_PlaySource(ALuint al_source, ALmixer_Data* almixer_data, ALint number_of_loops);
1094 
1102 extern ALMIXER_DECLSPEC ALint ALMIXER_CALL ALmixer_HaltChannel(ALint which_channel);
1103 
1111 extern ALMIXER_DECLSPEC ALint ALMIXER_CALL ALmixer_HaltSource(ALuint al_source);
1112 
1120 extern ALMIXER_DECLSPEC ALboolean ALMIXER_CALL ALmixer_RewindData(ALmixer_Data* almixer_data);
1121 
1131 extern ALMIXER_DECLSPEC ALint ALMIXER_CALL ALmixer_RewindChannel(ALint which_channel);
1141 extern ALMIXER_DECLSPEC ALint ALMIXER_CALL ALmixer_RewindSource(ALuint al_source);
1142 
1151 extern ALMIXER_DECLSPEC ALboolean ALMIXER_CALL ALmixer_SeekData(ALmixer_Data* almixer_data, ALuint msec_pos);
1152 
1162 extern ALMIXER_DECLSPEC ALint ALMIXER_CALL ALmixer_SeekChannel(ALint which_channel, ALuint msec_pos);
1172 extern ALMIXER_DECLSPEC ALint ALMIXER_CALL ALmixer_SeekSource(ALuint al_source, ALuint msec_pos);
1173 
1180 extern ALMIXER_DECLSPEC ALint ALMIXER_CALL ALmixer_PauseChannel(ALint which_channel);
1187 extern ALMIXER_DECLSPEC ALint ALMIXER_CALL ALmixer_PauseSource(ALuint al_source);
1188 
1195 extern ALMIXER_DECLSPEC ALint ALMIXER_CALL ALmixer_ResumeChannel(ALint which_channel);
1196 
1203  extern ALMIXER_DECLSPEC ALint ALMIXER_CALL ALmixer_ResumeSource(ALuint al_source);
1204 
1205 
1215 extern ALMIXER_DECLSPEC ALint ALMIXER_CALL ALmixer_ExpireChannel(ALint which_channel, ALint number_of_milliseconds);
1225 extern ALMIXER_DECLSPEC ALint ALMIXER_CALL ALmixer_ExpireSource(ALuint al_source, ALint number_of_milliseconds);
1226 
1245 extern ALMIXER_DECLSPEC ALint ALMIXER_CALL ALmixer_FadeInChannelTimed(ALint which_channel, ALmixer_Data* almixer_data, ALint number_of_loops, ALuint fade_ticks, ALint expire_ticks);
1246 
1251 extern ALMIXER_DECLSPEC ALint ALMIXER_CALL ALmixer_FadeInChannel(ALint which_channel, ALmixer_Data* almixer_data, ALint number_of_loops, ALuint fade_ticks);
1252 
1257 extern ALMIXER_DECLSPEC ALuint ALMIXER_CALL ALmixer_FadeInSourceTimed(ALuint al_source, ALmixer_Data* almixer_data, ALint number_of_loops, ALuint fade_ticks, ALint expire_ticks);
1258 
1263 extern ALMIXER_DECLSPEC ALuint ALMIXER_CALL ALmixer_FadeInSource(ALuint al_source, ALmixer_Data* almixer_data, ALint number_of_loops, ALuint fade_ticks);
1264 
1275 extern ALMIXER_DECLSPEC ALint ALMIXER_CALL ALmixer_FadeOutChannel(ALint which_channel, ALuint fade_ticks);
1276 
1287 extern ALMIXER_DECLSPEC ALint ALMIXER_CALL ALmixer_FadeOutSource(ALuint al_source, ALuint fade_ticks);
1288 
1299 extern ALMIXER_DECLSPEC ALint ALMIXER_CALL ALmixer_FadeChannel(ALint which_channel, ALuint fade_ticks, ALfloat volume);
1300 
1311 extern ALMIXER_DECLSPEC ALint ALMIXER_CALL ALmixer_FadeSource(ALuint al_source, ALuint fade_ticks, ALfloat volume);
1312 
1320 extern ALMIXER_DECLSPEC ALboolean ALMIXER_CALL ALmixer_SetVolumeChannel(ALint which_channel, ALfloat volume);
1321 
1329 extern ALMIXER_DECLSPEC ALboolean ALMIXER_CALL ALmixer_SetVolumeSource(ALuint al_source, ALfloat volume);
1330 
1338 extern ALMIXER_DECLSPEC ALfloat ALMIXER_CALL ALmixer_GetVolumeChannel(ALint which_channel);
1339 
1347 extern ALMIXER_DECLSPEC ALfloat ALMIXER_CALL ALmixer_GetVolumeSource(ALuint al_source);
1348 
1357 extern ALMIXER_DECLSPEC ALboolean ALMIXER_CALL ALmixer_SetMaxVolumeChannel(ALint which_channel, ALfloat volume);
1358 
1366 extern ALMIXER_DECLSPEC ALboolean ALMIXER_CALL ALmixer_SetMaxVolumeSource(ALuint al_source, ALfloat volume);
1367 
1375 extern ALMIXER_DECLSPEC ALfloat ALMIXER_CALL ALmixer_GetMaxVolumeChannel(ALint which_channel);
1376 
1384 extern ALMIXER_DECLSPEC ALfloat ALMIXER_CALL ALmixer_GetMaxVolumeSource(ALuint al_source);
1385 
1394 extern ALMIXER_DECLSPEC ALboolean ALMIXER_CALL ALmixer_SetMinVolumeChannel(ALint which_channel, ALfloat volume);
1395 
1403 extern ALMIXER_DECLSPEC ALboolean ALMIXER_CALL ALmixer_SetMinVolumeSource(ALuint al_source, ALfloat volume);
1404 
1412 extern ALMIXER_DECLSPEC ALfloat ALMIXER_CALL ALmixer_GetMinVolumeChannel(ALint which_channel);
1413 
1421 extern ALMIXER_DECLSPEC ALfloat ALMIXER_CALL ALmixer_GetMinVolumeSource(ALuint al_source);
1422 
1429 extern ALMIXER_DECLSPEC ALboolean ALMIXER_CALL ALmixer_SetMasterVolume(ALfloat new_volume);
1430 
1436  extern ALMIXER_DECLSPEC ALfloat ALMIXER_CALL ALmixer_GetMasterVolume(void);
1437 
1458 extern ALMIXER_DECLSPEC ALint ALMIXER_CALL ALmixer_IsActiveChannel(ALint which_channel);
1459 
1469 extern ALMIXER_DECLSPEC ALint ALMIXER_CALL ALmixer_IsActiveSource(ALuint al_source);
1470 
1480 extern ALMIXER_DECLSPEC ALint ALMIXER_CALL ALmixer_IsPlayingChannel(ALint which_channel);
1481 
1491 extern ALMIXER_DECLSPEC ALint ALMIXER_CALL ALmixer_IsPlayingSource(ALuint al_source);
1492 
1502 extern ALMIXER_DECLSPEC ALint ALMIXER_CALL ALmixer_IsPausedChannel(ALint which_channel);
1503 
1513 extern ALMIXER_DECLSPEC ALint ALMIXER_CALL ALmixer_IsPausedSource(ALuint al_source);
1514 
1519 extern ALMIXER_DECLSPEC ALuint ALMIXER_CALL ALmixer_CountAllFreeChannels(void);
1520 
1527 extern ALMIXER_DECLSPEC ALuint ALMIXER_CALL ALmixer_CountUnreservedFreeChannels(void);
1528 
1534 extern ALMIXER_DECLSPEC ALuint ALMIXER_CALL ALmixer_CountAllUsedChannels(void);
1535 
1542 extern ALMIXER_DECLSPEC ALuint ALMIXER_CALL ALmixer_CountUnreservedUsedChannels(void);
1543 
1544 
1550 extern ALMIXER_DECLSPEC ALuint ALMIXER_CALL ALmixer_CountTotalChannels(void);
1551 
1552 
1553 
1554 
1560 extern ALMIXER_DECLSPEC ALuint ALMIXER_CALL ALmixer_CountReservedChannels(void);
1561 
1567 extern ALMIXER_DECLSPEC ALboolean ALMIXER_CALL ALmixer_IsDecoderAvailable(const char* usr_ext);
1568 
1580 /* For testing */
1581 #if 0
1582 extern ALMIXER_DECLSPEC void ALMIXER_CALL ALmixer_OutputAttributes(void);
1583 #endif
1584 
1585 extern ALMIXER_DECLSPEC void ALMIXER_CALL ALmixer_OutputDecoders(void);
1587 extern ALMIXER_DECLSPEC void ALMIXER_CALL ALmixer_OutputOpenALInfo(void);
1588 
1590 extern ALMIXER_DECLSPEC ALboolean ALMIXER_CALL ALmixer_CompiledWithThreadBackend(void);
1591 
1595 #if 0
1596 extern ALMIXER_DECLSPEC size_t ALMIXER_CALL ALmixer_GetCurrentThreadID(void);
1597 
1598 #define ALMIXER_THREAD_TYPE_ORIGINATING 1
1599 #define ALMIXER_THREAD_TYPE_UPDATE 2
1600 
1608 extern ALMIXER_DECLSPEC size_t ALMIXER_CALL ALmixer_GetThreadIDForType(int almixer_thread_type);
1609 #endif
1610 
1616 /* Ends C function definitions when using C++ */
1617 #ifdef __cplusplus
1618 }
1619 #endif
1620 
1621 
1622 #endif /* _SDL_ALMIXER_H_ */
1623 
1624 /* end of SDL_ALmixer.h ... */
1625 
1626 
ALint ALmixer_FadeInChannel(ALint which_channel, ALmixer_Data *almixer_data, ALint number_of_loops, ALuint fade_ticks)
The same as ALmixer_FadeInChannelTimed, but the sound is played without time limits.
ALint ALmixer_IsPlayingSource(ALuint al_source)
Returns true if the specified sources is currently playing.
ALint ALmixer_Update(void)
The update function that allows ALmixer to update its internal state.
const char * ALmixer_GetError(void)
Gets the last error string that was set by the system and clears the error.
ALint ALmixer_ExpireChannel(ALint which_channel, ALint number_of_milliseconds)
Will cause a currently playing channel to stop playing in the specified number of milliseconds...
void ALmixer_SuspendUpdates(void)
(EXPERIMENTAL) Destroys the background update thread (ENABLE_ALMIXER_THREADS only).
ALuint rate
Sample rate; frequency of sample points per second.
Definition: ALmixer.h:591
ALint ALmixer_ExpireSource(ALuint al_source, ALint number_of_milliseconds)
Will cause a currently playing source to stop playing in the specified number of milliseconds.
ALuint ALmixer_CountTotalChannels(void)
Returns the number of allocated channels.
ALuint ALmixer_CountUnreservedFreeChannels(void)
Returns the number of channels that are currently available for playback (not playing, not paused), excluding the channels that have been reserved.
ALmixer_Data * ALmixer_LoadAll_RW(struct ALmixer_RWops *rw_ops, const char *file_ext, ALuint access_data)
This is the loader function to completely preload an audio resource from an RWops into RAM...
ALubyte major
Definition: ALmixer.h:181
void ALmixer_OutputOpenALInfo(void)
This function may be removed in the future.
ALint ALmixer_IsPausedSource(ALuint al_source)
Returns true if the specified sources is currently paused.
ALint ALmixer_PlayChannel(ALint which_channel, ALmixer_Data *almixer_data, ALint number_of_loops)
The same as ALmixer_PlayChannelTimed, but the sound is played without time limits.
ALboolean ALmixer_InitContext(ALuint playback_frequency, ALuint refresh_rate)
InitContext will only initialize the OpenAL context (and not the mixer part).
void ALmixer_SuspendPlayingState(void)
(EXPERIMENTAL) Pauses all currently playing channels with the intent that you will want to resume the...
ALuint ALmixer_CountAllFreeChannels(void)
Returns the number of channels that are currently available for playback (not playing, not paused).
ALuint ALmixer_PlaySource(ALuint al_source, ALmixer_Data *almixer_data, ALint number_of_loops)
The same as ALmixer_PlaySourceTimed, but the sound is played without time limits. ...
ALint ALmixer_FadeOutChannel(ALint which_channel, ALuint fade_ticks)
Fade out a current playing channel.
ALubyte patch
Definition: ALmixer.h:183
ALboolean ALmixer_SeekData(ALmixer_Data *almixer_data, ALuint msec_pos)
Seek the sound for a given data.
struct ALmixer_Data ALmixer_Data
Definition: ALmixer.h:570
ALint ALmixer_ResumeSource(ALuint al_source)
Resumes playback on a source that is paused.
ALint ALmixer_FadeSource(ALuint al_source, ALuint fade_ticks, ALfloat volume)
Gradually changes the volume from the current AL_GAIN to the specified volume.
void ALmixer_QuitWithoutFreeData(void)
HACK to shutdown ALmixer without freeing ALmixer_Data.
ALmixer_Data * ALmixer_LoadStream_RW(struct ALmixer_RWops *rw_ops, const char *file_ext, ALuint buffer_size, ALuint max_queue_buffers, ALuint num_startup_buffers, ALuint suggested_number_of_buffers_to_queue_per_update_pass, ALuint access_data)
This is the loader function to load an audio resource from an RWops as a stream.
ALmixer_Data * ALmixer_LoadStream_RAW(const char *file_name, ALmixer_AudioInfo *desired_format, ALuint buffer_size, ALuint max_queue_buffers, ALuint num_startup_buffers, ALuint suggested_number_of_buffers_to_queue_per_update_pass, ALuint access_data)
This is a back door stream loader function for RAW samples or if you need to specify the ALmixer_Audi...
void ALmixer_FreeData(ALmixer_Data *almixer_data)
Frees an ALmixer_Data.
ALint ALmixer_FindFreeChannel(ALint start_channel)
Will look for a channel available for playback.
ALint ALmixer_PauseSource(ALuint al_source)
Pauses playback on a source.
ALboolean ALmixer_SetMaxVolumeSource(ALuint al_source, ALfloat volume)
Sets the maximum volume via the AL_MAX_GAIN source property.
ALuint ALmixer_GetFrequency(void)
Returns the frequency that OpenAL is set to.
ALboolean ALmixer_IsInitialized(void)
Returns whether ALmixer has been initializatized (via Init) or not.
ALboolean ALmixer_SetMinVolumeChannel(ALint which_channel, ALfloat volume)
Sets the minimum volume via the AL_MIN_GAIN source property.
ALboolean ALmixer_CompiledWithThreadBackend(void)
This function is experimental.
ALfloat ALmixer_GetMinVolumeSource(ALuint al_source)
Gets the min volume via the AL_MIN_GAIN source property.
void ALmixer_Delay(ALuint milliseconds_delay)
ALboolean ALmixer_InitMixer(ALuint num_sources)
InitMixer will only initialize the Mixer system.
ALmixer_Data * ALmixer_LoadStream_RAW_RW(struct ALmixer_RWops *rw_ops, const char *file_ext, ALmixer_AudioInfo *desired_format, ALuint buffer_size, ALuint max_queue_buffers, ALuint num_startup_buffers, ALuint suggested_number_of_buffers_to_queue_per_update_pass, ALuint access_data)
This is a back door stream loader function for RAW samples or if you need to specify the ALmixer_Audi...
ALint ALmixer_SeekChannel(ALint which_channel, ALuint msec_pos)
Seeks the sound to the beginning that is playing on a specific channel.
const ALmixer_version * ALmixer_GetLinkedVersion(void)
Gets the library version of the dynamically linked ALmixer you are using.
ALmixer_Data * ALmixer_LoadSample_RAW_RW(struct ALmixer_RWops *rw_ops, const char *file_ext, ALmixer_AudioInfo *desired_format, ALuint buffer_size, ALboolean decode_mode_is_predecoded, ALuint max_queue_buffers, ALuint num_startup_buffers, ALuint suggested_number_of_buffers_to_queue_per_update_pass, ALuint access_data)
This is a back door general loader function for RAW samples or if you need to specify the ALmixer_Aud...
ALboolean ALmixer_IsPredecoded(ALmixer_Data *almixer_data)
Returns true if the almixer_data was completely loaded into memory or false if it was loaded as a str...
ALint ALmixer_FadeInChannelTimed(ALint which_channel, ALmixer_Data *almixer_data, ALint number_of_loops, ALuint fade_ticks, ALint expire_ticks)
Similar to ALmixer_PlayChannelTimed except that sound volume fades in from the minimum volume to the ...
void ALmixer_ResumeUpdates(void)
(EXPERIMENTAL) Recreates the background update thread (ENABLE_ALMIXER_THREADS only).
void ALmixer_SetPlaybackFinishedCallback(void(*playback_finished_callback)(ALint which_channel, ALuint al_source, ALmixer_Data *almixer_data, ALboolean finished_naturally, void *user_data), void *user_data)
Allows you to set a callback for when a sound has finished playing on a channel/source.
void ALmixer_BeginInterruption(void)
(EXPERIMENTAL) Call to notify ALmixer that your device needs to handle an interruption.
ALboolean ALmixer_RewindData(ALmixer_Data *almixer_data)
Rewinds the sound to the beginning for a given data.
void ALmixer_EndInterruption(void)
(EXPERIMENTAL) Call to notify ALmixer that your device needs to resume from an interruption.
ALfloat ALmixer_GetMinVolumeChannel(ALint which_channel)
Gets the min volume via the AL_MIN_GAIN source property.
ALint ALmixer_AllocateChannels(ALint num_chans)
Let&#39;s you change the maximum number of channels/sources available.
void ALmixer_Quit(void)
This shuts down ALmixer.
ALubyte channels
Number of sound channels.
Definition: ALmixer.h:590
ALboolean ALmixer_SetMinVolumeSource(ALuint al_source, ALfloat volume)
Sets the minimum volume via the AL_MIN_GAIN source property.
ALint ALmixer_PauseChannel(ALint which_channel)
Pauses playback on a channel.
ALint ALmixer_ResumeChannel(ALint which_channel)
Resumes playback on a channel that is paused.
ALint ALmixer_IsActiveSource(ALuint al_source)
Returns true if the specified source is currently playing or paused, or if -1 is passed the number of...
ALuint ALmixer_FadeInSourceTimed(ALuint al_source, ALmixer_Data *almixer_data, ALint number_of_loops, ALuint fade_ticks, ALint expire_ticks)
Similar to ALmixer_PlaySourceTimed except that sound volume fades in from the minimum volume to the m...
ALfloat ALmixer_GetMaxVolumeChannel(ALint which_channel)
Gets the max volume via the AL_MAX_GAIN source property.
Struct that contains the version information of this library.
Definition: ALmixer.h:179
ALushort format
Equivalent of SDL_AudioSpec.format.
Definition: ALmixer.h:589
ALint ALmixer_RewindChannel(ALint which_channel)
Rewinds the sound to the beginning that is playing on a specific channel.
ALuint ALmixer_CountUnreservedUsedChannels(void)
Returns the number of channels that are currently in use (playing/paused), excluding the channels tha...
ALmixer_Data * ALmixer_LoadSample_RW(struct ALmixer_RWops *rw_ops, const char *file_ext, ALuint buffer_size, ALboolean decode_mode_is_predecoded, ALuint max_queue_buffers, ALuint num_startup_buffers, ALuint suggested_number_of_buffers_to_queue_per_update_pass, ALuint access_data)
This is a general loader function to load an audio resource from an RWops.
ALubyte minor
Definition: ALmixer.h:182
ALboolean ALmixer_SetMaxVolumeChannel(ALint which_channel, ALfloat volume)
Sets the maximum volume via the AL_MAX_GAIN source property.
void ALmixer_OutputDecoders(void)
This function may be removed in the future.
ALuint ALmixer_PlaySourceTimed(ALuint al_source, ALmixer_Data *almixer_data, ALint number_of_loops, ALint number_of_milliseconds)
Play a sound on an OpenAL source with a time limit.
ALboolean ALmixer_SetVolumeChannel(ALint which_channel, ALfloat volume)
Sets the volume via the AL_GAIN source property.
ALboolean ALmixer_Init(ALuint playback_frequency, ALuint num_sources, ALuint refresh_rate)
This is the recommended Init function.
ALboolean ALmixer_AreUpdatesSuspended(void)
(EXPERIMENTAL) Call to determine if in ALmixer_SuspendUpdates().
ALuint ALmixer_CountReservedChannels(void)
Returns the number of reserved channels.
ALboolean ALmixer_SetVolumeSource(ALuint al_source, ALfloat volume)
Sets the volume via the AL_GAIN source property.
ALint ALmixer_PlayChannelTimed(ALint which_channel, ALmixer_Data *almixer_data, ALint number_of_loops, ALint number_of_milliseconds)
Play a sound on a channel with a time limit.
ALuint ALmixer_GetSource(ALint which_channel)
This function will look up the OpenAL source id for the corresponding channel number.
void ALmixer_ResumePlayingState(void)
(EXPERIMENTAL) Resumes all paused channels triggered by ALmixer_SuspendPlayingState.
Roughly the equvialent to the Sound_AudioInfo struct in SDL_sound.
Definition: ALmixer.h:587
ALint ALmixer_ReserveChannels(ALint number_of_reserve_channels)
Allows you to reserve a certain number of channels so they won&#39;t be automatically allocated to play o...
ALint ALmixer_FadeChannel(ALint which_channel, ALuint fade_ticks, ALfloat volume)
Gradually changes the volume from the current AL_GAIN to the specified volume.
void(* playback_finished_callback)(ALint which_channel, ALuint al_source, ALmixer_Data *almixer_data, ALboolean finished_naturally, void *ALmixer_SetPlaybackFinishedCallbackContainer)
Definition: ALmixer.h:901
ALboolean ALmixer_IsInInterruption(void)
(EXPERIMENTAL) Call to determine if in an interruption.
void ALmixer_SetPlaybackDataCallback(void(*playback_data_callback)(ALint which_channel, ALuint al_source, ALbyte *pcm_data, ALuint num_bytes, ALuint frequency, ALubyte num_channels_in_sample, ALubyte bit_depth, ALboolean is_unsigned, ALboolean decode_mode_is_predecoded, ALuint length_in_msec, void *user_data), void *user_data)
Allows you to set a callback for getting audio data.
ALuint ALmixer_FadeInSource(ALuint al_source, ALmixer_Data *almixer_data, ALint number_of_loops, ALuint fade_ticks)
The same as ALmixer_FadeInSourceTimed, but the sound is played without time limits.
ALfloat ALmixer_GetMaxVolumeSource(ALuint al_source)
Gets the maximum volume via the AL_MAX_GAIN source property.
void ALmixer_SetError(const char *fmt,...)
Sets an error string that can be retrieved by ALmixer_GetError.
ALint ALmixer_SeekSource(ALuint al_source, ALuint msec_pos)
Seeks the sound to the beginning that is playing on a specific source.
ALint ALmixer_IsPausedChannel(ALint which_channel)
Returns true if the specified channel is currently paused.
ALfloat ALmixer_GetVolumeChannel(ALint which_channel)
Gets the volume via the AL_GAIN source property.
ALint ALmixer_GetChannel(ALuint al_source)
This function will look up the channel for the corresponding source.
ALuint ALmixer_CountAllUsedChannels(void)
Returns the number of channels that are currently in use (playing/paused).
ALfloat ALmixer_GetMasterVolume(void)
Gets the OpenAL listener AL_GAIN which can be thought of as the "master volume".
ALboolean ALmixer_IsPlayingStateSuspended(void)
(EXPERIMENTAL) Call to determine if in ALmixer_SuspendPlayingState().
ALint ALmixer_GetTotalTime(ALmixer_Data *almixer_data)
Returns the total time in milliseconds of the audio resource.
ALint ALmixer_RewindSource(ALuint al_source)
Rewinds the sound to the beginning that is playing on a specific source.
ALmixer_Data * ALmixer_LoadAll_RAW(const char *file_name, ALmixer_AudioInfo *desired_format, ALuint access_data)
This is a back door loader function for complete preloading RAW samples into RAM or if you need to sp...
ALmixer_Data * ALmixer_LoadAll_RAW_RW(struct ALmixer_RWops *rw_ops, const char *file_ext, ALmixer_AudioInfo *desired_format, ALuint access_data)
This is a back door loader function for complete preloading RAW samples into RAM or if you need to sp...
ALboolean ALmixer_SetMasterVolume(ALfloat new_volume)
Sets the OpenAL listener AL_GAIN which can be thought of as the "master volume".
ALmixer_Data * ALmixer_LoadStream(const char *file_name, ALuint buffer_size, ALuint max_queue_buffers, ALuint num_startup_buffers, ALuint suggested_number_of_buffers_to_queue_per_update_pass, ALuint access_data)
This is the loader function to load an audio resource from a file.
ALint ALmixer_IsActiveChannel(ALint which_channel)
Returns true if the specified channel is currently playing or paused, or if -1 is passed the number o...
ALint ALmixer_HaltChannel(ALint which_channel)
Stops playback on a channel.
ALfloat ALmixer_GetVolumeSource(ALuint al_source)
Gets the volume via the AL_GAIN source property.
ALuint ALmixer_GetTicks(void)
This is the read/write operation structure – very basic.
Definition: ALmixer_RWops.h:118
ALmixer_Data * ALmixer_LoadSample_RAW(const char *file_name, ALmixer_AudioInfo *desired_format, ALuint buffer_size, ALboolean decode_mode_is_predecoded, ALuint max_queue_buffers, ALuint num_startup_buffers, ALuint suggested_number_of_buffers_to_queue_per_update_pass, ALuint access_data)
This is a back door general loader function for RAW samples or if you need to specify the ALmixer_Aud...
ALmixer_Data * ALmixer_LoadAll(const char *file_name, ALuint access_data)
This is the loader function to completely preload an audio resource from a file into RAM...
ALmixer_Data * ALmixer_LoadSample(const char *file_name, ALuint buffer_size, ALboolean decode_mode_is_predecoded, ALuint max_queue_buffers, ALuint num_startup_buffers, ALuint suggested_number_of_buffers_to_queue_per_update_pass, ALuint access_data)
This is a general loader function to load an audio resource from a file.
ALint ALmixer_FadeOutSource(ALuint al_source, ALuint fade_ticks)
Fade out a current playing source.
ALint ALmixer_HaltSource(ALuint al_source)
Stops playback on a channel.
ALboolean ALmixer_IsDecoderAvailable(const char *usr_ext)
Returns whether a decoder is available to decode the requested extension.
ALint ALmixer_IsPlayingChannel(ALint which_channel)
Returns true if the specified channel is currently playing.