我正在创建一个协作网络音乐平台。
目前,我有一台在本地工作的简单鼓机,带有一个记录所有节拍的 JSON 文件。即在模式中打孔之后,代码在登录到控制台时看起来像这样。然后,如果在当前节拍“打开”,则调度程序和播放功能会迭代并播放节拍。
"kick": [1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0, 0],
"snare": [0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0],
"hat": [0, 0, 1, 0, 0, 0, 1, 0, 0, 1, 0, 0, 1, 1, 1, 1],
"tom1": [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0],
"tom2": [0, 0, 1, 0, 0, 0, 1, 0, 0, 1, 0, 0, 1, 0, 0, 0],
"tom3": [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0]
所以接下来我想把这个网络应用程序联网,这样两个人就可以同时编辑模式。我真的很挣扎,希望在这里得到一些帮助。我看过流星和sharejs,但变得很困惑。
我怎样才能在服务器上拥有一个由两个用户编辑的 JSON 文件?(他们会轮流编辑图案,比如这个游戏http://sharejs.org/hex.html#9TGAyPGFOy)这个JSON文件需要在代码中随时更新,所以最新版本的赛道可以播放给两个用户。
任何提示都会很棒,我觉得我在这里过于复杂了......
谢谢