digital-sound-antiques/libkss

A new KSSPLAY interface method for separate channel output

okaxaki opened this issue · 4 comments

The current KSSPLAY does not provide any interface for separate channel output of each devices. Separate channel output is very useful for a lot of purpose, for example, per-channel filtering, volume control, spectrum analysis and so on. I will implement the interface soon.

Prior to the KSSPLAY implementation, I already have added per-channel output array to all device modules such as emu2149, emu2212, emu2413, emu8950 and emu76489. The change can be seen on develop branch of each module.

I have pushed the implementation of per-channel output to the develop branch of libkss.
By using KSSPLAY_calc_per_ch instead of KSSPLAY_calc, all channel outputs can be obtained through the array of the following struct.

typedef struct tagKSSPLAY_PER_CH_OUT {
  int16_t psg[3];
  int16_t scc[5];
  int16_t opll[15]; 
  int16_t opl[15];  
  int16_t sng[4];
  int16_t dac[2];
} KSSPLAY_PER_CH_OUT;
...
void KSSPLAY_calc_per_ch(KSSPLAY *kssplay, KSSPLAY_PER_CH_OUT *per_ch_out, uint32_t length);

See the commit 24df03c7 on libkss/develop branch for detail. The commit also includes updated kss2wav.c. kss2wav -n2 file.kss generates stereo SCC and OPLL wave file by using KSSPLAY_calc_per_ch.

Note that it is my intension that KSSPLAY_PER_CH_OUT contains raw wave - it means that all the volume and filter settings of KSSPLAY are ignored.

Further, libkss itself does not and won't provide any streaming, mixing or filtering function for KSSPLAY_PER_CH_OUT. Such functions are application-dependent and should be implmented
out of libkss.

I have merged the implementation to the master branch so I close this issue.

Thanks a lot for your efforts and this amazing feature! It works very well.