Skip to content

Commit

Permalink
feat(Media Pool): clear / set commands
Browse files Browse the repository at this point in the history
  • Loading branch information
Balte de Wit authored and Alex Van Camp committed Oct 4, 2018
1 parent bca847f commit a2ecc82
Show file tree
Hide file tree
Showing 3 changed files with 51 additions and 0 deletions.
24 changes: 24 additions & 0 deletions src/commands/Media/MediaPoolClearClipCommand.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
import AbstractCommand from '../AbstractCommand'

export class MediaPoolClearClipCommand extends AbstractCommand {
rawName = 'CMPC'

properties: {
index: number
}

serialize () {
const rawCommand = 'CMPC'
return new Buffer([
...Buffer.from(rawCommand),
this.properties.index,
0x00,
0x00,
0x00
])
}

updateProps (props: { index: number }) {
this._updateProps(props)
}
}
25 changes: 25 additions & 0 deletions src/commands/Media/MediaPoolSetClipCommand.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
import AbstractCommand from '../AbstractCommand'

export class MediaPoolSetClipCommand extends AbstractCommand {
rawName = 'SMPC'

properties: {
index: number,
name: string,
frames: number
}

serialize () {
const buffer = new Buffer(68)
buffer[0] = 3
buffer[1] = this.properties.index
buffer.write(this.properties.name, 2, 44)
buffer.writeUInt16BE(this.properties.frames, 66)

return Buffer.concat([ Buffer.from('SMPC', 'ascii'), buffer ])
}

updateProps (props: { index: number, name: string, frames: number }) {
this._updateProps(props)
}
}
2 changes: 2 additions & 0 deletions src/commands/Media/index.ts
Original file line number Diff line number Diff line change
@@ -1 +1,3 @@
export * from './MediaPlayerStatusCommand'
export * from './MediaPoolClearClipCommand'
export * from './MediaPoolSetClipCommand'

0 comments on commit a2ecc82

Please sign in to comment.