2010-01-01

my audio project

当时写到这里只是为了markdown的live preview,不过现在看了还是有点伤心。花了半个多月的心血,做的基本让自己满意了,但是其实day 5做出来的东西交上去基本上就是满分了……悲剧……

看着这个log,觉得UI真是个害人的东西。

放出来吧,以此祭奠这个project。

代码在这里:svn

C++大作业2

题目

设计实现一个WIN32(或LINUX)平台下的控制台窗口界面的录音和放音软件。要求在录音时,能够检测录音时的无声状态,并可以方便地插入不同的“过滤器”来处理声音片段,如检测输出音量大小、过滤掉无声段、 过滤掉噪音段等等。要求可以存取多种语音格式的WINDOWS WAVE文件。录音和放音过程可以随时中止。放音的播放列表可以实时编辑。能显示录音和放音的状态信息。

过程

day 1

  • searched for cross platform audio lib and got PortAudio, seemed very good
  • installed mingw and msys, worked well
  • compiled portaudio with ease, in wmme, not direct sound
  • tests works well
  • but how do i compile with a source file and a lib?
  • tough, not working
  • mingw-gcc test.c libportaudio.a -lwinmm, worked!
  • looked through the c++ wrapper, couldn't be compiled yet

day 2

  • started my own wrapper
  • rewrote the sine sample to y desired c++ form
  • implementing the pa++ to make it work
  • finished needed parts for the sine test
  • cannot compile, investigating, compiler's message is really confusing
  • debugging...program crashes when i tries to start a stream
  • still debugging.....
  • sweet! finally it worked! how beautiful sine wave sounded!
  • refactoring
  • wanted to make callback a class, stuck
  • at last, have to use an adapter like official c++ wrapper
  • oh wait, why bother the adapter class? just put the callback class into userData!
  • moving prototype code in hpp to cpp....i hate headers.
  • checked in the project to my google code thinxer-codestubs (seems that hg suits my need better, anyway, i love svn)
  • refactoring again, removing StreamCallback
  • link error.....oh shit
  • got it, poor, forgot to add classname when defining CallbackStream's virtual functions
  • made sine work after refactored

day 3

  • got a small recorder class! works!
  • starting a simple wave format implemetation

day 5

  • adding a override function to logger, stuck, strange
  • at last, wave read works! hooray!
  • and wave record works very easily

day 6

  • thinking about how to implement a stream-like io interface for record/playback, this would be essential for filters.

day 7 (Sep 7th)

  • implemented a BinaryBuffer and StreamFilter
  • working on the callback stream to work with the StreamFilter
  • working on FilteredCallbackStream
  • got that i don't need two adapters...filters can do everything
  • but i need two formats, one for input and one for output!
  • stuck stuck stuck!

day 8

  • ah, sine generator works! but my binarybuffer's effiency is too low!

day 9

  • implemented a very efficient binary buffer, i love it.

day 10

  • stuck! the stream parameters are determined at startup but wave needs to change them!
  • and the filters cannot got how much buffer left for play
  • so improve the StreamFilter.
  • i'd like not to change the pa++ lib, since it works well
  • oh shit....sample format are easy to convert, but samplerate is not so easy
  • so i need to know the output parameter from the wave file
  • i need an init and got the output format, then init the stream
  • so filters cannot be changed online (when pause), but it's ok :)
  • so to use a filtered stream i need the following steps: 1, register filters 2, init the filters and got the output parameters 3, init the stream 4, start it and no input/output paramters change during this stream 5, no change to the pa++ core lib and an agent will do all the things

day 11

  • at last, an agent was added and wave play works. but the code looked not so tidy..

day 12

  • trying to implement curses....
  • seems very complicated at first glance..
  • got a tutorial, and not so hard, now menus works
  • c++ wrap wrap wrap!!

day 13

  • still struggling on the UI

day 14

  • many minor improvements, trying to write a High Pass but without success

day 15

  • implemented a-law and u-law encoding
  • UI and UI....how to set filter's parameters?
  • got some simple inferfaces for the parameters and output info

day 16

  • still pains on ui, getting it to work though...
  • started playlist design.

day 17

  • debugging
  • implemented some better UI

day 18

  • still hard working, implemented a CustomFilterMenu

day 19

  • looking into a dll way of plug-in filters
  • thinking about whether i should merge the dll part into main, considering this would make the main cannot cross platform
  • put the dll into a small demo

day 20

  • writing ppt and doc
thinXer