コード例 #1
0
        public X1Track(X1Project _proj, int num)
        {
            project    = _proj;
            trackView  = null;
            mixerStrip = null;              //trackview + mixerstrip are created after the track and set these fields then

            name        = "Track " + (num + 1);
            number      = num;
            level       = 1.0f;
            pan         = 0.5f;
            mute        = false;
            record      = false;
            inputdevNum = -1;
        }
コード例 #2
0
        static public int loadTrack(X1Project _project, byte[] trackdata, int dataPos, IntPtr inHdl)
        {
            int    trackNameLen = BitConverter.ToInt32(trackdata, dataPos);
            String _trackName   = Encoding.ASCII.GetString(trackdata, dataPos + 4, trackNameLen);

            dataPos = dataPos + 4 + trackNameLen;
            int   _number = BitConverter.ToInt32(trackdata, dataPos);
            float _level  = BitConverter.ToSingle(trackdata, dataPos + 4);
            float _pan    = BitConverter.ToSingle(trackdata, dataPos + 8);

            X1Track track = new X1Track(_project, _number);

            _project.addTrack(track);
            _project.waverly.loadChannelData(_number, inHdl);

            track.setTrackName(_trackName);
            track.setLevel(_level);
            track.setPan(_pan);

            return(dataPos + 12);
        }
コード例 #3
0
ファイル: X1Project.cs プロジェクト: gooltz/Signals-X-1
//- track I/O -----------------------------------------------------------------

        static public X1Project open(SignalsWindow signalsWindow, String filename)
        {
            X1Project  newProject = null;
            FileStream infile     = File.Open(filename, FileMode.Open, FileAccess.Read);

            byte[] inbuf = new byte[12];
            infile.Read(inbuf, 0, 12);
            String sig     = Encoding.ASCII.GetString(inbuf, 0, 4);
            int    version = BitConverter.ToInt32(inbuf, 4);
            int    hdrSize = BitConverter.ToInt32(inbuf, 8);

            inbuf = new byte[hdrSize];
            infile.Read(inbuf, 0, hdrSize);
            int    projectNameLen = BitConverter.ToInt32(inbuf, 0);
            String _projectName   = Encoding.ASCII.GetString(inbuf, 4, projectNameLen);
            int    hdrOfs         = projectNameLen + 4;
            int    _sampleRate    = BitConverter.ToInt32(inbuf, hdrOfs);
            int    _duration      = BitConverter.ToInt32(inbuf, hdrOfs + 4);
            int    dataSize       = BitConverter.ToInt32(inbuf, hdrOfs + 8);
            float  _leftOutLevel  = BitConverter.ToSingle(inbuf, hdrOfs + 12);
            float  _rightOutLevel = BitConverter.ToSingle(inbuf, hdrOfs + 16);
            int    trackCount     = BitConverter.ToInt32(inbuf, hdrOfs + 20);

            newProject = new X1Project(signalsWindow, _projectName, _sampleRate, _duration);
            newProject.setLeftOutLevel(_leftOutLevel);
            newProject.setRightOutLevel(_rightOutLevel);
            newProject.filename = filename;

            int    trackDataPos = hdrOfs + 24;
            IntPtr inhdl        = infile.SafeFileHandle.DangerousGetHandle();

            for (int tracknum = 0; tracknum < trackCount; tracknum++)
            {
                trackDataPos = X1Track.loadTrack(newProject, inbuf, trackDataPos, inhdl);
            }

            return(newProject);
        }