ViewVC Help
View File | Revision Log | Show Annotations | Revision Graph | Root Listing
root/cebix/BasiliskII/src/Unix/Solaris/audio_solaris.cpp
(Generate patch)

Comparing BasiliskII/src/Unix/Solaris/audio_solaris.cpp (file contents):
Revision 1.2 by cebix, 1999-10-20T15:13:58Z vs.
Revision 1.10 by cebix, 2004-01-12T15:54:46Z

# Line 3 | Line 3
3   *
4   *  Adapted from Frodo's Solaris sound routines by Marc Chabanas
5   *
6 < *  Basilisk II (C) 1997-1999 Christian Bauer
6 > *  Basilisk II (C) 1997-2004 Christian Bauer
7   *
8   *  This program is free software; you can redistribute it and/or modify
9   *  it under the terms of the GNU General Public License as published by
# Line 40 | Line 40
40   #include "debug.h"
41  
42  
43 // Supported sample rates, sizes and channels
44 int audio_num_sample_rates = 1;
45 uint32 audio_sample_rates[] = {44100 << 16};
46 int audio_num_sample_sizes = 1;
47 uint16 audio_sample_sizes[] = {16};
48 int audio_num_channel_counts = 1;
49 uint16 audio_channel_counts[] = {2};
50
43   // Global variables
44   static int fd = -1;                                                     // fd of /dev/audio
45   static sem_t audio_irq_done_sem;                        // Signal from interrupt to streaming thread: data block read
# Line 64 | Line 56 | static void *stream_func(void *arg);
56   *  Initialization
57   */
58  
59 + // Set AudioStatus to reflect current audio stream format
60 + static void set_audio_status_format(void)
61 + {
62 +        AudioStatus.sample_rate = audio_sample_rates[0];
63 +        AudioStatus.sample_size = audio_sample_sizes[0];
64 +        AudioStatus.channels = audio_channel_counts[0];
65 + }
66 +
67   void AudioInit(void)
68   {
69          char str[256];
70  
71          // Init audio status and feature flags
72 <        AudioStatus.sample_rate = audio_sample_rates[0];
73 <        AudioStatus.sample_size = audio_sample_sizes[0];
74 <        AudioStatus.channels = audio_channel_counts[0];
72 >        audio_sample_rates.push_back(44100 << 16);
73 >        audio_sample_sizes.push_back(16);
74 >        audio_channel_counts.push_back(2);
75 >        set_audio_status_format();
76          AudioStatus.mixer = 0;
77          AudioStatus.num_sources = 0;
78          audio_component_flags = cmpWantsRegisterMessage | kStereoOut | k16BitOut;
# Line 114 | Line 115 | void AudioInit(void)
115          sound_buffer_size = (AudioStatus.sample_size>>3) * AudioStatus.channels * audio_frames_per_block;
116  
117          // Start audio thread
118 <        pthread_attr_init(&stream_thread_attr);
118 < #if defined(_POSIX_THREAD_PRIORITY_SCHEDULING)
119 <        pthread_attr_setinheritsched(&stream_thread_attr, PTHREAD_EXPLICIT_SCHED);
120 <        pthread_attr_setschedpolicy(&stream_thread_attr, SCHED_FIFO);
121 <        struct sched_param fifo_param;
122 <        fifo_param.sched_priority = (sched_get_priority_min(SCHED_FIFO) + sched_get_priority_max(SCHED_FIFO)) / 2;
123 <        pthread_attr_setschedparam(&stream_thread_attr, &fifo_param);
124 < #endif
118 >        Set_pthread_attr(&stream_thread_attr, 0);
119          stream_thread_active = (pthread_create(&stream_thread, &stream_thread_attr, stream_func, NULL) == 0);
120  
121          // Everything OK
# Line 210 | Line 204 | static void *stream_func(void *arg)
204                                          write(fd, Mac2HostAddr(ReadMacInt32(apple_stream_info + scd_buffer)), sound_buffer_size);
205                                  else {
206                                          // Last buffer
207 <                                        memcpy(last_buffer, Mac2HostAddr(ReadMacInt32(apple_stream_info + scd_buffer)), work_size);
207 >                                        Mac2Host_memcpy(last_buffer, ReadMacInt32(apple_stream_info + scd_buffer), work_size);
208                                          memset((uint8 *)last_buffer + work_size, 0, sound_buffer_size - work_size);
209                                          write(fd, last_buffer, sound_buffer_size);
210                                  }
# Line 267 | Line 261 | void AudioInterrupt(void)
261   *  It is guaranteed that AudioStatus.num_sources == 0
262   */
263  
264 < void audio_set_sample_rate(int index)
264 > bool audio_set_sample_rate(int index)
265   {
266 +        return true;
267   }
268  
269 < void audio_set_sample_size(int index)
269 > bool audio_set_sample_size(int index)
270   {
271 +        return true;
272   }
273  
274 < void audio_set_channels(int index)
274 > bool audio_set_channels(int index)
275   {
276 +        return true;
277   }
278  
279  

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines