23 #include "../include/tscope5/audio.h"
24 #include "../include/tscope5/audio_internal.h"
25 #include "../include/tscope5/system_internal.h"
48 if (!_ts5_is_tscope5_installed) {
49 ts5_install_tscope5(
"ts5_set_audio_frequency");
52 ts5_log(TS5_LOGLEVEL_4,
"ts5_set_audio_frequency(%u)\n", frequency);
54 unsigned int retval = _ts5_status.audio_status.frequency;
56 if (frequency!=TS5_11025 && frequency!=TS5_22050 && frequency!=TS5_44100) {
57 ts5_fatal(
"ts5_set_audio_frequency: unknonwn frequency requested\n");
60 _ts5_status.audio_status.frequency = frequency;
62 ts5_log(TS5_LOGLEVEL_4,
"ts5_set_audio_frequency: set sample rate to %u (was %u)\n",
63 _ts5_status.audio_status.frequency, retval);
76 ts5_check_audio(
"ts5_get_audio_frequency");
77 ts5_log(TS5_LOGLEVEL_4,
"ts5_get_audio_frequency()\n");
79 return al_get_voice_frequency(_ts5_status.audio_status.voice);
103 if (!_ts5_is_tscope5_installed) {
104 ts5_install_tscope5(
"ts5_set_audio_channels");
107 ts5_log(TS5_LOGLEVEL_4,
"ts5_set_audio_channels(%d)\n", channels);
109 unsigned int retval = _ts5_status.audio_status.channels;
111 if (channels!=TS5_MONO && channels!=TS5_STEREO) {
112 ts5_fatal(
"ts5_set_audio_channels: unknonwn number of channels requested\n");
115 _ts5_status.audio_status.channels = channels;
117 ts5_log(TS5_LOGLEVEL_4,
"ts5_set_audio_channels: set number of channels to %u (was %u)\n",
118 _ts5_status.audio_status.channels, retval);
131 ts5_check_audio(
"ts5_get_audio_channels");
132 ts5_log(TS5_LOGLEVEL_4,
"ts5_get_audio_channels()\n");
134 ALLEGRO_CHANNEL_CONF channels = al_get_voice_channels(_ts5_status.audio_status.voice);
138 if (channels == ALLEGRO_CHANNEL_CONF_1) {
141 else if (channels == ALLEGRO_CHANNEL_CONF_2) {
145 ts5_fatal(
"ts5_get_audio_channels: got an unknonwn number of channels\n");
175 if (!_ts5_is_tscope5_installed) {
176 ts5_install_tscope5(
"ts5_set_audio_depth");
179 ts5_log(TS5_LOGLEVEL_4,
"ts5_set_audio_depth(%d)\n", depth);
181 int retval = _ts5_status.audio_status.depth;
183 if (depth!=TS5_INTEGER && depth!=TS5_FLOAT) {
184 ts5_fatal(
"ts5_set_audio_depth: unknonwn sample depth requested\n");
187 _ts5_status.audio_status.depth = depth;
189 ts5_log(TS5_LOGLEVEL_4,
"ts5_set_audio_depth: set sample depth to %d (was %d)\n",
190 _ts5_status.audio_status.depth, retval);
203 ts5_check_audio(
"ts5_get_audio_depth");
204 ts5_log(TS5_LOGLEVEL_4,
"ts5_get_audio_depth()\n");
206 ALLEGRO_AUDIO_DEPTH depth = al_get_voice_depth(_ts5_status.audio_status.voice);
208 if (depth != TS5_INTEGER && depth !=TS5_FLOAT) {
209 ts5_fatal(
"ts5_get_audio_depth: got an unknonwn sample depth\n");
227 if (!_ts5_is_tscope5_installed) {
228 ts5_install_tscope5(
"ts5_set_audio_gain");
231 ts5_log(TS5_LOGLEVEL_4,
"ts5_set_audio_gain(%f)\n", gain);
233 double retval = _ts5_status.audio_status.gain;
236 ts5_fatal(
"ts5_set_audio_gain: gain should be >= 0.0\n");
239 _ts5_status.audio_status.gain = gain;
241 if (!al_set_mixer_gain(_ts5_status.audio_status.mixer, gain)) {
242 ts5_fatal(
"ts5_set_audio_gain: could not change audio gain\n");
245 ts5_log(TS5_LOGLEVEL_4,
"ts5_set_audio_gain: set gain to %f (was %f)\n",
246 _ts5_status.audio_status.gain, retval);
259 ts5_check_audio(
"ts5_get_audio_gain");
260 ts5_log(TS5_LOGLEVEL_4,
"ts5_get_audio_gain()\n");
262 return _ts5_status.audio_status.gain;
297 ts5_check_audio(
"ts5_alloc_sample");
298 ts5_log(TS5_LOGLEVEL_2,
"ts5_alloc_sample(%f)\n", length);
300 unsigned int samples = length * _ts5_status.audio_status.frequency;
302 ALLEGRO_CHANNEL_CONF channels;
304 if (_ts5_status.audio_status.channels==TS5_MONO) {
305 channels=ALLEGRO_CHANNEL_CONF_1;
307 else if (_ts5_status.audio_status.channels==TS5_STEREO) {
308 channels=ALLEGRO_CHANNEL_CONF_2;
311 ts5_fatal(
"ts5_alloc_sample: unknonwn channel configuration requested\n");
314 unsigned int sample_size = al_get_channel_count(channels) *
315 al_get_audio_depth_size(_ts5_status.audio_status.depth);
317 unsigned int bytes = samples * sample_size;
320 buff = al_malloc(bytes);
323 ts5_fatal(
"ts5_alloc_sample: could not allocate sample buffer\n");
326 TS5_SAMPLE *sample = NULL;
327 sample = (TS5_SAMPLE *)al_malloc(
sizeof(TS5_SAMPLE));
330 ts5_fatal(
"ts5_alloc_sample: could not allocate sample\n");
333 sample->sample = al_create_sample(buff, samples, _ts5_status.audio_status.frequency,
334 _ts5_status.audio_status.depth, channels,
true);
336 if (!sample->sample) {
337 ts5_fatal(
"ts5_alloc_sample: could not create sample\n");
340 sample->instance = al_create_sample_instance(NULL);
342 if (!sample->instance) {
343 ts5_fatal(
"ts5_alloc_sample: could not create sample instance\n");
346 if (!al_set_sample(sample->instance, sample->sample)) {
347 ts5_fatal(
"ts5_alloc_sample: could not attach sample to sample instance\n");
350 if (!al_attach_sample_instance_to_mixer(sample->instance, _ts5_status.audio_status.mixer)) {
351 ts5_fatal(
"ts5_alloc_sample: could not attach sample instance to mixer\n");
354 al_set_sample_instance_playing(sample->instance,
false);
356 sample->issample =
true;
357 sample->isfilestream =
false;
358 sample->ismemorystream =
false;
359 sample->stream = NULL;
378 ts5_check_audio(
"ts5_read_sample");
379 ts5_log(TS5_LOGLEVEL_2,
"ts5_read_sample(%s)\n", file);
381 TS5_SAMPLE *sample = NULL;
382 sample = (TS5_SAMPLE *)al_malloc(
sizeof(TS5_SAMPLE));
385 ts5_fatal(
"ts5_read_sample: could not allocate sample\n");
388 sample->issample =
true;
389 sample->isfilestream =
false;
390 sample->ismemorystream =
false;
392 sample->sample = NULL;
393 sample->sample = al_load_sample(file);
395 if (!sample->sample) {
396 ts5_fatal(
"ts5_read_sample: could not read sample\n");
399 sample->instance = NULL;
400 sample->instance = al_create_sample_instance(NULL);
402 if (!sample->instance) {
403 ts5_fatal(
"ts5_read_sample: could not create sample instance\n");
406 if (!al_set_sample(sample->instance, sample->sample)) {
407 ts5_fatal(
"ts5_read_sample: could not attach sample to sample instance\n");
410 if (!al_attach_sample_instance_to_mixer(sample->instance, _ts5_status.audio_status.mixer)) {
411 ts5_fatal(
"ts5_read_sample: could not attach sample instance to mixer\n");
414 al_set_sample_instance_playing(sample->instance,
false);
416 sample->stream = NULL;
435 ts5_check_audio(
"ts5_read_long_sample");
436 ts5_log(TS5_LOGLEVEL_2,
"ts5_read_long_sample(%s)\n", file);
438 TS5_SAMPLE *sample = NULL;
439 sample = (TS5_SAMPLE *)al_malloc(
sizeof(TS5_SAMPLE));
442 ts5_fatal(
"ts5_read_long_sample: could not allocate sample\n");
445 sample->issample =
false;
446 sample->isfilestream =
true;
447 sample->ismemorystream =
false;
449 sample->sample = NULL;
450 sample->instance = NULL;
452 sample->stream = NULL;
453 sample->stream = al_load_audio_stream(file, 4, 2048);
455 if (!sample->stream) {
456 ts5_fatal(
"ts5_read_long_sample: could not read sample\n");
459 if (!al_attach_audio_stream_to_mixer(sample->stream, _ts5_status.audio_status.mixer)) {
460 ts5_fatal(
"ts5_read_long_sample: could not attach sample stream to mixer\n");
463 al_set_audio_stream_playing(sample->stream,
false);
464 al_set_audio_stream_playmode(sample->stream, ALLEGRO_PLAYMODE_ONCE);
480 ts5_check_audio(
"ts5_write_sample");
481 ts5_log(TS5_LOGLEVEL_2,
"ts5_write_sample(%s,%p)\n", file, sample);
483 if (!sample->issample) {
484 ts5_fatal(
"ts5_write_sample: writing of streams is not implemented yet\n");
487 if (!al_save_sample(file, sample->sample)) {
488 ts5_fatal(
"ts5_write_sample: could not write sample\n");
503 ts5_check_audio(
"ts5_free_sample");
504 ts5_log(TS5_LOGLEVEL_2,
"ts5_free_sample(%p)\n", sample);
506 if (sample->issample) {
507 al_set_sample(sample->instance, NULL);
508 al_destroy_sample(sample->sample);
510 al_detach_sample_instance(sample->instance);
511 al_destroy_sample_instance(sample->instance);
513 else if (sample->isfilestream) {
514 al_detach_audio_stream(sample->stream);
515 al_destroy_audio_stream(sample->stream);
517 else if (sample->ismemorystream) {
518 ts5_fatal(
"ts5_free_sample: memory streams not implemented yet\n");
548 ts5_check_audio(
"ts5_play_sample");
549 ts5_log(TS5_LOGLEVEL_5,
"ts5_play_sample(%p)\n", sample);
552 ts5_fatal(
"ts5_play_sample: sample pointer is null\n");
555 if (sample->issample) {
557 if (!al_set_sample_instance_playing(sample->instance, 1)) {
558 ts5_fatal(
"ts5_play_sample: could not play sample\n");
561 else if (sample->isfilestream) {
563 if (!al_set_audio_stream_playing(sample->stream, 1)) {
564 ts5_fatal(
"ts5_play_sample: could not play sample\n");
567 else if (sample->ismemorystream) {
568 ts5_fatal(
"ts5_play_sample: memory streams not implemented yet\n");
580 ts5_check_audio(
"ts5_pause_sample");
581 ts5_log(TS5_LOGLEVEL_5,
"ts5_pause_sample(%p)\n", sample);
584 ts5_fatal(
"ts5_pause_sample: sample pointer is null\n");
587 if (sample->issample) {
589 unsigned int position = al_get_sample_instance_position(sample->instance);
591 if (!al_set_sample_instance_playing(sample->instance, 0)) {
592 ts5_fatal(
"ts5_pause_sample: could not pause sample\n");
595 if (!al_set_sample_instance_position(sample->instance, position)) {
596 ts5_fatal(
"ts5_pause_sample: could not change sample position\n");
599 else if (sample->isfilestream) {
601 if (!al_set_audio_stream_playing(sample->stream, 0)) {
602 ts5_fatal(
"ts5_pause_sample: could not pause sample\n");
605 else if (sample->ismemorystream) {
606 ts5_fatal(
"memory streams not implemented yet\n");
618 ts5_check_audio(
"ts5_stop_sample");
619 ts5_log(TS5_LOGLEVEL_5,
"ts5_stop_sample(%p)\n", sample);
622 ts5_fatal(
"ts5_stop_sample: sample pointer is null\n");
625 if (sample->issample) {
627 if (!al_set_sample_instance_playing(sample->instance, 0)) {
628 ts5_fatal(
"ts5_stop_sample: could not stop sample\n");
631 if (!al_set_sample_instance_position(sample->instance, 0)) {
632 ts5_fatal(
"ts5_stop_sample: could not stop sample\n");
635 else if (sample->isfilestream) {
637 al_drain_audio_stream(sample->stream);
639 if (!al_rewind_audio_stream(sample->stream)) {
640 ts5_fatal(
"ts5_stop_sample: could not rewind sample\n");
643 else if (sample->ismemorystream) {
644 ts5_fatal(
"ts5_stop_sample: memory streams not implemented yet\n");
676 ts5_check_audio(
"ts5_get_sample_status");
677 ts5_log(TS5_LOGLEVEL_5,
"ts5_get_sample_status(%p)\n", sample);
680 ts5_fatal(
"ts5_get_sample_status: sample pointer is null\n");
685 if (sample->issample) {
686 retval = al_get_sample_instance_playing(sample->instance);
688 else if (sample->isfilestream) {
689 retval = al_get_audio_stream_playing(sample->stream);
691 else if (sample->ismemorystream) {
692 ts5_fatal(
"ts5_get_sample_status: memory streams not implemented yet\n");
695 ts5_fatal(
"ts5_get_sample_status: sample type unknown\n");
711 ts5_check_audio(
"ts5_get_sample_frequency");
712 ts5_log(TS5_LOGLEVEL_4,
"ts5_get_sample_frequency(%p)\n", sample);
715 ts5_fatal(
"ts5_get_sample_frequency: sample pointer is null\n");
718 unsigned int retval = 0;
720 if (sample->issample) {
721 retval = al_get_sample_frequency(sample->sample);
723 else if (sample->isfilestream) {
724 retval = al_get_audio_stream_frequency(sample->stream);
726 else if (sample->ismemorystream) {
727 ts5_fatal(
"ts5_get_sample_frequency: memory streams not implemented yet\n");
743 ts5_check_audio(
"ts5_get_sample_channels");
744 ts5_log(TS5_LOGLEVEL_4,
"ts5_get_sample_channels(%p)\n", sample);
747 ts5_fatal(
"ts5_get_sample_channels: sample pointer is null\n");
750 ALLEGRO_CHANNEL_CONF channels;
752 if (sample->issample) {
753 channels = al_get_sample_channels(sample->sample);
755 else if (sample->isfilestream) {
756 channels = al_get_audio_stream_channels(sample->stream);
758 else if (sample->ismemorystream) {
759 ts5_fatal(
"ts5_get_sample_channels: memory streams not implemented yet\n");
762 unsigned int retval = 0;
764 if (channels == ALLEGRO_CHANNEL_CONF_1) {
767 else if (channels == ALLEGRO_CHANNEL_CONF_2) {
771 ts5_fatal(
"ts5_get_sample_channels: got an unknonwn number of channels\n");
787 ts5_check_audio(
"ts5_get_sample_depth");
788 ts5_log(TS5_LOGLEVEL_4,
"ts5_get_sample_depth(%p)\n", sample);
791 ts5_fatal(
"ts5_get_sample_depth: sample pointer is null\n");
794 ALLEGRO_AUDIO_DEPTH depth;
796 if (sample->issample) {
797 depth = al_get_sample_depth(sample->sample);
799 else if (sample->isfilestream) {
800 depth = al_get_audio_stream_depth(sample->stream);
802 else if (sample->ismemorystream) {
803 ts5_fatal(
"ts5_get_sample_depth: memory streams not implemented yet\n");
808 if (depth == ALLEGRO_AUDIO_DEPTH_INT16) {
809 retval = TS5_INTEGER;
811 else if (depth == ALLEGRO_AUDIO_DEPTH_FLOAT32) {
815 ts5_fatal(
"ts5_get_audio_depth: got an unknonwn sample depth\n");
831 ts5_check_audio(
"ts5_get_sample_length");
832 ts5_log(TS5_LOGLEVEL_4,
"ts5_get_sample_length(%p)\n", sample);
835 ts5_fatal(
"ts5_get_sample_length: sample pointer is null\n");
838 unsigned int retval = 0;
840 if (sample->issample) {
841 retval = al_get_sample_length(sample->sample);
843 else if (sample->isfilestream) {
844 retval = al_get_audio_stream_length(sample->stream);
846 else if (sample->ismemorystream) {
847 ts5_fatal(
"ts5_get_sample_length: memory streams not implemented yet\n");
865 ts5_check_audio(
"ts5_set_sample_position");
866 ts5_log(TS5_LOGLEVEL_4,
"ts5_set_sample_position(%p,%u)\n", sample, position);
869 ts5_fatal(
"ts5_set_sample_position: sample pointer is null\n");
872 unsigned int retval= 0;
874 if (sample->issample) {
876 unsigned int max = al_get_sample_length(sample->sample);
878 if (position > max) {
879 ts5_fatal(
"ts5_set_sample_position: position should be",
880 " <= the length of the sample (%d)\n", max);
883 retval = al_get_sample_instance_position(sample->instance);
885 if (!(al_set_sample_instance_position(sample->instance, position))) {
886 ts5_fatal(
"ts5_set_sample_position: could not change sample position\n");
889 else if (sample->isfilestream) {
891 unsigned int freq = al_get_audio_stream_frequency(sample->stream);
892 unsigned int max = al_get_audio_stream_length_secs(sample->stream) * freq;
894 if (position > max) {
895 ts5_fatal(
"ts5_set_sample_position: position should be",
896 " <= the length of the sample (%d)\n", max);
899 retval = al_get_audio_stream_position_secs(sample->stream) * freq;
901 if (!(al_seek_audio_stream_secs(sample->stream, position / freq))) {
902 ts5_fatal(
"ts5_set_sample_position: could not change sample position\n");
905 else if (sample->ismemorystream) {
906 ts5_fatal(
"ts5_set_sample_position: memory streams not implemented yet\n");
922 ts5_check_audio(
"ts5_get_sample_position");
923 ts5_log(TS5_LOGLEVEL_4,
"ts5_get_sample_position(%p)\n", sample);
926 ts5_fatal(
"ts5_get_sample_length: sample pointer is null\n");
929 unsigned int retval = 0;
931 if (sample->issample) {
932 retval = al_get_sample_instance_position(sample->instance);
934 else if (sample->isfilestream) {
935 unsigned int freq = al_get_audio_stream_frequency(sample->stream);
936 retval = al_get_audio_stream_position_secs(sample->stream) * freq;
938 else if (sample->ismemorystream) {
939 ts5_fatal(
"ts5_get_sample_position: memory streams not implemented yet\n");
956 ts5_check_audio(
"ts5_set_sample_speed");
957 ts5_log(TS5_LOGLEVEL_4,
"ts5_set_sample_speed(%p,%f)\n", sample, speed);
960 ts5_fatal(
"ts5_set_sample_speed: sample pointer is null\n");
964 ts5_fatal(
"ts5_set_sample_speed: speed should be >0 (is %f)\n", speed);
969 if (sample->issample) {
971 retval = al_get_sample_instance_speed(sample->instance);
973 if (!(al_set_sample_instance_speed(sample->instance, speed))) {
974 ts5_fatal(
"ts5_set_sample_speed: could not change sample speed (%f)\n", speed);
977 else if (sample->isfilestream) {
979 retval = al_get_audio_stream_speed(sample->stream);
981 if (!(al_set_audio_stream_speed(sample->stream, speed))) {
982 ts5_fatal(
"ts5_set_sample_speed: could not change sample speed (%f)\n", speed);
985 else if (sample->ismemorystream) {
986 ts5_fatal(
"memory streams not implemented yet\n");
1002 ts5_check_audio(
"ts5_get_sample_speed");
1003 ts5_log(TS5_LOGLEVEL_4,
"ts5_get_sample_speed(%p)\n", sample);
1006 ts5_fatal(
"ts5_get_sample_speed: sample pointer is null\n");
1009 double retval = 0.0;
1011 if (sample->issample) {
1012 retval = al_get_sample_instance_speed(sample->instance);
1014 else if (sample->isfilestream) {
1015 retval = al_get_audio_stream_speed(sample->stream);
1017 else if (sample->ismemorystream) {
1018 ts5_fatal(
"ts5_get_sample_speed: memory streams not implemented yet\n");
1035 ts5_check_audio(
"ts5_set_sample_gain");
1036 ts5_log(TS5_LOGLEVEL_4,
"ts5_set_sample_gain(%p,%f)\n", sample, gain);
1039 ts5_fatal(
"ts5_set_sample_gain: sample pointer is null\n");
1043 ts5_fatal(
"ts5_set_sample_gain: gain should be >0 (is %f)\n", gain);
1046 double retval = 0.0;
1048 if (sample->issample) {
1050 retval = al_get_sample_instance_gain(sample->instance);
1052 if (!(al_set_sample_instance_gain(sample->instance, gain))) {
1053 ts5_fatal(
"ts5_set_sample_gain: could not change sample gain (%f)\n", gain);
1056 else if (sample->isfilestream) {
1058 retval = al_get_audio_stream_gain(sample->stream);
1060 if (!(al_set_audio_stream_gain(sample->stream, gain))) {
1061 ts5_fatal(
"ts5_set_sample_gain: could not change sample gain (%f)\n", gain);
1064 else if (sample->ismemorystream) {
1065 ts5_fatal(
"memory streams not implemented yet\n");
1081 ts5_check_audio(
"ts5_get_sample_gain");
1082 ts5_log(TS5_LOGLEVEL_4,
"ts5_get_sample_gain(%p)\n", sample);
1085 ts5_fatal(
"ts5_get_sample_gain: sample pointer is null\n");
1088 double retval = 0.0;
1090 if (sample->issample) {
1091 retval = al_get_sample_instance_gain(sample->instance);
1093 else if (sample->isfilestream) {
1094 retval = al_get_audio_stream_gain(sample->stream);
1096 else if (sample->ismemorystream) {
1097 ts5_fatal(
"ts5_get_sample_gain: memory streams not implemented yet\n");
1114 ts5_check_audio(
"ts5_set_sample_pan");
1115 ts5_log(TS5_LOGLEVEL_4,
"ts5_set_sample_pan(%p,%f)\n", sample, pan);
1118 ts5_fatal(
"ts5_set_sample_pan: sample pointer is null\n");
1121 if (pan < -1.0 || pan > 1) {
1122 ts5_fatal(
"ts5_set_sample_pan: pan should be between -1.0 and 1.0 (is %f)\n", pan);
1125 double retval = 0.0;
1127 if (sample->issample) {
1129 retval = al_get_sample_instance_pan(sample->instance);
1131 if (!(al_set_sample_instance_pan(sample->instance, pan))) {
1132 ts5_fatal(
"ts5_set_sample_pan: could not change sample pan (%f)\n", pan);
1135 else if (sample->isfilestream) {
1137 retval = al_get_audio_stream_pan(sample->stream);
1139 if (!(al_set_audio_stream_pan(sample->stream, pan))) {
1140 ts5_fatal(
"ts5_set_sample_pan: could not change sample pan (%f)\n", pan);
1143 else if (sample->ismemorystream) {
1144 ts5_fatal(
"ts5_set_sample_pan: memory streams not implemented yet\n");
1160 ts5_check_audio(
"ts5_get_sample_pan");
1161 ts5_log(TS5_LOGLEVEL_4,
"ts5_get_sample_pan(%p)\n", sample);
1164 ts5_fatal(
"ts5_get_sample_pan: sample pointer is null\n");
1167 double retval = 0.0;
1169 if (sample->issample) {
1170 retval = al_get_sample_instance_pan(sample->instance);
1172 else if (sample->isfilestream) {
1173 retval = al_get_audio_stream_pan(sample->stream);
1175 else if (sample->ismemorystream) {
1176 ts5_fatal(
"memory streams not implemented yet\n");
1193 ts5_check_audio(
"ts5_set_sample_playmode");
1194 ts5_log(TS5_LOGLEVEL_4,
"ts5_set_sample_playmode(%p,%d)\n", sample, playmode);
1197 ts5_fatal(
"ts5_set_sample_playmode: sample pointer is null\n");
1200 if (playmode != TS5_PLAY_ONCE && playmode != TS5_PLAY_LOOP) {
1201 ts5_fatal(
"ts5_set_sample_playmode: playmode should be TS5_PLAY_ONCE or TS5_PLAY_LOOP\n");
1206 if (sample->issample) {
1208 retval = al_get_sample_instance_playmode(sample->instance);
1210 if (!(al_set_sample_instance_playmode(sample->instance, playmode))) {
1211 ts5_fatal(
"ts5_set_sample_playmode: could not change sample playmode\n");
1214 else if (sample->isfilestream) {
1216 retval = al_get_audio_stream_playmode(sample->stream) - 3;
1218 if (!(al_set_audio_stream_playmode(sample->stream, playmode))) {
1219 ts5_fatal(
"ts5_set_sample_playmode: could not change sample playmode\n");
1222 else if (sample->ismemorystream) {
1223 ts5_fatal(
"ts5_set_sample_playmode: memory streams not implemented yet\n");
1239 ts5_check_audio(
"ts5_get_sample_playmode");
1240 ts5_log(TS5_LOGLEVEL_4,
"ts5_get_sample_playmode(%p)\n", sample);
1243 ts5_fatal(
"ts5_get_sample_playmode: sample pointer is null\n");
1248 if (sample->issample) {
1249 retval = al_get_sample_instance_playmode(sample->instance);
1251 else if (sample->isfilestream) {
1252 retval = al_get_audio_stream_playmode(sample->stream) - 3;
1254 else if (sample->ismemorystream) {
1255 ts5_fatal(
"ts5_get_sample_playmode: memory streams not implemented yet\n");