2 ZynAddSubFX - a software synthesizer
4 Recorder.cpp - Records sound to a file
5 Copyright (C) 2002-2005 Nasca Octavian Paul
6 Author: Nasca Octavian Paul
8 This program is free software; you can redistribute it and/or
9 modify it under the terms of the GNU General Public License
10 as published by the Free Software Foundation; either version 2
11 of the License, or (at your option) any later version.
14 #include <rtosc/ports.h>
15 #include <rtosc/port-sugar.h>
19 #include "../globals.h"
20 #include "../Nio/Nio.h"
24 #define rObject Recorder
25 const rtosc::Ports
Recorder::ports
= {
26 {"preparefile:s", rDoc("Init WAV file"), 0,
28 obj
->preparefile(rtosc_argument(msg
, 0).s
, 1);
30 {"start:", rDoc("Start recording"), 0,
34 {"stop:", rDoc("Stop recording"), 0,
38 {"pause:", rDoc("Pause recording"), 0,
45 Recorder::Recorder(const SYNTH_T
&synth_
)
46 :status(0), notetrigger(0),synth(synth_
)
55 int Recorder::preparefile(std::string filename_
, int overwrite
)
60 statr
= stat(filename_
.c_str(), &fileinfo
);
61 if(statr
== 0) //file exists
65 Nio::waveNew(new WavFile(filename_
, synth
.samplerate
, 2));
72 void Recorder::start()
75 status
= 2; //recording
85 void Recorder::pause()
91 int Recorder::recording()
93 if((status
== 2) && (notetrigger
!= 0))
99 void Recorder::triggernow()
108 //TODO move recorder inside nio system