adlib.c (4dad0a9aa818698e0735c8352bf7925a1660df6f) | adlib.c (79fe9e4313f9dbad8ee4619031900ccabd4f8824) |
---|---|
1/* 2 * QEMU Proxy for OPL2/3 emulation by MAME team 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 --- 172 unchanged lines hidden (view full) --- 181 } 182 183 return net; 184} 185 186static void adlib_callback (void *opaque, int free) 187{ 188 AdlibState *s = opaque; | 1/* 2 * QEMU Proxy for OPL2/3 emulation by MAME team 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 --- 172 unchanged lines hidden (view full) --- 181 } 182 183 return net; 184} 185 186static void adlib_callback (void *opaque, int free) 187{ 188 AdlibState *s = opaque; |
189 int samples, net = 0, to_play, written; | 189 int samples, to_play, written; |
190 191 samples = free >> SHIFT; 192 if (!(s->active && s->enabled) || !samples) { 193 return; 194 } 195 196 to_play = MIN (s->left, samples); 197 while (to_play) { --- 16 unchanged lines hidden (view full) --- 214 } 215 216 YM3812UpdateOne (s->opl, s->mixbuf + s->pos, samples); 217 218 while (samples) { 219 written = write_audio (s, samples); 220 221 if (written) { | 190 191 samples = free >> SHIFT; 192 if (!(s->active && s->enabled) || !samples) { 193 return; 194 } 195 196 to_play = MIN (s->left, samples); 197 while (to_play) { --- 16 unchanged lines hidden (view full) --- 214 } 215 216 YM3812UpdateOne (s->opl, s->mixbuf + s->pos, samples); 217 218 while (samples) { 219 written = write_audio (s, samples); 220 221 if (written) { |
222 net += written; | |
223 samples -= written; 224 s->pos = (s->pos + written) % s->samples; 225 } 226 else { 227 s->left = samples; 228 return; 229 } 230 } --- 99 unchanged lines hidden --- | 222 samples -= written; 223 s->pos = (s->pos + written) % s->samples; 224 } 225 else { 226 s->left = samples; 227 return; 228 } 229 } --- 99 unchanged lines hidden --- |