|
From: Dean B. <dea...@bt...> - 2000-06-02 18:51:56
|
There are 2 zips included. One tech one and one design one. The tech one is the technology that is needed to stream sounds through the system. Circular buffers, notify points, threads, etc. The design one is the design of the system. Both are rough at the moment but have potential. DESIGN SOURCE ============= You have 2 main linked lists. One for StreamObjects and one for Effect plugins. Each StreamObject has a pointer to an input plugin and a pointer to another linked list. The link list tied to the StreamObject points to Effects held in the main Effects linked list. So StreamObjects can have one Input plugin but many effect plugins. The System can have many StreamObjects. You give the output plugin the StreamObject Linked List and a Mixer. It is not the case in this test but the Mixer would be full of virtual functions so the output can override certain functions if it wished to. The Output Plugin uses the Mixer to mix the Input buffers. Each Input Plugin has it's own buffer and the Output Plugin has it's own buffer. They could inheret these from a base buffer class at some point. At the moment the Mixer is in control of the reading from input plugins and applying effects. This may not be the way to do it but it means everything is in one loop. The Output Plugin can ignore the mixer and do it's own hardware mixing or it can overload certain parts of the class it's given. (just need some virtual funcs) It is very easy to add or remove playing streams from the system as you just remove or add them to the playing linked list. Adding or removing effects is just as easy. Once the mixer is done the output plugin takes over. This is just a test and things will obviously be different in the real thing but not much. We just have to combine the design with the technology. Plugins need to have pure abstract bases, Buffers can be inhereted from a buffer base, Mixer needs virtual funcs, etc, etc. The actual program takes 9 bytes out of 2 source files called Hello.txt and Pant.txt. And creates a new file called Mother.txt. SORRY ABOUT THE WEIRD NAMES. :) The mixer just concats the strings together at the moment. An UpperCase effect is applied to Hello.txt. The resulting file (Mother.txt) is one containing the first 9 chars from Hello.txt then the first 9 chars from Pant.txt + a NULL terminator. The buffers have fixed sizes at the moment but that can be easily changed in the future. IT SHOULD COMPILE ON LINUX. Can't be sure what it will do though. :) TECHNOLOGY SOURCE ================== This is the latest Win32 build with source. Sorry Linux guys. :) Basically this program takes sound data from an input plugin pulls it through the system applying the effect and outputs it to an output circular buffer. The Input Plugin is allowed to change the size of the buffer. I have allowed the output plugin to control things like Sound Volume, Panning and Speed. The plugin system allows many modules to exist in one dll. For instance, a .voc and a .wav input plugin could be held in the same dll. I have put all of SS's functions into a C dll which can be called from any language. Just make sure you use cdecl. I just found out today that VB might not support cdecl. May have to change it to stdcall. Can a VB guy tell me if that is true? I've included source to a Delphi/Pascal Frontend that I wrote in about 10 mins. I know it's shit but don't blame me blame Pascal. I hate the language. :) For some reason the position of the frequency bar isn't set properly. Still have to work that one out. :) By the way the effect really is total shit. I just blank out half of every block. :) The plugin names are stored in the registry here: HKEY_LOCAL_MACHINE\Software\GOOD\Sub Sonic If you want a debugging console window in the C++ front end then just #define I_WANT_A_CONSOLE in WinMain.cpp. I've compared the performance to WinAmp. In WinAmp I turned off all effects and visualization stuff to make it a bit farer. Playing the same file, this technology test uses less processing power. It continues playing the buffer till it stops at the end. This causes some old sound to be played at the end of some wav files depending on where the buffer pointer is. PLEASE TEST THIS WITH BIG!!!!!!! WAV FILES. Write an MP3 to WAV or something like that. I've probably forgotten to say a few things. I haven't really given the code a good check yet either. OH WELL. HAVE FUN GUYS! |