wavaudio.c (6ceb1b51f05f9e1892d082960ed602dca7b6696e) wavaudio.c (85bc58520c0e43660cbbe51b9eb5022a0baafe9f)
1/*
2 * QEMU WAV audio driver
3 *
4 * Copyright (c) 2004-2005 Vassili Karpov (malc)
5 *
6 * Permission is hereby granted, free of charge, to any person obtaining a copy
7 * of this software and associated documentation files (the "Software"), to deal
8 * in the Software without restriction, including without limitation the rights

--- 103 unchanged lines hidden (view full) ---

112 0x02, 0x00, 0x44, 0xac, 0x00, 0x00, 0x10, 0xb1, 0x02, 0x00, 0x04,
113 0x00, 0x10, 0x00, 0x64, 0x61, 0x74, 0x61, 0x00, 0x00, 0x00, 0x00
114 };
115 WAVConf *conf = drv_opaque;
116 struct audsettings wav_as = conf->settings;
117
118 stereo = wav_as.nchannels == 2;
119 switch (wav_as.fmt) {
1/*
2 * QEMU WAV audio driver
3 *
4 * Copyright (c) 2004-2005 Vassili Karpov (malc)
5 *
6 * Permission is hereby granted, free of charge, to any person obtaining a copy
7 * of this software and associated documentation files (the "Software"), to deal
8 * in the Software without restriction, including without limitation the rights

--- 103 unchanged lines hidden (view full) ---

112 0x02, 0x00, 0x44, 0xac, 0x00, 0x00, 0x10, 0xb1, 0x02, 0x00, 0x04,
113 0x00, 0x10, 0x00, 0x64, 0x61, 0x74, 0x61, 0x00, 0x00, 0x00, 0x00
114 };
115 WAVConf *conf = drv_opaque;
116 struct audsettings wav_as = conf->settings;
117
118 stereo = wav_as.nchannels == 2;
119 switch (wav_as.fmt) {
120 case AUD_FMT_S8:
121 case AUD_FMT_U8:
120 case AUDIO_FORMAT_S8:
121 case AUDIO_FORMAT_U8:
122 bits16 = 0;
123 break;
124
122 bits16 = 0;
123 break;
124
125 case AUD_FMT_S16:
126 case AUD_FMT_U16:
125 case AUDIO_FORMAT_S16:
126 case AUDIO_FORMAT_U16:
127 bits16 = 1;
128 break;
129
127 bits16 = 1;
128 break;
129
130 case AUD_FMT_S32:
131 case AUD_FMT_U32:
130 case AUDIO_FORMAT_S32:
131 case AUDIO_FORMAT_U32:
132 dolog ("WAVE files can not handle 32bit formats\n");
133 return -1;
132 dolog ("WAVE files can not handle 32bit formats\n");
133 return -1;
134
135 default:
136 abort();
134 }
135
136 hdr[34] = bits16 ? 0x10 : 0x08;
137
138 wav_as.endianness = 0;
139 audio_pcm_init_info (&hw->info, &wav_as);
140
141 hw->samples = 1024;

--- 78 unchanged lines hidden (view full) ---

220 (void) hw;
221 (void) cmd;
222 return 0;
223}
224
225static WAVConf glob_conf = {
226 .settings.freq = 44100,
227 .settings.nchannels = 2,
137 }
138
139 hdr[34] = bits16 ? 0x10 : 0x08;
140
141 wav_as.endianness = 0;
142 audio_pcm_init_info (&hw->info, &wav_as);
143
144 hw->samples = 1024;

--- 78 unchanged lines hidden (view full) ---

223 (void) hw;
224 (void) cmd;
225 return 0;
226}
227
228static WAVConf glob_conf = {
229 .settings.freq = 44100,
230 .settings.nchannels = 2,
228 .settings.fmt = AUD_FMT_S16,
231 .settings.fmt = AUDIO_FORMAT_S16,
229 .wav_path = "qemu.wav"
230};
231
232static void *wav_audio_init (void)
233{
234 WAVConf *conf = g_malloc(sizeof(WAVConf));
235 *conf = glob_conf;
236 return conf;

--- 63 unchanged lines hidden ---
232 .wav_path = "qemu.wav"
233};
234
235static void *wav_audio_init (void)
236{
237 WAVConf *conf = g_malloc(sizeof(WAVConf));
238 *conf = glob_conf;
239 return conf;

--- 63 unchanged lines hidden ---